From 829509baf173b404cd8b8f3103e1cc9a5508917c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 28 Apr 2025 18:31:57 +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/pre-commit/mirrors-mypy: v1.11.2 → v1.15.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.11.2...v1.15.0) - [github.com/astral-sh/ruff-pre-commit: v0.6.9 → v0.11.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.9...v0.11.7) --- .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 09b9d47..388c0ee 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,7 +18,7 @@ repos: # - id: no-commit-to-branch - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.11.2' + rev: 'v1.15.0' hooks: - id: mypy additional_dependencies: @@ -26,7 +26,7 @@ repos: - pytest - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.6.9' + rev: 'v0.11.7' hooks: - id: ruff args: [--fix] From f58cf3be281b522637d99eb5cf361d0ed82878ac Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 28 Apr 2025 18:32:33 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/database/evaluations.py | 2 +- src/database/flows.py | 4 ++-- src/database/studies.py | 6 +++--- src/database/tasks.py | 8 ++++---- src/routers/openml/tasktype.py | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/database/evaluations.py b/src/database/evaluations.py index f98b15e..799d411 100644 --- a/src/database/evaluations.py +++ b/src/database/evaluations.py @@ -9,7 +9,7 @@ def get_math_functions(function_type: str, connection: Connection) -> Sequence[Row]: return cast( - Sequence[Row], + "Sequence[Row]", connection.execute( text( """ diff --git a/src/database/flows.py b/src/database/flows.py index 93fb219..3129e91 100644 --- a/src/database/flows.py +++ b/src/database/flows.py @@ -6,7 +6,7 @@ def get_subflows(for_flow: int, expdb: Connection) -> Sequence[Row]: return cast( - Sequence[Row], + "Sequence[Row]", expdb.execute( text( """ @@ -36,7 +36,7 @@ def get_tags(flow_id: int, expdb: Connection) -> list[str]: def get_parameters(flow_id: int, expdb: Connection) -> Sequence[Row]: return cast( - Sequence[Row], + "Sequence[Row]", expdb.execute( text( """ diff --git a/src/database/studies.py b/src/database/studies.py index 848c034..35c1b79 100644 --- a/src/database/studies.py +++ b/src/database/studies.py @@ -43,7 +43,7 @@ def get_study_data(study: Row, expdb: Connection) -> Sequence[Row]: """ if study.type_ == StudyType.TASK: return cast( - Sequence[Row], + "Sequence[Row]", expdb.execute( text( """ @@ -56,7 +56,7 @@ def get_study_data(study: Row, expdb: Connection) -> Sequence[Row]: ).all(), ) return cast( - Sequence[Row], + "Sequence[Row]", expdb.execute( text( """ @@ -103,7 +103,7 @@ def create(study: CreateStudy, user: User, expdb: Connection) -> int: }, ) (study_id,) = expdb.execute(text("""SELECT LAST_INSERT_ID();""")).one() - return cast(int, study_id) + return cast("int", study_id) def attach_task(task_id: int, study_id: int, user: User, expdb: Connection) -> None: diff --git a/src/database/tasks.py b/src/database/tasks.py index 56a6718..97caef3 100644 --- a/src/database/tasks.py +++ b/src/database/tasks.py @@ -19,7 +19,7 @@ def get(id_: int, expdb: Connection) -> Row | None: def get_task_types(expdb: Connection) -> Sequence[Row]: return cast( - Sequence[Row], + "Sequence[Row]", expdb.execute( text( """ @@ -46,7 +46,7 @@ def get_task_type(task_type_id: int, expdb: Connection) -> Row | None: def get_input_for_task_type(task_type_id: int, expdb: Connection) -> Sequence[Row]: return cast( - Sequence[Row], + "Sequence[Row]", expdb.execute( text( """ @@ -62,7 +62,7 @@ def get_input_for_task_type(task_type_id: int, expdb: Connection) -> Sequence[Ro def get_input_for_task(id_: int, expdb: Connection) -> Sequence[Row]: return cast( - Sequence[Row], + "Sequence[Row]", expdb.execute( text( """ @@ -78,7 +78,7 @@ def get_input_for_task(id_: int, expdb: Connection) -> Sequence[Row]: def get_task_type_inout_with_template(task_type: int, expdb: Connection) -> Sequence[Row]: return cast( - Sequence[Row], + "Sequence[Row]", expdb.execute( text( """ diff --git a/src/routers/openml/tasktype.py b/src/routers/openml/tasktype.py index dcc9b1c..5213f17 100644 --- a/src/routers/openml/tasktype.py +++ b/src/routers/openml/tasktype.py @@ -53,11 +53,11 @@ def get_task_type( task_type = _normalize_task_type(task_type_record) # Some names are quoted, or have typos in their comma-separation (e.g. 'A ,B') task_type["creator"] = [ - creator.strip(' "') for creator in cast(str, task_type["creator"]).split(",") + creator.strip(' "') for creator in cast("str", task_type["creator"]).split(",") ] if contributors := task_type.pop("contributors"): task_type["contributor"] = [ - creator.strip(' "') for creator in cast(str, contributors).split(",") + creator.strip(' "') for creator in cast("str", contributors).split(",") ] task_type["creation_date"] = task_type.pop("creationDate") task_type_inputs = get_input_for_task_type(task_type_id, expdb)