Skip to content

Commit

Permalink
Improve typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Pliner committed Sep 30, 2023
1 parent 3003d09 commit 6be4bf9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions marshmallow_recipe/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,12 +560,12 @@ def raw_field(

if _MARSHMALLOW_VERSION_MAJOR >= 3:

def data_key_fields(name: str | None) -> dict[str, Any]:
def data_key_fields(name: str | None) -> collections.abc.Mapping[str, Any]:
if name is None:
return {}
return dict(data_key=name)

def default_fields(value: Any) -> dict[str, Any]:
def default_fields(value: Any) -> collections.abc.Mapping[str, Any]:
return dict(dump_default=value, load_default=value)

class StrFieldV3(m.fields.Str):
Expand Down Expand Up @@ -760,12 +760,12 @@ def _validate_default(enum_type: Any, default: Any, allow_none: bool) -> None:
except ImportError:
dateutil_tz_utc_cls = None

def data_key_fields(name: str | None) -> dict[str, Any]:
def data_key_fields(name: str | None) -> collections.abc.Mapping[str, Any]:
if name is None:
return {}
return dict(dump_to=name, load_from=name)

def default_fields(value: Any) -> dict[str, Any]:
def default_fields(value: Any) -> collections.abc.Mapping[str, Any]:
return dict(missing=value, default=value)

class StrFieldV2(m.fields.Str):
Expand Down

0 comments on commit 6be4bf9

Please sign in to comment.