How to use the cassiopeia.type.dto.common.CassiopeiaDto function in cassiopeia

To help you get started, we’ve selected a few cassiopeia examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github meraki-analytics / cassiopeia / cassiopeia / type / dto / staticdata.py View on Github external
title (str): title
        type (str): type
    """

    def __init__(self, dictionary):
        self.blocks = [(Block(block) if not isinstance(block, Block) else block) for block in dictionary.get("blocks", []) if block]
        self.champion = dictionary.get("champion", "")
        self.map = dictionary.get("map", "")
        self.mode = dictionary.get("mode", "")
        self.priority = dictionary.get("priority", False)
        self.title = dictionary.get("title", "")
        self.type = dictionary.get("type", "")


@cassiopeia.type.core.common.inheritdocs
class Image(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    Args:
        full (str): full link
        group (str): group
        h (int): h
        sprite (str): sprite
        w (int): w
        x (int): x
        y (int): y
    """

    def __init__(self, dictionary, is_alt=False):
        self.full = dictionary.get("full", "")
        self.group = dictionary.get("group", "")
        self.h = dictionary.get("h", 0)
        self.sprite = dictionary.get("sprite", "")
github meraki-analytics / cassiopeia / cassiopeia / type / dto / match.py View on Github external
self.championId = dictionary.get("championId", 0)
        self.highestAchievedSeasonTier = dictionary.get("highestAchievedSeasonTier", "")
        self.masteries = [(Mastery(m) if not isinstance(m, Mastery) else m) for m in dictionary.get("masteries", []) if m]
        self.participantId = dictionary.get("participantId", 0)
        self.runes = [(Rune(r) if not isinstance(r, Rune) else r) for r in dictionary.get("runes", []) if r]
        self.spell1Id = dictionary.get("spell1Id", 0)
        self.spell2Id = dictionary.get("spell2Id", 0)
        val = dictionary.get("stats", None)
        self.stats = ParticipantStats(val) if val and not isinstance(val, ParticipantStats) else val
        self.teamId = dictionary.get("teamId", 0)
        val = dictionary.get("timeline", None)
        self.timeline = ParticipantTimeline(val) if val and not isinstance(val, ParticipantTimeline) else val


