Skip to content

Commit

Permalink
Merge pull request #467 from spkane31/spk/add-annotations
Browse files Browse the repository at this point in the history
Adding type annotation for the scoreboard method
  • Loading branch information
cwendt94 authored Oct 2, 2023
2 parents b9fba66 + 81d853a commit 8186275
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions espn_api/football/league.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ def scoreboard(self, week: int = None) -> List[Matchup]:

for team in self.teams:
for matchup in matchups:
if matchup.home_team == team.team_id:
if matchup._home_team_id == team.team_id:
matchup.home_team = team
elif matchup.away_team == team.team_id:
elif matchup._away_team_id == team.team_id:
matchup.away_team = team

return matchups
Expand Down
8 changes: 6 additions & 2 deletions espn_api/football/matchup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
from .team import Team

class Matchup(object):
'''Creates Matchup instance'''
def __init__(self, data):
self.matchup_type = data.get('playoffTierType', 'NONE')
self.is_playoff = self.matchup_type != 'NONE'
(self.home_team, self.home_score) = self._fetch_matchup_info(data, 'home')
(self.away_team, self.away_score) = self._fetch_matchup_info(data, 'away')
(self._home_team_id, self.home_score) = self._fetch_matchup_info(data, 'home')
(self._away_team_id, self.away_score) = self._fetch_matchup_info(data, 'away')
self.home_team: Team
self.away_team: Team

def __repr__(self):
return f'Matchup({self.home_team}, {self.away_team})'
Expand Down

0 comments on commit 8186275

Please sign in to comment.