From cc5731f7dd87c0489a71a2e410f181ec13546e2c Mon Sep 17 00:00:00 2001 From: jason Date: Thu, 25 Jul 2019 23:14:37 -0500 Subject: [PATCH] updated League endpoint stuff --- cassiopeia/core/league.py | 9 +- cassiopeia/datastores/cache.py | 58 +++--------- cassiopeia/datastores/kernel/leagues.py | 114 +++++++++-------------- cassiopeia/datastores/riotapi/leagues.py | 12 +-- cassiopeia/datastores/uniquekeys.py | 12 +-- cassiopeia/transformers/leagues.py | 7 -- doc/datapipeline.rst | 2 +- 7 files changed, 73 insertions(+), 141 deletions(-) diff --git a/cassiopeia/core/league.py b/cassiopeia/core/league.py index 8526c3bb..6101d2e7 100644 --- a/cassiopeia/core/league.py +++ b/cassiopeia/core/league.py @@ -49,7 +49,7 @@ def __call__(self, **kwargs): class LeagueSummonerEntriesData(CoreDataList): """League entries for a single summoner.""" _dto_type = LeagueSummonerEntriesDto - _renamed = {} + _renamed = {"summonerId": "summoner_id"} class LeagueEntriesData(CoreDataList): @@ -274,7 +274,6 @@ def division(self) -> Division: class LeagueSummonerEntries(CassiopeiaLazyList): _data_types = {LeagueSummonerEntriesData} - @provide_default_region def __init__(self, *, summoner: Summoner): self.__summoner = summoner kwargs = {"region": summoner.region} @@ -296,7 +295,7 @@ def __get_query_from_kwargs__(cls, *, summoner: Union[Summoner, str]) -> dict: @lazy_property def region(self) -> Region: - return Region(self._data[LeagueEntriesData].region) + return Region(self._data[LeagueSummonerEntriesData].region) @lazy_property def platform(self) -> Platform: @@ -328,12 +327,12 @@ def threes(self): class League(CassiopeiaGhost): _data_types = {LeagueData} - def __init__(self, id: str = None, region: Union[Region, str] = None): + def __init__(self, id: str = None, queue: Queue = None, region: Union[Region, str] = None): if region is None: region = configuration.settings.default_region if region is not None and not isinstance(region, Region): region = Region(region) - kwargs = {"id": id, "region": region} + kwargs = {"id": id, "region": region, "queue": queue} super().__init__(**kwargs) def __get_query__(self): diff --git a/cassiopeia/datastores/cache.py b/cassiopeia/datastores/cache.py index e1d78fb7..6ebca9fe 100644 --- a/cassiopeia/datastores/cache.py +++ b/cassiopeia/datastores/cache.py @@ -16,7 +16,7 @@ from ..core.staticdata.languagestrings import LanguageStringsData, LanguageStrings from ..core.staticdata.version import VersionListData, Versions from ..core.championmastery import ChampionMasteryData, ChampionMasteryListData, ChampionMastery, ChampionMasteries -from ..core.league import MasterLeagueListData, GrandmasterLeagueListData, ChallengerLeagueListData, LeagueEntries, League, ChallengerLeague, GrandmasterLeague, MasterLeague, LeagueEntries +from ..core.league import MasterLeagueListData, GrandmasterLeagueListData, ChallengerLeagueListData, LeagueSummonerEntries, League, ChallengerLeague, GrandmasterLeague, MasterLeague, LeagueEntries from ..core.match import MatchData, TimelineData, Match, Timeline from ..core.summoner import SummonerData, Summoner from ..core.status import ShardStatusData, ShardStatus @@ -46,7 +46,7 @@ ProfileIcons: datetime.timedelta(days=20), ChampionMastery: datetime.timedelta(days=7), ChampionMasteries: datetime.timedelta(days=7), - LeagueEntries: datetime.timedelta(hours=6), + LeagueSummonerEntries: datetime.timedelta(hours=6), League: datetime.timedelta(hours=6), ChallengerLeague: datetime.timedelta(hours=6), GrandmasterLeague: datetime.timedelta(hours=6), @@ -225,45 +225,25 @@ def put_many_champion_masteries(self, items: Iterable[ChampionMasteries], contex # League API # ############## - # LeagueEntries + # LeagueSummonerEntries - @get.register(LeagueEntries) + @get.register(LeagueSummonerEntries) @validate_query(uniquekeys.validate_league_entries_query, uniquekeys.convert_region_to_platform) - def get_league_position(self, query: Mapping[str, Any], context: PipelineContext = None) -> LeagueEntries: - return self._get(LeagueEntries, query, uniquekeys.for_league_entries_query, context) + def get_league_summoner_entries(self, query: Mapping[str, Any], context: PipelineContext = None) -> LeagueSummonerEntries: + return self._get(LeagueSummonerEntries, query, uniquekeys.for_league_summoner_entries_query, context) - @get_many.register(LeagueEntries) + @get_many.register(LeagueSummonerEntries) @validate_query(uniquekeys.validate_many_league_entries_query, uniquekeys.convert_region_to_platform) - def get_many_league_position(self, query: Mapping[str, Any], context: PipelineContext = None) -> Generator[LeagueEntries, None, None]: - return self._get_many(LeagueEntries, query, uniquekeys.for_many_league_entries_query, context) + def get_many_league_summoner_entries(self, query: Mapping[str, Any], context: PipelineContext = None) -> Generator[LeagueSummonerEntries, None, None]: + return self._get_many(LeagueSummonerEntries, query, uniquekeys.for_many_league_summoner_entries_query, context) - @put.register(LeagueEntries) - def put_league_position(self, item: LeagueEntries, context: PipelineContext = None) -> None: - self._put(LeagueEntries, item, uniquekeys.for_league_entries, context=context) + @put.register(LeagueSummonerEntries) + def put_league_summoner_entries(self, item: LeagueSummonerEntries, context: PipelineContext = None) -> None: + self._put(LeagueSummonerEntries, item, uniquekeys.for_league_summoner_entries, context=context) - @put_many.register(LeagueEntries) - def put_many_league_position(self, items: Iterable[LeagueEntries], context: PipelineContext = None) -> None: - self._put_many(LeagueEntries, items, uniquekeys.for_league_entries, context=context) - - # Leagues - - @get.register(League) - @validate_query(uniquekeys.validate_league_query, uniquekeys.convert_region_to_platform) - def get_league_summoner(self, query: Mapping[str, Any], context: PipelineContext = None) -> League: - return self._get(League, query, uniquekeys.for_league_query, context) - - @get_many.register(League) - @validate_query(uniquekeys.validate_many_league_query, uniquekeys.convert_region_to_platform) - def get_many_league_summoner(self, query: Mapping[str, Any], context: PipelineContext = None) -> Generator[League, None, None]: - return self._get_many(League, query, uniquekeys.for_many_league_query, context) - - @put.register(League) - def put_league_summoner(self, item: League, context: PipelineContext = None) -> None: - self._put(League, item, uniquekeys.for_league, context=context) - - @put_many.register(League) - def put_many_league_summoner(self, items: Iterable[League], context: PipelineContext = None) -> None: - self._put_many(League, items, uniquekeys.for_league, context=context) + @put_many.register(LeagueSummonerEntries) + def put_many_league_summoner_entries(self, items: Iterable[LeagueSummonerEntries], context: PipelineContext = None) -> None: + self._put_many(LeagueSummonerEntries, items, uniquekeys.for_league_summoner_entries, context=context) # Challenger @@ -325,14 +305,6 @@ def put_league_summoner(self, item: MasterLeague, context: PipelineContext = Non def put_many_league_summoner(self, items: Iterable[MasterLeague], context: PipelineContext = None) -> None: self._put_many(MasterLeague, items, uniquekeys.for_master_league, context=context) - @get.register(LeagueEntries) - @validate_query(uniquekeys.validate_league_entries_list_query, uniquekeys.convert_region_to_platform) - def get_league_entries_list(self, query: Mapping[str, Any], context: ProfileIcon = None) -> LeagueEntries: - return self._get(LeagueEntries, query, uniquekeys.for_league_entries_list_query, context) - - @put.register(LeagueEntries) - def put_league_entries_list(self, item: LeagueEntries, context: PipelineContext = None) -> None: - self._put(LeagueEntries, item, uniquekeys.for_league_entries_list, context=context) ################### # Static Data API # diff --git a/cassiopeia/datastores/kernel/leagues.py b/cassiopeia/datastores/kernel/leagues.py index c44cdb1e..ed51818c 100644 --- a/cassiopeia/datastores/kernel/leagues.py +++ b/cassiopeia/datastores/kernel/leagues.py @@ -3,7 +3,7 @@ from datapipelines import DataSource, PipelineContext, Query, NotFoundError, validate_query from .common import KernelSource, APINotFoundError from ...data import Platform, Queue, Tier, Division -from ...dto.league import LeaguesListDto, ChallengerLeagueListDto, MasterLeagueListDto,GrandmasterLeagueListDto, LeaguePositionsDto, LeagueListDto, PaginatedLeaguesListDto +from ...dto.league import LeagueEntriesDto, LeagueDto, LeagueSummonerEntriesDto, ChallengerLeagueListDto, MasterLeagueListDto, GrandmasterLeagueListDto from ..uniquekeys import convert_region_to_platform T = TypeVar("T") @@ -18,18 +18,20 @@ def get(self, type: Type[T], query: MutableMapping[str, Any], context: PipelineC def get_many(self, type: Type[T], query: MutableMapping[str, Any], context: PipelineContext = None) -> Iterable[T]: pass - _validate_get_paginated_leagues_list_query = Query. \ + # League Entries + + _validate_get_league_entries_query = Query. \ has("queue").as_(Queue).also. \ has("tier").as_(Tier).also. \ has("division").as_(Division).also. \ has("page").as_(int).also. \ has("platform").as_(Platform) - @get.register(PaginatedLeaguesListDto) - @validate_query(_validate_get_paginated_leagues_list_query, convert_region_to_platform) - def get_league_entries_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> PaginatedLeaguesListDto: - parameters = {"platform": query["platform"].value} - endpoint = "lol/league/v4/entries/{queue}/{tier}/{division}/{page}".format( + @get.register(LeagueEntriesDto) + @validate_query(_validate_get_league_entries_query, convert_region_to_platform) + def get_league_entries_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> LeagueEntriesDto: + parameters = {"platform": query["platform"].value, "page": query["page"]} + endpoint = "lol/league/v4/entries/{queue}/{tier}/{division}".format( queue=query["queue"].value, tier=query["tier"].value, division=query["division"].value, @@ -42,85 +44,52 @@ def get_league_entries_list(self, query: MutableMapping[str, Any], context: Pipe region = query["platform"].region.value for entry in data: entry["region"] = region - return PaginatedLeaguesListDto(entries=data, page=query["page"], region=query["region"].value, queue=query["queue"].value, tier=query["tier"].value, division=query["division"].value) - - # Leagues + return LeagueEntriesDto(entries=data, page=query["page"], region=query["region"].value, queue=query["queue"].value, tier=query["tier"].value, division=query["division"].value) - _validate_get_leagues_query = Query. \ - has("id").as_(str).also. \ + _validate_get_league_summoner_entries_query = Query. \ + has("summoner.id").as_(str).also. \ has("platform").as_(Platform) - @get.register(LeagueListDto) - @validate_query(_validate_get_leagues_query, convert_region_to_platform) - def get_leagues_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> LeagueListDto: + # League Summoner Entries + + @get.register(LeagueSummonerEntriesDto) + @validate_query(_validate_get_league_summoner_entries_query, convert_region_to_platform) + def get_league_summoner_entries_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> LeagueSummonerEntriesDto: parameters = {"platform": query["platform"].value} - endpoint = "lol/league/v4/leagues/{leagueId}".format(leagueId=query["id"]) + endpoint = "lol/league/v4/entries/by-summoner/{id}".format(id=query["summoner.id"]) try: data = self._get(endpoint=endpoint, parameters=parameters) except APINotFoundError as error: raise NotFoundError(str(error)) from error - data["region"] = query["platform"].region.value - for entry in data["entries"]: - entry["region"] = data["region"] - entry["tier"] = data["tier"] - return LeagueListDto(data) - - _validate_get_many_leagues_by_summoner_query = Query. \ - has("summoner.ids").as_(Iterable).also. \ - has("platform").as_(Platform) - - @get_many.register(LeaguesListDto) - @validate_query(_validate_get_many_leagues_by_summoner_query, convert_region_to_platform) - def get_many_leagues_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> Generator[LeaguesListDto, None, None]: - def generator(): - parameters = {"platform": query["platform"].value} - for id in query["summoner.ids"]: - endpoint = "lol/league/v4/leagues/by-summoner/{summonerId}".format(summonerId=id) - try: - data = self._get(endpoint=endpoint, parameters=parameters) - except APINotFoundError as error: - raise NotFoundError(str(error)) from error - - data["region"] = query["platform"].region.value - data["summonerId"] = id - for entry in data["entries"]: - entry["region"] = data["region"] - yield LeaguesListDto(data) + region = query["platform"].region.value + for entry in data: + entry["region"] = region + return LeagueSummonerEntriesDto(entries=data, region=region, summonerId=query["summoner.id"]) - return generator() + # League by ID - _validate_get_many_leagues_query = Query. \ - has("ids").as_(Iterable).also. \ + _validate_get_league_query = Query. \ + has("id").as_(str).also. \ has("platform").as_(Platform) - @get_many.register(LeagueListDto) - @validate_query(_validate_get_many_leagues_query, convert_region_to_platform) - def get_many_leagues_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> Generator[LeagueListDto, None, None]: - def generator(): - parameters = {"platform": query["platform"].value} - for id in query["ids"]: - endpoint = "lol/league/v4/leagues/{leagueId}".format(leagueId=id) - try: - data = self._get(endpoint=endpoint, parameters=parameters) - except APINotFoundError as error: - raise NotFoundError(str(error)) from error - - data = {"leagues": data} - data["region"] = query["platform"].region.value - for league in data["leagues"]: - league["region"] = data["region"] - for entry in league["entries"]: - entry["region"] = data["region"] - yield LeagueListDto(data) - - return generator() - + @get.register(LeagueDto) + @validate_query(_validate_get_league_query, convert_region_to_platform) + def get_leagues_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> LeagueDto: + parameters = {"platform": query["platform"].value} + endpoint = "leagues/{leagueId}".format(leagueId=query["id"]) + try: + data = self._get(endpoint=endpoint, parameters=parameters) + except APINotFoundError as error: + raise NotFoundError(str(error)) from error + return LeagueDto(data) _validate_get_challenger_league_query = Query. \ has("queue").as_(Queue).also. \ has("platform").as_(Platform) + # Challenger League + @get.register(ChallengerLeagueListDto) @validate_query(_validate_get_challenger_league_query, convert_region_to_platform) def get_challenger_league_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> ChallengerLeagueListDto: @@ -143,7 +112,7 @@ def get_challenger_league_list(self, query: MutableMapping[str, Any], context: P @get_many.register(ChallengerLeagueListDto) @validate_query(_validate_get_many_challenger_league_query, convert_region_to_platform) - def get_challenger_leagues_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> Generator[ChallengerLeagueListDto, None, None]: + def get_many_challenger_leagues_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> Generator[ChallengerLeagueListDto, None, None]: def generator(): parameters = {"platform": query["platform"].value} for queue in query["queues"]: @@ -162,6 +131,8 @@ def generator(): return generator() + # Grandmaster League + _validate_get_grandmaster_league_query = Query. \ has("queue").as_(Queue).also. \ has("platform").as_(Platform) @@ -188,7 +159,7 @@ def get_grandmaster_league_list(self, query: MutableMapping[str, Any], context: @get_many.register(GrandmasterLeagueListDto) @validate_query(_validate_get_many_grandmaster_league_query, convert_region_to_platform) - def get_grandmaster_leagues_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> Generator[GrandmasterLeagueListDto, None, None]: + def get_many_grandmaster_leagues_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> Generator[GrandmasterLeagueListDto, None, None]: def generator(): parameters = {"platform": query["platform"].value} for queue in query["queues"]: @@ -207,6 +178,7 @@ def generator(): return generator() + # Master League _validate_get_master_league_query = Query. \ has("queue").as_(Queue).also. \ @@ -234,7 +206,7 @@ def get_master_league_list(self, query: MutableMapping[str, Any], context: Pipel @get_many.register(MasterLeagueListDto) @validate_query(_validate_get_many_master_league_query, convert_region_to_platform) - def get_master_leagues_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> Generator[MasterLeagueListDto, None, None]: + def get_many_master_leagues_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> Generator[MasterLeagueListDto, None, None]: def generator(): parameters = {"platform": query["platform"].value} for queue in query["queues"]: diff --git a/cassiopeia/datastores/riotapi/leagues.py b/cassiopeia/datastores/riotapi/leagues.py index fbf2a4f5..e5f035e2 100644 --- a/cassiopeia/datastores/riotapi/leagues.py +++ b/cassiopeia/datastores/riotapi/leagues.py @@ -3,7 +3,7 @@ from datapipelines import DataSource, PipelineContext, Query, NotFoundError, validate_query from .common import RiotAPIService, APINotFoundError from ...data import Platform, Queue, Tier, Division -from ...dto.league import LeagueEntriesDto, LeagueEntryDto, LeagueDto, LeagueSummonerEntriesDto, ChallengerLeagueListDto, MasterLeagueListDto, GrandmasterLeagueListDto +from ...dto.league import LeagueEntriesDto, LeagueDto, LeagueSummonerEntriesDto, ChallengerLeagueListDto, MasterLeagueListDto, GrandmasterLeagueListDto from ..uniquekeys import convert_region_to_platform T = TypeVar("T") @@ -68,7 +68,6 @@ def get_league_summoner_entries_list(self, query: MutableMapping[str, Any], cont entry["region"] = region return LeagueSummonerEntriesDto(entries=data, region=region, summonerId=query["summoner.id"]) - # Leagues _validate_get_league_query = Query. \ @@ -119,7 +118,6 @@ def generator(): return generator() - _validate_get_challenger_league_query = Query. \ has("queue").as_(Queue).also. \ has("platform").as_(Platform) @@ -147,7 +145,7 @@ def get_challenger_league_list(self, query: MutableMapping[str, Any], context: P @get_many.register(ChallengerLeagueListDto) @validate_query(_validate_get_many_challenger_league_query, convert_region_to_platform) - def get_challenger_leagues_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> Generator[ChallengerLeagueListDto, None, None]: + def get_many_challenger_leagues_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> Generator[ChallengerLeagueListDto, None, None]: def generator(): for queue in query["queues"]: url = "https://{platform}.api.riotgames.com/lol/league/v4/challengerleagues/by-queue/{queueName}".format(platform=query["platform"].value.lower(), queueName=queue.value) @@ -167,7 +165,6 @@ def generator(): return generator() - _validate_get_grandmaster_league_query = Query. \ has("queue").as_(Queue).also. \ has("platform").as_(Platform) @@ -195,7 +192,7 @@ def get_grandmaster_league_list(self, query: MutableMapping[str, Any], context: @get_many.register(GrandmasterLeagueListDto) @validate_query(_validate_get_many_grandmaster_league_query, convert_region_to_platform) - def get_grandmaster_leagues_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> Generator[GrandmasterLeagueListDto, None, None]: + def get_many_grandmaster_leagues_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> Generator[GrandmasterLeagueListDto, None, None]: def generator(): for queue in query["queues"]: url = "https://{platform}.api.riotgames.com/lol/league/v4/grandmasterleagues/by-queue/{queueName}".format(platform=query["platform"].value.lower(), queueName=queue.value) @@ -215,7 +212,6 @@ def generator(): return generator() - _validate_get_master_league_query = Query. \ has("queue").as_(Queue).also. \ has("platform").as_(Platform) @@ -243,7 +239,7 @@ def get_master_league_list(self, query: MutableMapping[str, Any], context: Pipel @get_many.register(MasterLeagueListDto) @validate_query(_validate_get_many_master_league_query, convert_region_to_platform) - def get_master_leagues_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> Generator[MasterLeagueListDto, None, None]: + def get_many_master_leagues_list(self, query: MutableMapping[str, Any], context: PipelineContext = None) -> Generator[MasterLeagueListDto, None, None]: def generator(): for queue in query["queues"]: url = "https://{platform}.api.riotgames.com/lol/league/v4/masterleagues/by-queue/{queueName}".format(platform=query["platform"].value.lower(), queueName=queue.value) diff --git a/cassiopeia/datastores/uniquekeys.py b/cassiopeia/datastores/uniquekeys.py index e67b3ffd..2f2e4993 100644 --- a/cassiopeia/datastores/uniquekeys.py +++ b/cassiopeia/datastores/uniquekeys.py @@ -14,7 +14,7 @@ from ..dto.summoner import SummonerDto from ..core.championmastery import ChampionMastery, ChampionMasteries -from ..core.league import LeagueEntries, ChallengerLeague, GrandmasterLeague, MasterLeague, League, LeagueEntry +from ..core.league import LeagueSummonerEntries, ChallengerLeague, GrandmasterLeague, MasterLeague, League, LeagueEntry from ..core.staticdata import Champion, Rune, Item, SummonerSpell, Map, Locales, LanguageStrings, ProfileIcon, ProfileIcons, Realms, Versions, Items, Champions, Maps, SummonerSpells, Runes from ..core.status import ShardStatus from ..core.match import Match, MatchHistory, Timeline @@ -1142,15 +1142,15 @@ def for_champion_masteries_query(query: Query) -> List[Tuple]: has("summoners.id").as_(Iterable) -def for_league_entries(entries: LeagueEntries) -> List[Tuple[str, str]]: - return [(entries.platform.value, entries._LeagueEntries__summoner.id)] +def for_league_summoner_entries(entries: LeagueSummonerEntries) -> List[Tuple[str, str]]: + return [(entries.platform.value, entries._LeagueSummonerEntries__summoner.id)] -def for_league_entries_query(query: Query) -> List[Tuple[str, str]]: +def for_league_summoner_entries_query(query: Query) -> List[Tuple[str, str]]: return [(query["platform"].value, query["summoner.id"])] -def for_many_league_entries_query(query: Query) -> Generator[List[Tuple[str, str]], None, None]: +def for_many_league_summoner_entries_query(query: Query) -> Generator[List[Tuple[str, str]], None, None]: for id in query["summoners.id"]: try: yield [(query["platform"].value, id)] @@ -1273,7 +1273,7 @@ def for_many_master_league_query(query: Query) -> Generator[List[Tuple[str, str] has("division").as_(Division).also. \ has("platform").as_(Platform) -def for_league_entries_list(lel: LeagueEntries) -> List[Tuple[str, str, str, str]]: +def for_league_entries_list(lel: LeagueSummonerEntries) -> List[Tuple[str, str, str, str]]: return [(lel.platform.value, lel.queue.value, lel.tier.value, lel.division.value)] def for_league_entries_list_query(query: Query) -> List[Tuple[str, str, str, str]]: diff --git a/cassiopeia/transformers/leagues.py b/cassiopeia/transformers/leagues.py index 3da15d8c..b24a9a05 100644 --- a/cassiopeia/transformers/leagues.py +++ b/cassiopeia/transformers/leagues.py @@ -72,13 +72,6 @@ def league_entry_data_to_core(self, value: LeagueEntryData, context: PipelineCon def league_entries_data_to_core(self, value: LeagueEntriesData, context: PipelineContext = None) -> LeagueEntries: return LeagueEntries(*[LeagueTransformer.league_entry_data_to_core(self, entry) for entry in value], tier=value.tier, division=value.division, queue=value.queue, region=value.region) - @transform.register(LeagueSummonerEntriesData, LeagueSummonerEntries) - def league_summoner_entries_data_to_core(self, value: LeagueSummonerEntriesData, context: PipelineContext = None) -> LeagueSummonerEntries: - print("HERE", value.to_dict(), value, type(value)) - for entry in value: - print("HERE", entry.to_dict(), entry, type(entry)) - return LeagueSummonerEntries.from_data(*[LeagueTransformer.league_entry_data_to_core(self, entry) for entry in value], summoner=value["summoner_id"]) - #@transform.register(ChallengerLeagueListData, ChallengerLeague) def challenger_league_list_data_to_core(self, value: ChallengerLeagueListData, context: PipelineContext = None) -> ChallengerLeague: data = deepcopy(value) diff --git a/doc/datapipeline.rst b/doc/datapipeline.rst index da7e0b1c..da9de61c 100644 --- a/doc/datapipeline.rst +++ b/doc/datapipeline.rst @@ -87,7 +87,7 @@ It takes one optional parameter (called ``expirations``), which is a mapping of ProfileIcons: datetime.timedelta(days=20), ChampionMastery: datetime.timedelta(days=7), ChampionMasteries: datetime.timedelta(days=7), - LeagueEntries: datetime.timedelta(hours=6), + LeagueSummonerEntries: datetime.timedelta(hours=6), League: datetime.timedelta(hours=6), ChallengerLeague: datetime.timedelta(hours=6), MasterLeague: datetime.timedelta(hours=6),