Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -18,15 +18,15 @@ repos:
# - id: no-commit-to-branch

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.11.2'
rev: 'v1.18.1'
hooks:
- id: mypy
additional_dependencies:
- fastapi
- pytest

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.6.9'
rev: 'v0.13.0'
hooks:
- id: ruff
args: [--fix]
Expand Down
2 changes: 1 addition & 1 deletion src/database/evaluations.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

def get_math_functions(function_type: str, connection: Connection) -> Sequence[Row]:
return cast(
Sequence[Row],
"Sequence[Row]",
connection.execute(
text(
"""
Expand Down
4 changes: 2 additions & 2 deletions src/database/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def get_subflows(for_flow: int, expdb: Connection) -> Sequence[Row]:
return cast(
Sequence[Row],
"Sequence[Row]",
expdb.execute(
text(
"""
Expand Down Expand Up @@ -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(
"""
Expand Down
6 changes: 3 additions & 3 deletions src/database/studies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
"""
Expand All @@ -56,7 +56,7 @@ def get_study_data(study: Row, expdb: Connection) -> Sequence[Row]:
).all(),
)
return cast(
Sequence[Row],
"Sequence[Row]",
expdb.execute(
text(
"""
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions src/database/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
"""
Expand All @@ -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(
"""
Expand All @@ -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(
"""
Expand All @@ -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(
"""
Expand Down
4 changes: 2 additions & 2 deletions src/routers/openml/tasktype.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading