diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e44b7b079..3f40c10a0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,13 +1,13 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.5 + rev: v0.15.2 hooks: - id: ruff args: [ --fix ] @@ -16,7 +16,7 @@ repos: types_or: ["python"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.15.0' + rev: 'v1.19.1' hooks: - id: mypy additional_dependencies: ["types-tabulate", "types-requests"] diff --git a/amlb/utils/core.py b/amlb/utils/core.py index ed1a1dcb4..48db91761 100644 --- a/amlb/utils/core.py +++ b/amlb/utils/core.py @@ -300,13 +300,15 @@ def as_list(*args): def flatten(iterable, flatten_tuple=False, flatten_dict=False): return reduce( lambda left, right: ( - left.extend(right) - if isinstance(right, (list, tuple) if flatten_tuple else list) - else left.extend(right.items()) - if flatten_dict and isinstance(right, dict) - else left.append(right) - ) - or left, + ( + left.extend(right) + if isinstance(right, (list, tuple) if flatten_tuple else list) + else left.extend(right.items()) + if flatten_dict and isinstance(right, dict) + else left.append(right) + ) + or left + ), iterable, [], ) diff --git a/amlb/utils/os.py b/amlb/utils/os.py index 131b559c0..9449637a2 100644 --- a/amlb/utils/os.py +++ b/amlb/utils/os.py @@ -195,8 +195,10 @@ def add_to_archive(file, isdir): walk_apply( path, add_to_archive, - filter_=lambda p: (filter_ is None or filter_(p)) - and not os.path.samefile(dest_archive, p), + filter_=lambda p: ( + (filter_ is None or filter_(p)) + and not os.path.samefile(dest_archive, p) + ), ) diff --git a/frameworks/H2OAutoML/exec.py b/frameworks/H2OAutoML/exec.py index 009ed49c7..b27c7fd69 100644 --- a/frameworks/H2OAutoML/exec.py +++ b/frameworks/H2OAutoML/exec.py @@ -283,8 +283,10 @@ def save_artifacts(automl, dataset, config): models_artifacts.append(models_archive) clean_dir( models_dir, - filter_=lambda p: p not in models_artifacts - and os.path.splitext(p)[1] in [".json", ".zip", ""], + filter_=lambda p: ( + p not in models_artifacts + and os.path.splitext(p)[1] in [".json", ".zip", ""] + ), ) if "model_predictions" in artifacts: