Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
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
args: [ --fix, --unsafe-fixes]
# 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/
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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]]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ccd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_recombination.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions tests/test_thermo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Loading