Skip to content

Commit d75b1d2

Browse files
authored
build: update pre-commit dependencies (#571)
1 parent 24701eb commit d75b1d2

File tree

12 files changed

+91
-91
lines changed

12 files changed

+91
-91
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ default_language_version:
22
python: "3.12"
33
repos:
44
- repo: https://github.com/compilerla/conventional-pre-commit
5-
rev: v3.1.0
5+
rev: v3.4.0
66
hooks:
77
- id: conventional-pre-commit
88
stages: [commit-msg]
99
- repo: https://github.com/pre-commit/pre-commit-hooks
10-
rev: v4.5.0
10+
rev: v4.6.0
1111
hooks:
1212
- id: check-ast
1313
- id: check-case-conflict
@@ -18,17 +18,17 @@ repos:
1818
- id: mixed-line-ending
1919
- id: trailing-whitespace
2020
- repo: https://github.com/pdm-project/pdm
21-
rev: 2.13.1
21+
rev: 2.17.3
2222
hooks:
2323
- id: pdm-lock-check
2424
- repo: https://github.com/charliermarsh/ruff-pre-commit
25-
rev: "v0.3.4"
25+
rev: "v0.5.6"
2626
hooks:
2727
- id: ruff
2828
args: ["--fix"]
2929
- id: ruff-format
3030
- repo: https://github.com/codespell-project/codespell
31-
rev: v2.2.6
31+
rev: v2.3.0
3232
hooks:
3333
- id: codespell
3434
- repo: https://github.com/pre-commit/mirrors-prettier
@@ -37,7 +37,7 @@ repos:
3737
- id: prettier
3838
exclude: ".all-contributorsrc"
3939
- repo: https://github.com/pre-commit/mirrors-mypy
40-
rev: "v1.10.0"
40+
rev: "v1.11.1"
4141
hooks:
4242
- id: mypy
4343
exclude: "test_decimal_constraints|examples/fields/test_example_2|examples/configuration|tools/"
@@ -56,7 +56,7 @@ repos:
5656
sqlalchemy>=2,
5757
]
5858
- repo: https://github.com/RobertCraigie/pyright-python
59-
rev: v1.1.341
59+
rev: v1.1.374
6060
hooks:
6161
- id: pyright
6262
exclude: "tests"

pdm.lock

Lines changed: 51 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

polyfactory/factories/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ def create_factory(
566566
)
567567

568568
@classmethod
569-
def get_constrained_field_value( # noqa: C901, PLR0911, PLR0912
569+
def get_constrained_field_value( # noqa: C901, PLR0911
570570
cls,
571571
annotation: Any,
572572
field_meta: FieldMeta,
@@ -626,7 +626,7 @@ def get_constrained_field_value( # noqa: C901, PLR0911, PLR0912
626626
except ValueError:
627627
collection_type = None
628628
if collection_type is not None:
629-
if collection_type == dict:
629+
if collection_type is dict:
630630
return handle_constrained_mapping(
631631
factory=cls,
632632
field_meta=field_meta,
@@ -748,7 +748,7 @@ def get_field_value( # noqa: C901, PLR0911, PLR0912
748748
if (origin := get_type_origin(unwrapped_annotation)) and is_safe_subclass(origin, Collection):
749749
if cls.__randomize_collection_length__:
750750
collection_type = get_collection_type(unwrapped_annotation)
751-
if collection_type != dict:
751+
if collection_type is not dict:
752752
return handle_constrained_collection(
753753
collection_type=collection_type, # type: ignore[type-var]
754754
factory=cls,

polyfactory/factories/pydantic_factory.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
from pydantic import BaseModel as BaseModelV1
5252
from pydantic.color import Color
5353
from pydantic.fields import ( # type: ignore[attr-defined]
54-
DeferredType, # pyright: ignore[reportGeneralTypeIssues]
55-
ModelField, # pyright: ignore[reportGeneralTypeIssues]
56-
Undefined, # pyright: ignore[reportGeneralTypeIssues]
54+
DeferredType, # pyright: ignore[attr-defined,reportAttributeAccessIssue]
55+
ModelField, # pyright: ignore[attr-defined,reportAttributeAccessIssue]
56+
Undefined, # pyright: ignore[attr-defined,reportAttributeAccessIssue]
5757
)
5858

5959
# Keep this import last to prevent warnings from pydantic if pydantic v2
@@ -99,7 +99,7 @@
9999

100100
from typing_extensions import NotRequired, TypeGuard
101101

102-
T = TypeVar("T", bound="BaseModelV1 | BaseModelV2")
102+
T = TypeVar("T", bound="BaseModelV1 | BaseModelV2") # pyright: ignore[reportInvalidTypeForm]
103103

104104
_IS_PYDANTIC_V1 = VERSION.startswith("1")
105105

@@ -443,7 +443,7 @@ def get_constrained_field_value(
443443
value = cls.get_field_value(
444444
field_meta, field_build_parameters=field_build_parameters, build_context=build_context
445445
)
446-
return to_json(value) # pyright: ignore[reportUnboundVariable]
446+
return to_json(value) # pyright: ignore[reportPossiblyUnboundVariable]
447447

448448
return super().get_constrained_field_value(
449449
annotation, field_meta, field_build_parameters=field_build_parameters, build_context=build_context
@@ -619,5 +619,5 @@ def _is_pydantic_v1_model(model: Any) -> TypeGuard[BaseModelV1]:
619619
return is_safe_subclass(model, BaseModelV1)
620620

621621

622-
def _is_pydantic_v2_model(model: Any) -> TypeGuard[BaseModelV2]:
622+
def _is_pydantic_v2_model(model: Any) -> TypeGuard[BaseModelV2]: # pyright: ignore[reportInvalidTypeForm]
623623
return not _IS_PYDANTIC_V1 and is_safe_subclass(model, BaseModelV2)

polyfactory/factories/sqlalchemy_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def get_type_from_column(cls, column: Column) -> type:
141141
annotation = column_type
142142
elif issubclass(column_type, postgresql.ARRAY):
143143
if type(column.type.item_type) in sqla_types: # type: ignore[attr-defined]
144-
annotation = List[type(column.type.item_type)] # type: ignore[attr-defined,misc]
144+
annotation = List[type(column.type.item_type)] # type: ignore[attr-defined,misc,assignment]
145145
else:
146146
annotation = List[column.type.item_type.python_type] # type: ignore[assignment,name-defined]
147147
elif issubclass(column_type, types.ARRAY):

polyfactory/factories/typed_dict_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
NotRequired,
77
Required,
88
TypeGuard,
9-
_TypedDictMeta, # pyright: ignore[reportGeneralTypeIssues]
9+
_TypedDictMeta, # pyright: ignore[reportAttributeAccessIssue]
1010
get_origin,
1111
get_type_hints,
1212
is_typeddict,

0 commit comments

Comments
 (0)