Skip to content

Commit 716b6b5

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 0ac62bb commit 716b6b5

File tree

7 files changed

+72
-27
lines changed

7 files changed

+72
-27
lines changed

masci_tools/io/common_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def get_outfile_txt(outfile):
8080
return tmptxt
8181

8282

83-
def skipHeader(seq: Iterable[Any], n: int) -> Generator[Any, None, None]:
83+
def skipHeader(seq: Iterable[Any], n: int) -> Generator[Any]:
8484
"""Iterate over a sequence skipping the first n elements
8585
8686
Args:
@@ -617,7 +617,7 @@ def find_symmetry_relation(from_pos: VectorType,
617617
:raises ValueError: If no symmetry relation is found
618618
"""
619619

620-
def lattice_shifts() -> Generator[np.ndarray, None, None]:
620+
def lattice_shifts() -> Generator[np.ndarray]:
621621
for i in range(-2, 3):
622622
for j in range(-2, 3):
623623
for k in range(-2, 3):

masci_tools/io/fleur_xml.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ def find(self, name: str, **kwargs: Any) -> _GeneratorContextManager[_EvalContex
513513
raise ValueError(f'No nodes found for name {name}')
514514

515515
@contextmanager
516-
def nested(self, etree_or_element: XMLLike) -> Generator[_EvalContext, None, None]:
516+
def nested(self, etree_or_element: XMLLike) -> Generator[_EvalContext]:
517517
"""
518518
Create a nested context from the current one
519519
inheriting the schema_dict, constants and logger only replacing the
@@ -534,7 +534,7 @@ def nested(self, etree_or_element: XMLLike) -> Generator[_EvalContext, None, Non
534534
"""
535535
yield _EvalContext(etree_or_element, self.schema_dict, self.constants, logger=self.logger)
536536

537-
def iter(self, name: str, **kwargs: Any) -> Generator[_EvalContext, None, None]:
537+
def iter(self, name: str, **kwargs: Any) -> Generator[_EvalContext]:
538538
"""
539539
Finds all elements for the given name and constraints and gives nested
540540
contexts for these elements to be iterated over,
@@ -572,7 +572,7 @@ def iter(self, name: str, **kwargs: Any) -> Generator[_EvalContext, None, None]:
572572
def FleurXMLContext(etree_or_element: XMLLike | etree.XPathElementEvaluator,
573573
schema_dict: fleur_schema.InputSchemaDict | fleur_schema.OutputSchemaDict,
574574
constants: dict[str, float] | None = None,
575-
logger: logging.Logger | None = None) -> Generator[_EvalContext, None, None]:
575+
logger: logging.Logger | None = None) -> Generator[_EvalContext]:
576576
"""
577577
Contextmanager to hold the relevant datastructures for evaluating values from XML files
578578

masci_tools/tools/greensfunction.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ def listElements(hdffile: FileLike, show: bool = False) -> list[GreensfElement]:
10731073

10741074
def select_elements_from_file(hdffile: FileLike,
10751075
show: bool = False,
1076-
**selection_params: Any) -> Generator[GreensFunction, None, None]:
1076+
**selection_params: Any) -> Generator[GreensFunction]:
10771077
"""
10781078
Construct the green's function matching specified criteria from a given ``greensf.hdf`` file
10791079
@@ -1088,7 +1088,7 @@ def select_elements_from_file(hdffile: FileLike,
10881088
elements = listElements(hdffile, show=show)
10891089
found_elements = select_element_indices(elements, show=show, **selection_params)
10901090

1091-
def gf_iterator(found_elements: list[int]) -> Generator[GreensFunction, None, None]:
1091+
def gf_iterator(found_elements: list[int]) -> Generator[GreensFunction]:
10921092
for index in found_elements:
10931093
yield GreensFunction.fromFile(hdffile, index=index + 1)
10941094

@@ -1097,7 +1097,7 @@ def gf_iterator(found_elements: list[int]) -> Generator[GreensFunction, None, No
10971097

10981098
def select_elements(greensfunctions: list[GreensFunction],
10991099
show: bool = False,
1100-
**selection_params: Any) -> Generator[GreensFunction, None, None]:
1100+
**selection_params: Any) -> Generator[GreensFunction]:
11011101
"""
11021102
Select :py:class:`GreensFunction` objects from a list based on constraints on the
11031103
values of their underlying :py:class:`GreensfElement`
@@ -1112,7 +1112,7 @@ def select_elements(greensfunctions: list[GreensFunction],
11121112
elements = [gf.element for gf in greensfunctions]
11131113
found_elements = select_element_indices(elements, show=show, **selection_params)
11141114

1115-
def gf_iterator(found_elements: list[int]) -> Generator[GreensFunction, None, None]:
1115+
def gf_iterator(found_elements: list[int]) -> Generator[GreensFunction]:
11161116
for index in found_elements:
11171117
yield greensfunctions[index]
11181118

@@ -1152,7 +1152,7 @@ def intersite_shells_from_file(hdffile: FileLike,
11521152
reference_atom: int,
11531153
show: bool = False,
11541154
max_shells: int | None = None
1155-
) -> Generator[tuple[np.floating[Any], GreensFunction, GreensFunction], None, None]:
1155+
) -> Generator[tuple[np.floating[Any], GreensFunction, GreensFunction]]:
11561156
"""
11571157
Construct the green's function pairs to calculate the Jij exchange constants
11581158
for a given reference atom from a given ``greensf.hdf`` file
@@ -1171,7 +1171,7 @@ def intersite_shells_from_file(hdffile: FileLike,
11711171

11721172
def shell_iterator(
11731173
shells: list[tuple[np.floating[Any], list[tuple[int, int]]]]
1174-
) -> Generator[tuple[np.floating[Any], GreensFunction, GreensFunction], None, None]:
1174+
) -> Generator[tuple[np.floating[Any], GreensFunction, GreensFunction]]:
11751175
for distance, pairs in shells:
11761176
for g1, g2 in pairs:
11771177
#Plus 1 because the indexing starts at 1 in the hdf file
@@ -1186,7 +1186,7 @@ def intersite_shells(greensfunctions: list[GreensFunction],
11861186
reference_atom: int,
11871187
show: bool = False,
11881188
max_shells: int | None = None
1189-
) -> Generator[tuple[np.floating[Any], GreensFunction, GreensFunction], None, None]:
1189+
) -> Generator[tuple[np.floating[Any], GreensFunction, GreensFunction]]:
11901190
"""
11911191
Construct the green's function pairs to calculate the Jij exchange constants
11921192
for a given reference atom from a list of given :py:class:`GreensFunction`
@@ -1205,7 +1205,7 @@ def intersite_shells(greensfunctions: list[GreensFunction],
12051205

12061206
def shell_iterator(
12071207
shells: list[tuple[np.floating[Any], list[tuple[int, int]]]]
1208-
) -> Generator[tuple[np.floating[Any], GreensFunction, GreensFunction], None, None]:
1208+
) -> Generator[tuple[np.floating[Any], GreensFunction, GreensFunction]]:
12091209
for distance, pairs in shells:
12101210
for g1, g2 in pairs:
12111211
yield (distance, greensfunctions[g1], greensfunctions[g2])

