@@ -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 # generic aliases do not have a __name__ prior python 3.10
@@ -642,7 +642,7 @@ def _field_for_generic_type(
642642def field_for_schema (
643643 typ : type ,
644644 default = marshmallow .missing ,
645- metadata : Mapping [str , Any ] = None ,
645+ metadata : Optional [ Mapping [str , Any ] ] = None ,
646646 base_schema : Optional [Type [marshmallow .Schema ]] = None ,
647647 typ_frame : Optional [types .FrameType ] = None ,
648648 generic_params_to_args : Optional [Tuple [Tuple [type , type ], ...]] = None ,
@@ -795,7 +795,7 @@ def _base_schema(
795795 # Remove `type: ignore` when mypy handles dynamic base classes
796796 # https://github.com/python/mypy/issues/2813
797797 class BaseSchema (base_schema or marshmallow .Schema ): # type: ignore
798- def load (self , data : Mapping , * , many : bool = None , ** kwargs ):
798+ def load (self , data : Mapping , * , many : Optional [ bool ] = None , ** kwargs ):
799799 all_loaded = super ().load (data , many = many , ** kwargs )
800800 many = self .many if many is None else bool (many )
801801 if many :
0 commit comments