Skip to content

Commit 63f32b0

Browse files
ci(pre-commit.ci): autoupdate (#263)
* ci(pre-commit.ci): autoupdate updates: - [github.com/abravalheri/validate-pyproject: v0.19 → v0.22](abravalheri/validate-pyproject@v0.19...v0.22) - [github.com/crate-ci/typos: v1.24.5 → v1.27.0](crate-ci/typos@v1.24.5...v1.27.0) - [github.com/astral-sh/ruff-pre-commit: v0.6.4 → v0.7.2](astral-sh/ruff-pre-commit@v0.6.4...v0.7.2) - [github.com/pre-commit/mirrors-mypy: v1.11.2 → v1.13.0](pre-commit/mirrors-mypy@v1.11.2...v1.13.0) * fix: update linting --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Talley Lambert <[email protected]>
1 parent 74f4e0a commit 63f32b0

File tree

6 files changed

+16
-13
lines changed

6 files changed

+16
-13
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@ ci:
55

66
repos:
77
- repo: https://github.com/abravalheri/validate-pyproject
8-
rev: v0.19
8+
rev: v0.23
99
hooks:
1010
- id: validate-pyproject
1111

1212
- repo: https://github.com/crate-ci/typos
13-
rev: v1.24.5
13+
rev: typos-dict-v0.11.35
1414
hooks:
1515
- id: typos
1616
args: [--force-exclude] # omit --write-changes
1717

1818
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: v0.6.4
19+
rev: v0.7.4
2020
hooks:
2121
- id: ruff
2222
args: [--fix, --unsafe-fixes]
2323
- id: ruff-format
2424

2525
- repo: https://github.com/pre-commit/mirrors-mypy
26-
rev: v1.11.2
26+
rev: v1.13.0
2727
hooks:
2828
- id: mypy
2929
exclude: ^tests|^docs|_napari_plugin|widgets
3030
additional_dependencies:
31-
- pydantic>=2
31+
- pydantic>=2.10
3232
- pydantic-compat
3333
- xsdata==24.2.1
3434
- Pint

src/ome_autogen/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ def _disp_type(obj: Any) -> str:
221221
else:
222222
_fields = [
223223
f"{k}: {_disp_type(v.annotation)}"
224-
for k, v in sorted(m.model_fields.items())
224+
# this type ignore indicates something that may break in pydantic 3
225+
# but for now, it's confusing and I think it's an error
226+
for k, v in sorted(m.model_fields.items()) # type: ignore
225227
]
226228
if _fields:
227229
module += CLASS.format(

src/ome_types/_conversion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ def _get_ns_elem(elem: ET._Element | AnyElementTree) -> str:
561561
"""Get namespace from an element or element tree."""
562562
root = elem.getroot() if hasattr(elem, "getroot") else elem
563563
# return root.nsmap[root.prefix] this only works for lxml
564-
return root.tag.split("}", 1)[0].lstrip("{")
564+
return str(root.tag).split("}", 1)[0].lstrip("{")
565565

566566

567567
def _get_ns_file(source: FileLike) -> str:
@@ -582,7 +582,7 @@ def _get_root_ome_type(xml: FileLike | AnyElementTree) -> type[OMEType]:
582582
if hasattr(xml, "seek"):
583583
xml.seek(0)
584584
_, root = next(ET.iterparse(xml, events=("start",)))
585-
localname = cast("ET._Element", root).tag.rsplit("}", 1)[-1]
585+
localname = str(root.tag).rsplit("}", 1)[-1]
586586

587587
if hasattr(xml, "seek"):
588588
xml.seek(0)

src/ome_types/_pydantic_compat.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ def field_type(field: FieldInfo) -> Any:
1919
return field.annotation
2020

2121
def field_regex(obj: type[BaseModel], field_name: str) -> str | None:
22-
field_info = obj.model_fields[field_name]
22+
# typing is incorrect at the moment, but may indicate breakage in pydantic 3
23+
field_info = obj.model_fields[field_name] # type: ignore [index]
2324
meta = field_info.json_schema_extra or {}
2425
# if a "metadata" key exists... use it.
2526
# After pydantic-compat 0.2, this is where it will be.
@@ -30,7 +31,7 @@ def field_regex(obj: type[BaseModel], field_name: str) -> str | None:
3031
return None
3132

3233
def get_default(f: FieldInfo) -> Any:
33-
return f.get_default(call_default_factory=True)
34+
return f.get_default(call_default_factory=True, validated_data={})
3435

3536
else:
3637
from pydantic.color import Color as Color # type: ignore [no-redef]

src/xsdata_pydantic_basemodel/compat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ class AnyElement(PydanticCompatMixin, BaseModel):
4848
tail: Optional[str] = Field(default=None)
4949
children: List["AnyElement"] = Field(
5050
default_factory=list,
51-
metadata={"type": XmlType.WILDCARD}, # type: ignore [call-arg]
51+
metadata={"type": XmlType.WILDCARD}, # type: ignore [call-arg,call-overload]
5252
)
5353
attributes: Dict[str, str] = Field(
5454
default_factory=dict,
55-
metadata={"type": XmlType.ATTRIBUTES}, # type: ignore [call-arg]
55+
metadata={"type": XmlType.ATTRIBUTES}, # type: ignore [call-arg,call-overload]
5656
)
5757

5858
model_config: ClassVar["ConfigDict"] = {"arbitrary_types_allowed": True}

src/xsdata_pydantic_basemodel/pydantic_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,5 @@ def dataclass_fields(obj: type[M]) -> tuple[dc.Field, ...]:
105105
"""Return a tuple of dataclass fields for the given pydantic model class."""
106106
return tuple(
107107
_pydantic_field_to_dataclass_field(name, f)
108-
for name, f in obj.model_fields.items()
108+
for name, f in obj.model_fields.items() # type: ignore
109109
)

0 commit comments

Comments
 (0)