From b78ab78ffb17c9aa20d82f3b271d13a1ac63c26a Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Tue, 12 Dec 2023 11:32:39 -0500 Subject: [PATCH] fix: fix pre-commit --- .pre-commit-config.yaml | 4 ++-- src/ome_types/_pydantic_compat.py | 2 +- src/ome_types/model/_shape_union.py | 4 ++-- src/ome_types/model/_structured_annotations.py | 4 ++-- src/xsdata_pydantic_basemodel/compat.py | 6 ++++-- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9753983a..7262e224 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,13 +13,13 @@ repos: exclude: ^tests|^docs - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.6 + rev: v0.1.7 hooks: - id: ruff args: [--fix] - repo: https://github.com/psf/black - rev: 23.11.0 + rev: 23.12.0 hooks: - id: black exclude: ^docs diff --git a/src/ome_types/_pydantic_compat.py b/src/ome_types/_pydantic_compat.py index 46cb821c..4f9d4bb7 100644 --- a/src/ome_types/_pydantic_compat.py +++ b/src/ome_types/_pydantic_compat.py @@ -23,7 +23,7 @@ def field_regex(obj: type[BaseModel], field_name: str) -> str | None: if field_info.json_schema_extra and isinstance( field_info.json_schema_extra, dict ): - return field_info.json_schema_extra.get("pattern") + return field_info.json_schema_extra.get("pattern") # type: ignore return None def get_default(f: FieldInfo) -> Any: diff --git a/src/ome_types/model/_shape_union.py b/src/ome_types/model/_shape_union.py index 09a57c4a..289ff442 100644 --- a/src/ome_types/model/_shape_union.py +++ b/src/ome_types/model/_shape_union.py @@ -55,7 +55,7 @@ class ShapeUnion(OMEType, RootModel, UserSequence[ShapeType]): # type: ignore[m default_factory=list, json_schema_extra={ "type": "Elements", - "choices": tuple( + "choices": tuple( # type: ignore[dict-item] {"name": kind.title(), "type": cls} for kind, cls in _KINDS.items() ), }, @@ -117,7 +117,7 @@ class ShapeUnion(OMEType, UserSequence[ShapeType]): # type: ignore # for some reason that messes up xsdata data binding __root__: List[object] = Field( default_factory=list, - metadata={ + metadata={ # type: ignore[call-arg] "type": "Elements", "choices": tuple( {"name": kind.title(), "type": cls} for kind, cls in _KINDS.items() diff --git a/src/ome_types/model/_structured_annotations.py b/src/ome_types/model/_structured_annotations.py index cda18ef2..ca6f056a 100644 --- a/src/ome_types/model/_structured_annotations.py +++ b/src/ome_types/model/_structured_annotations.py @@ -64,7 +64,7 @@ class StructuredAnnotationList(OMEType, RootModel, UserSequence[Annotation]): # default_factory=list, json_schema_extra={ "type": "Elements", - "choices": tuple( + "choices": tuple( # type: ignore[dict-item] {"name": cls.__name__, "type": cls} for cls in AnnotationTypes ), }, @@ -124,7 +124,7 @@ class StructuredAnnotationList(OMEType, UserSequence[Annotation]): # type: igno # for some reason that messes up xsdata data binding __root__: List[object] = Field( default_factory=list, - metadata={ + metadata={ # type: ignore[call-arg] "type": "Elements", "choices": tuple( {"name": cls.__name__, "type": cls} for cls in AnnotationTypes diff --git a/src/xsdata_pydantic_basemodel/compat.py b/src/xsdata_pydantic_basemodel/compat.py index 6c17a786..f0b34d55 100644 --- a/src/xsdata_pydantic_basemodel/compat.py +++ b/src/xsdata_pydantic_basemodel/compat.py @@ -46,10 +46,12 @@ class AnyElement(PydanticCompatMixin, BaseModel): text: Optional[str] = Field(default=None) tail: Optional[str] = Field(default=None) children: List["AnyElement"] = Field( - default_factory=list, metadata={"type": XmlType.WILDCARD} + default_factory=list, + metadata={"type": XmlType.WILDCARD}, # type: ignore [call-arg] ) attributes: Dict[str, str] = Field( - default_factory=dict, metadata={"type": XmlType.ATTRIBUTES} + default_factory=dict, + metadata={"type": XmlType.ATTRIBUTES}, # type: ignore [call-arg] ) model_config: ClassVar["ConfigDict"] = {"arbitrary_types_allowed": True}