Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class TeamData(CoreData):
_renamed = {"dominionVictoryScore": "dominionScore", "firstBaron": "firstBaronKiller", "firstBlood": "firstBloodKiller", "firstDragon": "firstDragonKiller", "firstInhibitor": "firstInhibitorKiller", "firstRiftHerald": "firstRiftHeraldKiller", "firstTower": "firstTowerKiller"}
def __call__(self, **kwargs):
if "bans" in kwargs:
self.bans = [ban["championId"] for ban in kwargs.pop("bans")]
if "win" in kwargs:
self.isWinner = kwargs.pop("win") != "Fail"
if "teamId" in kwargs:
self.side = Side(kwargs.pop("teamId"))
super().__call__(**kwargs)
return self
class MatchReferenceData(CoreData):
_renamed = {"account_id": "accountId", "gameId": "id", "champion": "championId", "teamId": "side", "platformId": "platform"}
def __call__(self, **kwargs):
if "timestamp" in kwargs:
self.creation = arrow.get(kwargs.pop("timestamp") / 1000)
# Set lane and role if they are missing from the data
if "lane" not in kwargs:
kwargs["lane"] = None
if "role" not in kwargs:
kwargs["role"] = None
super().__call__(**kwargs)
return self
class MatchData(CoreData):
return self
class SkinData(CoreData):
_renamed = {"num": "number"}
class StatsData(CoreData):
_renamed = {"armorperlevel": "armorPerLevel", "hpperlevel": "healthPerLevel", "attackdamage": "attackDamage", "mpperlevel": "manaPerLevel", "attackspeedoffset": "attackSpeedOffset", "hp": "health", "hpregenperlevel": "healthHegenPerLevel", "attackspeedperlevel": "percentAttackSpeedPerLevel", "attackrange": "attackRange", "attackdamageperlevel": "attackDamagePerLevel", "mpregenperlevel": "manaRegenPerLevel", "mp": "mana", "spellblockperlevel": "magicResistPerLevel", "crit": "criticalStrikeChance", "mpregen": "manaRegen", "spellblock": "magicResist", "hpregen": "healthRegen", "critperlevel": "criticalStrikeChancePerLevel"}
class InfoData(CoreData):
_renamed = {}
class ChampionData(CoreData):
_dto_type = dto.ChampionDto
_renamed = {"allytips": "allyTips", "enemytips": "enemyTips", "recommended": "recommendedItemsets", "partype": "resource", "included_data": "includedData"}
def __call__(self, **kwargs):
if "recommended" in kwargs:
self.recommendedItemsets = [RecommendedData(**item) for item in kwargs.pop("recommended")]
if "info" in kwargs:
self.info = InfoData(**kwargs.pop("info"))
if "stats" in kwargs:
self.stats = StatsData(**kwargs.pop("stats"))
if "image" in kwargs:
self.image = ImageData(**kwargs.pop("image"))
if "skins" in kwargs:
self.skins = [SkinData(**skin) for skin in kwargs.pop("skins")]
if "passive" in kwargs:
version = kwargs.get("version", get_latest_version(kwargs["region"], endpoint="champion"))
def __init__(self, *args, **kwargs):
list.__init__(self, *args)
CoreData.__init__(self, **kwargs)
class TranslationData(CoreData):
_renamed = {"updated_at": "updated"}
class MessageData(CoreData):
_renamed = {"created_at": "created", "updated_at": "updated"}
def __call__(self, **kwargs):
if "translations" in kwargs:
self.translations = [TranslationData(**translation) for translation in kwargs.pop("translations")]
super().__call__(**kwargs)
return self
class IncidentData(CoreData):
_renamed = {"created_at": "created"}
def __call__(self, **kwargs):
if "updates" in kwargs:
self.updates = [MessageData(**update) for update in kwargs.pop("updates")]
super().__call__(**kwargs)
return self
class ServiceData(CoreData):
_renamed = {}
def __call__(self, **kwargs):
if "incidents" in kwargs:
self.incidents = [IncidentData(**incident) for incident in kwargs.pop("incidents")]
super().__call__(**kwargs)
return self
class FrameData(CoreData):
_renamed = {}
def __call__(self, **kwargs):
if "events" in kwargs:
self.events = [EventData(**event) for event in kwargs.pop("events")]
if "participantFrames" in kwargs:
self.participantFrames = {int(key): ParticipantFrameData(**pframe) for key, pframe in kwargs.pop("participantFrames").items()}
super().__call__(**kwargs)
return self
class TimelineData(CoreData):
_dto_type = dto.TimelineDto
_renamed = {"matchId": "id", "frameInterval": "frame_interval"}
def __call__(self, **kwargs):
if "frames" in kwargs:
self.frames = [FrameData(**frame) for frame in kwargs.pop("frames")]
super().__call__(**kwargs)
return self
class ParticipantTimelineData(CoreData):
_renamed = {"participantId": "id"}
def __call__(self, **kwargs):
#timeline.setCreepScore(getStatTotals(item.getCreepsPerMinDeltas(), durationInSeconds));
#timeline.setCreepScoreDifference(getStatTotals(item.getCsDiffPerMinDeltas(), durationInSeconds));
from ..common import CoreData, CassiopeiaObject, CassiopeiaGhost, CoreDataList, CassiopeiaLazyList, get_latest_version, provide_default_region, ghost_load_on
from .common import ImageData, Sprite, Image
from ...dto.staticdata import map as dto
##############
# Data Types #
##############
class MapListData(CoreDataList):
_dto_type = dto.MapListDto
_renamed = {"included_data": "includedData"}
class MapData(CoreData):
_dto_type = dto.MapDto
_renamed = {"mapId": "id", "mapName": "name", "unpurchasableItemList": "unpurchasableItems", "included_data": "includedData"}
def __call__(self, **kwargs):
if "image" in kwargs:
self.image = ImageData(**kwargs.pop("image"))
super().__call__(**kwargs)
return self
##############
# Core Types #
##############
class Maps(CassiopeiaLazyList):
return self._dto["region"]
@property
def version(self) -> str:
return self._dto["version"]
@property
def locale(self) -> str:
return self._dto["locale"]
@property
def included_data(self) -> Set[str]:
return self._dto["includedData"]
class MasteryData(CoreData):
_dto_type = dto.MasteryDto
_renamed = {"prerequisite": "prereq", "tree": "masteryTree", "image_data": "image", "points": "ranks", "sanitized_description": "sanitizedDescription", "included_data": "includedData"}
@property
def region(self) -> str:
return self._dto["region"]
@property
def version(self) -> str:
return self._dto["version"]
@property
def locale(self) -> str:
return self._dto["locale"]
@property
from typing import Dict, Union
from merakicommons.cache import lazy_property
from merakicommons.container import searchable
from ...data import Region, Platform
from ..common import CoreData, CassiopeiaGhost, get_latest_version, provide_default_region, ghost_load_on
from ...dto.staticdata import realm as dto
##############
# Data Types #
##############
class LanguageStringsData(CoreData):
_dto_type = dto.RealmDto
_renamed = {"data": "strings"}
##############
# Core Types #
##############
@searchable({})
class LanguageStrings(CassiopeiaGhost):
_data_types = {LanguageStringsData}
@provide_default_region
def __init__(self, *, strings: Dict[str, str] = None, region: Union[Region, str] = None, version: str = None, locale: str = None):
if locale is None and region is not None:
from ..common import CoreData, CoreDataList, CassiopeiaObject, CassiopeiaGhost, CassiopeiaLazyList, get_latest_version, provide_default_region, ghost_load_on
from .common import ImageData, Image, Sprite
from ...dto.staticdata import summonerspell as dto
##############
# Data Types #
##############
class SummonerSpellListData(CoreDataList):
_dto_type = dto.SummonerSpellListDto
_renamed = {"included_data": "includedData"}
class SpellVarsData(CoreData):
_renamed = {"dyn": "dynamic", "coeff": "coefficients"}
class LevelTipData(CoreData):
_renamed = {"effect": "effects", "label": "keywords"}
class SummonerSpellData(CoreData):
_dto_type = dto.SummonerSpellDto
_renamed = {"maxrank": "maxRank", "cooldown": "cooldowns", "cost": "costs", "effect": "effects", "costType": "resource", "included_data": "includedData"}
def __call__(self, **kwargs):
if "vars" in kwargs:
self.variables = [SpellVarsData(**v) for v in kwargs.pop("vars")]
if "altimages" in kwargs:
self.alternativeImages = [ImageData(**alt) for alt in kwargs.pop("altimages")]
super().__call__(**kwargs)
return self
class TimelineData(CoreData):
_dto_type = dto.TimelineDto
_renamed = {"matchId": "id", "frameInterval": "frame_interval"}
def __call__(self, **kwargs):
if "frames" in kwargs:
self.frames = [FrameData(**frame) for frame in kwargs.pop("frames")]
super().__call__(**kwargs)
return self
class ParticipantTimelineData(CoreData):
_renamed = {"participantId": "id"}
def __call__(self, **kwargs):
#timeline.setCreepScore(getStatTotals(item.getCreepsPerMinDeltas(), durationInSeconds));
#timeline.setCreepScoreDifference(getStatTotals(item.getCsDiffPerMinDeltas(), durationInSeconds));
#timeline.setDamageTaken(getStatTotals(item.getDamageTakenPerMinDeltas(), durationInSeconds));
#timeline.setDamageTakenDifference(getStatTotals(item.getDamageTakenDiffPerMinDeltas(), durationInSeconds));
#timeline.setExperience(getStatTotals(item.getXpPerMinDeltas(), durationInSeconds));
#timeline.setExperienceDifference(getStatTotals(item.getXpDiffPerMinDeltas(), durationInSeconds));
super().__call__(**kwargs)
return self
class ParticipantStatsData(CoreData):
_renamed = {}