Skip to content

Commit

Permalink
bump ruff target-version = "py311"
Browse files Browse the repository at this point in the history
prev 3.9
  • Loading branch information
janosh committed Mar 30, 2024
1 parent 29eecf2 commit e8a4444
Show file tree
Hide file tree
Showing 41 changed files with 29 additions and 132 deletions.
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
ci:
autoupdate_schedule: quarterly
skip: [pyright]

default_stages: [commit]

default_install_hook_types: [pre-commit, commit-msg]

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

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.0.0-beta.2
rev: v9.0.0-rc.0
hooks:
- id: eslint
types: [file]
Expand All @@ -80,7 +81,7 @@ repos:
- id: check-github-actions

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.355
rev: v1.1.356
hooks:
- id: pyright
args: [--level, error]
2 changes: 0 additions & 2 deletions matbench_discovery/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Global variables used all across the matbench_discovery package."""

from __future__ import annotations

import json
import os
import warnings
Expand Down
12 changes: 4 additions & 8 deletions matbench_discovery/data.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
from __future__ import annotations

import gzip
import json
import os
import pickle
import sys
import urllib.error
import urllib.request
from collections.abc import Callable
from glob import glob
from typing import TYPE_CHECKING, Any, Callable
from pathlib import Path
from typing import Any

import pandas as pd
from monty.json import MontyDecoder
from pymatgen.analysis.phase_diagram import PatchedPhaseDiagram
from tqdm import tqdm

from matbench_discovery import FIGSHARE_DIR
from matbench_discovery.enums import Key

if TYPE_CHECKING:
from pathlib import Path

from pymatgen.analysis.phase_diagram import PatchedPhaseDiagram

# ruff: noqa: T201

# repo URL to raw files on GitHub
Expand Down
2 changes: 0 additions & 2 deletions matbench_discovery/enums.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from enum import StrEnum, unique
from typing import Self

Expand Down
11 changes: 2 additions & 9 deletions matbench_discovery/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@
positive/negative and compute performance metrics.
"""

from __future__ import annotations

from typing import TYPE_CHECKING
from collections.abc import Sequence

import numpy as np
import pandas as pd
from sklearn.metrics import r2_score

from matbench_discovery import STABILITY_THRESHOLD

if TYPE_CHECKING:
from collections.abc import Sequence

import pandas as pd


__author__ = "Janosh Riebesell"
__date__ = "2023-02-01"

Expand Down
8 changes: 2 additions & 6 deletions matbench_discovery/plots.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""Plotting functions for analyzing model performance on materials discovery."""

from __future__ import annotations

import functools
import math
from collections import defaultdict
from typing import TYPE_CHECKING, Any, Literal
from collections.abc import Sequence
from typing import Any, Literal

import matplotlib.pyplot as plt
import numpy as np
Expand All @@ -23,9 +22,6 @@
from matbench_discovery import STABILITY_THRESHOLD
from matbench_discovery.metrics import classify_stable

if TYPE_CHECKING:
from collections.abc import Sequence

__author__ = "Janosh Riebesell"
__date__ = "2022-08-05"

Expand Down
8 changes: 2 additions & 6 deletions matbench_discovery/preds.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

from typing import TYPE_CHECKING, Any, Literal
from collections.abc import Sequence
from typing import Any, Literal

import pandas as pd
from tqdm import tqdm
Expand All @@ -11,9 +10,6 @@
from matbench_discovery.metrics import stable_metrics
from matbench_discovery.plots import plotly_colors, plotly_line_styles, plotly_markers

if TYPE_CHECKING:
from collections.abc import Sequence

"""Centralize data-loading and computing metrics for plotting scripts"""

__author__ = "Janosh Riebesell"
Expand Down
7 changes: 1 addition & 6 deletions matbench_discovery/slurm.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
from __future__ import annotations

import os
import subprocess
import sys
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from collections.abc import Sequence
from collections.abc import Sequence

# taken from https://slurm.schedmd.com/job_array.html#env_vars, lower-cased and
# and removed the SLURM_ prefix
Expand Down
8 changes: 1 addition & 7 deletions matbench_discovery/structure.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
from __future__ import annotations

from typing import TYPE_CHECKING

import numpy as np

if TYPE_CHECKING:
from pymatgen.core import Structure
from pymatgen.core import Structure

__author__ = "Janosh Riebesell"
__date__ = "2022-12-02"
Expand Down
2 changes: 0 additions & 2 deletions models/alignn/test_alignn.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# %%
from __future__ import annotations

import json
import os
from importlib.metadata import version
Expand Down
2 changes: 0 additions & 2 deletions models/alignn/train_alignn.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# %%
from __future__ import annotations

import json
import os
from importlib.metadata import version
Expand Down
2 changes: 0 additions & 2 deletions models/alignn_ff/alignn_ff_relax.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# %%
from __future__ import annotations

import os

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions models/alignn_ff/test_alignn_ff.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# %%
from __future__ import annotations

import json
import os
from glob import glob
Expand Down
2 changes: 0 additions & 2 deletions models/bowsr/join_bowsr_results.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# %%
from __future__ import annotations

import os
from glob import glob

Expand Down
2 changes: 0 additions & 2 deletions models/bowsr/test_bowsr.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# %%
from __future__ import annotations

import contextlib
import os
from importlib.metadata import version
Expand Down
2 changes: 0 additions & 2 deletions models/cgcnn/test_cgcnn.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# %%
from __future__ import annotations

import os
from importlib.metadata import version

Expand Down
2 changes: 0 additions & 2 deletions models/chgnet/ctk_structure_viewer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

import pandas as pd
from crystal_toolkit.helpers.utils import hook_up_fig_with_struct_viewer

Expand Down
8 changes: 2 additions & 6 deletions models/chgnet/ctk_trajectory_viewer.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# %%
from __future__ import annotations

import os
import sys
from typing import TYPE_CHECKING, Callable
from collections.abc import Callable

import crystal_toolkit.components as ctc
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from chgnet.model import StructOptimizer as ChgnetRelaxer
from chgnet.model.dynamics import TrajectoryObserver
from crystal_toolkit.settings import SETTINGS
from dash import Dash, dcc, html
from dash.dependencies import Input, Output
Expand All @@ -19,9 +18,6 @@
from matbench_discovery.data import df_wbm
from matbench_discovery.enums import Key

if TYPE_CHECKING:
from chgnet.model.dynamics import TrajectoryObserver

# ruff: noqa: T201
__author__ = "Janosh Riebesell"
__date__ = "2023-03-22"
Expand Down
2 changes: 0 additions & 2 deletions models/chgnet/join_chgnet_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"""

