From 28d4a71f23ff1563bb7d032394a0f7ab4e7cff03 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 7 Apr 2025 21:02:42 +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/astral-sh/ruff-pre-commit: v0.8.6 → v0.11.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.6...v0.11.4) - [github.com/codespell-project/codespell: v2.3.0 → v2.4.1](https://github.com/codespell-project/codespell/compare/v2.3.0...v2.4.1) - [github.com/pre-commit/mirrors-mypy: v1.14.1 → v1.15.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.14.1...v1.15.0) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7da298f3..dc43aece 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ ci: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.6 + rev: v0.11.4 hooks: - id: ruff args: [--fix] @@ -23,14 +23,14 @@ repos: - id: trailing-whitespace - repo: https://github.com/codespell-project/codespell - rev: v2.3.0 + rev: v2.4.1 hooks: - id: codespell exclude_types: [json] args: [--check-filenames] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.14.1 + rev: v1.15.0 hooks: - id: mypy exclude: (tests|examples)/ From 83f611df733897ad7e1e362a1d9ebd204046ba80 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 7 Apr 2025 21:03:16 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- aviary/predict.py | 6 +++--- aviary/train.py | 12 ++++++------ aviary/wren/data.py | 3 +-- tests/test_wyckoff_ops.py | 12 ++++++------ 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/aviary/predict.py b/aviary/predict.py index 70e1bf28..7c0f1547 100644 --- a/aviary/predict.py +++ b/aviary/predict.py @@ -214,9 +214,9 @@ def predict_from_wandb_checkpoints( print(f"Using checkpoints from {len(runs)} run(s):") run_target = runs[0].config["target"] - assert all( - run_target == run.config["target"] for run in runs - ), f"Runs have differing targets, first {run_target=}" + assert all(run_target == run.config["target"] for run in runs), ( + f"Runs have differing targets, first {run_target=}" + ) target_col = kwargs.get("target_col") if target_col and target_col != run_target: diff --git a/aviary/train.py b/aviary/train.py index a8ab420a..8a1e6da3 100644 --- a/aviary/train.py +++ b/aviary/train.py @@ -433,9 +433,9 @@ def checkpoint_model( torch.save(checkpoint_dict, checkpoint_path) if checkpoint_endpoint == "wandb": - assert ( - wandb.run is not None - ), "can't save model checkpoint to Weights and Biases, wandb.run is None" + assert wandb.run is not None, ( + "can't save model checkpoint to Weights and Biases, wandb.run is None" + ) torch.save( checkpoint_dict, f"{wandb.run.dir}/{timestamp + '-' if timestamp else ''}{run_name}-{epochs}.pth", @@ -584,9 +584,9 @@ def df_train_test_split( if folds: n_folds, test_fold_idx = folds assert 1 < n_folds <= 10, f"{n_folds = } must be between 2 and 10" - assert ( - 0 <= test_fold_idx < n_folds - ), f"{test_fold_idx = } must be between 0 and {n_folds - 1}" + assert 0 <= test_fold_idx < n_folds, ( + f"{test_fold_idx = } must be between 0 and {n_folds - 1}" + ) df_splits: list[pd.DataFrame] = np.array_split(df, n_folds) test_df = df_splits.pop(test_fold_idx) diff --git a/aviary/wren/data.py b/aviary/wren/data.py index fd5d7257..c1039c7d 100644 --- a/aviary/wren/data.py +++ b/aviary/wren/data.py @@ -276,8 +276,7 @@ def parse_protostructure_label( if len(elems) != len(wyckoff_letters): raise ValueError( - f"Chemical system {chemsys} does not match Wyckoff letters " - f"{wyckoff_letters}" + f"Chemical system {chemsys} does not match Wyckoff letters {wyckoff_letters}" ) wyckoff_site_multiplicities = [] diff --git a/tests/test_wyckoff_ops.py b/tests/test_wyckoff_ops.py index 66ea0cac..38cacb14 100644 --- a/tests/test_wyckoff_ops.py +++ b/tests/test_wyckoff_ops.py @@ -349,9 +349,9 @@ def test_get_protostructure_label_from_aflow(structure, expected): @pytest.mark.parametrize("structure, expected", zip(TEST_STRUCTS, TEST_PROTOSTRUCTURES)) def test_get_protostructure_label_from_moyopy(structure, expected): """Check that moyopy gives correct protostructure label simple cases.""" - assert ( - get_protostructure_label_from_moyopy(structure) == expected - ), f"unexpected moyopy protostructure for {structure=}" + assert get_protostructure_label_from_moyopy(structure) == expected, ( + f"unexpected moyopy protostructure for {structure=}" + ) @pytest.mark.parametrize( @@ -365,9 +365,9 @@ def test_moyopy_spglib_consistency(protostructure): moyopy_label = get_protostructure_label_from_moyopy(struct) spglib_label = get_protostructure_label_from_spglib(struct) - assert ( - moyopy_label == spglib_label - ), f"spglib moyopy protostructure mismatch for {protostructure}" + assert moyopy_label == spglib_label, ( + f"spglib moyopy protostructure mismatch for {protostructure}" + ) @pytest.mark.skipif(pyxtal is None, reason="pyxtal not installed")