Skip to content

Commit e8a4444

Browse files
committed
bump ruff target-version = "py311"
prev 3.9
1 parent 29eecf2 commit e8a4444

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+29
-132
lines changed

.pre-commit-config.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
ci:
22
autoupdate_schedule: quarterly
3+
skip: [pyright]
34

45
default_stages: [commit]
56

67
default_install_hook_types: [pre-commit, commit-msg]
78

89
repos:
910
- repo: https://github.com/astral-sh/ruff-pre-commit
10-
rev: v0.3.3
11+
rev: v0.3.4
1112
hooks:
1213
- id: ruff
1314
args: [--fix]
@@ -56,7 +57,7 @@ repos:
5657
exclude: ^(site/src/figs/.+\.svelte|data/wbm/20.+\..+|site/src/(routes|figs).+\.(yaml|json)|changelog.md)$
5758

5859
- repo: https://github.com/pre-commit/mirrors-eslint
59-
rev: v9.0.0-beta.2
60+
rev: v9.0.0-rc.0
6061
hooks:
6162
- id: eslint
6263
types: [file]
@@ -80,7 +81,7 @@ repos:
8081
- id: check-github-actions
8182

8283
- repo: https://github.com/RobertCraigie/pyright-python
83-
rev: v1.1.355
84+
rev: v1.1.356
8485
hooks:
8586
- id: pyright
8687
args: [--level, error]

matbench_discovery/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Global variables used all across the matbench_discovery package."""
22

3-
from __future__ import annotations
4-
53
import json
64
import os
75
import warnings

matbench_discovery/data.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
1-
from __future__ import annotations
2-
31
import gzip
42
import json
53
import os
64
import pickle
75
import sys
86
import urllib.error
97
import urllib.request
8+
from collections.abc import Callable
109
from glob import glob
11-
from typing import TYPE_CHECKING, Any, Callable
10+
from pathlib import Path
11+
from typing import Any
1212

1313
import pandas as pd
1414
from monty.json import MontyDecoder
15+
from pymatgen.analysis.phase_diagram import PatchedPhaseDiagram
1516
from tqdm import tqdm
1617

1718
from matbench_discovery import FIGSHARE_DIR
1819
from matbench_discovery.enums import Key
1920

20-
if TYPE_CHECKING:
21-
from pathlib import Path
22-
23-
from pymatgen.analysis.phase_diagram import PatchedPhaseDiagram
24-
2521
# ruff: noqa: T201
2622

2723
# repo URL to raw files on GitHub

matbench_discovery/enums.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import annotations
2-
31
from enum import StrEnum, unique
42
from typing import Self
53

matbench_discovery/metrics.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,14 @@
22
positive/negative and compute performance metrics.
33
"""
44

5-
from __future__ import annotations
6-
7-
from typing import TYPE_CHECKING
5+
from collections.abc import Sequence
86

97
import numpy as np
8+
import pandas as pd
109
from sklearn.metrics import r2_score
1110

1211
from matbench_discovery import STABILITY_THRESHOLD
1312

14-
if TYPE_CHECKING:
15-
from collections.abc import Sequence
16-
17-
import pandas as pd
18-
19-
2013
__author__ = "Janosh Riebesell"
2114
__date__ = "2023-02-01"
2215

matbench_discovery/plots.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
"""Plotting functions for analyzing model performance on materials discovery."""
22

3-
from __future__ import annotations
4-
53
import functools
64
import math
75
from collections import defaultdict
8-
from typing import TYPE_CHECKING, Any, Literal
6+
from collections.abc import Sequence
7+
from typing import Any, Literal
98

109
import matplotlib.pyplot as plt
1110
import numpy as np
@@ -23,9 +22,6 @@
2322
from matbench_discovery import STABILITY_THRESHOLD
2423
from matbench_discovery.metrics import classify_stable
2524

26-
if TYPE_CHECKING:
27-
from collections.abc import Sequence
28-
2925
__author__ = "Janosh Riebesell"
3026
__date__ = "2022-08-05"
3127

matbench_discovery/preds.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
from __future__ import annotations
2-
3-
from typing import TYPE_CHECKING, Any, Literal
1+
from collections.abc import Sequence
2+
from typing import Any, Literal
43

54
import pandas as pd
65
from tqdm import tqdm
@@ -11,9 +10,6 @@
1110
from matbench_discovery.metrics import stable_metrics
1211
from matbench_discovery.plots import plotly_colors, plotly_line_styles, plotly_markers
1312

14-
if TYPE_CHECKING:
15-
from collections.abc import Sequence
16-
1713
"""Centralize data-loading and computing metrics for plotting scripts"""
1814

1915
__author__ = "Janosh Riebesell"

matbench_discovery/slurm.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
from __future__ import annotations
2-
31
import os
42
import subprocess
53
import sys
6-
from typing import TYPE_CHECKING
7-
8-
if TYPE_CHECKING:
9-
from collections.abc import Sequence
4+
from collections.abc import Sequence
105

116
# taken from https://slurm.schedmd.com/job_array.html#env_vars, lower-cased and
127
# and removed the SLURM_ prefix

matbench_discovery/structure.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
from __future__ import annotations
2-
3-
from typing import TYPE_CHECKING
4-
51
import numpy as np
6-
7-
if TYPE_CHECKING:
8-
from pymatgen.core import Structure
2+
from pymatgen.core import Structure
93

