Skip to content

Commit

Permalink
build: update pre-commit dependencies (#571)
Browse files Browse the repository at this point in the history
  • Loading branch information
adhtruong authored Aug 4, 2024
1 parent 24701eb commit d75b1d2
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 91 deletions.
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ default_language_version:
python: "3.12"
repos:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.1.0
rev: v3.4.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-ast
- id: check-case-conflict
Expand All @@ -18,17 +18,17 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/pdm-project/pdm
rev: 2.13.1
rev: 2.17.3
hooks:
- id: pdm-lock-check
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.3.4"
rev: "v0.5.6"
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
- repo: https://github.com/pre-commit/mirrors-prettier
Expand All @@ -37,7 +37,7 @@ repos:
- id: prettier
exclude: ".all-contributorsrc"
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.10.0"
rev: "v1.11.1"
hooks:
- id: mypy
exclude: "test_decimal_constraints|examples/fields/test_example_2|examples/configuration|tools/"
Expand All @@ -56,7 +56,7 @@ repos:
sqlalchemy>=2,
]
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.341
rev: v1.1.374
hooks:
- id: pyright
exclude: "tests"
Expand Down
101 changes: 51 additions & 50 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions polyfactory/factories/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def create_factory(
)

@classmethod
def get_constrained_field_value( # noqa: C901, PLR0911, PLR0912
def get_constrained_field_value( # noqa: C901, PLR0911
cls,
annotation: Any,
field_meta: FieldMeta,
Expand Down Expand Up @@ -626,7 +626,7 @@ def get_constrained_field_value( # noqa: C901, PLR0911, PLR0912
except ValueError:
collection_type = None
if collection_type is not None:
if collection_type == dict:
if collection_type is dict:
return handle_constrained_mapping(
factory=cls,
field_meta=field_meta,
Expand Down Expand Up @@ -748,7 +748,7 @@ def get_field_value( # noqa: C901, PLR0911, PLR0912
if (origin := get_type_origin(unwrapped_annotation)) and is_safe_subclass(origin, Collection):
if cls.__randomize_collection_length__:
collection_type = get_collection_type(unwrapped_annotation)
if collection_type != dict:
if collection_type is not dict:
return handle_constrained_collection(
collection_type=collection_type, # type: ignore[type-var]
factory=cls,
Expand Down
12 changes: 6 additions & 6 deletions polyfactory/factories/pydantic_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
from pydantic import BaseModel as BaseModelV1
from pydantic.color import Color
from pydantic.fields import ( # type: ignore[attr-defined]
DeferredType, # pyright: ignore[reportGeneralTypeIssues]
ModelField, # pyright: ignore[reportGeneralTypeIssues]
Undefined, # pyright: ignore[reportGeneralTypeIssues]
DeferredType, # pyright: ignore[attr-defined,reportAttributeAccessIssue]
ModelField, # pyright: ignore[attr-defined,reportAttributeAccessIssue]
Undefined, # pyright: ignore[attr-defined,reportAttributeAccessIssue]
)

# Keep this import last to prevent warnings from pydantic if pydantic v2
Expand Down Expand Up @@ -99,7 +99,7 @@

from typing_extensions import NotRequired, TypeGuard

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

_IS_PYDANTIC_V1 = VERSION.startswith("1")

Expand Down Expand Up @@ -443,7 +443,7 @@ def get_constrained_field_value(
value = cls.get_field_value(
field_meta, field_build_parameters=field_build_parameters, build_context=build_context
)
return to_json(value) # pyright: ignore[reportUnboundVariable]
return to_json(value) # pyright: ignore[reportPossiblyUnboundVariable]

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


def _is_pydantic_v2_model(model: Any) -> TypeGuard[BaseModelV2]:
def _is_pydantic_v2_model(model: Any) -> TypeGuard[BaseModelV2]: # pyright: ignore[reportInvalidTypeForm]
return not _IS_PYDANTIC_V1 and is_safe_subclass(model, BaseModelV2)
2 changes: 1 addition & 1 deletion polyfactory/factories/sqlalchemy_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def get_type_from_column(cls, column: Column) -> type:
annotation = column_type
elif issubclass(column_type, postgresql.ARRAY):
if type(column.type.item_type) in sqla_types: # type: ignore[attr-defined]
annotation = List[type(column.type.item_type)] # type: ignore[attr-defined,misc]
annotation = List[type(column.type.item_type)] # type: ignore[attr-defined,misc,assignment]
else:
annotation = List[column.type.item_type.python_type] # type: ignore[assignment,name-defined]
elif issubclass(column_type, types.ARRAY):
Expand Down
2 changes: 1 addition & 1 deletion polyfactory/factories/typed_dict_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
NotRequired,
Required,
TypeGuard,
_TypedDictMeta, # pyright: ignore[reportGeneralTypeIssues]
_TypedDictMeta, # pyright: ignore[reportAttributeAccessIssue]
get_origin,
get_type_hints,
is_typeddict,
Expand Down
Loading

0 comments on commit d75b1d2

Please sign in to comment.