Module valolyticspy.services.dto_loader
Expand source code
import sys
sys.path.append("")
from typing import Dict
from enum import Enum
from valolyticspy.services.api.valorant_api import ValorantApiClient as API
from valolyticspy.services.dictionaries.agent import AgentDictionary
from valolyticspy.dtos.valorant_api.buddy import Buddy
from valolyticspy.dtos.valorant_api.bundle import Bundle
from valolyticspy.dtos.valorant_api.ceremony import Ceremony
from valolyticspy.dtos.valorant_api.competitive_tier import CompetitiveTier
from valolyticspy.dtos.valorant_api.content_tier import ContentTier
from valolyticspy.dtos.valorant_api.contract import Contract
from valolyticspy.dtos.valorant_api.currency import Currency
from valolyticspy.dtos.valorant_api.event import Event
from valolyticspy.dtos.valorant_api.game_mode import GameMode
from valolyticspy.dtos.valorant_api.gear import Gear
from valolyticspy.dtos.valorant_api.level_border import LevelBorder
from valolyticspy.services.dictionaries.map import MapDictionary
from valolyticspy.dtos.valorant_api.player_card import PlayerCard
from valolyticspy.dtos.valorant_api.player_title import PlayerTitle
from valolyticspy.dtos.valorant_api.season import Season
from valolyticspy.dtos.valorant_api.spray import Spray
from valolyticspy.dtos.valorant_api.theme import Theme
from valolyticspy.services.dictionaries.weapon import WeaponDictionary
from valolyticspy.dtos.valorant_api.version import Version
class Dtos(Enum):
"""
Enum class representing different DTOs (Data Transfer Objects) used in the application.
Each DTO corresponds to a specific data entity in the application.
"""
AGENTS = "agents"
BUDDIES = "buddies"
BUNDLES = "bundles"
CEREMONIES = "ceremonies"
COMPETITIVE_TIERS = "competitivetiers"
CONTENT_TIERS = "contenttiers"
CONTRACTS = "contracts"
CURRENCIES = "currencies"
EVENTS = "events"
GAME_MODES = "gamemodes"
GEAR = "gear"
LEVEL_BORDERS = "levelborders"
MAPS = "maps"
PLAYER_CARDS = "playercards"
PLAYER_TITLES = "playertitles"
SEASONS = "seasons"
SPRAYS = "sprays"
THEMES = "themes"
WEAPONS = "weapons"
VERSION = "version"
class ValorantDTO:
"""
Represents a collection of Valorant DTOs.
Attributes:
AGENTS (AgentDictionary): A dictionary of agents.
BUDDIES (Dict[str, Buddy]): A dictionary of buddies.
BUNDLES (Dict[str, Bundle]): A dictionary of bundles.
CEREMONIES (Dict[str, Ceremony]): A dictionary of ceremonies.
COMPETITIVE_TIERS (Dict[str, CompetitiveTier]): A dictionary of competitive tiers.
CONTENT_TIERS (Dict[str, ContentTier]): A dictionary of content tiers.
CONTRACTS (Dict[str, Contract]): A dictionary of contracts.
CURRENCIES (Dict[str, Currency]): A dictionary of currencies.
EVENTS (Dict[str, Event]): A dictionary of events.
GAME_MODES (Dict[str, GameMode]): A dictionary of game modes.
GEAR (Dict[str, Gear]): A dictionary of gear.
LEVEL_BORDERS (Dict[str, LevelBorder]): A dictionary of level borders.
MAPS (MapDictionary): A dictionary of maps.
PLAYER_CARDS (Dict[str, PlayerCard]): A dictionary of player cards.
PLAYER_TITLES (Dict[str, PlayerTitle]): A dictionary of player titles.
SEASONS (Dict[str, Season]): A dictionary of seasons.
SPRAYS (Dict[str, Spray]): A dictionary of sprays.
THEMES (Dict[str, Theme]): A dictionary of themes.
WEAPONS (WeaponDictionary): A dictionary of weapons.
VERSION (Version): The version of the Valorant DTOs.
Methods:
refresh(dto: Dtos=None) -> None:
Refreshes the DTOs based on the specified DTO type.
"""
AGENTS: AgentDictionary = AgentDictionary()
BUDDIES: Dict[str, Buddy] = {}
BUNDLES: Dict[str, Bundle] = {}
CEREMONIES: Dict[str, Ceremony] = {}
COMPETITIVE_TIERS: Dict[str, CompetitiveTier] = {}
CONTENT_TIERS: Dict[str, ContentTier] = {}
CONTRACTS: Dict[str, Contract] = {}
CURRENCIES: Dict[str, Currency] = {}
EVENTS: Dict[str, Event] = {}
GAME_MODES: Dict[str, GameMode] = {}
GEAR: Dict[str, Gear] = {}
LEVEL_BORDERS: Dict[str, LevelBorder] = {}
MAPS: MapDictionary = MapDictionary()
PLAYER_CARDS: Dict[str, PlayerCard] = {}
PLAYER_TITLES: Dict[str, PlayerTitle] = {}
SEASONS: Dict[str, Season] = {}
SPRAYS: Dict[str, Spray] = {}
THEMES: Dict[str, Theme] = {}
WEAPONS: WeaponDictionary = WeaponDictionary()
VERSION: Version = {}
@classmethod
def refresh(cls, dto: Dtos = None) -> None:
"""
Refreshes the DTOs based on the specified DTO type.
Args:
dto (Dtos, optional): The type of DTO to refresh. Defaults to None.
Returns:
None
"""
if dto is not None:
match dto:
case Dtos.AGENTS:
cls.AGENTS.refresh()
case Dtos.BUDDIES:
cls.BUDDIES = {buddy.uuid: buddy for buddy in API.get_buddies()}
case Dtos.BUNDLES:
cls.BUNDLES = {bundle.uuid: bundle for bundle in API.get_bundles()}
case Dtos.CEREMONIES:
cls.CEREMONIES = {ceremony.uuid: ceremony for ceremony in API.get_ceremonies()}
case Dtos.COMPETITIVE_TIERS:
cls.COMPETITIVE_TIERS = {competitive_tier.uuid: competitive_tier for competitive_tier in API.get_competitive_tiers()}
case Dtos.CONTENT_TIERS:
cls.CONTENT_TIERS = {content_tier.uuid: content_tier for content_tier in API.get_content_tiers()}
case Dtos.CONTRACTS:
cls.CONTRACTS = {contract.uuid: contract for contract in API.get_contracts()}
case Dtos.CURRENCIES:
cls.CURRENCIES = {currency.uuid: currency for currency in API.get_currencies()}
case Dtos.EVENTS:
cls.EVENTS = {event.uuid: event for event in API.get_events()}
case Dtos.GAME_MODES:
cls.GAME_MODES = {game_mode.uuid: game_mode for game_mode in API.get_game_modes()}
case Dtos.GEAR:
cls.GEAR = {gear.uuid: gear for gear in API.get_gear()}
case Dtos.LEVEL_BORDERS:
cls.LEVEL_BORDERS = {level_border.uuid: level_border for level_border in API.get_level_borders()}
case Dtos.MAPS:
cls.MAPS.refresh()
case Dtos.PLAYER_CARDS:
cls.PLAYER_CARDS = {player_card.uuid: player_card for player_card in API.get_player_cards()}
case Dtos.PLAYER_TITLES:
cls.PLAYER_TITLES = {player_title.uuid: player_title for player_title in API.get_player_titles()}
case Dtos.SEASONS:
cls.SEASONS = {season.uuid: season for season in API.get_seasons()}
case Dtos.SPRAYS:
cls.SPRAYS = {spray.uuid: spray for spray in API.get_sprays()}
case Dtos.THEMES:
cls.THEMES = {theme.uuid: theme for theme in API.get_themes()}
case Dtos.WEAPONS:
cls.WEAPONS.refresh()
case Dtos.VERSION:
cls.VERSION = API.get_version()
else:
cls.AGENTS.refresh()
cls.BUDDIES = {buddy.uuid: buddy for buddy in API.get_buddies()}
cls.BUNDLES = {bundle.uuid: bundle for bundle in API.get_bundles()}
cls.CEREMONIES = {ceremony.uuid: ceremony for ceremony in API.get_ceremonies()}
cls.COMPETITIVE_TIERS = {competitive_tier.uuid: competitive_tier for competitive_tier in API.get_competitive_tiers()}
cls.CONTENT_TIERS = {content_tier.uuid: content_tier for content_tier in API.get_content_tiers()}
cls.CONTRACTS = {contract.uuid: contract for contract in API.get_contracts()}
cls.CURRENCIES = {currency.uuid: currency for currency in API.get_currencies()}
cls.EVENTS = {event.uuid: event for event in API.get_events()}
cls.GAME_MODES = {game_mode.uuid: game_mode for game_mode in API.get_game_modes()}
cls.GEAR = {gear.uuid: gear for gear in API.get_gear()}
cls.LEVEL_BORDERS = {level_border.uuid: level_border for level_border in API.get_level_borders()}
cls.MAPS.refresh()
cls.PLAYER_CARDS = {player_card.uuid: player_card for player_card in API.get_player_cards()}
cls.PLAYER_TITLES = {player_title.uuid: player_title for player_title in API.get_player_titles()}
cls.SEASONS = {season.uuid: season for season in API.get_seasons()}
cls.SPRAYS = {spray.uuid: spray for spray in API.get_sprays()}
cls.THEMES = {theme.uuid: theme for theme in API.get_themes()}
cls.WEAPONS.refresh()
cls.VERSION = API.get_version()
Classes
class Dtos (value, names=None, *, module=None, qualname=None, type=None, start=1)-
Enum class representing different DTOs (Data Transfer Objects) used in the application. Each DTO corresponds to a specific data entity in the application.
Expand source code
class Dtos(Enum): """ Enum class representing different DTOs (Data Transfer Objects) used in the application. Each DTO corresponds to a specific data entity in the application. """ AGENTS = "agents" BUDDIES = "buddies" BUNDLES = "bundles" CEREMONIES = "ceremonies" COMPETITIVE_TIERS = "competitivetiers" CONTENT_TIERS = "contenttiers" CONTRACTS = "contracts" CURRENCIES = "currencies" EVENTS = "events" GAME_MODES = "gamemodes" GEAR = "gear" LEVEL_BORDERS = "levelborders" MAPS = "maps" PLAYER_CARDS = "playercards" PLAYER_TITLES = "playertitles" SEASONS = "seasons" SPRAYS = "sprays" THEMES = "themes" WEAPONS = "weapons" VERSION = "version"Ancestors
- enum.Enum
Class variables
var AGENTSvar BUDDIESvar BUNDLESvar CEREMONIESvar COMPETITIVE_TIERSvar CONTENT_TIERSvar CONTRACTSvar CURRENCIESvar EVENTSvar GAME_MODESvar GEARvar LEVEL_BORDERSvar MAPSvar PLAYER_CARDSvar PLAYER_TITLESvar SEASONSvar SPRAYSvar THEMESvar VERSIONvar WEAPONS
class ValorantDTO-
Represents a collection of Valorant DTOs.
Attributes
AGENTS:AgentDictionary- A dictionary of agents.
BUDDIES:Dict[str, Buddy]- A dictionary of buddies.
BUNDLES:Dict[str, Bundle]- A dictionary of bundles.
CEREMONIES:Dict[str, Ceremony]- A dictionary of ceremonies.
COMPETITIVE_TIERS:Dict[str, CompetitiveTier]- A dictionary of competitive tiers.
CONTENT_TIERS:Dict[str, ContentTier]- A dictionary of content tiers.
CONTRACTS:Dict[str, Contract]- A dictionary of contracts.
CURRENCIES:Dict[str, Currency]- A dictionary of currencies.
EVENTS:Dict[str, Event]- A dictionary of events.
GAME_MODES:Dict[str, GameMode]- A dictionary of game modes.
GEAR:Dict[str, Gear]- A dictionary of gear.
LEVEL_BORDERS:Dict[str, LevelBorder]- A dictionary of level borders.
MAPS:MapDictionary- A dictionary of maps.
PLAYER_CARDS:Dict[str, PlayerCard]- A dictionary of player cards.
PLAYER_TITLES:Dict[str, PlayerTitle]- A dictionary of player titles.
SEASONS:Dict[str, Season]- A dictionary of seasons.
SPRAYS:Dict[str, Spray]- A dictionary of sprays.
THEMES:Dict[str, Theme]- A dictionary of themes.
WEAPONS:WeaponDictionary- A dictionary of weapons.
VERSION:Version- The version of the Valorant DTOs.
Methods
refresh(dto: Dtos=None) -> None: Refreshes the DTOs based on the specified DTO type.
Expand source code
class ValorantDTO: """ Represents a collection of Valorant DTOs. Attributes: AGENTS (AgentDictionary): A dictionary of agents. BUDDIES (Dict[str, Buddy]): A dictionary of buddies. BUNDLES (Dict[str, Bundle]): A dictionary of bundles. CEREMONIES (Dict[str, Ceremony]): A dictionary of ceremonies. COMPETITIVE_TIERS (Dict[str, CompetitiveTier]): A dictionary of competitive tiers. CONTENT_TIERS (Dict[str, ContentTier]): A dictionary of content tiers. CONTRACTS (Dict[str, Contract]): A dictionary of contracts. CURRENCIES (Dict[str, Currency]): A dictionary of currencies. EVENTS (Dict[str, Event]): A dictionary of events. GAME_MODES (Dict[str, GameMode]): A dictionary of game modes. GEAR (Dict[str, Gear]): A dictionary of gear. LEVEL_BORDERS (Dict[str, LevelBorder]): A dictionary of level borders. MAPS (MapDictionary): A dictionary of maps. PLAYER_CARDS (Dict[str, PlayerCard]): A dictionary of player cards. PLAYER_TITLES (Dict[str, PlayerTitle]): A dictionary of player titles. SEASONS (Dict[str, Season]): A dictionary of seasons. SPRAYS (Dict[str, Spray]): A dictionary of sprays. THEMES (Dict[str, Theme]): A dictionary of themes. WEAPONS (WeaponDictionary): A dictionary of weapons. VERSION (Version): The version of the Valorant DTOs. Methods: refresh(dto: Dtos=None) -> None: Refreshes the DTOs based on the specified DTO type. """ AGENTS: AgentDictionary = AgentDictionary() BUDDIES: Dict[str, Buddy] = {} BUNDLES: Dict[str, Bundle] = {} CEREMONIES: Dict[str, Ceremony] = {} COMPETITIVE_TIERS: Dict[str, CompetitiveTier] = {} CONTENT_TIERS: Dict[str, ContentTier] = {} CONTRACTS: Dict[str, Contract] = {} CURRENCIES: Dict[str, Currency] = {} EVENTS: Dict[str, Event] = {} GAME_MODES: Dict[str, GameMode] = {} GEAR: Dict[str, Gear] = {} LEVEL_BORDERS: Dict[str, LevelBorder] = {} MAPS: MapDictionary = MapDictionary() PLAYER_CARDS: Dict[str, PlayerCard] = {} PLAYER_TITLES: Dict[str, PlayerTitle] = {} SEASONS: Dict[str, Season] = {} SPRAYS: Dict[str, Spray] = {} THEMES: Dict[str, Theme] = {} WEAPONS: WeaponDictionary = WeaponDictionary() VERSION: Version = {} @classmethod def refresh(cls, dto: Dtos = None) -> None: """ Refreshes the DTOs based on the specified DTO type. Args: dto (Dtos, optional): The type of DTO to refresh. Defaults to None. Returns: None """ if dto is not None: match dto: case Dtos.AGENTS: cls.AGENTS.refresh() case Dtos.BUDDIES: cls.BUDDIES = {buddy.uuid: buddy for buddy in API.get_buddies()} case Dtos.BUNDLES: cls.BUNDLES = {bundle.uuid: bundle for bundle in API.get_bundles()} case Dtos.CEREMONIES: cls.CEREMONIES = {ceremony.uuid: ceremony for ceremony in API.get_ceremonies()} case Dtos.COMPETITIVE_TIERS: cls.COMPETITIVE_TIERS = {competitive_tier.uuid: competitive_tier for competitive_tier in API.get_competitive_tiers()} case Dtos.CONTENT_TIERS: cls.CONTENT_TIERS = {content_tier.uuid: content_tier for content_tier in API.get_content_tiers()} case Dtos.CONTRACTS: cls.CONTRACTS = {contract.uuid: contract for contract in API.get_contracts()} case Dtos.CURRENCIES: cls.CURRENCIES = {currency.uuid: currency for currency in API.get_currencies()} case Dtos.EVENTS: cls.EVENTS = {event.uuid: event for event in API.get_events()} case Dtos.GAME_MODES: cls.GAME_MODES = {game_mode.uuid: game_mode for game_mode in API.get_game_modes()} case Dtos.GEAR: cls.GEAR = {gear.uuid: gear for gear in API.get_gear()} case Dtos.LEVEL_BORDERS: cls.LEVEL_BORDERS = {level_border.uuid: level_border for level_border in API.get_level_borders()} case Dtos.MAPS: cls.MAPS.refresh() case Dtos.PLAYER_CARDS: cls.PLAYER_CARDS = {player_card.uuid: player_card for player_card in API.get_player_cards()} case Dtos.PLAYER_TITLES: cls.PLAYER_TITLES = {player_title.uuid: player_title for player_title in API.get_player_titles()} case Dtos.SEASONS: cls.SEASONS = {season.uuid: season for season in API.get_seasons()} case Dtos.SPRAYS: cls.SPRAYS = {spray.uuid: spray for spray in API.get_sprays()} case Dtos.THEMES: cls.THEMES = {theme.uuid: theme for theme in API.get_themes()} case Dtos.WEAPONS: cls.WEAPONS.refresh() case Dtos.VERSION: cls.VERSION = API.get_version() else: cls.AGENTS.refresh() cls.BUDDIES = {buddy.uuid: buddy for buddy in API.get_buddies()} cls.BUNDLES = {bundle.uuid: bundle for bundle in API.get_bundles()} cls.CEREMONIES = {ceremony.uuid: ceremony for ceremony in API.get_ceremonies()} cls.COMPETITIVE_TIERS = {competitive_tier.uuid: competitive_tier for competitive_tier in API.get_competitive_tiers()} cls.CONTENT_TIERS = {content_tier.uuid: content_tier for content_tier in API.get_content_tiers()} cls.CONTRACTS = {contract.uuid: contract for contract in API.get_contracts()} cls.CURRENCIES = {currency.uuid: currency for currency in API.get_currencies()} cls.EVENTS = {event.uuid: event for event in API.get_events()} cls.GAME_MODES = {game_mode.uuid: game_mode for game_mode in API.get_game_modes()} cls.GEAR = {gear.uuid: gear for gear in API.get_gear()} cls.LEVEL_BORDERS = {level_border.uuid: level_border for level_border in API.get_level_borders()} cls.MAPS.refresh() cls.PLAYER_CARDS = {player_card.uuid: player_card for player_card in API.get_player_cards()} cls.PLAYER_TITLES = {player_title.uuid: player_title for player_title in API.get_player_titles()} cls.SEASONS = {season.uuid: season for season in API.get_seasons()} cls.SPRAYS = {spray.uuid: spray for spray in API.get_sprays()} cls.THEMES = {theme.uuid: theme for theme in API.get_themes()} cls.WEAPONS.refresh() cls.VERSION = API.get_version()Class variables
var AGENTS : AgentDictionaryvar BUDDIES : Dict[str, Buddy]var BUNDLES : Dict[str, Bundle]var CEREMONIES : Dict[str, Ceremony]var COMPETITIVE_TIERS : Dict[str, CompetitiveTier]var CONTENT_TIERS : Dict[str, ContentTier]var CONTRACTS : Dict[str, Contract]var CURRENCIES : Dict[str, Currency]var EVENTS : Dict[str, Event]var GAME_MODES : Dict[str, GameMode]var GEAR : Dict[str, Gear]var LEVEL_BORDERS : Dict[str, LevelBorder]var MAPS : MapDictionaryvar PLAYER_CARDS : Dict[str, PlayerCard]var PLAYER_TITLES : Dict[str, PlayerTitle]var SEASONS : Dict[str, Season]var SPRAYS : Dict[str, Spray]var THEMES : Dict[str, Theme]var VERSION : Versionvar WEAPONS : WeaponDictionary
Static methods
def refresh(dto: Dtos = None) ‑> None-
Refreshes the DTOs based on the specified DTO type.
Args
dto:Dtos, optional- The type of DTO to refresh. Defaults to None.
Returns
None
Expand source code
@classmethod def refresh(cls, dto: Dtos = None) -> None: """ Refreshes the DTOs based on the specified DTO type. Args: dto (Dtos, optional): The type of DTO to refresh. Defaults to None. Returns: None """ if dto is not None: match dto: case Dtos.AGENTS: cls.AGENTS.refresh() case Dtos.BUDDIES: cls.BUDDIES = {buddy.uuid: buddy for buddy in API.get_buddies()} case Dtos.BUNDLES: cls.BUNDLES = {bundle.uuid: bundle for bundle in API.get_bundles()} case Dtos.CEREMONIES: cls.CEREMONIES = {ceremony.uuid: ceremony for ceremony in API.get_ceremonies()} case Dtos.COMPETITIVE_TIERS: cls.COMPETITIVE_TIERS = {competitive_tier.uuid: competitive_tier for competitive_tier in API.get_competitive_tiers()} case Dtos.CONTENT_TIERS: cls.CONTENT_TIERS = {content_tier.uuid: content_tier for content_tier in API.get_content_tiers()} case Dtos.CONTRACTS: cls.CONTRACTS = {contract.uuid: contract for contract in API.get_contracts()} case Dtos.CURRENCIES: cls.CURRENCIES = {currency.uuid: currency for currency in API.get_currencies()} case Dtos.EVENTS: cls.EVENTS = {event.uuid: event for event in API.get_events()} case Dtos.GAME_MODES: cls.GAME_MODES = {game_mode.uuid: game_mode for game_mode in API.get_game_modes()} case Dtos.GEAR: cls.GEAR = {gear.uuid: gear for gear in API.get_gear()} case Dtos.LEVEL_BORDERS: cls.LEVEL_BORDERS = {level_border.uuid: level_border for level_border in API.get_level_borders()} case Dtos.MAPS: cls.MAPS.refresh() case Dtos.PLAYER_CARDS: cls.PLAYER_CARDS = {player_card.uuid: player_card for player_card in API.get_player_cards()} case Dtos.PLAYER_TITLES: cls.PLAYER_TITLES = {player_title.uuid: player_title for player_title in API.get_player_titles()} case Dtos.SEASONS: cls.SEASONS = {season.uuid: season for season in API.get_seasons()} case Dtos.SPRAYS: cls.SPRAYS = {spray.uuid: spray for spray in API.get_sprays()} case Dtos.THEMES: cls.THEMES = {theme.uuid: theme for theme in API.get_themes()} case Dtos.WEAPONS: cls.WEAPONS.refresh() case Dtos.VERSION: cls.VERSION = API.get_version() else: cls.AGENTS.refresh() cls.BUDDIES = {buddy.uuid: buddy for buddy in API.get_buddies()} cls.BUNDLES = {bundle.uuid: bundle for bundle in API.get_bundles()} cls.CEREMONIES = {ceremony.uuid: ceremony for ceremony in API.get_ceremonies()} cls.COMPETITIVE_TIERS = {competitive_tier.uuid: competitive_tier for competitive_tier in API.get_competitive_tiers()} cls.CONTENT_TIERS = {content_tier.uuid: content_tier for content_tier in API.get_content_tiers()} cls.CONTRACTS = {contract.uuid: contract for contract in API.get_contracts()} cls.CURRENCIES = {currency.uuid: currency for currency in API.get_currencies()} cls.EVENTS = {event.uuid: event for event in API.get_events()} cls.GAME_MODES = {game_mode.uuid: game_mode for game_mode in API.get_game_modes()} cls.GEAR = {gear.uuid: gear for gear in API.get_gear()} cls.LEVEL_BORDERS = {level_border.uuid: level_border for level_border in API.get_level_borders()} cls.MAPS.refresh() cls.PLAYER_CARDS = {player_card.uuid: player_card for player_card in API.get_player_cards()} cls.PLAYER_TITLES = {player_title.uuid: player_title for player_title in API.get_player_titles()} cls.SEASONS = {season.uuid: season for season in API.get_seasons()} cls.SPRAYS = {spray.uuid: spray for spray in API.get_sprays()} cls.THEMES = {theme.uuid: theme for theme in API.get_themes()} cls.WEAPONS.refresh() cls.VERSION = API.get_version()