mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-28 06:36:54 +08:00
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:
committed by
Jelle Zijlstra
parent
5dc89fe8cf
commit
3272307933
@@ -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
|
||||
|
||||
2
third_party/3/dataclasses.pyi
vendored
2
third_party/3/dataclasses.pyi
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user