Skip to content

Commit

Permalink
feat: implemented Season.to_str() method
Browse files Browse the repository at this point in the history
  • Loading branch information
201st-Luka committed Aug 25, 2023
1 parent 0418407 commit e46aafa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pyclasher/api/models/season.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,13 @@ def from_str(cls, season):
year = int(season[0])
month = int(season[1])
return cls(year, month)

def to_str(self):
return f"{self.year}-{self.month}"

def __eq__(self, other):
if isinstance(other, Season):
return self.year == other.year and self.month == other.month
if isinstance(other, str):
return self == Season.from_str(other)
raise NotImplementedError
3 changes: 3 additions & 0 deletions pyclasher/api/models/season.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ class Season:
@classmethod
def from_str(cls, season: str):
...

def to_str(self) -> str:
...

0 comments on commit e46aafa

Please sign in to comment.