masci_tools/util/case_insensitive_dict.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def __ne__(self, other: object) -> bool:
158158
return super().__ne__({self._norm_key(key) for key in other})
159159
return False
160160

161-
def __iter__(self) -> Generator[T_co, None, None]:
161+
def __iter__(self) -> Generator[T_co]:
162162
for item in super().__iter__():
163163
yield self.original_case[item]
164164

masci_tools/util/xml/xml_getters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,9 @@ def get_parameterdata(xmltree: XMLLike,
502502
tag_name='xcFunctional',
503503
)
504504
if exco_dict['xctyp'] == 'LibXC':
505-
exchName = root.attribute('exchange', tag_name='LibXCName')
506-
corrName = root.attribute('correlation', tag_name='LibXCName')
507-
exco_dict['xctyp'] = 'LibXC: Exch: ' + exchName + ', Cor: ' + corrName
505+
exchName = root.attribute('exchange', tag_name='LibXCName')
506+
corrName = root.attribute('correlation', tag_name='LibXCName')
507+
exco_dict['xctyp'] = 'LibXC: Exch: ' + exchName + ', Cor: ' + corrName
508508
parameters['exco'] = filter_out_empty_dict_entries(exco_dict)
509509
# &film
510510
# TODO

masci_tools/vis/parameters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929