# %%
from __future__ import annotations

import os
from glob import glob

Expand Down
2 changes: 0 additions & 2 deletions models/chgnet/test_chgnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
"""

# %%
from __future__ import annotations

import os
from importlib.metadata import version
from typing import Any, Literal
Expand Down
2 changes: 0 additions & 2 deletions models/m3gnet/join_m3gnet_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"""

# %%
from __future__ import annotations

import os
from glob import glob
from typing import Literal
Expand Down
2 changes: 0 additions & 2 deletions models/m3gnet/test_m3gnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"""

# %%
from __future__ import annotations

import os
import warnings
from importlib.metadata import version
Expand Down
2 changes: 0 additions & 2 deletions models/mace/join_mace_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"""

# %%
from __future__ import annotations

import os
from glob import glob

Expand Down
2 changes: 0 additions & 2 deletions models/mace/test_mace.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# %%
from __future__ import annotations

import os
from importlib.metadata import version
from typing import Any, Literal
Expand Down
2 changes: 0 additions & 2 deletions models/mace/train_mace.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
pip install git+https://github.com/ACEsuit/mace@foundations
"""

from __future__ import annotations

import ast
import json
import os
Expand Down
2 changes: 0 additions & 2 deletions models/megnet/test_megnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"""

# %%
from __future__ import annotations

import os
from importlib.metadata import version

Expand Down
2 changes: 0 additions & 2 deletions models/voronoi_rf/join_voronoi_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"""

# %%
from __future__ import annotations

import os
from glob import glob

Expand Down
2 changes: 0 additions & 2 deletions models/wrenformer/test_wrenformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"""

# %%
from __future__ import annotations

import os
import sys
from importlib.metadata import version
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,15 @@ matbench_discovery = ["figshare/*"]
universal = true

[tool.ruff]
target-version = "py39"
target-version = "py311"

[tool.ruff.lint]
select = ["ALL"]
ignore = [
"ANN101",
"ANN102",
"ANN401",
"B905", # zip without explicit strict
"BLE001",
"C408", # unnecessary-collection-call
"C901",
Expand All @@ -99,6 +100,7 @@ ignore = [
"FBT002",
"FIX002",
"INP001",
"ISC001",
"N806", # non-lowercase-variable-in-function
"PD901", # pandas-df-variable-name
"PERF203", # try-except-in-loop
Expand Down
2 changes: 0 additions & 2 deletions scripts/model_figs/compile_model_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"""

# %%
from __future__ import annotations

import re
from typing import Any

Expand Down
2 changes: 0 additions & 2 deletions scripts/model_figs/metrics_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"""

# %%
from __future__ import annotations

import json

import numpy as np
Expand Down
Loading

0 comments on commit e8a4444

Please sign in to comment.