From 32723079339004737dcc05e29740e23cd891c470 Mon Sep 17 00:00:00 2001 From: Benjamin Woodruff Date: Fri, 28 Jun 2019 18:28:50 -0700 Subject: [PATCH] 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 --- stdlib/3.7/dataclasses.pyi | 2 +- third_party/3/dataclasses.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/3.7/dataclasses.pyi b/stdlib/3.7/dataclasses.pyi index f8bcd5263..e3bf1d136 100644 --- a/stdlib/3.7/dataclasses.pyi +++ b/stdlib/3.7/dataclasses.pyi @@ -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 diff --git a/third_party/3/dataclasses.pyi b/third_party/3/dataclasses.pyi index f8bcd5263..e3bf1d136 100644 --- a/third_party/3/dataclasses.pyi +++ b/third_party/3/dataclasses.pyi @@ -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