Skip to content

Commit 351e391

Browse files
committed
update pre-commit
1 parent a7ebbbc commit 351e391

File tree

8 files changed

+15
-11
lines changed

8 files changed

+15
-11
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@ default_language_version:
22
python: python3
33
repos:
44
- repo: https://github.com/psf/black
5-
rev: 23.1.0
5+
rev: 24.8.0
66
hooks:
77
- id: black
88
- repo: https://github.com/charliermarsh/ruff-pre-commit
9-
rev: v0.0.252
9+
rev: v0.6.4
1010
hooks:
1111
- id: ruff
1212
args:
1313
- --fix
1414
- repo: https://github.com/pre-commit/pre-commit-hooks
15-
rev: v4.4.0
15+
rev: v4.6.0
1616
hooks:
1717
- id: check-toml
1818
- id: check-yaml
1919
- id: end-of-file-fixer
2020
- id: trailing-whitespace
2121
- repo: https://github.com/myint/docformatter
22-
rev: v1.5.1
22+
rev: v1.7.5
2323
hooks:
2424
- id: docformatter
2525
args: ["--in-place", "--wrap-summaries=88"]

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,19 @@ exclude_lines = [
6666
]
6767

6868
[tool.ruff]
69-
select = [
69+
lint.select = [
7070
"E", # pycodestyle errors
7171
"W", # pycodestyle warnings
7272
"F", # pyflakes
7373
# "I", # isort
7474
"C", # flake8-comprehensions
7575
"B", # flake8-bugbear
7676
]
77-
ignore = [
77+
lint.ignore = [
7878
"E501", # line too long, handled by black
7979
]
8080

81-
[tool.ruff.per-file-ignores]
81+
[tool.ruff.lint.per-file-ignores]
8282
"__init__.py" = ["F401"]
8383
"tests/test_forward_refs.py" = ["F821"]
8484

src/extendable_pydantic/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ def _resolve_submodel_fields(
104104
for field_name, field_info in cast(BaseModel, cls).model_fields.items():
105105
new_type = resolve_annotation(field_info.annotation, registry)
106106
if not all_identical(field_info.annotation, new_type):
107-
cast(BaseModel, cls).model_fields[
108-
field_name
109-
] = FieldInfo.merge_field_infos(field_info, annotation=new_type)
107+
cast(BaseModel, cls).model_fields[field_name] = (
108+
FieldInfo.merge_field_infos(field_info, annotation=new_type)
109+
)
110110
to_rebuild = True
111111
if to_rebuild:
112112
delattr(cls, "__pydantic_core_schema__")

src/extendable_pydantic/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def all_identical(left: Optional[Any], right: Optional[Any]) -> bool:
4545
return True
4646

4747

48-
def resolve_annotation(
48+
def resolve_annotation( # noqa: C901
4949
type_: Any, registry: Optional[ExtendableClassesRegistry] = None
5050
) -> Any:
5151
"""Return type with all occurrences of subclass of `ExtendableModelMeta` keys

tests/test_forward_refs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test forward refs resolution."""
2+
23
from typing import List, Optional
34

45
from pydantic import BaseModel, ConfigDict

tests/test_generics_inheritance.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test generics model inheritance."""
2+
23
from typing import Generic, List, TypeVar, Optional
34

45
try:

tests/test_inheritance.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test model inheritance."""
2+
23
from typing import List, Optional
34

45
try:

tests/test_relation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test relations."""
2+
23
from pydantic.main import BaseModel
34

45
from extendable_pydantic import ExtendableModelMeta

0 commit comments

Comments
 (0)