diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1c68489..ee11226 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,7 +13,7 @@ ci: repos: - repo: https://github.com/compilerla/conventional-pre-commit - rev: v2.4.0 + rev: v4.3.0 hooks: - id: conventional-pre-commit stages: [commit-msg] @@ -36,7 +36,7 @@ repos: ] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v6.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -70,18 +70,18 @@ repos: - id: text-unicode-replacement-char - repo: https://github.com/Lucas-C/pre-commit-hooks-safety - rev: v1.3.2 + rev: v1.4.2 hooks: - id: python-safety-dependencies-check files: pyproject.toml - repo: https://github.com/PyCQA/docformatter - rev: v1.7.5 + rev: v1.7.7 hooks: - id: docformatter - repo: https://github.com/nbQA-dev/nbQA - rev: 1.7.0 + rev: 1.9.1 hooks: - id: nbqa-check-ast - id: nbqa-mypy @@ -89,36 +89,36 @@ repos: - id: nbqa-pyupgrade - repo: https://github.com/bwhmather/ssort - rev: v0.11.6 + rev: 0.15.0 hooks: - id: ssort - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 + rev: v3.21.1 hooks: - id: pyupgrade - - repo: https://github.com/psf/black - rev: 23.10.1 + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 25.11.0 hooks: - id: black - id: black-jupyter files: \.ipynb$ - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 7.0.0 hooks: - id: isort args: ["--profile=black"] - repo: https://github.com/PyCQA/pylint - rev: v3.0.1 + rev: v4.0.2 hooks: - id: pylint args: ["--rcfile=pyproject.toml"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.6.1 + rev: v1.18.2 hooks: - id: mypy args: @@ -126,7 +126,7 @@ repos: exclude: "tests" - repo: https://github.com/PyCQA/bandit - rev: 1.7.5 + rev: 1.8.6 hooks: - id: bandit exclude: "^tests/" @@ -134,7 +134,7 @@ repos: - "-r" - repo: https://github.com/kynan/nbstripout - rev: 0.6.1 + rev: 0.8.1 hooks: - id: nbstripout diff --git a/src/autoembedder/data.py b/src/autoembedder/data.py index 9f47b55..8778f66 100644 --- a/src/autoembedder/data.py +++ b/src/autoembedder/data.py @@ -28,7 +28,7 @@ def __init__( @staticmethod def _data_from_source( - source: Union[str, dd.DataFrame, pd.DataFrame] + source: Union[str, dd.DataFrame, pd.DataFrame], ) -> dd.DataFrame: if isinstance(source, str): try: diff --git a/src/autoembedder/evaluator.py b/src/autoembedder/evaluator.py index fde110d..2f2b7ca 100644 --- a/src/autoembedder/evaluator.py +++ b/src/autoembedder/evaluator.py @@ -37,9 +37,11 @@ def _predict( device = torch.device( "cuda" if torch.cuda.is_available() - else "mps" - if torch.backends.mps.is_available() and parameters.get("use_mps", False) - else "cpu" + else ( + "mps" + if torch.backends.mps.is_available() and parameters.get("use_mps", False) + else "cpu" + ) ) with torch.no_grad(): diff --git a/src/autoembedder/learner.py b/src/autoembedder/learner.py index 3bc5610..cf2533b 100644 --- a/src/autoembedder/learner.py +++ b/src/autoembedder/learner.py @@ -362,9 +362,12 @@ def fit( torch.device( "cuda" if torch.cuda.is_available() - else "mps" - if torch.backends.mps.is_available() and parameters.get("use_mps", False) - else "cpu" + else ( + "mps" + if torch.backends.mps.is_available() + and parameters.get("use_mps", False) + else "cpu" + ) ) ) if ( @@ -437,10 +440,12 @@ def fit( map_location=torch.device( "cuda" if torch.cuda.is_available() - else "mps" - if torch.backends.mps.is_available() - and parameters.get("use_mps", False) - else "cpu" + else ( + "mps" + if torch.backends.mps.is_available() + and parameters.get("use_mps", False) + else "cpu" + ) ), ) Checkpoint.load_objects( diff --git a/src/autoembedder/model.py b/src/autoembedder/model.py index 5a1296a..700ea2f 100644 --- a/src/autoembedder/model.py +++ b/src/autoembedder/model.py @@ -58,9 +58,11 @@ def model_input( device = torch.device( "cuda" if torch.cuda.is_available() - else "mps" - if torch.backends.mps.is_available() and parameters.get("use_mps", False) - else "cpu" + else ( + "mps" + if torch.backends.mps.is_available() and parameters.get("use_mps", False) + else "cpu" + ) ) cat = [] cont = []