Skip to content

Commit d344902

Browse files
authored
Merge branch 'litestar-org:main' into feat/sqlalchemy-defaults
2 parents 3f37c0d + c79cebe commit d344902

17 files changed

Lines changed: 51 additions & 39 deletions

.pre-commit-config.yaml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ default_language_version:
22
python: "3.13"
33
repos:
44
- repo: https://github.com/compilerla/conventional-pre-commit
5-
rev: v4.0.0
5+
rev: v4.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: v5.0.0
10+
rev: v6.0.0
1111
hooks:
1212
- id: check-ast
1313
- id: check-case-conflict
@@ -17,18 +17,24 @@ repos:
1717
- id: end-of-file-fixer
1818
- id: mixed-line-ending
1919
- id: trailing-whitespace
20-
- repo: https://github.com/charliermarsh/ruff-pre-commit
21-
rev: "v0.11.0"
20+
- repo: local
2221
hooks:
2322
- id: ruff
24-
args: ["--fix"]
23+
name: ruff
24+
entry: uv run ruff check --fix
25+
language: system
26+
types: [python]
2527
- id: ruff-format
28+
name: ruff-format
29+
entry: uv run ruff format
30+
language: system
31+
types: [python]
2632
- repo: https://github.com/crate-ci/typos
27-
rev: v1.30.3
33+
rev: v1.44.0
2834
hooks:
2935
- id: typos
3036
- repo: https://github.com/pycontribs/mirrors-prettier
31-
rev: "v3.5.3"
37+
rev: v3.6.2
3238
hooks:
3339
- id: prettier
3440
exclude: ".all-contributorsrc"
@@ -53,6 +59,6 @@ repos:
5359
entry: uv run --all-groups pyright
5460
types: [python]
5561
- repo: https://github.com/sphinx-contrib/sphinx-lint
56-
rev: "v1.0.0"
62+
rev: v1.0.2
5763
hooks:
5864
- id: sphinx-lint

docs/examples/handling_custom_types/test_example_2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __str__(self) -> str:
2121

2222

2323
# we create a custom base factory to handle dataclasses, with an extended provider map
24-
class CustomDataclassFactory(Generic[T], DataclassFactory[T]):
24+
class CustomDataclassFactory(DataclassFactory[T], Generic[T]):
2525
__is_base_factory__ = True
2626

2727
@classmethod

polyfactory/factories/attrs_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
T = TypeVar("T", bound=AttrsInstance)
2424

2525

26-
class AttrsFactory(Generic[T], BaseFactory[T]):
26+
class AttrsFactory(BaseFactory[T], Generic[T]):
2727
"""Base factory for attrs classes."""
2828

2929
__model__: type[T]

polyfactory/factories/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,8 +1245,8 @@ def _register_builtin_factories() -> None:
12451245
12461246
:returns: None
12471247
"""
1248-
import polyfactory.factories.dataclass_factory
1249-
import polyfactory.factories.typed_dict_factory # noqa: F401
1248+
import polyfactory.factories.dataclass_factory # noqa: PLC0415
1249+
import polyfactory.factories.typed_dict_factory # noqa: F401, PLC0415
12501250

12511251
for module in [
12521252
"polyfactory.factories.pydantic_factory",

polyfactory/factories/beanie_odm_factory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
T = TypeVar("T", bound=Document)
2525

2626

27-
class BeaniePersistenceHandler(Generic[T], AsyncPersistenceProtocol[T]):
27+
class BeaniePersistenceHandler(AsyncPersistenceProtocol[T], Generic[T]):
2828
"""Persistence Handler using beanie logic"""
2929

3030
async def save(self, data: T) -> T:
@@ -40,7 +40,7 @@ async def save_many(self, data: list[T]) -> list[T]:
4040
return [await doc.insert() for doc in data] # pyright: ignore[reportGeneralTypeIssues]
4141

4242

43-
class BeanieDocumentFactory(Generic[T], ModelFactory[T]):
43+
class BeanieDocumentFactory(ModelFactory[T], Generic[T]):
4444
"""Base factory for Beanie Documents"""
4545

4646
__async_persistence__ = BeaniePersistenceHandler

polyfactory/factories/dataclass_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from polyfactory.field_meta import FieldMeta, Null
1010

1111

12-
class DataclassFactory(Generic[T], BaseFactory[T]):
12+
class DataclassFactory(BaseFactory[T], Generic[T]):
1313
"""Dataclass base factory"""
1414

1515
__is_base_factory__ = True

polyfactory/factories/msgspec_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
T = TypeVar("T", bound=msgspec.Struct)
2323

2424

25-
class MsgspecFactory(Generic[T], BaseFactory[T]):
25+
class MsgspecFactory(BaseFactory[T], Generic[T]):
2626
"""Base factory for msgspec Structs."""
2727

2828
__is_base_factory__ = True

polyfactory/factories/odmantic_odm_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from typing_extensions import TypeGuard
2424

2525

26-
class OdmanticModelFactory(Generic[T], ModelFactory[T]):
26+
class OdmanticModelFactory(ModelFactory[T], Generic[T]):
2727
"""Base factory for odmantic models"""
2828

2929
__is_base_factory__ = True

polyfactory/factories/pydantic_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def get_constraints_metadata(cls, annotation: Any) -> Sequence[Any]:
355355
return metadata
356356

357357

358-
class ModelFactory(Generic[T], BaseFactory[T]):
358+
class ModelFactory(BaseFactory[T], Generic[T]):
359359
"""Base factory for pydantic models"""
360360

361361
__forward_ref_resolution_type_mapping__: ClassVar[Mapping[str, type]] = {}

polyfactory/factories/sqlalchemy_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class _SessionMaker(Protocol[_T_co]):
128128
def __call__() -> _T_co: ...
129129

130130

131-
class SQLAlchemyFactory(Generic[T], BaseFactory[T]):
131+
class SQLAlchemyFactory(BaseFactory[T], Generic[T]):
132132
"""Base factory for SQLAlchemy models."""
133133

134134
__is_base_factory__ = True

0 commit comments

Comments
 (0)