diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 09b9d47..f1964f8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-ast - id: check-toml @@ -18,7 +18,7 @@ repos: # - id: no-commit-to-branch - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.11.2' + rev: 'v1.19.1' 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.14.9' hooks: - id: ruff args: [--fix] 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)