Skip to content

Commit 778feda

Browse files
authored
Auto-update pre-commit hooks
1 parent b837d5d commit 778feda

8 files changed

Lines changed: 32 additions & 41 deletions

File tree

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ default_language_version:
33
exclude: ^(.github/|tests/test_data/abinit/)
44
repos:
55
- repo: https://github.com/charliermarsh/ruff-pre-commit
6-
rev: v0.6.1
6+
rev: v0.14.3
77
hooks:
88
- id: ruff
99
args: [--fix]
1010
- id: ruff-format
1111
- repo: https://github.com/pre-commit/pre-commit-hooks
12-
rev: v4.6.0
12+
rev: v6.0.0
1313
hooks:
1414
- id: check-yaml
1515
- id: fix-encoding-pragma
1616
args: [--remove]
1717
- id: end-of-file-fixer
1818
- id: trailing-whitespace
1919
- repo: https://github.com/asottile/blacken-docs
20-
rev: 1.18.0
20+
rev: 1.20.0
2121
hooks:
2222
- id: blacken-docs
2323
additional_dependencies: [black]
@@ -30,22 +30,22 @@ repos:
3030
- id: rst-directive-colons
3131
- id: rst-inline-touching-normal
3232
- repo: https://github.com/pre-commit/mirrors-mypy
33-
rev: v1.11.1
33+
rev: v1.18.2
3434
hooks:
3535
- id: mypy
3636
files: ^src/
3737
additional_dependencies:
3838
- tokenize-rt==4.1.0
3939
- types-paramiko
4040
- repo: https://github.com/codespell-project/codespell
41-
rev: v2.3.0
41+
rev: v2.4.1
4242
hooks:
4343
- id: codespell
44-
stages: [commit, commit-msg]
44+
stages: [pre-commit, commit-msg]
4545
args: [--ignore-words-list, 'titel,statics,ba,nd,te,atomate']
4646
types_or: [python, rst, markdown]
4747
- repo: https://github.com/kynan/nbstripout
48-
rev: 0.7.1
48+
rev: 0.8.1
4949
hooks:
5050
- id: nbstripout
5151
args:

