Make dataclasses.Field.metadata non-optional (#3094)

If `metadata` is `None` the Field constructor replaces it with an empty
mapping object, so this value can never be None.

https://github.com/python/cpython/blob/v3.7.3/Lib/dataclasses.py#L243
This commit is contained in:
Benjamin Woodruff
2019-06-28 18:28:50 -07:00
committed by Jelle Zijlstra
parent 5dc89fe8cf
commit 3272307933
2 changed files with 2 additions and 2 deletions

View File

@@ -34,7 +34,7 @@ class Field(Generic[_T]):
hash: Optional[bool]
init: bool
compare: bool
metadata: Optional[Mapping[str, Any]]
metadata: Mapping[str, Any]
# NOTE: Actual return type is 'Field[_T]', but we want to help type checkers

View File

@@ -34,7 +34,7 @@ class Field(Generic[_T]):
hash: Optional[bool]
init: bool
compare: bool
metadata: Optional[Mapping[str, Any]]
metadata: Mapping[str, Any]
# NOTE: Actual return type is 'Field[_T]', but we want to help type checkers