3030
@contextmanager
31-
def NestedPlotParameters(plotter_object: Plotter) -> Generator[None, None, None]:
31+
def NestedPlotParameters(plotter_object: Plotter) -> Generator[None]:
3232
"""
3333
Contextmanager for nested plot function calls
3434
Will reset function defaults and parameters to previous

tests/io/test_fleur_inpgen.py

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ def test_write_inpgen_file_defaults_dict(file_regression):
1313

1414
param = 5.43
1515
cell = [[0, param / 2., param / 2.], [param / 2., 0, param / 2.], [param / 2., param / 2., 0]]
16-
kinds = [{'symbols': ('Si',), 'weights': (1.0,), 'mass': 28.0855, 'name': 'Si'}]
16+
kinds = [{
17+
'symbols': ('Si',),
18+
'weights': (1.0,),
19+
'mass': 28.0855,
20+
'name': 'Si'
21+
}]
1722
sites = [{
1823
'position': (0.0, 0.0, 0.0),
1924
'kind_name': 'Si'
@@ -37,7 +42,12 @@ def test_write_inpgen_file_magmom_str(file_regression):
3742

3843
param = 5.43
3944
cell = [[0, param / 2., param / 2.], [param / 2., 0, param / 2.], [param / 2., param / 2., 0]]
40-
kinds = [{'symbols': ('Si',), 'weights': (1.0,), 'mass': 28.0855, 'name': 'Si'}]
45+
kinds = [{
46+
'symbols': ('Si',),
47+
'weights': (1.0,),
48+
'mass': 28.0855,
49+
'name': 'Si'
50+
}]
4151
sites = [{
4252
'position': (0.0, 0.0, 0.0),
4353
'kind_name': 'Si',
@@ -63,7 +73,12 @@ def test_write_inpgen_file_magmom_float(file_regression):
6373

6474
param = 5.43
6575
cell = [[0, param / 2., param / 2.], [param / 2., 0, param / 2.], [param / 2., param / 2., 0]]
66-
kinds = [{'symbols': ('Si',), 'weights': (1.0,), 'mass': 28.0855, 'name': 'Si'}]
76+
kinds = [{
77+
'symbols': ('Si',),
78+
'weights': (1.0,),
79+
'mass': 28.0855,
80+
'name': 'Si'
81+
}]
6782
sites = [{
6883
'position': (0.0, 0.0, 0.0),
6984
'kind_name': 'Si',
@@ -89,7 +104,12 @@ def test_write_inpgen_file_magmom_list(file_regression):
89104

90105
param = 5.43
91106
cell = [[0, param / 2., param / 2.], [param / 2., 0, param / 2.], [param / 2., param / 2., 0]]
92-
kinds = [{'symbols': ('Si',), 'weights': (1.0,), 'mass': 28.0855, 'name': 'Si'}]
107+
kinds = [{
108+
'symbols': ('Si',),
109+
'weights': (1.0,),
110+
'mass': 28.0855,
111+
'name': 'Si'
112+
}]
93113
sites = [{
94114
'position': (0.0, 0.0, 0.0),
95115
'kind_name': 'Si',
@@ -115,7 +135,12 @@ def test_write_inpgen_file_defaults_dict_filename(file_regression):
115135

116136
param = 5.43
117137
cell = [[0, param / 2., param / 2.], [param / 2., 0, param / 2.], [param / 2., param / 2., 0]]
118-
kinds = [{'symbols': ('Si',), 'weights': (1.0,), 'mass': 28.0855, 'name': 'Si'}]
138+
kinds = [{
139+
'symbols': ('Si',),
140+
'weights': (1.0,),
141+
'mass': 28.0855,
142+
'name': 'Si'
143+
}]
119144
sites = [{
120145
'position': (0.0, 0.0, 0.0),
121146
'kind_name': 'Si'
@@ -140,7 +165,12 @@ def test_write_inpgen_file_defaults_str(file_regression):
140165

141166
param = 5.43
142167
cell = [[0, param / 2., param / 2.], [param / 2., 0, param / 2.], [param / 2., param / 2., 0]]
143-
kinds = [{'symbols': ('Si',), 'weights': (1.0,), 'mass': 28.0855, 'name': 'Si'}]
168+
kinds = [{
169+
'symbols': ('Si',),
170+
'weights': (1.0,),
171+
'mass': 28.0855,
172+
'name': 'Si'
173+
}]
144174
sites = [{
145175
'position': (0.0, 0.0, 0.0),
146176
'kind_name': 'Si'
@@ -197,7 +227,12 @@ def test_write_inpgen_file_parameters(file_regression):
197227

198228
param = 5.43
199229
cell = [[0, param / 2., param / 2.], [param / 2., 0, param / 2.], [param / 2., param / 2., 0]]
200-
kinds = [{'symbols': ('Si',), 'weights': (1.0,), 'mass': 28.0855, 'name': 'Si'}]
230+
kinds = [{
231+
'symbols': ('Si',),
232+
'weights': (1.0,),
233+
'mass': 28.0855,
234+
'name': 'Si'
235+
}]
201236
sites = [{
202237
'position': (0.0, 0.0, 0.0),
203238
'kind_name': 'Si'
@@ -242,7 +277,12 @@ def test_write_inpgen_file_econfig(file_regression):
242277

243278
param = 5.43
244279
cell = [[0, param / 2., param / 2.], [param / 2., 0, param / 2.], [param / 2., param / 2., 0]]
245-
kinds = [{'symbols': ('Si',), 'weights': (1.0,), 'mass': 28.0855, 'name': 'Si'}]
280+
kinds = [{
281+
'symbols': ('Si',),
282+
'weights': (1.0,),
283+
'mass': 28.0855,
284+
'name': 'Si'
285+
}]
246286
sites = [{
247287
'position': (0.0, 0.0, 0.0),
248288
'kind_name': 'Si'
@@ -289,7 +329,12 @@ def test_write_inpgen_file_soc_qss(file_regression):
289329

290330
param = 5.43
291331
cell = [[0, param / 2., param / 2.], [param / 2., 0, param / 2.], [param / 2., param / 2., 0]]
292-
kinds = [{'symbols': ('Si',), 'weights': (1.0,), 'mass': 28.0855, 'name': 'Si'}]
332+
kinds = [{
333+
'symbols': ('Si',),
334+
'weights': (1.0,),
335+
'mass': 28.0855,
336+
'name': 'Si'
337+
}]
293338
sites = [{
294339
'position': (0.0, 0.0, 0.0),
295340
'kind_name': 'Si'

0 commit comments

Comments
 (0)