Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_versions():
int_test_handler.test_result(riotapi.get_versions())
def test_recent_games():
int_test_handler.test_result(riotapi.get_recent_games(riotapi.get_summoner_by_id(int_test_handler.summoner_id)))
def test_champion_by_id():
int_test_handler.test_result(riotapi.get_champion_by_id(int_test_handler.champion_id))
def get_champion_statuses(free_to_play=False):
"""
Gets the statuses for all champions (whether they are disabled, etc.)
Args:
free_to_play (bool): whether to only return free champions (default False)
Returns:
dict: the statuses for all the champions
"""
statuses = cassiopeia.dto.championapi.get_champion_statuses(free_to_play)
# Always load champions since we'll be using them here
cassiopeia.riotapi.get_champions()
return {cassiopeia.riotapi.get_champion_by_id(champ.id): cassiopeia.type.core.champion.ChampionStatus(champ) for champ in statuses.champions}
def summoner(self):
"""
Returns:
Summoner: the summoner that triggered the event
"""
return cassiopeia.riotapi.get_summoner_by_id(int(self.data.summonerId)) if self.data.summonerId else None
def summoner_spell_f(self):
"""SummonerSpell the participant's second summoner spell"""
return cassiopeia.riotapi.get_summoner_spell(self.data.participant.spell2Id) if self.data.participant.spell2Id else None
def champion_masteries(self):
"""
Returns:
datetime: the date this summoner was last modified specified as epoch milliseconds. The following events will update this timestamp: profile icon change, playing the tutorial or advanced tutorial, finishing a game, summoner name change
"""
return cassiopeia.riotapi.get_champion_masteries(self)
"""
Gets the most recent games a summoner played
Args:
summoner (Summoner): the summoner to get recent games for
Returns:
list: the summoner's recent games
"""
games = cassiopeia.dto.gameapi.get_recent_games(summoner.id)
# Load required data if loading policy is eager
if cassiopeia.core.requests.load_policy is cassiopeia.type.core.common.LoadPolicy.eager:
summoner_ids = games.summoner_ids
cassiopeia.riotapi.get_summoners_by_id(list(summoner_ids)) if summoner_ids else None
cassiopeia.riotapi.get_summoner_spells() if games.summoner_spell_ids else None
return [cassiopeia.type.core.game.Game(game, games.summonerId) for game in games.games]
def league_entries(self):
"""
Returns:
int: the team's id
"""
return cassiopeia.riotapi.get_league_entries_by_team(self)
def match(self):
"""
Returns:
datetime: the date and time for the team's last game in epoch milliseconds
"""
return cassiopeia.riotapi.get_match(self.id)