Utilities¶
Module Contents¶
Functions¶
get_discriminator
¶
Recursively search for the discriminator attribute in a model.
| PARAMETER | DESCRIPTION |
|---|---|
model
|
The model to search within.
TYPE:
|
fieldname
|
The name of the field to search for.
TYPE:
|
key
|
The key to search for in dictionaries.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The name of the discriminator attribute.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the discriminator attribute is not found. |
Source code in griddy/nfl/utils/annotations.py
parse_datetime
¶
Convert a RFC 3339 / ISO 8601 formatted string into a datetime object. Python versions 3.11 and later support parsing RFC 3339 directly with datetime.fromisoformat(), but for earlier versions, this function encapsulates the necessary extra logic.