-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from joeyagreco/playoff-round-type
Added PlayoffRoundType enum field
- Loading branch information
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from __future__ import annotations | ||
|
||
from enum import unique | ||
|
||
from sleeper.enum.ModelEnum import ModelEnum | ||
|
||
|
||
@unique | ||
class PlayoffRoundType(ModelEnum): | ||
ONE_WEEK_PER_ROUND = "ONE_WEEK_PER_ROUND" # each round of playoffs is one week | ||
TWO_WEEK_CHAMPIONSHIP_ROUND = "TWO_WEEK_CHAMPIONSHIP_ROUND" # each round of playoffs is one week, while the championship spans two weeks | ||
TWO_WEEKS_PER_ROUND = "TWO_WEEKS_PER_ROUND" # each round of playoffs spans two weeks | ||
|
||
@classmethod | ||
def from_int(cls, val: int) -> PlayoffRoundType: | ||
if val == 0: | ||
return PlayoffRoundType.ONE_WEEK_PER_ROUND | ||
elif val == 1: | ||
return PlayoffRoundType.TWO_WEEK_CHAMPIONSHIP_ROUND | ||
elif val == 2: | ||
return PlayoffRoundType.TWO_WEEKS_PER_ROUND | ||
else: | ||
cls._handle_unknown_value(PlayoffRoundType, str(val)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters