Skip to content

Commit

Permalink
Bump the pip-packages group across 1 directory with 4 updates (#159)
Browse files Browse the repository at this point in the history
* 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](pytest-dev/pytest@7.4.4...8.3.3)

Updates `flake8` from 6.1.0 to 7.1.1
- [Commits](PyCQA/flake8@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](psf/black@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](RobertCraigie/pyright-python@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] <[email protected]>

* Fix lint

* Fix lint

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Iurii Pliner <[email protected]>
  • Loading branch information
dependabot[bot] and Pliner authored Oct 28, 2024
1 parent 1c0bbac commit 4b966e2
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions marshmallow_recipe/bake.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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] = {
Expand Down Expand Up @@ -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=}")
Expand Down
12 changes: 6 additions & 6 deletions marshmallow_recipe/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions marshmallow_recipe/naming_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 7 additions & 10 deletions marshmallow_recipe/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 4b966e2

Please sign in to comment.