From 4b966e284d7ff784a65e374f4e911a3dde795857 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 09:49:05 +0000 Subject: [PATCH] Bump the pip-packages group across 1 directory with 4 updates (#159) * Bump the pip-packages group across 1 directory with 4 updates Bumps the pip-packages group with 4 updates in the / directory: [pytest](https://github.com/pytest-dev/pytest), [flake8](https://github.com/pycqa/flake8), [black](https://github.com/psf/black) and [pyright](https://github.com/RobertCraigie/pyright-python). Updates `pytest` from 7.4.4 to 8.3.3 - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/7.4.4...8.3.3) Updates `flake8` from 6.1.0 to 7.1.1 - [Commits](https://github.com/pycqa/flake8/compare/6.1.0...7.1.1) Updates `black` from 23.12.1 to 24.10.0 - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/compare/23.12.1...24.10.0) Updates `pyright` from 1.1.344 to 1.1.386 - [Release notes](https://github.com/RobertCraigie/pyright-python/releases) - [Commits](https://github.com/RobertCraigie/pyright-python/compare/v1.1.344...v1.1.386) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:development update-type: version-update:semver-major dependency-group: pip-packages - dependency-name: flake8 dependency-type: direct:development update-type: version-update:semver-major dependency-group: pip-packages - dependency-name: black dependency-type: direct:development update-type: version-update:semver-major dependency-group: pip-packages - dependency-name: pyright dependency-type: direct:development update-type: version-update:semver-patch dependency-group: pip-packages ... Signed-off-by: dependabot[bot] * Fix lint * Fix lint --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Iurii Pliner --- Makefile | 2 +- marshmallow_recipe/bake.py | 7 +++---- marshmallow_recipe/fields.py | 12 ++++++------ marshmallow_recipe/naming_case.py | 3 +-- marshmallow_recipe/serialization.py | 17 +++++++---------- requirements-dev.txt | 8 ++++---- 6 files changed, 22 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index f8b6733..737ad26 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ isort: @isort --line-length 120 --use-parentheses --multi-line 3 --combine-as --trailing-comma marshmallow_recipe tests flake8: - @flake8 --max-line-length 120 --ignore C901,C812,E203 --extend-ignore W503 marshmallow_recipe tests + @flake8 --max-line-length 120 --ignore C901,C812,E203,E704 --extend-ignore W503 marshmallow_recipe tests pyright: @pyright diff --git a/marshmallow_recipe/bake.py b/marshmallow_recipe/bake.py index 75d30e5..1eeaa1b 100644 --- a/marshmallow_recipe/bake.py +++ b/marshmallow_recipe/bake.py @@ -99,7 +99,7 @@ def bake_schema( {"__module__": f"{__package__}.auto_generated"} | { field.name: get_field_for( - field.type, + field.type, # type: ignore metadata, naming_case=naming_case, none_value_handling=none_value_handling, @@ -342,8 +342,7 @@ def __call__( name: str, default: Any, **kwargs: Any, - ) -> m.fields.Field: - ... + ) -> m.fields.Field: ... _SIMPLE_TYPE_FIELD_FACTORIES: dict[type, _FieldFactory] = { @@ -381,7 +380,7 @@ def _substitute_any_to_open_generic(type: type) -> type: def _try_get_underlying_type_from_optional(type: type) -> type | None: # to support Union[int, None] and int | None - if get_origin(type) is Union or isinstance(type, types.UnionType): + if get_origin(type) is Union or isinstance(type, types.UnionType): # type: ignore type_args = get_args(type) if types.NoneType not in type_args or len(type_args) != 2: raise ValueError(f"Unsupported {type=}") diff --git a/marshmallow_recipe/fields.py b/marshmallow_recipe/fields.py index da78a61..582e1f6 100644 --- a/marshmallow_recipe/fields.py +++ b/marshmallow_recipe/fields.py @@ -619,7 +619,7 @@ def _serialize(self, value: Any, attr: Any, obj: Any, **kwargs: Any) -> Any: def _deserialize(self, value: Any, attr: Any, data: Any, **kwargs: Any) -> Any: result = super()._deserialize(value, attr, data, **kwargs) - if result is not None: + if result is not None: # type: ignore if self.strip_whitespaces: result = result.strip() if self.allow_none and len(result) == 0: @@ -635,12 +635,12 @@ def _deserialize(self, value: Any, attr: Any, data: Any, **kwargs: Any) -> Any: class DateTimeFieldV3(m.fields.DateTime): SERIALIZATION_FUNCS = { **m.fields.DateTime.SERIALIZATION_FUNCS, # type: ignore - **{"iso": datetime.datetime.isoformat, "iso8601": datetime.datetime.isoformat} + **{"iso": datetime.datetime.isoformat, "iso8601": datetime.datetime.isoformat}, } DESERIALIZATION_FUNCS = { **m.fields.DateTime.DESERIALIZATION_FUNCS, # type: ignore - **{"iso": datetime.datetime.fromisoformat, "iso8601": datetime.datetime.fromisoformat} + **{"iso": datetime.datetime.fromisoformat, "iso8601": datetime.datetime.fromisoformat}, } def _deserialize(self, value: Any, attr: Any, data: Any, **kwargs: Any) -> Any: @@ -832,7 +832,7 @@ def _serialize(self, value: Any, attr: Any, obj: Any, **_: Any) -> Any: def _deserialize(self, value: Any, attr: Any, data: Any, **_: Any) -> Any: result = super()._deserialize(value, attr, data) - if result is not None: + if result is not None: # type: ignore if self.strip_whitespaces: result = result.strip() if self.allow_none and len(result) == 0: @@ -854,12 +854,12 @@ def __isoformat(v: datetime.datetime, *, localtime: bool = False, **kwargs: Any) DATEFORMAT_SERIALIZATION_FUNCS = { **m.fields.DateTime.DATEFORMAT_SERIALIZATION_FUNCS, # type: ignore - **{"iso": __isoformat, "iso8601": __isoformat} + **{"iso": __isoformat, "iso8601": __isoformat}, } DATEFORMAT_DESERIALIZATION_FUNCS = { **m.fields.DateTime.DATEFORMAT_DESERIALIZATION_FUNCS, # type: ignore - **{"iso": datetime.datetime.fromisoformat, "iso8601": datetime.datetime.fromisoformat} + **{"iso": datetime.datetime.fromisoformat, "iso8601": datetime.datetime.fromisoformat}, } def _serialize(self, value: Any, attr: Any, obj: Any, **kwargs: Any) -> Any: diff --git a/marshmallow_recipe/naming_case.py b/marshmallow_recipe/naming_case.py index 10d52f3..0133561 100644 --- a/marshmallow_recipe/naming_case.py +++ b/marshmallow_recipe/naming_case.py @@ -3,8 +3,7 @@ class NamingCase(Protocol): - def __call__(self, name: str) -> str: - ... + def __call__(self, name: str) -> str: ... @dataclasses.dataclass(frozen=True, slots=True, kw_only=True) diff --git a/marshmallow_recipe/serialization.py b/marshmallow_recipe/serialization.py index b425e95..46003f7 100644 --- a/marshmallow_recipe/serialization.py +++ b/marshmallow_recipe/serialization.py @@ -22,28 +22,25 @@ class _SchemaKey: class SchemaFunction(Protocol): - def __call__(self, cls: type, *, many: bool = False, naming_case: NamingCase | None = None) -> m.Schema: - ... + def __call__(self, cls: type, *, many: bool = False, naming_case: NamingCase | None = None) -> m.Schema: ... class LoadFunction(Protocol): - def __call__(self, cls: type[_T], data: dict[str, Any], *, naming_case: NamingCase | None = None) -> _T: - ... + def __call__(self, cls: type[_T], data: dict[str, Any], *, naming_case: NamingCase | None = None) -> _T: ... class LoadManyFunction(Protocol): - def __call__(self, cls: type[_T], data: list[dict[str, Any]], *, naming_case: NamingCase | None = None) -> list[_T]: - ... + def __call__( + self, cls: type[_T], data: list[dict[str, Any]], *, naming_case: NamingCase | None = None + ) -> list[_T]: ... class DumpFunction(Protocol): - def __call__(self, data: Any, *, naming_case: NamingCase | None = None) -> dict[str, Any]: - ... + def __call__(self, data: Any, *, naming_case: NamingCase | None = None) -> dict[str, Any]: ... class DumpManyFunction(Protocol): - def __call__(self, data: list[Any], *, naming_case: NamingCase | None = None) -> list[dict[str, Any]]: - ... + def __call__(self, data: list[Any], *, naming_case: NamingCase | None = None) -> list[dict[str, Any]]: ... schema: SchemaFunction diff --git a/requirements-dev.txt b/requirements-dev.txt index a93ad23..03f2a64 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,8 +1,8 @@ -pytest==7.4.4 +pytest==8.3.3 isort==5.13.2 -flake8==6.1.0 -black==23.12.1 -pyright==1.1.344 +flake8==7.1.1 +black==24.10.0 +pyright==1.1.386 marshmallow>=2,<4 setuptools