Skip to content

Commit 6c5df3c

Browse files
authored
Auto-update pre-commit hooks
1 parent b435eab commit 6c5df3c

File tree

25 files changed

+447
-471
lines changed

25 files changed

+447
-471
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ 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.1
77
hooks:
88
- id: ruff
99
args: [--fix]
@@ -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.16.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, Union
10+
from typing import TYPE_CHECKING, Any, Union
1111

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

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

104-
forces: Optional[list[Vector3D]] = Field(
104+
forces: list[Vector3D] | None = Field(
105105
None, description="Forces acting on each atom"
106106
)
107-
all_forces: Optional[list[list[Vector3D]]] = Field(
107+
all_forces: list[list[Vector3D]] | None = Field(
108108
None,
109109
description="Forces acting on each atom for each structure in the output file",
110110
)
111-
stress: Optional[Matrix3D] = Field(None, description="The stress on the cell")
112-
stresses: Optional[list[Matrix3D]] = Field(
111+
stress: Matrix3D | None = Field(None, description="The stress on the cell")
112+
stresses: list[Matrix3D] | None = Field(
113113
None, description="The atomic virial stresses"
114114
)
115115

116-
is_metal: Optional[bool] = Field(None, description="Whether the system is metallic")
117-
bandgap: Optional[float] = Field(
116+
is_metal: bool | None = Field(None, description="Whether the system is metallic")
117+
bandgap: float | None = Field(
118118
None, description="The band gap from the calculation in eV"
119119
)
120120
cbm: float = Field(
121121
None,
122122
description="The conduction band minimum, or LUMO for molecules, in eV "
123123
"(if system is not metallic)",
124124
)
125-
vbm: Optional[float] = Field(
125+
vbm: float | None = Field(
126126
None,
127127
description="The valence band maximum, or HOMO for molecules, in eV "
128128
"(if system is not metallic)",
@@ -263,7 +263,7 @@ def from_aims_files(
263263
parse_dos: str | bool = False,
264264
parse_bandstructure: str | bool = False,
265265
store_trajectory: bool = False,
266-
store_volumetric_data: Optional[Sequence[str]] = STORE_VOLUMETRIC_DATA,
266+
store_volumetric_data: Sequence[str] | None = STORE_VOLUMETRIC_DATA,
267267
) -> tuple[Self, dict[AimsObject, dict]]:
268268
"""Create an FHI-aims calculation document from a directory and file paths.
269269
@@ -392,7 +392,7 @@ def _get_output_file_paths(volumetric_files: list[str]) -> dict[AimsObject, str]
392392
def _get_volumetric_data(
393393
dir_name: Path,
394394
output_file_paths: dict[AimsObject, str],
395-
store_volumetric_data: Optional[Sequence[str]],
395+
store_volumetric_data: Sequence[str] | None,
396396
) -> dict[AimsObject, VolumetricData]:
397397
"""
398398
Load volumetric data files from a directory.
@@ -429,7 +429,7 @@ def _get_volumetric_data(
429429
return volumetric_data
430430

431431

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

458458
def _parse_bandstructure(
459459
parse_bandstructure: str | bool, aims_output: AimsOutput
460-
) -> Optional[BandStructure]:
460+
) -> BandStructure | None:
461461
"""
462462
Get the band structure.
463463
@@ -477,7 +477,7 @@ def _parse_bandstructure(
477477
return None
478478

479479

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

0 commit comments

Comments
 (0)