Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ exclude: '.git|.tox'
files: 'serde/|tests/|examples/|bench/bench.py'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer

- repo: https://github.com/psf/black
rev: 24.3.0
rev: 24.10.0
hooks:
- id: black
args:
- .
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.356
rev: v1.1.389
hooks:
- id: pyright
additional_dependencies: ['pyyaml', 'msgpack', 'msgpack-types']
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
rev: v0.8.4
hooks:
- id: ruff
args:
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ numpy = [
{ version = ">1.22.0,<3.0.0", markers = "python_version ~= '3.12'" },
{ version = ">1.22.0,<3.0.0", markers = "python_version ~= '3.13'" },
]
mypy = "==1.14.0"
mypy = "==1.14.1"
pytest = "*"
pytest-cov = "*"
pytest-watch = "*"
Expand Down Expand Up @@ -121,7 +121,8 @@ include = [
exclude = [
"serde/numpy.py",
"bench",
"serde/__init__.py"
"serde/__init__.py",
"examples/type_numpy_jaxtyping.py"
]
pythonVersion = "3.12"
reportMissingImports = false
Expand Down
15 changes: 9 additions & 6 deletions serde/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,9 @@ def recursive(cls: Union[type[Any], Any]) -> None:

if is_dataclass(cls):
lst.add(cls)
for f in dataclass_fields(cls):
recursive(f.type)
if isinstance(cls, type):
for f in dataclass_fields(cls):
recursive(f.type)
elif isinstance(cls, str):
lst.add(cls)
elif is_opt(cls):
Expand Down Expand Up @@ -379,8 +380,9 @@ def recursive(cls: TypeLike) -> None:
recursive(cls.__value__)
if is_dataclass(cls):
stack.append(cls)
for f in dataclass_fields(cls):
recursive(f.type)
if isinstance(cls, type):
for f in dataclass_fields(cls):
recursive(f.type)
stack.pop()
elif is_opt(cls):
args = type_args(cls)
Expand Down Expand Up @@ -420,8 +422,9 @@ def recursive(cls: Union[type[Any], Any]) -> None:
recursive(arg)
if is_dataclass(cls):
lst.add(cls)
for f in dataclass_fields(cls):
recursive(f.type)
if isinstance(cls, type):
for f in dataclass_fields(cls):
recursive(f.type)
elif is_opt(cls):
args = type_args(cls)
if args:
Expand Down