meraki-analytics / cassiopeia

An all-inclusive Python framework for the Riot Games League of Legends API. Cass focuses on making the data easy and fun to work with, while providing all the tools necessary to create a website or do data analysis.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot get MatchData attribute "teams"

retzugil opened this issue · comments

I'm attempting to grab TeamData from a match using the following on cassiopeia 5.0.1 installed via pip:

import cassiopeia as cass

cass.set_riot_api_key(KEY_HERE)

summoner = cass.get_summoner(name="FromIron", region="NA")

mh = cass.get_match_history(continent=summoner.region.continent, puuid=summoner.puuid)
mh[0].teams

I was expecting the output to be an array of size 2 containing TeamData like:

[<cassiopeia.core.match.Team object at 0x1077193a0>, <cassiopeia.core.match.Team object at 0x107719130>]

But instead I'm receiving an empty array:

[]


This might be caused by a lazy loading issue at:

@CassiopeiaGhost.property(MatchData)
@ghost_load_on
@lazy
def teams(self) -> List[Team]:
return [
Team.from_data(t, match=self)
for i, t in enumerate(self._data[MatchData].teams)
]

which might have to get loaded like this prior to access:

if hasattr(self._data[MatchData], "participants"):
if not self._Ghost__is_loaded(MatchData):
self.__load__(MatchData)
self._Ghost__set_loaded(
MatchData
) # __load__ doesn't trigger __set_loaded.

Close as dupe of #407