How to use cassiopeia - 10 common examples

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 / test / integration / core / staticdata.py View on Github external
def test_versions():
    int_test_handler.test_result(riotapi.get_versions())
github meraki-analytics / cassiopeia / test / integration / core / game.py View on Github external
def test_recent_games():
    int_test_handler.test_result(riotapi.get_recent_games(riotapi.get_summoner_by_id(int_test_handler.summoner_id)))
github meraki-analytics / cassiopeia / test / integration / core / staticdata.py View on Github external
def test_champion_by_id():
    int_test_handler.test_result(riotapi.get_champion_by_id(int_test_handler.champion_id))
github meraki-analytics / cassiopeia / cassiopeia / type / core / currentgame.py View on Github external
def _sa_rebind_all():
    Participant.dto_type = cassiopeia.type.dto.currentgame.CurrentGameParticipant
    Ban.dto_type = cassiopeia.type.dto.currentgame.BannedChampion
    Game.dto_type = cassiopeia.type.dto.currentgame.CurrentGameInfo
github meraki-analytics / kernel / merakikernel / integrations / cassiopeia / gamebindings.py View on Github external
def get_recent_games(summoner_id):
    region = cassiopeia.dto.requests.region
    return cassiopeia.type.dto.game.RecentGames(merakikernel.riotapi.gameapi.recent_games(region, str(summoner_id)))
github meraki-analytics / cassiopeia / cassiopeia / core / leagueapi.py View on Github external
def __get_league_entries_by_team_id(ids):
    leagues = cassiopeia.core.requests.call_with_ensured_size(cassiopeia.dto.leagueapi.get_league_entries_by_team, 10, ids)

    # Load required data if loading policy is eager
    if cassiopeia.core.requests.load_policy is cassiopeia.type.core.common.LoadPolicy.eager:
        summoner_ids = set()
        team_ids = set()
        for team in leagues.items():
            for league in team[1]:
                summoner_ids = summoner_ids | league.summoner_ids
                team_ids = team_ids | league.team_ids
        cassiopeia.riotapi.get_summoners_by_id(list(summoner_ids)) if summoner_ids else None
        cassiopeia.riotapi.get_teams(list(team_ids)) if team_ids else None

    if not isinstance(ids, list):
        return [cassiopeia.type.core.league.League(league) for league in leagues[ids]]
    else:
        return [[cassiopeia.type.core.league.League(league) for league in leagues.get(id_, []) if leagues.get(id_, [])] for id_ in ids]
github meraki-analytics / cassiopeia / cassiopeia / dto / statusapi.py View on Github external
def get_shards():
    """
    https://developer.riotgames.com/api/methods#!/908/3143

    Returns:
        list: the shards (unfortunately neither Crystal nor Kirby's)
    """
    request = "http://status.leagueoflegends.com/shards"
    return [cassiopeia.type.dto.status.Shard(shard) for shard in cassiopeia.dto.requests.get(request, static=True, include_base=False)]
github meraki-analytics / cassiopeia / cassiopeia / type / core / summoner.py View on Github external
import datetime

import cassiopeia.riotapi
import cassiopeia.type.core.common
import cassiopeia.type.dto.summoner


@cassiopeia.type.core.common.inheritdocs
class RunePage(cassiopeia.type.core.common.CassiopeiaObject):
    dto_type = cassiopeia.type.dto.summoner.RunePage

    def __str__(self):
        return "Rune Page ({name})".format(name=self.name)

    def __iter__(self):
        return iter(self.runes)

    def __len__(self):
        return len(self.runes)

    def __getitem__(self, index):
        return self.runes[index]

    def __eq__(self, other):
github meraki-analytics / cassiopeia / cassiopeia / type / dto / team.py View on Github external
def _sa_bind_team_stat_detail():
    global TeamStatDetail

    @cassiopeia.type.core.common.inheritdocs
    class TeamStatDetail(TeamStatDetail, cassiopeia.type.dto.common.BaseDB):
        __tablename__ = "TeamStatDetail"
        averageGamesPlayed = sqlalchemy.Column(sqlalchemy.Integer)
        losses = sqlalchemy.Column(sqlalchemy.Integer)
        teamStatType = sqlalchemy.Column(sqlalchemy.String(30))
        wins = sqlalchemy.Column(sqlalchemy.Integer)
        _id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
        _team_id = sqlalchemy.Column(sqlalchemy.String(50), sqlalchemy.ForeignKey("Team.fullId", ondelete="CASCADE"))
github meraki-analytics / cassiopeia / cassiopeia / core / summonerapi.py View on Github external
def __get_rune_pages_by_id(ids):
    pages = cassiopeia.core.requests.call_with_ensured_size(cassiopeia.dto.summonerapi.get_summoner_runes, 40, ids)

    # Load required data if loading policy is eager
    if cassiopeia.core.requests.load_policy is cassiopeia.type.core.common.LoadPolicy.eager:
        rune_ids = set()
        for page in pages.values():
            rune_ids |= page.rune_ids
        cassiopeia.riotapi.get_runes() if rune_ids else None

    if not isinstance(ids, list):
        return [cassiopeia.type.core.summoner.RunePage(page) for page in pages[str(ids)].pages]
    else:
        return [[cassiopeia.type.core.summoner.RunePage(page) for page in pages[str(id_)].pages] for id_ in ids]