Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Returns:
list: the services that this region offers
"""
return [Service(service) for service in self.data.services]
@property
def region(self):
"""
Returns:
Region: the region of the server is located in
"""
return cassiopeia.type.core.common.Region(self.data.slug.upper()) if self.data.slug else None
@cassiopeia.type.core.common.inheritdocs
class Service(cassiopeia.type.core.common.CassiopeiaObject):
dto_type = cassiopeia.type.dto.status.Service
def __str__(self):
return self.name
def __iter__(self):
return iter(self.incidents)
def __len__(self):
return len(self.incidents)
def __getitem__(self, index):
return self.incidents[index]
@cassiopeia.type.core.common.lazyproperty
def incidents(self):
import datetime
import cassiopeia.riotapi
import cassiopeia.type.core.common
import cassiopeia.type.dto.team
@cassiopeia.type.core.common.inheritdocs
class Team(cassiopeia.type.core.common.CassiopeiaObject):
dto_type = cassiopeia.type.dto.team.Team
def __str__(self):
return self.name
def __iter__(self):
return iter(self.roster)
def __len__(self):
return len(self.roster)
def __getitem__(self, index):
return self.roster[index]
def __eq__(self, other):
return self.id == other.id
if self.stats is not None:
for cat_name, cat in Item.__item_categories.items():
for subcat, attrs in cat.items():
for attr in attrs:
if getattr(self.stats, attr, 0.0) != 0.0:
cats.add(cat_name)
cats.add(subcat)
if str(self.id) in Item.__boot_ids or len(set(self.data.from_) & Item.__boot_ids) > 0:
cats.add("Boots")
cats.remove("Other Movement Items")
return list(cats)
@cassiopeia.type.core.common.inheritdocs
class ItemSet(cassiopeia.type.core.common.CassiopeiaObject):
dto_type = cassiopeia.type.dto.staticdata.Block
def __str__(self):
return "Item Set"
def __iter__(self):
return iter(self.items)
def __len__(self):
return len(self.items)
def __getitem__(self, index):
return self.items[index]
@cassiopeia.type.core.common.lazyproperty
def items(self):
return self.data.ranks
@property
def sanitized_descriptions(self):
"""
Returns:
list: sanitized descriptions of this mastery by rank
"""
return self.data.sanitizedDescription
##################
# Realm Endpoint #
##################
@cassiopeia.type.core.common.inheritdocs
class Realm(cassiopeia.type.core.common.CassiopeiaObject):
dto_type = cassiopeia.type.dto.staticdata.Realm
def __str__(self):
return "Realm"
def __eq__(self, other):
return self.cdn == other.cdn
def __ne__(self, other):
return self.cdn != other.cdn
def __hash__(self):
return hash(self.cdn)
@property
def cdn(self):
Returns:
int: the team score for the participant
"""
return self.data.teamScore
@property
def xp(self):
"""
Returns:
int: the amount of XP the participant has
"""
return self.data.xp
@cassiopeia.type.core.common.inheritdocs
class Position(cassiopeia.type.core.common.CassiopeiaObject):
dto_type = cassiopeia.type.dto.match.Position
def __str__(self):
return "({x}, {y})".format(x=self.x, y=self.y)
@property
def x(self):
"""
Returns:
int: the x-position of the pixel
"""
return self.data.x
@property
def y(self):
"""
Returns:
bool: whether or not the team won this match
"""
return self.data.win
@cassiopeia.type.core.common.immutablemethod
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)
@cassiopeia.type.core.common.inheritdocs
class Stats(cassiopeia.type.core.common.CassiopeiaObject):
dto_type = cassiopeia.type.dto.team.TeamStatDetail
def __str__(self):
return "Stats ({q})".format(q=self.queue)
@property
def average_games_played(self):
"""
Returns:
float: the average number of games played
"""
return self.data.averageGamesPlayed
@property
def losses(self):
"""
brazil = "BR"
europe_north_east = "EUNE"
europe_west = "EUW"
japan = "JP"
korea = "KR"
latin_america_north = "LAN"
latin_america_south = "LAS"
north_america = "NA"
oceania = "OCE"
pbe = "PBE"
russia = "RU"
turkey = "TR"
@cassiopeia.type.core.common.inheritdocs
class TournamentCode(cassiopeia.type.core.common.CassiopeiaObject):
dto_type = cassiopeia.type.dto.tournament.TournamentCode
def __str__(self):
return "{name} ({code})".format(name=self.name, code=self.code)
@property
def code(self):
"""
Returns:
str: the tournament code
"""
return self.data.code
@property
def id(self):
"""
Returns:
int: the sell price of the item
"""
return self.data.sell
@property
def total(self):
"""
Returns:
int: the total price of the item
"""
return self.data.total
@cassiopeia.type.core.common.inheritdocs
class ItemStats(cassiopeia.type.core.common.CassiopeiaObject):
dto_type = cassiopeia.type.dto.staticdata.BasicDataStats
__stats = set()
for tag, tags in Item._Item__item_categories.items():
for tag, stats in tags.items():
for stat in stats:
__stats.add(stat)
def __init__(self, data, scraped_stats={}):
super().__init__(data)
for k, v in scraped_stats.items():
if ("percent" in k or "spell_vamp" in k or "life_steal" in k or "tenacity" in k) and v > 1.0:
scraped_stats[k] = v / 100.0
self.__scraped_stats = scraped_stats
def __str__(self):
import datetime
import cassiopeia.riotapi
import cassiopeia.type.core.common
import cassiopeia.type.dto.matchlist
@cassiopeia.type.core.common.inheritdocs
class MatchReference(cassiopeia.type.core.common.CassiopeiaObject):
dto_type = cassiopeia.type.dto.matchlist.MatchReference
def __str__(self):
return "Match {id} Reference".format(id=self.id)
def __eq__(self, other):
return self.id == other.id
def __ne__(self, other):
return self.id != other.id
def __hash__(self):
return hash(self.id)
@cassiopeia.type.core.common.immutablemethod
def match(self, include_timeline=True):
import cassiopeia.riotapi
import cassiopeia.type.core.common
import cassiopeia.type.dto.staticdata
try:
from future.builtins.misc import super
except ImportError:
pass
######################
# Champion Endpoints #
######################
@cassiopeia.type.core.common.inheritdocs
class SetItem(cassiopeia.type.core.common.CassiopeiaObject):
dto_type = cassiopeia.type.dto.staticdata.BlockItem
def __str__(self):
return "{item} ({count})".format(item=self.item, count=self.count)
@property
def count(self):
"""
Returns:
int: how many of this item are in the block
"""
return self.data.count
@property
def item(self):
"""