Skip to content

Commit d6ee50a

Browse files
authored
Auto-update pre-commit hooks
1 parent 84b838c commit d6ee50a

File tree

23 files changed

+371
-390
lines changed

23 files changed

+371
-390
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ default_language_version:
33
exclude: ^(.github/|tests/test_data/abinit/)
44
repos:
55
- repo: https://github.com/charliermarsh/ruff-pre-commit
6-
rev: v0.9.3
6+
rev: v0.12.10
77
hooks:
88
- id: ruff
99
args: [--fix]
1010
exclude: tutorials/grueneisen_workflow.ipynb
1111
- id: ruff-format
1212
- repo: https://github.com/pre-commit/pre-commit-hooks
13-
rev: v5.0.0
13+
rev: v6.0.0
1414
hooks:
1515
- id: check-yaml
1616
- id: fix-encoding-pragma
@@ -31,15 +31,15 @@ repos:
3131
- id: rst-directive-colons
3232
- id: rst-inline-touching-normal
3333
- repo: https://github.com/pre-commit/mirrors-mypy
34-
rev: v1.14.1
34+
rev: v1.17.1
3535
hooks:
3636
- id: mypy
3737
files: ^src/
3838
additional_dependencies:
3939
- tokenize-rt==4.1.0
4040
- types-paramiko
4141
- repo: https://github.com/codespell-project/codespell
42-
rev: v2.4.0
42+
rev: v2.4.1
4343
hooks:
4444
- id: codespell
4545
stages: [pre-commit, commit-msg]

src/atomate2/abinit/schemas/calculation.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import os
77
from datetime import datetime, timezone
88
from pathlib import Path
9-
from typing import Optional, Union
9+
from typing import Union
1010

1111
from abipy.electrons.gsr import GsrFile
1212
from abipy.flowtk import events
@@ -82,23 +82,23 @@ class CalculationOutput(BaseModel):
8282
None, description="The Fermi level from the calculation in eV"
8383
)
8484