104
__author__ = "Janosh Riebesell"
115
__date__ = "2022-12-02"

models/alignn/test_alignn.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# %%
2-
from __future__ import annotations
3-
42
import json
53
import os
64
from importlib.metadata import version

models/alignn/train_alignn.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# %%
2-
from __future__ import annotations
3-
42
import json
53
import os
64
from importlib.metadata import version

models/alignn_ff/alignn_ff_relax.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# %%
2-
from __future__ import annotations
3-
42
import os
53

64
import numpy as np

models/alignn_ff/test_alignn_ff.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# %%
2-
from __future__ import annotations
3-
42
import json
53
import os
64
from glob import glob

models/bowsr/join_bowsr_results.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# %%
2-
from __future__ import annotations
3-
42
import os
53
from glob import glob
64

models/bowsr/test_bowsr.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# %%
2-
from __future__ import annotations
3-
42
import contextlib
53
import os
64
from importlib.metadata import version

models/cgcnn/test_cgcnn.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# %%
2-
from __future__ import annotations
3-
42
import os
53
from importlib.metadata import version
64

models/chgnet/ctk_structure_viewer.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import annotations
2-
31
import pandas as pd
42
from crystal_toolkit.helpers.utils import hook_up_fig_with_struct_viewer
53

models/chgnet/ctk_trajectory_viewer.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# %%
2-
from __future__ import annotations
3-
42
import os
53
import sys
6-
from typing import TYPE_CHECKING, Callable
4+
from collections.abc import Callable
75

86
import crystal_toolkit.components as ctc
97
import numpy as np
108
import pandas as pd
119
import plotly.graph_objects as go
1210
from chgnet.model import StructOptimizer as ChgnetRelaxer
11+
from chgnet.model.dynamics import TrajectoryObserver
1312
from crystal_toolkit.settings import SETTINGS
1413
from dash import Dash, dcc, html
1514
from dash.dependencies import Input, Output
@@ -19,9 +18,6 @@
1918
from matbench_discovery.data import df_wbm
2019
from matbench_discovery.enums import Key
2120

22-
if TYPE_CHECKING:
23-
from chgnet.model.dynamics import TrajectoryObserver
24-
2521
# ruff: noqa: T201
2622
__author__ = "Janosh Riebesell"
2723
__date__ = "2023-03-22"

models/chgnet/join_chgnet_results.py

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
"""
44

55
# %%
6-
from __future__ import annotations
7-
86
import os
97
from glob import glob
108

models/chgnet/test_chgnet.py

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
"""
77

88
# %%
9-
from __future__ import annotations
10-
119
import os
1210
from importlib.metadata import version
1311
from typing import Any, Literal

models/m3gnet/join_m3gnet_results.py

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
"""
44

55
# %%
6-
from __future__ import annotations
7-
86
import os
97
from glob import glob
108
from typing import Literal

models/m3gnet/test_m3gnet.py

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
"""
66

77
# %%
8-
from __future__ import annotations
9-
108
import os
119
import warnings
1210
from importlib.metadata import version

models/mace/join_mace_results.py

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
"""
44

55
# %%
6-
from __future__ import annotations
7-
86
import os
97
from glob import glob
108

models/mace/test_mace.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# %%
2-
from __future__ import annotations
3-
42
import os
53
from importlib.metadata import version
64
from typing import Any, Literal

models/mace/train_mace.py

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
pip install git+https://github.com/ACEsuit/mace@foundations
1313
"""
1414

15-
from __future__ import annotations
16-
1715
import ast
1816
import json
1917
import os

models/megnet/test_megnet.py

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
"""
66

77
# %%
8-
from __future__ import annotations
9-
108
import os
119
from importlib.metadata import version
1210

models/voronoi_rf/join_voronoi_features.py

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
"""
44

55
# %%
6-
from __future__ import annotations
7-
86
import os
97
from glob import glob
108

models/wrenformer/test_wrenformer.py

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
"""
55

66
# %%
7-
from __future__ import annotations
8-
97
import os
108
import sys
119
from importlib.metadata import version

pyproject.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,15 @@ matbench_discovery = ["figshare/*"]
7777
universal = true
7878

7979
[tool.ruff]
80-
target-version = "py39"
80+
target-version = "py311"
8181

8282
[tool.ruff.lint]
8383
select = ["ALL"]
8484
ignore = [
8585
"ANN101",
8686
"ANN102",
8787
"ANN401",
88+
"B905", # zip without explicit strict
8889
"BLE001",
8990
"C408", # unnecessary-collection-call
9091
"C901",
@@ -99,6 +100,7 @@ ignore = [
99100
"FBT002",
100101
"FIX002",
101102
"INP001",
103+
"ISC001",
102104
"N806", # non-lowercase-variable-in-function
103105
"PD901", # pandas-df-variable-name
104106
"PERF203", # try-except-in-loop

scripts/model_figs/compile_model_stats.py

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
"""
44

55
# %%
6-
from __future__ import annotations
7-
86
import re
97
from typing import Any
108

scripts/model_figs/metrics_tables.py

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
"""
44

55
# %%
6-
from __future__ import annotations
7-
86
import json
97

108
import numpy as np

0 commit comments

Comments
 (0)