@@ -116,7 +116,7 @@ def dataclass(
116116# underscore. The presence of _cls is used to detect if this
117117# decorator is being called with parameters or not.
118118def dataclass (
119- _cls : Type [_U ] = None ,
119+ _cls : Optional [ Type [_U ] ] = None ,
120120 * ,
121121 repr : bool = True ,
122122 eq : bool = True ,
@@ -173,16 +173,16 @@ def add_schema(_cls: Type[_U]) -> Type[_U]:
173173
174174@overload
175175def add_schema (
176- base_schema : Type [marshmallow .Schema ] = None ,
176+ base_schema : Optional [ Type [marshmallow .Schema ] ] = None ,
177177) -> Callable [[Type [_U ]], Type [_U ]]:
178178 ...
179179
180180
181181@overload
182182def add_schema (
183183 _cls : Type [_U ],
184- base_schema : Type [marshmallow .Schema ] = None ,
185- cls_frame : types .FrameType = None ,
184+ base_schema : Optional [ Type [marshmallow .Schema ] ] = None ,
185+ cls_frame : Optional [ types .FrameType ] = None ,
186186) -> Type [_U ]:
187187 ...
188188
@@ -224,7 +224,7 @@ def decorator(clazz: Type[_U]) -> Type[_U]:
224224def class_schema (
225225 clazz : type ,
226226 base_schema : Optional [Type [marshmallow .Schema ]] = None ,
227- clazz_frame : types .FrameType = None ,
227+ clazz_frame : Optional [ types .FrameType ] = None ,
228228) -> Type [marshmallow .Schema ]:
229229 """
230230 Convert a class to a marshmallow schema
@@ -371,7 +371,7 @@ def _dataclass_fields(clazz: type) -> Tuple[dataclasses.Field, ...]:
371371def _internal_class_schema (
372372 clazz : type ,
373373 base_schema : Optional [Type [marshmallow .Schema ]] = None ,
374- clazz_frame : types .FrameType = None ,
374+ clazz_frame : Optional [ types .FrameType ] = None ,
375375 generic_params_to_args : Optional [Tuple [Tuple [type , type ], ...]] = None ,
376376) -> Type [marshmallow .Schema ]:
377377 _RECURSION_GUARD .seen_classes [clazz ] = clazz .__name__
@@ -611,7 +611,7 @@ def _field_for_generic_type(
611611def field_for_schema (
612612 typ : type ,
613613 default = marshmallow .missing ,
614- metadata : Mapping [str , Any ] = None ,
614+ metadata : Optional [ Mapping [str , Any ] ] = None ,
615615 base_schema : Optional [Type [marshmallow .Schema ]] = None ,
616616 typ_frame : Optional [types .FrameType ] = None ,
617617 generic_params_to_args : Optional [Tuple [Tuple [type , type ], ...]] = None ,
@@ -761,7 +761,7 @@ def _base_schema(
761761 # Remove `type: ignore` when mypy handles dynamic base classes
762762 # https://github.com/python/mypy/issues/2813
763763 class BaseSchema (base_schema or marshmallow .Schema ): # type: ignore
764- def load (self , data : Mapping , * , many : bool = None , ** kwargs ):
764+ def load (self , data : Mapping , * , many : Optional [ bool ] = None , ** kwargs ):
765765 all_loaded = super ().load (data , many = many , ** kwargs )
766766 many = self .many if many is None else bool (many )
767767 if many :
@@ -807,7 +807,7 @@ def _generic_params_to_args(clazz: type) -> Tuple[Tuple[type, type], ...]:
807807
808808def _dataclass_type_hints (
809809 clazz : type ,
810- clazz_frame : types .FrameType = None ,
810+ clazz_frame : Optional [ types .FrameType ] = None ,
811811 generic_params_to_args : Optional [Tuple [Tuple [type , type ], ...]] = None ,
812812) -> Mapping [str , type ]:
813813 localns = clazz_frame .f_locals if clazz_frame else None
0 commit comments