Skip to content

Commit 71a5edc

Browse files
committed
bump ruff pre-commit to 0.3.0 + auto-fixes
1 parent c9dc8ee commit 71a5edc

40 files changed

+9
-45
lines changed

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ default_install_hook_types: [pre-commit, commit-msg]
77

88
repos:
99
- repo: https://github.com/astral-sh/ruff-pre-commit
10-
rev: v0.2.2
10+
rev: v0.3.0
1111
hooks:
1212
- id: ruff
1313
args: [--fix]
1414
- id: ruff-format
1515

1616
- repo: https://github.com/janosh/format-ipy-cells
17-
rev: v0.1.10
17+
rev: v0.1.11
1818
hooks:
1919
- id: format-ipy-cells
2020

@@ -80,7 +80,7 @@ repos:
8080
- id: check-github-actions
8181

8282
- repo: https://github.com/RobertCraigie/pyright-python
83-
rev: v1.1.351
83+
rev: v1.1.352
8484
hooks:
8585
- id: pyright
8686
args: [--level, error]

data/mp/build_phase_diagram.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
DFT-ground truth convex hull energies.
33
"""
44

5-
65
# %%
76
import gzip
87
import json

data/mp/eda_mp_trj.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""MPtrj exploratory data analysis (EDA)."""
22

3-
43
# %%
54
import io
65
import os

data/mp/get_mp_traj.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
all 1.6M task docs.
66
"""
77

8-
98
# %%
109
import os
1110
import subprocess

data/wbm/compile_wbm_test_set.py

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
https://nature.com/articles/s41524-020-00481-6
4040
"""
4141

