diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9c5df8f6..6ec2d8b5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.15.7 + rev: v0.16.10 hooks: # Run the linter. - id: ruff @@ -9,7 +9,7 @@ repos: # Run the formatter. - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.19.1 + rev: v2.4.0 hooks: - id: mypy files: ^pymatgen/ @@ -20,7 +20,7 @@ repos: - tokenize-rt==4.1.0 - types-pkg_resources==0.1.2 - repo: https://github.com/codespell-project/codespell - rev: v2.4.2 + rev: v2.4.3 hooks: - id: codespell name: codespell diff --git a/tests/conftest.py b/tests/conftest.py index b709ed9d..f5c7340d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,7 +1,7 @@ from collections import defaultdict from pathlib import Path -import numpy as np +import numpy as np import pytest from monty.serialization import loadfn from pymatgen.analysis.defects.core import PeriodicSite, Substitution @@ -90,8 +90,8 @@ def get_data(q): ) return def_entry, frey_summary - defect_entries = dict() - plot_data = dict() + defect_entries = {} + plot_data = {} for qq in [-2, -1, 0, 1]: defect_entry, frey_summary = get_data(qq) defect_entries[qq] = defect_entry @@ -106,7 +106,7 @@ def chgcar_fe3o4(test_dir): @pytest.fixture(scope="session") def v_ga(test_dir): - res = dict() + res = {} for q1, q2 in [(0, -1), (-1, 0)]: ccd_dir = test_dir / f"v_Ga/ccd_{q1}_{q2}" vaspruns = [Vasprun(ccd_dir / f"{i}/vasprun.xml") for i in [0, 1, 2]] diff --git a/tests/test_ccd.py b/tests/test_ccd.py index 61686adc..fa1e445a 100644 --- a/tests/test_ccd.py +++ b/tests/test_ccd.py @@ -178,7 +178,7 @@ def test_dielectric_func(test_dir) -> None: assert isinstance(df, pd.DataFrame) assert len(df) == 11 - df, cmap, norm = plot_optical_transitions( + df, _cmap, _norm = plot_optical_transitions( hd0, kpt_index=-100, band_window=5, diff --git a/tests/test_recombination.py b/tests/test_recombination.py index ecb4c2df..e00da8c7 100644 --- a/tests/test_recombination.py +++ b/tests/test_recombination.py @@ -35,7 +35,7 @@ def test_get_vibronic_matrix_elements() -> None: for m, n in itertools.product(range(Ni), range(Nf)): ovl[m, n] = analytic_overlap_NM(dQ, omega_i, omega_f, m, n) - e, matel = get_mQn( + _e, matel = get_mQn( omega_i=omega_i, omega_f=omega_f, m_init=0, Nf=Nf, dQ=dQ, ovl=ovl ) ref_result = [0.0, 3984589.0407885523, 0.0, 0.0, 0.0] diff --git a/tests/test_thermo.py b/tests/test_thermo.py index 2d974615..febf3731 100644 --- a/tests/test_thermo.py +++ b/tests/test_thermo.py @@ -226,7 +226,7 @@ def test_formation_energy_diagram_numerical(formation_energy_diagram) -> None: def test_competing_phases(formation_energy_diagram) -> None: fed = copy.deepcopy(formation_energy_diagram) - cp_at_point = dict() + cp_at_point = {} for chempot_, competing_phases_ in zip(fed.chempot_limits, fed.competing_phases): key = ",".join([f"{k}:{v:0.2f}" for k, v in chempot_.items()]) cp_at_point[key] = set(competing_phases_.keys()) @@ -247,7 +247,7 @@ def test_multi( bulk_dos = bulk_vasprun.complete_dos _, vbm = bulk_dos.get_cbm_vbm() bulk_entry = bulk_vasprun.get_computed_entry(inc_structure=False) - defect_entries, plot_data = defect_entries_and_plot_data_Mg_Ga + defect_entries, _plot_data = defect_entries_and_plot_data_Mg_Ga def_ent_list = list(defect_entries.values()) with pytest.raises( @@ -306,7 +306,7 @@ def test_formation_from_directory( for q in [-1, 0, 1]: qq.append(q) dmap = {"bulk": sc_dir / "bulk_sc"} - dmap.update(zip(qq, map(lambda x: sc_dir / f"q={x}", qq))) + dmap.update(zip(qq, (sc_dir / f"q={x}" for x in qq))) assert len(dmap) == len(qq) + 1 fed = FormationEnergyDiagram.with_directories( directory_map=dmap, diff --git a/tests/test_utils.py b/tests/test_utils.py index 48ac7e84..94243d71 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -11,8 +11,8 @@ get_plane_spacing, group_docs, ) -from pymatgen.core.structure_matcher import StructureMatcher from pymatgen.core.periodic_table import Specie +from pymatgen.core.structure_matcher import StructureMatcher from pymatgen.io.vasp.outputs import Chgcar