diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 60a633321ac..d57d1fa0207 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ ci: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.2 + rev: v0.8.1 hooks: - id: ruff args: [--fix, --unsafe-fixes] @@ -36,7 +36,7 @@ repos: exclude: src/pymatgen/analysis/aflow_prototypes.json - repo: https://github.com/MarcoGorelli/cython-lint - rev: v0.16.2 + rev: v0.16.6 hooks: - id: cython-lint args: [--no-pycodestyle] @@ -48,7 +48,7 @@ repos: - id: blacken-docs - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.42.0 + rev: v0.43.0 hooks: - id: markdownlint # MD013: line too long @@ -59,12 +59,12 @@ repos: args: [--disable, MD013, MD024, MD025, MD033, MD041, "--"] - repo: https://github.com/kynan/nbstripout - rev: 0.8.0 + rev: 0.8.1 hooks: - id: nbstripout args: [--drop-empty-cells, --keep-output] - repo: https://github.com/RobertCraigie/pyright-python - rev: v1.1.387 + rev: v1.1.389 hooks: - id: pyright diff --git a/src/pymatgen/io/aims/inputs.py b/src/pymatgen/io/aims/inputs.py index 0997601f750..3c1aa389540 100644 --- a/src/pymatgen/io/aims/inputs.py +++ b/src/pymatgen/io/aims/inputs.py @@ -590,7 +590,7 @@ def get_content( width = parameters["smearing"][1] if name == "methfessel-paxton": order = parameters["smearing"][2] - order = " %d" % order + order = f" {order:d}" else: order = "" diff --git a/src/pymatgen/io/cp2k/sets.py b/src/pymatgen/io/cp2k/sets.py index ae6db0edd9a..fc4e7770a7b 100644 --- a/src/pymatgen/io/cp2k/sets.py +++ b/src/pymatgen/io/cp2k/sets.py @@ -71,7 +71,6 @@ from pymatgen.io.vasp.inputs import KpointsSupportedModes if TYPE_CHECKING: - from pathlib import Path from typing import Literal __author__ = "Nicholas Winner" diff --git a/src/pymatgen/io/lobster/outputs.py b/src/pymatgen/io/lobster/outputs.py index 78946c1fc51..421816c5bd6 100644 --- a/src/pymatgen/io/lobster/outputs.py +++ b/src/pymatgen/io/lobster/outputs.py @@ -444,11 +444,8 @@ def __init__( for line in lines: if ( ("_" not in line.split()[1] and version != "5.1.0") - or "_" not in line.split()[1] - and version == "5.1.0" - or (line.split()[1].count("_") == 1) - and version == "5.1.0" - and self.is_lcfo + or ("_" not in line.split()[1] and version == "5.1.0") + or ((line.split()[1].count("_") == 1) and version == "5.1.0" and self.is_lcfo) ): data_without_orbitals.append(line) elif line.split()[1].count("_") >= 2 and version == "5.1.0": diff --git a/src/pymatgen/io/vasp/outputs.py b/src/pymatgen/io/vasp/outputs.py index ba23c9c9f11..0e3182cf68b 100644 --- a/src/pymatgen/io/vasp/outputs.py +++ b/src/pymatgen/io/vasp/outputs.py @@ -4517,7 +4517,7 @@ def __init__( else: preamble.append(line) - elif line == "" or "Direct configuration=" in line and len(coords_str) > 0: + elif line == "" or ("Direct configuration=" in line and len(coords_str) > 0): parse_poscar = True restart_preamble = False else: diff --git a/src/pymatgen/symmetry/groups.py b/src/pymatgen/symmetry/groups.py index 4e91b4cbb98..62a0c8df28a 100644 --- a/src/pymatgen/symmetry/groups.py +++ b/src/pymatgen/symmetry/groups.py @@ -29,7 +29,7 @@ from pymatgen.core.lattice import Lattice # Don't import at runtime to avoid circular import - from pymatgen.core.operations import SymmOp # noqa: TCH004 + from pymatgen.core.operations import SymmOp # noqa: TC004 CrystalSystem = Literal[ "cubic", diff --git a/tests/io/lobster/test_outputs.py b/tests/io/lobster/test_outputs.py index 4dac8c4a01b..f46f69b8af1 100644 --- a/tests/io/lobster/test_outputs.py +++ b/tests/io/lobster/test_outputs.py @@ -1670,16 +1670,19 @@ def test_has_good_quality_check_occupied_bands_patched(self): ) # Assert for expected results if ( - actual_deviation == 0.05 - and number_occ_bands_spin_up <= 7 - and number_occ_bands_spin_down <= 7 - and spin is Spin.up - or actual_deviation == 0.05 - and spin is Spin.down + ( + actual_deviation == 0.05 + and number_occ_bands_spin_up <= 7 + and number_occ_bands_spin_down <= 7 + and spin is Spin.up + ) + or (actual_deviation == 0.05 and spin is Spin.down) or actual_deviation == 0.1 - or actual_deviation in [0.2, 0.5, 1.0] - and number_occ_bands_spin_up == 0 - and number_occ_bands_spin_down == 0 + or ( + actual_deviation in [0.2, 0.5, 1.0] + and number_occ_bands_spin_up == 0 + and number_occ_bands_spin_down == 0 + ) ): assert result else: