2.0.0 introduces DBConfig as a TypedDict, specified as:
class DBConfig(TypedDict, total=False):
...
OPTIONS: Optional[Dict[str, Any]]
As far as I can tell from a cursory reading of parse, it cannot be Optional (None) - options is always at least an empty directory ({}), but it can be NotRequired as a key (which is AFAIK already handled by the class being total=False) because if it is empty it just won't be set.
This came up for me because I have some code which does:
if "OPTIONS" in parsed_db_config:
parsed_db_config["OPTIONS"].update(...some_stuff)
which gets raised as an error:
error: Item "None" of "Optional[Dict[str, Any]]" has no attribute "update" [union-attr]
2.0.0
introducesDBConfig
as aTypedDict
, specified as:As far as I can tell from a cursory reading of
parse
, it cannot beOptional
(None
) -options
is always at least an empty directory ({}
), but it can beNotRequired
as a key (which is AFAIK already handled by the class beingtotal=False
) because if it is empty it just won't be set.This came up for me because I have some code which does:
which gets raised as an error:
Here's the totality of
options
being used and then potentially bound to theOPTIONS
key: https://github.com/jazzband/dj-database-url/blob/9b0f325910b388832f9bed7f580cc8e8d15cb2ff/dj_database_url/__init__.py#L159-L182