supercontest.util.types
Collection of custom types, classes, aliases, and generics used by other modules.
Module Attributes
Pick counts. |
|
Pick counts, by user. |
|
Pick counts, by user, by week. |
|
Pick counts, by user, by week, by season. |
|
Pick counts, by week. |
|
Pick counts, by week, by user. |
|
Pick counts, by season. |
|
Pick counts, by season, by user. |
|
Point rollups. |
|
Point rollups, by user. |
|
Point rollups, by user, by week. |
|
Point rollups, by user, by week, by season. |
|
Point rollups, by week. |
|
Point rollups, by week, by user. |
|
Point rollups, by season. |
|
Point rollups, by season, by user. |
|
Picks, by user. |
|
Picks, by user, by week. |
|
Picks, by user, by week, by season. |
Functions
Converts a defaultdict to a dict. |
Classes
Typing for single-row (user) results of an ALLTIME-scoped view. |
|
One game's line, as the lines job commits it, from either source. |
|
One game as Westgate's card prints it: text, before anything is read into it. |
|
Keys and their types for the fetched scores dictionary. |
|
Typing for single-row (user) results of a SEASON-scoped view. |
|
One user's week: picks, points so far, rank, and grade. |
|
Typing for single-row (user) results of a WEEK-scoped view. |
- class supercontest.util.types.AlltimeResults
Bases:
TypedDictTyping for single-row (user) results of an ALLTIME-scoped view.
- avg_pick_margin: NotRequired[int | float]
- cover: int
- noncover: int
- num_picks: int
- percentage: int | float
- pick_counts_by_season: dict[int, dict[str, int]]
- point_rollups_by_season: dict[int, dict[str, float]]
- points: int | float
- push: int
- rank: NotRequired[int]
- user_id: int
- class supercontest.util.types.Line(kickoff: datetime, line: float, favored_team: str, underdog_team: str, home_team: str | None)
Bases:
objectOne game’s line, as the lines job commits it, from either source.
The card and the admin’s hand-entered lines both become this before
commit_linessees them, so nothing turns a typed time back into Westgate’s text to have it parsed again.- favored_team: str
- classmethod from_fetch(fetch: LinesFetch) Line
Reads a card’s printed game.
- Parameters:
fetch – The parser’s text.
- Returns:
The line.
- Raises:
ValueError – If the kickoff or the line is not what the card prints.
- home_team: str | None
One of the two teams, or None for a neutral site.
- kickoff: datetime
The kickoff, aware, in UTC.
- line: float
Points the favorite gives; 0 for a pick’em.
- underdog_team: str
- class supercontest.util.types.LinesFetch
Bases:
TypedDictOne game as Westgate’s card prints it: text, before anything is read into it.
The PDF parser’s output.
Line.from_fetch()reads it into aLineat the edge; nothing past the fetch sees this shape.- datetime: str
- favored_team: str
- home_team: str | None
- line: str
- underdog_team: str
- supercontest.util.types.PickCounts
Pick counts.
alias of
defaultdict[str,int]
- supercontest.util.types.PickCountsBySeason
Pick counts, by season.
alias of
dict[int,dict[str,int]]
- supercontest.util.types.PickCountsBySeasonByUser
Pick counts, by season, by user.
alias of
defaultdict[int,dict[int,dict[str,int]]]
- supercontest.util.types.PickCountsByUser
Pick counts, by user.
alias of
defaultdict[int,defaultdict[str,int]]
- supercontest.util.types.PickCountsByUserByWeek
Pick counts, by user, by week.
alias of
defaultdict[int,defaultdict[int,defaultdict[str,int]]]
- supercontest.util.types.PickCountsByUserByWeekBySeason
Pick counts, by user, by week, by season.
alias of
defaultdict[int,defaultdict[int,defaultdict[int,defaultdict[str,int]]]]
- supercontest.util.types.PickCountsByWeek
Pick counts, by week.
alias of
dict[int,defaultdict[str,int]]
- supercontest.util.types.PickCountsByWeekByUser
Pick counts, by week, by user.
alias of
defaultdict[int,dict[int,defaultdict[str,int]]]
- supercontest.util.types.PointRollups
Point rollups.
alias of
defaultdict[str,float]
- supercontest.util.types.PointRollupsBySeason
Point rollups, by season.
alias of
dict[int,dict[str,float]]
- supercontest.util.types.PointRollupsBySeasonByUser
Point rollups, by season, by user.
alias of
defaultdict[int,dict[int,dict[str,float]]]
- supercontest.util.types.PointRollupsByUser
Point rollups, by user.
alias of
defaultdict[int,defaultdict[str,float]]
- supercontest.util.types.PointRollupsByUserByWeek
Point rollups, by user, by week.
alias of
defaultdict[int,defaultdict[int,defaultdict[str,float]]]
- supercontest.util.types.PointRollupsByUserByWeekBySeason
Point rollups, by user, by week, by season.
alias of
defaultdict[int,defaultdict[int,defaultdict[int,defaultdict[str,float]]]]
- supercontest.util.types.PointRollupsByWeek
Point rollups, by week.
alias of
dict[int,defaultdict[str,float]]
- supercontest.util.types.PointRollupsByWeekByUser
Point rollups, by week, by user.
alias of
defaultdict[int,dict[int,defaultdict[str,float]]]
- supercontest.util.types.RawPicksByUser
Picks, by user.
alias of
defaultdict[int,list[Any]]
- supercontest.util.types.RawPicksByUserByWeek
Picks, by user, by week.
alias of
defaultdict[int,defaultdict[int,list[Any]]]
- supercontest.util.types.RawPicksByUserByWeekBySeason
Picks, by user, by week, by season.
alias of
defaultdict[int,defaultdict[int,defaultdict[int,list[Any]]]]
- class supercontest.util.types.ScoresFetch
Bases:
TypedDictKeys and their types for the fetched scores dictionary.
- status: str
- team_scores: dict[str, int]
- class supercontest.util.types.SeasonResults
Bases:
TypedDictTyping for single-row (user) results of a SEASON-scoped view.
- bonus: NotRequired[int]
- cover: int
- noncover: int
- num_picks: int
- payout: NotRequired[int]
- percentage: int | float
- percentile: NotRequired[int | float]
- pick_counts_by_week: dict[int, defaultdict[str, int]]
- point_rollups_by_week: dict[int, defaultdict[str, float]]
- points: int | float
- previous_rank: NotRequired[int | None]
- purse: NotRequired[int]
- push: int
- rank: NotRequired[int]
- user_id: int
- class supercontest.util.types.WeekResultRow
Bases:
WeekResultsOne user’s week: picks, points so far, rank, and grade.
- grade: NotRequired[float]
- name: str
- num_picks: int
- pick_counts: defaultdict[str, int]
- points_finished: float
- points_inprogress: float
- rank: NotRequired[int]
- sorted_pick_teams: list[str]
- user_id: int
- class supercontest.util.types.WeekResults
Bases:
TypedDictTyping for single-row (user) results of a WEEK-scoped view.
- grade: NotRequired[float]
- num_picks: int
- pick_counts: defaultdict[str, int]
- points_finished: float
- points_inprogress: float
- rank: NotRequired[int]
- sorted_pick_teams: list[str]
- user_id: int
- supercontest.util.types.ddict2dict(ddict: defaultdict[Any, Any] | dict[Any, Any]) dict[Any, Any]
Converts a defaultdict to a dict. Handles nested/recursion.
- Parameters:
ddict – Default dictionary.
- Returns:
Dictionary.