def __load_hook__(self, load_group: CoreData, data: CoreData) -> None: self.clear() from ...transformers.staticdata import StaticDataTransformer SearchableList.__init__(self, [ StaticDataTransformer.mastery_data_to_core(None, i) for i in data ]) super().__load_hook__(load_group, data)
def __load_hook__(self, load_group: CoreData, data: CoreData) -> None: self.clear() from ..transformers.masteries import MasteriesTransformer SearchableList.__init__(self, [ MasteriesTransformer.mastery_page_data_to_core(None, i) for i in data ]) super().__load_hook__(load_group, data)
def __load_hook__(self, load_group: CoreData, data: CoreData) -> None: self.clear() from ..transformers.spectator import SpectatorTransformer SearchableList.__init__(self, [ SpectatorTransformer.current_game_data_to_core(None, i) for i in data ]) super().__load_hook__(load_group, data)
def __load_hook__(self, load_group: CoreData, data: CoreData) -> None: self.clear() from ..transformers.championmastery import ChampionMasteryTransformer SearchableList.__init__(self, [ ChampionMasteryTransformer.champion_mastery_data_to_core(None, cm) for cm in data ]) super().__load_hook__(load_group, data)
def builds_from(self) -> List["Item"]: if hasattr(self._data[ItemData], "buildsFrom"): return SearchableList([ Item(id=id_, region=self.region) for id_ in self._data[ItemData].buildsFrom ]) else: return SearchableList([])
def skins(self) -> List[Skin]: """This champion's skins.""" skins = [] for skin in self._data[ChampionData].skins: skins.append(Skin.from_data((skin))) skins[-1]._Skin__champion_key = self.key return SearchableList(skins)
def test_delete_list_key(): list_ = SearchableList([other, normal, outer, inner, defined]) with pytest.raises(SearchError): del list_["value"] with pytest.raises(SearchError): del list_[0.0] with pytest.raises(SearchError): del list_[bytes()] assert list_ == [other, normal, outer, inner, defined] del list_["hello"] assert list_ == [other, normal, defined] del list_[normal] assert list_ == [other, defined] del list_["foo"] assert list_ == [defined] del list_[defined] assert list_ == []
def runes(self) -> List[Rune]: return SearchableList([ Rune(id=rune_id, region=self.__match.region, version=get_latest_version(region=self.__match.region, endpoint="rune")) for rune_id in self._data[CurrentGameParticipantData].runes ])
def spells(self) -> List[ChampionSpell]: """This champion's spells.""" keys = {0: "Q", 1: "W", 2: "E", 3: "R"} spells = [] for i, spell in enumerate(self._data[ChampionData].spells): spell.keyboard_key = keys[i] spells.append(ChampionSpell.from_data(spell)) return SearchableList(spells)
def entries(self) -> List[LeagueEntry]: entries = [] for entry in self._data[LeagueData].entries: entry.leagueId = self.id entry = LeagueEntry.from_data(data=entry, loaded_groups={LeagueEntriesData}) entries.append(entry) return SearchableList(entries)
def test_delete_list_index(): list_ = SearchableList([other, normal, outer, inner, defined]) for i in range(5, VALUE_COUNT): with pytest.raises(IndexError): del list_[i] assert list_ == [other, normal, outer, inner, defined] del list_[2] assert list_ == [other, normal, inner, defined] del list_[0] assert list_ == [normal, inner, defined] del list_[2] assert list_ == [normal, inner] del list_[1] assert list_ == [normal] del list_[0] assert list_ == []
def effects(self) -> List[List[float]]: """The level-by-level replacements for {{ e# }} tags in other values.""" return SearchableList(self._data[SummonerSpellData].effects)
def range(self) -> List[Union[int, str]]: """The maximum range of this spell. `self` if it has no range.""" return SearchableList(self._data[SummonerSpellData].range)
def modes(self) -> List[GameMode]: return SearchableList( [GameMode(mode) for mode in self._data[SummonerSpellData].modes])
def variables(self) -> List[SpellVars]: """Contains spell data.""" return SearchableList( SpellVars(v) for v in self._data[SummonerSpellData].variables)
def __load_hook__(self, load_group: CoreData, data: CoreData) -> None: self.clear() from ..transformers.leagues import LeagueTransformer SearchableList.__init__(self, [LeagueTransformer.league_list_data_to_core(None, i) for i in data]) super().__load_hook__(load_group, data)
def coefficients(self) -> List[float]: """The scaling coefficients for this spell.""" return SearchableList(self._data[SpellVarsData].coefficients)
def incidents(self) -> List[Incident]: return SearchableList([ Incident.from_data(inc) for inc in self._data[ServiceData].incidents ])
def alternative_images(self) -> List[Image]: """The alternative images for this spell. These won't exist after patch NN, when Riot standardized all images.""" return SearchableList( Image.from_data(alt) for alt in self._data[SummonerSpellData].alternative_images)
def translations(self) -> List[Translation]: return SearchableList([ Translation(trans) for trans in self._data[MessageData].translations ])
def updates(self) -> List[Message]: return SearchableList([ Message.from_data(message) for message in self._data[IncidentData].updates ])
def recommended_itemsets(self) -> List[RecommendedItems]: """The champion's recommended itemsets.""" return SearchableList( RecommendedItems.from_data(item, region=self.region) for item in self._data[ChampionData].recommendedItemsets)
def teams(self) -> List[Team]: return SearchableList([ Team.from_data(team, match=self) for team in self._data[CurrentGameInfoData].teams ])
def participants(self) -> List[Participant]: return SearchableList([ Participant.from_data(p, match=self.__match) for p in self._data[TeamData].participants ])
def cooldowns(self) -> List[float]: """The cooldowns of this spell (per level).""" return SearchableList(self._data[SummonerSpellData].cooldowns)
def services(self) -> List[Service]: return SearchableList([ Service.from_data(service) for service in self._data[ShardStatusData].services ])
def costs(self) -> List[int]: """The resource costs of this spell (per level).""" return SearchableList(self._data[SummonerSpellData].costs)
def entries(self) -> List[LeagueEntry]: return SearchableList([ LeagueEntry.from_data(entry) for entry in self._data[MasterLeagueListData].entries ])
def participants(self) -> List[Participant]: return SearchableList( [*self.blue_team.participants, *self.red_team.participants])
def keywords(self) -> List[str]: return SearchableList(self._data[ItemData].keywords)