From cbebfcacb2544a737defe9ca81176a938e2b8b0d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2026 18:42:09 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.15.7 → v0.15.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.7...v0.15.9) - [github.com/pre-commit/mirrors-mypy: v1.19.1 → v1.20.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.19.1...v1.20.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dc323f61..0ce51ab7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -68,7 +68,7 @@ repos: # Ruff is a code style and formatter # It works on files in-place - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.7 + rev: v0.15.9 hooks: - id: ruff-check name: ruff @@ -90,7 +90,7 @@ repos: # The project's documentation can be found at: # https://mypy.readthedocs.io/en/stable/index.html - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.19.1 + rev: v1.20.0 hooks: - id: mypy exclude: ^tests/.*$ From 602221fbb2a8067ceed15ae75ba8ccee264fb244 Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Wed, 8 Apr 2026 15:53:59 +0200 Subject: [PATCH 2/2] Satisfy mypy and specify black's target versions --- oteapi/models/genericconfig.py | 12 ++++++++++-- pyproject.toml | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/oteapi/models/genericconfig.py b/oteapi/models/genericconfig.py index f685602a..d582318e 100644 --- a/oteapi/models/genericconfig.py +++ b/oteapi/models/genericconfig.py @@ -9,7 +9,7 @@ from pydantic.fields import PydanticUndefined if TYPE_CHECKING: # pragma: no cover - from typing import Any + from typing import Any, cast class AttrDict(BaseModel, MutableMapping): # noqa: PLW1641 @@ -103,6 +103,10 @@ def update( # type: ignore[override] ) -> None: if other and isinstance(other, Mapping): for key, value in other.items(): + if not isinstance(key, str): + raise TypeError( + "Keys must be of type `str`, not " f"`{type(key).__name__}`." + ) setattr(self, key, value) elif other and isinstance(other, BaseModel): for key, value in other: @@ -117,7 +121,11 @@ def update( # type: ignore[override] raise ValueError( "`other` must be an iterable of objects of length two." ) - for key, value in other: # type: ignore[misc] + + if TYPE_CHECKING: # pragma: no cover + other = cast(Iterable[tuple[str, Any]], other) + + for key, value in other: setattr(self, key, value) elif other: raise TypeError( diff --git a/pyproject.toml b/pyproject.toml index 8230491e..be49acaf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -110,6 +110,9 @@ exclude = [ ".codecov.yml", ] +[tool.black] +target-version = ["py310","py311","py312","py313"] + [tool.mypy] python_version = "3.10" ignore_missing_imports = true