85-
forces: Optional[list[Vector3D]] = Field(
85+
forces: list[Vector3D] | None = Field(
8686
None, description="Forces acting on each atom"
8787
)
88-
stress: Optional[Matrix3D] = Field(None, description="The stress on the cell")
89-
is_metal: Optional[bool] = Field(None, description="Whether the system is metallic")
90-
bandgap: Optional[float] = Field(
88+
stress: Matrix3D | None = Field(None, description="The stress on the cell")
89+
is_metal: bool | None = Field(None, description="Whether the system is metallic")
90+
bandgap: float | None = Field(
9191
None, description="The band gap from the calculation in eV"
9292
)
93-
direct_bandgap: Optional[float] = Field(
93+
direct_bandgap: float | None = Field(
9494
None, description="The direct band gap from the calculation in eV"
9595
)
96-
cbm: Optional[float] = Field(
96+
cbm: float | None = Field(
9797
None,
9898
description="The conduction band minimum, or LUMO for molecules, in eV "
9999
"(if system is not metallic)",
100100
)
101-
vbm: Optional[float] = Field(
101+
vbm: float | None = Field(
102102
None,
103103
description="The valence band maximum, or HOMO for molecules, in eV "
104104
"(if system is not metallic)",
@@ -194,7 +194,7 @@ class Calculation(BaseModel):
194194
event_report: events.EventReport = Field(
195195
None, description="Event report of this abinit job."
196196
)
197-
output_file_paths: Optional[dict[str, str]] = Field(
197+
output_file_paths: dict[str, str] | None = Field(
198198
None,
199199
description="Paths (relative to dir_name) of the Abinit output files "
200200
"associated with this calculation",

src/atomate2/abinit/schemas/task.py

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import logging
66
from collections.abc import Sequence
77
from pathlib import Path
8-
from typing import Any, Optional, Union
8+
from typing import Any, Union
99

1010
from abipy.abio.inputs import AbinitInput
1111
from abipy.flowtk import events
@@ -89,7 +89,7 @@ class OutputDoc(BaseModel):
8989
"""
9090

9191
structure: Union[Structure] = Field(None, description="The output structure object")
92-
trajectory: Optional[Sequence[Union[Structure]]] = Field(
92+
trajectory: Sequence[Union[Structure]] | None = Field(
9393
None, description="The trajectory of output structures"
9494
)
9595
energy: float = Field(
@@ -98,15 +98,15 @@ class OutputDoc(BaseModel):
9898
energy_per_atom: float = Field(
9999
None, description="The final DFT energy per atom for the last calculation"
100100
)
101-
bandgap: Optional[float] = Field(
101+
bandgap: float | None = Field(
102102
None, description="The DFT bandgap for the last calculation"
103103
)
104-
cbm: Optional[float] = Field(None, description="CBM for this calculation")
105-
vbm: Optional[float] = Field(None, description="VBM for this calculation")
106-
forces: Optional[list[Vector3D]] = Field(
104+
cbm: float | None = Field(None, description="CBM for this calculation")
105+
vbm: float | None = Field(None, description="VBM for this calculation")
106+
forces: list[Vector3D] | None = Field(
107107
None, description="Forces on atoms from the last calculation"
108108
)
109-
stress: Optional[Matrix3D] = Field(
109+
stress: Matrix3D | None = Field(
110110
None, description="Stress on the unit cell from the last calculation"
111111
)
112112

@@ -179,49 +179,47 @@ class AbinitTaskDoc(StructureMetadata):
179179
Additional json loaded from the calculation directory
180180
"""
181181

182-
dir_name: Optional[str] = Field(
183-
None, description="The directory for this Abinit task"
184-
)
185-
last_updated: Optional[str] = Field(
182+
dir_name: str | None = Field(None, description="The directory for this Abinit task")
183+
last_updated: str | None = Field(
186184
default_factory=datetime_str,
187185
description="Timestamp for when this task document was last updated",
188186
)
189-
completed_at: Optional[str] = Field(
187+
completed_at: str | None = Field(
190188
None, description="Timestamp for when this task was completed"
191189
)
192-
input: Optional[InputDoc] = Field(
190+
input: InputDoc | None = Field(
193191
None, description="The input to the first calculation"
194192
)
195-
output: Optional[OutputDoc] = Field(
193+
output: OutputDoc | None = Field(
196194
None, description="The output of the final calculation"
197195
)
198196
structure: Union[Structure] = Field(
199197
None, description="Final output atoms from the task"
200198
)
201-
state: Optional[TaskState] = Field(None, description="State of this task")
202-
event_report: Optional[events.EventReport] = Field(
199+
state: TaskState | None = Field(None, description="State of this task")
200+
event_report: events.EventReport | None = Field(
203201
None, description="Event report of this abinit job."
204202
)
205-
included_objects: Optional[list[AbinitObject]] = Field(
203+
included_objects: list[AbinitObject] | None = Field(
206204
None, description="List of Abinit objects included with this task document"
207205
)
208-
abinit_objects: Optional[dict[AbinitObject, Any]] = Field(
206+
abinit_objects: dict[AbinitObject, Any] | None = Field(
209207
None, description="Abinit objects associated with this task"
210208
)
211-
task_label: Optional[str] = Field(None, description="A description of the task")
212-
tags: Optional[list[str]] = Field(
209+
task_label: str | None = Field(None, description="A description of the task")
210+
tags: list[str] | None = Field(
213211
None, description="Metadata tags for this task document"
214212
)
215-
author: Optional[str] = Field(
213+
author: str | None = Field(
216214
None, description="Author extracted from transformations"
217215
)
218-
icsd_id: Optional[str] = Field(
216+
icsd_id: str | None = Field(
219217
None, description="International crystal structure database id of the structure"
220218
)
221-
calcs_reversed: Optional[list[Calculation]] = Field(
219+
calcs_reversed: list[Calculation] | None = Field(
222220
None, description="The inputs and outputs for all Abinit runs in this task."
223221
)
224-
transformations: Optional[dict[str, Any]] = Field(
222+
transformations: dict[str, Any] | None = Field(
225223
None,
226224
description="Information on the structural transformations, parsed from a "
227225
"transformations.json file",
@@ -231,7 +229,7 @@ class AbinitTaskDoc(StructureMetadata):
231229
description="Information on the custodian settings used to run this "
232230
"calculation, parsed from a custodian.json file",
233231
)
234-
additional_json: Optional[dict[str, Any]] = Field(
232+
additional_json: dict[str, Any] | None = Field(
235233
None, description="Additional json loaded from the calculation directory"
236234
)
237235

src/atomate2/aims/schemas/calculation.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from collections.abc import Sequence
88
from datetime import datetime, timezone
99
from pathlib import Path
10-
from typing import TYPE_CHECKING, Any, Optional
10+
from typing import TYPE_CHECKING, Any
1111

1212
import numpy as np
1313
from ase.spectrum.band_structure import BandStructure
@@ -98,32 +98,32 @@ class CalculationOutput(BaseModel):
9898
None, description="The final structure from the calculation"
9999
)
100100

101-
efermi: Optional[float] = Field(
101+
efermi: float | None = Field(
102102
None, description="The Fermi level from the calculation in eV"
103103
)
104104

105-
forces: Optional[list[Vector3D]] = Field(
105+
forces: list[Vector3D] | None = Field(
106106
None, description="Forces acting on each atom"
107107
)
108-
all_forces: Optional[list[list[Vector3D]]] = Field(
108+
all_forces: list[list[Vector3D]] | None = Field(
109109
None,
110110
description="Forces acting on each atom for each structure in the output file",
111111
)
112-
stress: Optional[Matrix3D] = Field(None, description="The stress on the cell")
113-
stresses: Optional[list[Matrix3D]] = Field(
112+
stress: Matrix3D | None = Field(None, description="The stress on the cell")
113+
stresses: list[Matrix3D] | None = Field(
114114
None, description="The atomic virial stresses"
115115
)
116116

117-
is_metal: Optional[bool] = Field(None, description="Whether the system is metallic")
118-
bandgap: Optional[float] = Field(
117+
is_metal: bool | None = Field(None, description="Whether the system is metallic")
118+
bandgap: float | None = Field(
119119
None, description="The band gap from the calculation in eV"
120120
)
121121
cbm: float = Field(
122122
None,
123123
description="The conduction band minimum, or LUMO for molecules, in eV "
124124
"(if system is not metallic)",
125125
)
126-
vbm: Optional[float] = Field(
126+
vbm: float | None = Field(
127127
None,
128128
description="The valence band maximum, or HOMO for molecules, in eV "
129129
"(if system is not metallic)",
@@ -264,7 +264,7 @@ def from_aims_files(
264264
parse_dos: str | bool = False,
265265
parse_bandstructure: str | bool = False,
266266
store_trajectory: bool = False,
267-
store_volumetric_data: Optional[Sequence[str]] = STORE_VOLUMETRIC_DATA,
267+
store_volumetric_data: Sequence[str] | None = STORE_VOLUMETRIC_DATA,
268268
) -> tuple[Self, dict[AimsObject, dict]]:
269269
"""Create an FHI-aims calculation document from a directory and file paths.
270270
@@ -393,7 +393,7 @@ def _get_output_file_paths(volumetric_files: list[str]) -> dict[AimsObject, str]
393393
def _get_volumetric_data(
394394
dir_name: Path,
395395
output_file_paths: dict[AimsObject, str],
396-
store_volumetric_data: Optional[Sequence[str]],
396+
store_volumetric_data: Sequence[str] | None,
397397
) -> dict[AimsObject, VolumetricData]:
398398
"""
399399
Load volumetric data files from a directory.
@@ -430,7 +430,7 @@ def _get_volumetric_data(
430430
return volumetric_data
431431

432432

433-
def _parse_dos(parse_dos: str | bool, aims_output: AimsOutput) -> Optional[Dos]:
433+
def _parse_dos(parse_dos: str | bool, aims_output: AimsOutput) -> Dos | None:
434434
"""Parse DOS outputs from FHI-aims calculation.
435435
436436
Parameters
@@ -458,7 +458,7 @@ def _parse_dos(parse_dos: str | bool, aims_output: AimsOutput) -> Optional[Dos]:
458458

459459
def _parse_bandstructure(
460460
parse_bandstructure: str | bool, aims_output: AimsOutput
461-
) -> Optional[BandStructure]:
461+
) -> BandStructure | None:
462462
"""
463463
Get the band structure.
464464
@@ -478,7 +478,7 @@ def _parse_bandstructure(
478478
return None
479479

480480

481-
def _parse_trajectory(aims_output: AimsOutput) -> Optional[Trajectory]:
481+
def _parse_trajectory(aims_output: AimsOutput) -> Trajectory | None:
482482
"""Grab a Trajectory object given an FHI-aims output object.
483483
484484
Parameters

0 commit comments

Comments
 (0)