42-
4342
# %% links to google drive files received via email from 1st author Hai-Chen Wang
4443
# on 2021-06-15 containing initial and relaxed structures
4544
google_drive_ids = {

models/chgnet/analyze_chgnet.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Compare CHGNet long vs short relaxations."""
22

3-
43
# %%
54
import os
65

models/chgnet/join_chgnet_results.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
into single file.
33
"""
44

5-
65
# %%
76
from __future__ import annotations
87

models/chgnet/test_chgnet.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
pip install -e ./chgnet.
66
"""
77

8-
98
# %%
109
from __future__ import annotations
1110

models/m3gnet/join_m3gnet_results.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
into single file.
33
"""
44

5-
65
# %%
76
from __future__ import annotations
87

models/m3gnet/pre_vs_post_m3gnet_relaxation.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Compare M3GNet-relaxed vs DFT-relaxed WBM lattice volumes and angles."""
22

3-
43
# %%
54
import os
65

models/m3gnet/test_m3gnet.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
https://github.com/materialsvirtuallab/m3gnet.
55
"""
66

7-
87
# %%
98
from __future__ import annotations
109

models/mace/analyze_mace.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Investigate MACE energy underpredictions."""
22

3-
43
# %%
54
import os
65

models/mace/join_mace_results.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
into single file.
33
"""
44

5-
65
# %%
76
from __future__ import annotations
87

models/megnet/test_megnet.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
See https://github.com/materialsvirtuallab/megnet.
55
"""
66

7-
87
# %%
98
from __future__ import annotations
109

models/voronoi_rf/join_voronoi_features.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
into single file.
33
"""
44

5-
65
# %%
76
from __future__ import annotations
87

models/voronoi_rf/train_test_voronoi_rf.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Train and test a Voronoi RandomForestRegressor model."""
22

3-
43
# %%
54
import os
65
import sys

models/voronoi_rf/voronoi_featurize_dataset.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Voronoi tessellation structure-based features.
33
"""
44

5-
65
# %%
76
import os
87
import sys

models/wrenformer/analyze_wrenformer.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Compare CHGNet long vs short relaxations."""
22

3-
43
# %%
54
import numpy as np
65
import pandas as pd

models/wrenformer/test_wrenformer.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
saves predictions to CSV.
44
"""
55

6-
76
# %%
87
from __future__ import annotations
98

models/wrenformer/train_wrenformer.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Train a Wrenformer ensemble on target_col of data_path."""
22

3-
43
# %%
54
import os
65
from importlib.metadata import version

scripts/analyze_model_failure_cases.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
Might point to deficiencies in the data or models architecture.
44
"""
55

6-
76
# %%
87
import itertools
98

scripts/compute_struct_fingerprints.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
Might point to deficiencies in the data or models architecture.
44
"""
55

6-
76
# %%
87
import os
98
from glob import glob

scripts/hist_classified_stable_vs_hull_dist.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
See fig. S1 in https://science.org/doi/10.1126/sciadv.abn4117.
55
"""
66

7-
87
# %%
98
from typing import Final
109

scripts/hist_classified_stable_vs_hull_dist_batches.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
See fig. S1 in https://science.org/doi/10.1126/sciadv.abn4117.
66
"""
77

8-
98
# %%
109
from typing import Final
1110

scripts/model_figs/analyze_model_disagreement.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
models can pinpoint DFT calculation gone wrong.
33
"""
44

5-
65
# %%
76
import sys
87

scripts/model_figs/compile_model_stats.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
pandas-styled HTML table and a plotly figure.
33
"""
44

5-
65
# %%
76
from __future__ import annotations
87

scripts/model_figs/cumulative_metrics.py

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
will provide the best hit rate for the given budget.
88
"""
99

10-
1110
# %%
1211
import pandas as pd
1312
from pymatviz.io import save_fig

scripts/model_figs/hist_classified_stable_vs_hull_dist_models.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
histogram stacks true/false positives/negatives with different colors.
44
"""
55

6-
76
# %%
87
import math
98
from typing import Final

scripts/model_figs/metrics_tables.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
pandas-styled HTML table and a plotly figure.
33
"""
44

5-
65
# %%
76
from __future__ import annotations
87

scripts/model_figs/parity_energy_models.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
Last plot is split into 2x3 subplots, one for each model.
44
"""
55

6-
76
# %%
87
import math
98
from typing import Literal

scripts/model_figs/per_element_errors.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
Might point to deficiencies in the data or models architecture.
44
"""
55

6-
76
# %%
87
import pandas as pd
98
import plotly.express as px

scripts/model_figs/roc_prc_curves_models.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Plot ROC and PR (precision-recall) curves for each model."""
22

3-
43
# %%
54
import math
65

@@ -44,7 +43,7 @@
4443
fpr, tpr, thresholds = roc_curve(y_true, y_pred, pos_label=0)
4544
AUC = auc(fpr, tpr)
4645
title = f"{model} · {AUC=:.2f}"
47-
thresholds = [f"{t:.3} eV/atom" for t in thresholds]
46+
thresholds = [f"{thresh:.3} eV/atom" for thresh in thresholds]
4847
df_tmp = pd.DataFrame(
4948
{"FPR": fpr, "TPR": tpr, color_col: thresholds, "AUC": AUC, facet_col: title}
5049
).round(3)

scripts/model_figs/rolling_mae_vs_hull_dist_models.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Plot rolling MAE as a function of hull distance for all models."""
22

3-
43
# %%
54
from typing import Final
65

scripts/model_figs/rolling_mae_vs_hull_dist_wbm_batches.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
batch in a single plot.
33
"""
44

5-
65
# %%
76
from pymatviz.io import save_fig
87

scripts/model_figs/run_all.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
model-comparison figure.
44
"""
55

6-
76
# %%
87
import os
98
import runpy

scripts/project_compositions.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Compute t-SNE or UMAP projections of WBM and MP compositions."""
22

3-
43
# %%
54
import os
65
from datetime import datetime

scripts/rolling_mae_vs_hull_dist.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Plot rolling MAE as a function of hull distance for a single model."""
22

3-
43
# %%
54
from pymatviz.io import save_fig
65

scripts/update_wandb_runs.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
https://wandb.ai/janosh/matbench-discovery.
33
"""
44

5-
65
# %%
76
import pandas as pd
87
import wandb

scripts/wbm_umap_projection.py

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
https://www.nature.com/articles/s41524-023-01012-9
1010
"""
1111

12-
1312
# %%
1413
from __future__ import annotations
1514

tests/test_slurm.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ def test_slurm_submit(
4141
assert stderr == stderr == ""
4242

4343
# check slurm_submit() prints cmd and calls subprocess.run() in submit mode
44-
with pytest.raises(SystemExit), patch("sys.argv", ["slurm-submit"]), patch(
45-
"matbench_discovery.slurm.subprocess.run"
46-
) as mock_subprocess_run:
44+
with (
45+
pytest.raises(SystemExit),
46+
patch("sys.argv", ["slurm-submit"]),
47+
patch("matbench_discovery.slurm.subprocess.run") as mock_subprocess_run,
48+
):
4749
func_call()
4850

4951
assert mock_subprocess_run.call_count == 1

0 commit comments

Comments
 (0)