@cassiopeia.type.core.common.inheritdocs
class ParticipantIdentity(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    Gets all champion IDs contained in this object
    """
    def __init__(self, dictionary):
        self.participantId = dictionary.get("participantId", 0)
        val = dictionary.get("player", None)
        self.player = Player(val) if val and not isinstance(val, Player) else val


@cassiopeia.type.core.common.inheritdocs
class Team(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    Gets all mastery IDs contained in this object
    """
    def __init__(self, dictionary):
        self.bans = [(BannedChampion(c) if not isinstance(c, BannedChampion) else c) for c in dictionary.get("bans", []) if c]
github meraki-analytics / cassiopeia / cassiopeia / type / dto / currentgame.py View on Github external
@cassiopeia.type.core.common.inheritdocs
class Mastery(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    Args:
        masteryId (int): the ID of the mastery
        rank (int): the number of points put into this mastery by the user
    """
    def __init__(self, dictionary):
        self.masteryId = dictionary.get("masteryId", 0)
        self.rank = dictionary.get("rank", 0)


@cassiopeia.type.core.common.inheritdocs
class Observer(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    Args:
        encryptionKey (str): key used to decrypt the spectator grid game data for playback
    """
    def __init__(self, dictionary):
        self.encryptionKey = dictionary.get("encryptionKey", "")


@cassiopeia.type.core.common.inheritdocs
class CurrentGameParticipant(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    Args:
        bot (bool): flag indicating whether or not this participant is a bot
        championId (int): the ID of the champion played by this participant
        masteries (list): the masteries used by this participant
        profileIconId (int): the ID of the profile icon used by this participant
github meraki-analytics / cassiopeia / cassiopeia / type / dto / matchhistory.py View on Github external
self.player = Player(val) if val and not isinstance(val, Player) else val


@cassiopeia.type.core.common.inheritdocs
class Mastery(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    masteryId    int    mastery ID
    rank         int    mastery rank
    """
    def __init__(self, dictionary):
        self.masteryId = dictionary.get("masteryId", 0)
        self.rank = dictionary.get("rank", 0)


@cassiopeia.type.core.common.inheritdocs
class ParticipantStats(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    assists                            int     number of assists
    champLevel                         int     champion level achieved
    combatPlayerScore                  int     if game was a dominion game, player's combat score, otherwise 0
    deaths                             int     number of deaths
    doubleKills                        int     number of double kills
    firstBloodAssist                   bool    flag indicating if participant got an assist on first blood
    firstBloodKill                     bool    flag indicating if participant got first blood
    firstInhibitorAssist               bool    flag indicating if participant got an assist on the first inhibitor
    firstInhibitorKill                 bool    flag indicating if participant destroyed the first inhibitor
    firstTowerAssist                   bool    flag indicating if participant got an assist on the first tower
    firstTowerKill                     bool    flag indicating if participant destroyed the first tower
    goldEarned                         int     gold earned
    goldSpent                          int     gold spent
    inhibitorKills                     int     number of inhibitor kills
    item0                              int     first item ID
github meraki-analytics / cassiopeia / cassiopeia / type / dto / tournament.py View on Github external
self.pickType = pickType
        self.mapType = mapType


@cassiopeia.type.core.common.inheritdocs
class LobbyEventWrapper(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    Args:
        eventList (list): the list of events
    """
    def __init__(self, dictionary):
        self.eventList = [(LobbyEvent(event) if not isinstance(event, LobbyEvent) else event) for event in dictionary.get("eventList", []) if event]


@cassiopeia.type.core.common.inheritdocs
class LobbyEvent(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    Args:
        eventType (str): the type of event that was triggered
        summonerId (str): the summoner that triggered the event
        timestamp (str): timestamp from the event
    """
    def __init__(self, dictionary):
        self.eventType = dictionary.get("eventType", "")
        self.summonerId = dictionary.get("summonerId", "")
        self.timestamp = dictionary.get("timestamp", "")


@cassiopeia.type.core.common.inheritdocs
class ProviderRegistrationParameters(cassiopeia.type.dto.common.CassiopeiaParametersDto):
    """
    Args:
github meraki-analytics / cassiopeia / cassiopeia / type / dto / featuredgames.py View on Github external
self.summonerName = dictionary.get("summonerName", "")
        self.teamId = dictionary.get("teamId", 0)


@cassiopeia.type.core.common.inheritdocs
class Observer(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    Args:
        encryptionKey (str): key used to decrypt the spectator grid game data for playback
    """
    def __init__(self, dictionary):
        self.encryptionKey = dictionary.get("encryptionKey", "")


@cassiopeia.type.core.common.inheritdocs
class BannedChampion(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    Args:
        championId (int): the ID of the banned champion
        pickTurn (int): the turn during which the champion was banned
        teamId (int): the ID of the team that banned the champion
    """
    def __init__(self, dictionary):
        self.championId = dictionary.get("championId", 0)
        self.pickTurn = dictionary.get("pickTurn", 0)
        self.teamId = dictionary.get("teamId", 0)


@cassiopeia.type.core.common.inheritdocs
class FeaturedGameInfo(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    Args:
github meraki-analytics / cassiopeia / cassiopeia / type / dto / matchhistory.py View on Github external
self.totalTimeCrowdControlDealt = dictionary.get("totalTimeCrowdControlDealt", 0)
        self.totalUnitsHealed = dictionary.get("totalUnitsHealed", 0)
        self.towerKills = dictionary.get("towerKills", 0)
        self.tripleKills = dictionary.get("tripleKills", 0)
        self.trueDamageDealt = dictionary.get("trueDamageDealt", 0)
        self.trueDamageDealtToChampions = dictionary.get("trueDamageDealtToChampions", 0)
        self.trueDamageTaken = dictionary.get("trueDamageTaken", 0)
        self.unrealKills = dictionary.get("unrealKills", 0)
        self.visionWardsBoughtInGame = dictionary.get("visionWardsBoughtInGame", 0)
        self.wardsKilled = dictionary.get("wardsKilled", 0)
        self.wardsPlaced = dictionary.get("wardsPlaced", 0)
        self.winner = dictionary.get("winner", False)


@cassiopeia.type.core.common.inheritdocs
class ParticipantTimeline(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    ancientGolemAssistsPerMinCounts    ParticipantTimelineData    ancient golem assists per minute timeline counts
    ancientGolemKillsPerMinCounts      ParticipantTimelineData    ancient golem kills per minute timeline counts
    assistedLaneDeathsPerMinDeltas     ParticipantTimelineData    assisted lane deaths per minute timeline data
    assistedLaneKillsPerMinDeltas      ParticipantTimelineData    assisted lane kills per minute timeline data
    baronAssistsPerMinCounts           ParticipantTimelineData    baron assists per minute timeline counts
    baronKillsPerMinCounts             ParticipantTimelineData    baron kills per minute timeline counts
    creepsPerMinDeltas                 ParticipantTimelineData    creeps per minute timeline data
    csDiffPerMinDeltas                 ParticipantTimelineData    creep score difference per minute timeline data
    damageTakenDiffPerMinDeltas        ParticipantTimelineData    damage taken difference per minute timeline data
    damageTakenPerMinDeltas            ParticipantTimelineData    damage taken per minute timeline data
    dragonAssistsPerMinCounts          ParticipantTimelineData    dragon assists per minute timeline counts
    dragonKillsPerMinCounts            ParticipantTimelineData    dragon kills per minute timeline counts
    elderLizardAssistsPerMinCounts     ParticipantTimelineData    elder lizard assists per minute timeline counts
    elderLizardKillsPerMinCounts       ParticipantTimelineData    elder lizard kills per minute timeline counts
    goldPerMinDeltas                   ParticipantTimelineData    gold per minute timeline data
github meraki-analytics / cassiopeia / cassiopeia / type / dto / summoner.py View on Github external
self.pages = [(RunePage(p) if not isinstance(p, RunePage) else p) for p in dictionary.get("pages", []) if p]
        self.summonerId = dictionary.get("summonerId", 0)

    @property
    def rune_ids(self):
        """
        Gets all rune IDs contained in this object
        """
        ids = set()
        for p in self.pages:
            ids = ids | p.rune_ids
        return ids


@cassiopeia.type.core.common.inheritdocs
class RunePage(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    Gets all rune IDs contained in this object
    """
    def __init__(self, dictionary):
        self.current = dictionary.get("current", False)
        self.id = dictionary.get("id", 0)
        self.name = dictionary.get("name", "")
        self.slots = [(RuneSlot(s) if not isinstance(s, RuneSlot) else s) for s in dictionary.get("slots", []) if s]

    @property
    def rune_ids(self):
        """
        Args:
            current (bool): indicates if the page is the current page
            id (int): rune page ID
            name (str): rune page name
github meraki-analytics / cassiopeia / cassiopeia / type / dto / staticdata.py View on Github external
tree (list): item tree
        type (str): type
        version (str): version
    """

    def __init__(self, dictionary):
        self.data = {id_: MapDetails(map_) if not isinstance(map_, MapDetails) else map_ for id_, map_ in dictionary.get("data", {}).items()}
        self.type = dictionary.get("type", "")
        self.version = dictionary.get("version", "")


#####################
# Mastery Endpoints #
#####################
@cassiopeia.type.core.common.inheritdocs
class MasteryTreeItem(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    Args:
        data (dict): language str data
        type (str): type
        version (str): version
    """

    def __init__(self, dictionary):
        self.masteryId = dictionary.get("masteryId", 0)
        self.prereq = dictionary.get("prereq", "")


@cassiopeia.type.core.common.inheritdocs
class MasteryTreeList(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    Args:
github meraki-analytics / cassiopeia / cassiopeia / type / dto / match.py View on Github external
self.totalTimeCrowdControlDealt = dictionary.get("totalTimeCrowdControlDealt", 0)
        self.totalUnitsHealed = dictionary.get("totalUnitsHealed", 0)
        self.towerKills = dictionary.get("towerKills", 0)
        self.tripleKills = dictionary.get("tripleKills", 0)
        self.trueDamageDealt = dictionary.get("trueDamageDealt", 0)
        self.trueDamageDealtToChampions = dictionary.get("trueDamageDealtToChampions", 0)
        self.trueDamageTaken = dictionary.get("trueDamageTaken", 0)
        self.unrealKills = dictionary.get("unrealKills", 0)
        self.visionWardsBoughtInGame = dictionary.get("visionWardsBoughtInGame", 0)
        self.wardsKilled = dictionary.get("wardsKilled", 0)
        self.wardsPlaced = dictionary.get("wardsPlaced", 0)
        self.winner = dictionary.get("winner", False)


@cassiopeia.type.core.common.inheritdocs
class ParticipantTimeline(cassiopeia.type.dto.common.CassiopeiaDto):
    """
    Args:
        championId (int): champion ID
        highestAchievedSeasonTier (str): highest ranked tier achieved for the previous season, if any, otherwise null. Used to display border in game loading screen. (Legal values: CHALLENGER, MASTER, DIAMOND, PLATINUM, GOLD, SILVER, BRONZE, UNRANKED)
        masteries (list): list of mastery information
        participantId (int): participant ID
        runes (list): list of rune information
        spell1Id (int): first summoner spell ID
        spell2Id (int): second summoner spell ID
        stats (ParticipantStats): participant statistics
        teamId (int): team ID
        timeline (ParticipantTimeline): timeline data. Delta fields refer to values for the specified period (e.g., the gold per minute over the first 10 minutes of the game versus the second 20 minutes of the game. Diffs fields refer to the deltas versus the calculated lane opponent(s).
    """
    def __init__(self, dictionary):
        val = dictionary.get("ancientGolemAssistsPerMinCounts", None)
        self.ancientGolemAssistsPerMinCounts = ParticipantTimelineData(val, "ancientGolemAssistsPerMinCounts") if val and not isinstance(val, ParticipantTimelineData) else val