From b03d4873da221a70277f1c59d77c6e1981f76655 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Aug 2026 19:32:48 +0000 Subject: [PATCH 1/5] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-mypy: v2.1.0 → v2.3.0](https://github.com/pre-commit/mirrors-mypy/compare/v2.1.0...v2.3.0) - [github.com/astral-sh/ruff-pre-commit: v0.15.20 → v0.16.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.20...v0.16.2) --- .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 368571c..4dc2cfd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,7 +23,7 @@ repos: # - id: no-commit-to-branch - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v2.1.0' + rev: 'v2.3.0' hooks: - id: mypy additional_dependencies: @@ -32,7 +32,7 @@ repos: - sqlalchemy - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.15.20' + rev: 'v0.16.2' hooks: - id: ruff args: [--fix] From 1155e5d2eb17fc035514eab6500f0155e015824f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Aug 2026 19:33:22 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/routers/tasktype.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/routers/tasktype.py b/src/routers/tasktype.py index a1a4c5a..4e86369 100644 --- a/src/routers/tasktype.py +++ b/src/routers/tasktype.py @@ -22,9 +22,9 @@ router = APIRouter(prefix="/tasktype", tags=["tasks"]) -def _normalize_task_type(task_type: Row[Any]) -> dict[str, str | None | list[Any]]: +def _normalize_task_type(task_type: Row[Any]) -> dict[str, str | list[Any] | None]: # Task types may contain multi-line fields which have either \r\n or \n line endings - ttype: dict[str, str | None | list[Any]] = { + ttype: dict[str, str | list[Any] | None] = { k: str(v).replace("\r\n", "\n").strip() if v is not None else v for k, v in task_type._mapping.items() # noqa: SLF001 if k != "id" @@ -40,10 +40,10 @@ async def list_task_types( expdb: Annotated[AsyncSession, Depends(expdb_session)], ) -> dict[ Literal["task_types"], - dict[Literal["task_type"], list[dict[str, str | None | list[Any]]]], + dict[Literal["task_type"], list[dict[str, str | list[Any] | None]]], ]: """Return a high level description of all task types.""" - task_types: list[dict[str, str | None | list[Any]]] = [ + task_types: list[dict[str, str | list[Any] | None]] = [ _normalize_task_type(ttype) for ttype in await get_task_types(expdb) ] return {"task_types": {"task_type": task_types}} @@ -53,7 +53,7 @@ async def list_task_types( async def get_task_type( task_type_id: Identifier, expdb: Annotated[AsyncSession, Depends(expdb_session)], -) -> dict[Literal["task_type"], dict[str, str | None | list[str] | list[dict[str, str]]]]: +) -> dict[Literal["task_type"], dict[str, str | list[str] | list[dict[str, str]] | None]]: """Return a detailed description for the given task type, including expected inputs.""" task_type_record = await db_get_task_type(task_type_id, expdb) if task_type_record is None: From b83abcc055e17108deeace05e9d546bf0b7ac4a8 Mon Sep 17 00:00:00 2001 From: PGijsbers Date: Mon, 10 Aug 2026 16:58:22 +0200 Subject: [PATCH 3/5] ignore or address PLR0917 warnings introduced with ruff 0.16 --- src/routers/datasets.py | 1 + src/routers/tasks.py | 1 + tests/routers/setups_tag_test.py | 2 +- tests/routers/tag_test_helper.py | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/routers/datasets.py b/src/routers/datasets.py index b23babd..87e5a93 100644 --- a/src/routers/datasets.py +++ b/src/routers/datasets.py @@ -186,6 +186,7 @@ def _quality_clause(quality: str, range_: str | None) -> str: @router.get(path="/list") async def list_datasets( # noqa: PLR0913, C901 expdb_db: Annotated[AsyncSession, Depends(expdb_session)], + *, pagination: Annotated[Pagination, Body(default_factory=Pagination)], data_name: Annotated[CasualString128 | None, Body()] = None, tag: Annotated[TagString | None, Body()] = None, diff --git a/src/routers/tasks.py b/src/routers/tasks.py index 7e08e55..bf592d6 100644 --- a/src/routers/tasks.py +++ b/src/routers/tasks.py @@ -259,6 +259,7 @@ def _quality_clause(quality: str, range_: str | None) -> str: @router.get(path="/list") async def list_tasks( # noqa: PLR0913, PLR0912, C901, PLR0915 expdb: Annotated[AsyncSession, Depends(expdb_session)], + *, pagination: Annotated[Pagination, Body(default_factory=Pagination)], task_type_id: Annotated[Identifier | None, Body(description="Filter by task type id.")] = None, tag: Annotated[TagString | None, Body()] = None, diff --git a/tests/routers/setups_tag_test.py b/tests/routers/setups_tag_test.py index e31077f..4258bd4 100644 --- a/tests/routers/setups_tag_test.py +++ b/tests/routers/setups_tag_test.py @@ -96,7 +96,7 @@ async def test_setup_tag_direct_success(expdb_session: AsyncSession) -> None: [[], ["some_other_tag"], ["foo_some_other_tag", "bar_some_other_tag"]], ids=["none", "one tag", "two tags"], ) -async def test_setup_tag_response_is_identical_when_tag_doesnt_exist( # noqa: PLR0913 +async def test_setup_tag_response_is_identical_when_tag_doesnt_exist( # noqa: PLR0913, PLR0917 api_key: str, other_tags: list[str], py_api: httpx.AsyncClient, diff --git a/tests/routers/tag_test_helper.py b/tests/routers/tag_test_helper.py index 95d4ca6..91bcb5c 100644 --- a/tests/routers/tag_test_helper.py +++ b/tests/routers/tag_test_helper.py @@ -11,7 +11,7 @@ import httpx -async def assert_tag_response_is_identical( # noqa: PLR0913 +async def assert_tag_response_is_identical( # noqa: PLR0913, PLR0917 identifier: Identifier, tag: str, api_key: str, From 663261b5dc9f74351392d9c4ee098f2706bfbd9c Mon Sep 17 00:00:00 2001 From: PGijsbers Date: Tue, 11 Aug 2026 10:58:11 +0200 Subject: [PATCH 4/5] Comply with PLR0917 --- tests/routers/dataset_tag_test.py | 9 ++++++++- tests/routers/tag_test_helper.py | 3 ++- tests/routers/task_tag_test.py | 4 +++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/routers/dataset_tag_test.py b/tests/routers/dataset_tag_test.py index 851e395..a1f1224 100644 --- a/tests/routers/dataset_tag_test.py +++ b/tests/routers/dataset_tag_test.py @@ -124,4 +124,11 @@ async def test_dataset_tag_response_is_identical( py_api: httpx.AsyncClient, php_api: httpx.AsyncClient, ) -> None: - await assert_tag_response_is_identical(dataset_id, tag, api_key, "dataset", py_api, php_api) + await assert_tag_response_is_identical( + identifier=dataset_id, + tag=tag, + api_key=api_key, + entity="dataset", + py_api=py_api, + php_api=php_api, + ) diff --git a/tests/routers/tag_test_helper.py b/tests/routers/tag_test_helper.py index 91bcb5c..e054583 100644 --- a/tests/routers/tag_test_helper.py +++ b/tests/routers/tag_test_helper.py @@ -11,7 +11,8 @@ import httpx -async def assert_tag_response_is_identical( # noqa: PLR0913, PLR0917 +async def assert_tag_response_is_identical( # noqa: PLR0913 + *, identifier: Identifier, tag: str, api_key: str, diff --git a/tests/routers/task_tag_test.py b/tests/routers/task_tag_test.py index 13413e7..d6cc012 100644 --- a/tests/routers/task_tag_test.py +++ b/tests/routers/task_tag_test.py @@ -116,4 +116,6 @@ async def test_task_tag_response_is_identical( py_api: httpx.AsyncClient, php_api: httpx.AsyncClient, ) -> None: - await assert_tag_response_is_identical(task_id, tag, api_key, "task", py_api, php_api) + await assert_tag_response_is_identical( + identifier=task_id, tag=tag, api_key=api_key, entity="task", py_api=py_api, php_api=php_api + ) From 06f608a971718896adc299601e5d17d58b281cff Mon Sep 17 00:00:00 2001 From: PGijsbers Date: Tue, 11 Aug 2026 14:07:16 +0200 Subject: [PATCH 5/5] also make expdb a keyword-only argument --- src/routers/datasets.py | 2 +- src/routers/tasks.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routers/datasets.py b/src/routers/datasets.py index 87e5a93..177be32 100644 --- a/src/routers/datasets.py +++ b/src/routers/datasets.py @@ -185,8 +185,8 @@ def _quality_clause(quality: str, range_: str | None) -> str: @router.post(path="/list", description="Provided for convenience, same as `GET` endpoint.") @router.get(path="/list") async def list_datasets( # noqa: PLR0913, C901 - expdb_db: Annotated[AsyncSession, Depends(expdb_session)], *, + expdb_db: Annotated[AsyncSession, Depends(expdb_session)], pagination: Annotated[Pagination, Body(default_factory=Pagination)], data_name: Annotated[CasualString128 | None, Body()] = None, tag: Annotated[TagString | None, Body()] = None, diff --git a/src/routers/tasks.py b/src/routers/tasks.py index bf592d6..a57e3de 100644 --- a/src/routers/tasks.py +++ b/src/routers/tasks.py @@ -258,8 +258,8 @@ def _quality_clause(quality: str, range_: str | None) -> str: @router.post(path="/list", description="Provided for convenience, same as `GET` endpoint.") @router.get(path="/list") async def list_tasks( # noqa: PLR0913, PLR0912, C901, PLR0915 - expdb: Annotated[AsyncSession, Depends(expdb_session)], *, + expdb: Annotated[AsyncSession, Depends(expdb_session)], pagination: Annotated[Pagination, Body(default_factory=Pagination)], task_type_id: Annotated[Identifier | None, Body(description="Filter by task type id.")] = None, tag: Annotated[TagString | None, Body()] = None,