src/atomate2/abinit/jobs/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ def setup_job(
5454

5555
if structure is None and prev_outputs is None and restart_from is None:
5656
raise RuntimeError(
57-
"At least one of structure, prev_outputs or "
58-
"restart_from should be defined."
57+
"At least one of structure, prev_outputs or restart_from should be defined."
5958
)
6059

6160
if history is None:

src/atomate2/cli/dev.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,9 @@ def test_run_{test_name}(self, mock_abinit, abinit_test_dir, clean_dir):
560560
from atomate2.abinit.schemas.core import AbinitTaskDocument
561561
562562
# load the initial structure, the maker and the ref_paths from the test_dir
563-
test_dir = abinit_test_dir / {" / ".join(
564-
[f'"{part}"' for part in test_dir.parts[index_part:]]
565-
)}
563+
test_dir = abinit_test_dir / {
564+
" / ".join([f'"{part}"' for part in test_dir.parts[index_part:]])
565+
}
566566
structure = Structure.from_file(test_dir / "initial_structure.json.gz")
567567
maker_info = loadfn(test_dir / "maker.json.gz")
568568
maker = maker_info["maker"]
@@ -602,13 +602,13 @@ def save_abinit_maker(maker: Maker) -> None:
602602
author_mail = None
603603
if git:
604604
name = subprocess.run(
605-
"git config user.name".split(),
605+
["git", "config", "user.name"],
606606
capture_output=True,
607607
encoding="utf-8",
608608
check=True,
609609
)
610610
mail = subprocess.run(
611-
"git config user.email".split(),
611+
["git", "config", "user.email"],
612612
capture_output=True,
613613
encoding="utf-8",
614614
check=True,

src/atomate2/common/schemas/defects.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import logging
44
from collections.abc import Sequence
5-
from itertools import starmap
65
from typing import Any, Callable, Optional, Union
76

87
import numpy as np
@@ -246,14 +245,10 @@ def get_cs_entry(
246245
return ComputedStructureEntry(structure=struct, energy=energy, data=data)
247246

248247
entries1 = list(
249-
starmap(
250-
get_cs_entry, zip(structures1, energies1, static_dirs1, static_uuids1)
251-
)
248+
map(get_cs_entry, structures1, energies1, static_dirs1, static_uuids1)
252249
)
253250
entries2 = list(
254-
starmap(
255-
get_cs_entry, zip(structures2, energies2, static_dirs2, static_uuids2)
256-
)
251+
map(get_cs_entry, structures2, energies2, static_dirs2, static_uuids2)
257252
)
258253

259254
return cls.from_entries(entries1, entries2, relaxed_uuid1, relaxed_uuid2)

src/atomate2/common/schemas/phonons.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def from_forces_born(
407407
force_gamma=True,
408408
)
409409
phonon.run_mesh(kpoint.kpts[0])
410-
phonon_dos_sigma = kwargs.get("phonon_dos_sigma", None)
410+
phonon_dos_sigma = kwargs.get("phonon_dos_sigma")
411411
dos_use_tetrahedron_method = kwargs.get("dos_use_tetrahedron_method", True)
412412
phonon.run_total_dos(
413413
sigma=phonon_dos_sigma, use_tetrahedron_method=dos_use_tetrahedron_method

src/atomate2/common/schemas/qha.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,15 @@ class PhononQHADoc(StructureMetadata, extra="allow"): # type: ignore[call-arg]
4242
)
4343
volume_temperature: Optional[list[float]] = Field(
4444
None,
45-
description="Volumes in Angstrom^3 at temperatures." "Shape: (temperatures, )",
45+
description="Volumes in Angstrom^3 at temperatures.Shape: (temperatures, )",
4646
)
4747
gibbs_temperature: Optional[list[float]] = Field(
4848
None,
49-
description="Gibbs free energies in eV at temperatures."
50-
"Shape: (temperatures, )",
49+
description="Gibbs free energies in eV at temperatures.Shape: (temperatures, )",
5150
)
5251
bulk_modulus_temperature: Optional[list[float]] = Field(
5352
None,
54-
description="Bulk modulus in GPa at temperature." "Shape: (temperatures, )",
53+
description="Bulk modulus in GPa at temperature.Shape: (temperatures, )",
5554
)
5655
heat_capacity_p_numerical: Optional[list[float]] = Field(
5756
None,
@@ -60,7 +59,7 @@ class PhononQHADoc(StructureMetadata, extra="allow"): # type: ignore[call-arg]
6059
)
6160
gruneisen_temperature: Optional[list[float]] = Field(
6261
None,
63-
description="Gruneisen parameters at temperatures." "Shape: (temperatures, )",
62+
description="Gruneisen parameters at temperatures.Shape: (temperatures, )",
6463
)
6564
pressure: Optional[float] = Field(
6665
None, description="Pressure in GPA at which Gibb's energy was computed"
@@ -147,33 +146,33 @@ def from_phonon_runs(
147146
# create some plots here
148147
# add kwargs to change the names and file types
149148
qha.plot_helmholtz_volume().savefig(
150-
f"{kwargs.get('helmholtz_volume_filename','helmholtz_volume')}"
151-
f".{kwargs.get('plot_type','pdf')}"
149+
f"{kwargs.get('helmholtz_volume_filename', 'helmholtz_volume')}"
150+
f".{kwargs.get('plot_type', 'pdf')}"
152151
)
153152
qha.plot_volume_temperature().savefig(
154-
f"{kwargs.get('volume_temperature_plot','volume_temperature')}"
155-
f".{kwargs.get('plot_type','pdf')}"
153+
f"{kwargs.get('volume_temperature_plot', 'volume_temperature')}"
154+
f".{kwargs.get('plot_type', 'pdf')}"
156155
)
157156
qha.plot_thermal_expansion().savefig(
158-
f"{kwargs.get('thermal_expansion_plot','thermal_expansion')}"
159-
f".{kwargs.get('plot_type','pdf')}"
157+
f"{kwargs.get('thermal_expansion_plot', 'thermal_expansion')}"
158+
f".{kwargs.get('plot_type', 'pdf')}"
160159
)
161160
qha.plot_gibbs_temperature().savefig(
162161
f"{kwargs.get('gibbs_temperature_plot', 'gibbs_temperature')}"
163-
f".{kwargs.get('plot_type','pdf')}"
162+
f".{kwargs.get('plot_type', 'pdf')}"
164163
)
165164
qha.plot_bulk_modulus_temperature().savefig(
166165
f"{kwargs.get('bulk_modulus_plot', 'bulk_modulus_temperature')}"
167-
f".{kwargs.get('plot_type','pdf')}"
166+
f".{kwargs.get('plot_type', 'pdf')}"
168167
)
169168
qha.plot_heat_capacity_P_numerical().savefig(
170169
f"{kwargs.get('heat_capacity_plot', 'heat_capacity_P_numerical')}"
171-
f".{kwargs.get('plot_type','pdf')}"
170+
f".{kwargs.get('plot_type', 'pdf')}"
172171
)
173172
# qha.plot_heat_capacity_P_polyfit().savefig("heat_capacity_P_polyfit.eps")
174173
qha.plot_gruneisen_temperature().savefig(
175174
f"{kwargs.get('gruneisen_temperature_plot', 'gruneisen_temperature')}"
176-
f".{kwargs.get('plot_type','pdf')}"
175+
f".{kwargs.get('plot_type', 'pdf')}"
177176
)
178177

179178
qha.write_helmholtz_volume(

src/atomate2/forcefields/schemas.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ class ForceFieldTaskDocument(StructureMetadata):
148148
is_force_converged: Optional[bool] = Field(
149149
None,
150150
description=(
151-
"Whether the calculation is converged with respect "
152-
"to interatomic forces."
151+
"Whether the calculation is converged with respect to interatomic forces."
153152
),
154153
)
155154

src/atomate2/lobster/schemas.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,7 @@ def from_directory(
412412
with open(f"{filename}.json", "w") as fp:
413413
json.dump(analyse.condensed_bonding_analysis, fp)
414414
with open(f"{filename}.txt", "w") as fp:
415-
for line in describe.text:
416-
fp.write(f"{line}\n")
415+
fp.writelines(f"{line}\n" for line in describe.text)
417416

418417
# Read in strongest icohp values
419418
sb = _identify_strongest_bonds(

0 commit comments

Comments
 (0)