Skip to content

Commit 04e4fd6

Browse files
committed
ruff unignore RET501 and fix unnecessary return none
1 parent 9eb253c commit 04e4fd6

File tree

9 files changed

+47
-48
lines changed

9 files changed

+47
-48
lines changed

pymatgen/analysis/bond_valence.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def _recurse(assigned=None):
295295
# recurses to find permutations of valences based on whether a
296296
# charge balanced assignment can still be found
297297
if self._n > self.max_permutations:
298-
return None
298+
return
299299
if assigned is None:
300300
assigned = []
301301

@@ -312,16 +312,16 @@ def _recurse(assigned=None):
312312

313313
if highest < 0 or lowest > 0:
314314
self._n += 1
315-
return None
315+
return
316316

317317
if i == len(valences):
318318
evaluate_assignment(assigned)
319319
self._n += 1
320-
return None
320+
return
321321
for v in valences[i]:
322322
new_assigned = list(assigned)
323323
_recurse([*new_assigned, v])
324-
return None
324+
return
325325

326326
else:
327327
n_sites = np.array([len(i) for i in equi_sites])
@@ -373,7 +373,7 @@ def _recurse(assigned=None):
373373
# recurses to find permutations of valences based on whether a
374374
# charge balanced assignment can still be found
375375
if self._n > self.max_permutations:
376-
return None
376+
return
377377
if assigned is None:
378378
assigned = []
379379

@@ -392,18 +392,18 @@ def _recurse(assigned=None):
392392

393393
if highest < -self.charge_neutrality_tolerance or lowest > self.charge_neutrality_tolerance:
394394
self._n += 1
395-
return None
395+
return
396396

397397
if i == len(new_valences):
398398
evaluate_assignment(assigned)
399399
self._n += 1
400-
return None
400+
return
401401

402402
for v in new_valences[i]:
403403
new_assigned = list(assigned)
404404
_recurse([*new_assigned, v])
405405

406-
return None
406+
return
407407

408408
_recurse()
409409

pymatgen/analysis/chemenv/coordination_environments/structure_environments.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -677,12 +677,12 @@ def plot_csm_and_maps(self, isite, max_csm=8.0):
677677
import matplotlib.pyplot as plt
678678
except ImportError:
679679
print('Plotting Chemical Environments requires matplotlib ... exiting "plot" function')
680-
return None
680+
return
681681
fig = self.get_csm_and_maps(isite=isite, max_csm=max_csm)
682682
if fig is None:
683-
return None
683+
return
684684
plt.show()
685-
return None
685+
return
686686

687687
def get_csm_and_maps(self, isite, max_csm=8.0, figsize=None, symmetry_measure_type=None):
688688
"""

pymatgen/entries/mixing_scheme.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ def display_entries(entries):
735735
try:
736736
pd = PhaseDiagram(entries)
737737
except ValueError:
738-
return None
738+
return
739739

740740
print(
741741
f"{'entry_id':<12}{'formula':<12}{'spacegroup':<12}{'run_type':<10}{'eV/atom':<8}"
@@ -747,4 +747,4 @@ def display_entries(entries):
747747
f"{e.parameters['run_type']:<10}{e.energy_per_atom:<8.3f}"
748748
f"{e.correction / e.composition.num_atoms:<9.3f} {pd.get_e_above_hull(e):<9.3f}"
749749
)
750-
return None
750+
return

pymatgen/io/abinit/pseudos.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,12 +1301,12 @@ def Z_val(self):
13011301
def l_max(self):
13021302
"""Maximum angular momentum."""
13031303
# TODO return an actual value
1304-
return None
1304+
return
13051305

13061306
@property
13071307
def l_local(self):
13081308
"""Angular momentum used for the local part."""
1309-
return None
1309+
return
13101310

13111311
@property
13121312
def summary(self):

pymatgen/io/res.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def _parse_date(cls, string: str) -> date:
438438

439439
def _raise_or_none(self, err: ParseError) -> None:
440440
if self.parse_rems != "strict":
441-
return None
441+
return
442442
raise err
443443

444444
def get_run_start_info(self) -> tuple[date, str] | None:

pymatgen/transformations/advanced_transformations.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def __repr__(self):
9595
@property
9696
def inverse(self):
9797
"""Returns: None"""
98-
return None
98+
return
9999

100100
@property
101101
def is_one_to_many(self) -> bool:
@@ -158,7 +158,7 @@ def __repr__(self):
158158
@property
159159
def inverse(self):
160160
"""Returns: None"""
161-
return None
161+
return
162162

163163
@property
164164
def is_one_to_many(self) -> bool:
@@ -265,7 +265,7 @@ def __repr__(self):
265265
@property
266266
def inverse(self):
267267
"""Returns: None"""
268-
return None
268+
return
269269

270270
@property
271271
def is_one_to_many(self) -> bool:
@@ -506,7 +506,7 @@ def __repr__(self):
506506
@property
507507
def inverse(self):
508508
"""Returns: None"""
509-
return None
509+
return
510510

511511
@property
512512
def is_one_to_many(self) -> bool:
@@ -576,7 +576,7 @@ def __repr__(self):
576576
@property
577577
def inverse(self):
578578
"""Returns: None"""
579-
return None
579+
return
580580

581581
@property
582582
def is_one_to_many(self) -> bool:
@@ -954,7 +954,7 @@ def __repr__(self):
954954
@property
955955
def inverse(self):
956956
"""Returns: None"""
957-
return None
957+
return
958958

959959
@property
960960
def is_one_to_many(self) -> bool:
@@ -1186,7 +1186,7 @@ def apply_transformation(self, structure: Structure, return_ranked_list: bool |
11861186
@property
11871187
def inverse(self):
11881188
"""Returns: None"""
1189-
return None
1189+
return
11901190

11911191
@property
11921192
def is_one_to_many(self) -> bool:
@@ -1272,7 +1272,7 @@ def apply_transformation(self, structure):
12721272
@property
12731273
def inverse(self):
12741274
"""Returns: None"""
1275-
return None
1275+
return
12761276

12771277
@property
12781278
def is_one_to_many(self) -> bool:
@@ -1334,7 +1334,7 @@ def apply_transformation(self, structure: Structure, return_ranked_list: bool |
13341334
@property
13351335
def inverse(self):
13361336
"""Returns: None"""
1337-
return None
1337+
return
13381338

13391339
@property
13401340
def is_one_to_many(self) -> bool:
@@ -1536,7 +1536,7 @@ def apply_transformation(self, structure):
15361536
@property
15371537
def inverse(self):
15381538
"""Returns: None"""
1539-
return None
1539+
return
15401540

15411541
@property
15421542
def is_one_to_many(self) -> bool:
@@ -1682,7 +1682,7 @@ def inverse(self):
16821682
Returns:
16831683
None
16841684
"""
1685-
return None
1685+
return
16861686

16871687
@property
16881688
def is_one_to_many(self) -> bool:
@@ -1775,7 +1775,7 @@ def apply_transformation(self, structure: Structure, return_ranked_list: bool |
17751775
@property
17761776
def inverse(self):
17771777
"""Returns: None"""
1778-
return None
1778+
return
17791779

17801780
@property
17811781
def is_one_to_many(self) -> bool:
@@ -1934,7 +1934,7 @@ def apply_transformation(self, structure: Structure, return_ranked_list: bool |
19341934
@property
19351935
def inverse(self):
19361936
"""Returns: None"""
1937-
return None
1937+
return
19381938

19391939
@property
19401940
def is_one_to_many(self) -> bool:
@@ -2193,7 +2193,7 @@ def _get_unique_bestsqs_strucs(sqs, best_only, return_ranked_list, remove_duplic
21932193
@property
21942194
def inverse(self):
21952195
"""Returns: None"""
2196-
return None
2196+
return
21972197

21982198
@property
21992199
def is_one_to_many(self) -> bool:
@@ -2282,7 +2282,7 @@ def inverse(self):
22822282
"""
22832283
Returns: None
22842284
"""
2285-
return None
2285+
return
22862286

22872287
@property
22882288
def is_one_to_many(self) -> bool:

pymatgen/transformations/site_transformations.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def __repr__(self):
8080
@property
8181
def inverse(self):
8282
"""Return: None"""
83-
return None
83+
return
8484

8585
@property
8686
def is_one_to_many(self) -> bool:
@@ -132,7 +132,7 @@ def __repr__(self):
132132
@property
133133
def inverse(self):
134134
"""Return: None"""
135-
return None
135+
return
136136

137137
@property
138138
def is_one_to_many(self) -> bool:
@@ -176,7 +176,7 @@ def __repr__(self):
176176
@property
177177
def inverse(self):
178178
"""Return: None"""
179-
return None
179+
return
180180

181181
@property
182182
def is_one_to_many(self) -> bool:
@@ -534,7 +534,7 @@ def __repr__(self):
534534
@property
535535
def inverse(self):
536536
"""Return: None"""
537-
return None
537+
return
538538

539539
@property
540540
def is_one_to_many(self) -> bool:
@@ -573,7 +573,7 @@ def apply_transformation(self, structure):
573573
@property
574574
def inverse(self):
575575
"""Return: None"""
576-
return None
576+
return
577577

578578
@property
579579
def is_one_to_many(self) -> bool:

pymatgen/transformations/standard_transformations.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def inverse(self):
119119
"""
120120
Returns: None
121121
"""
122-
return None
122+
return
123123

124124
@property
125125
def is_one_to_many(self) -> bool:
@@ -179,7 +179,7 @@ def inverse(self):
179179
"""
180180
Returns: None
181181
"""
182-
return None
182+
return
183183

184184
@property
185185
def is_one_to_many(self) -> bool:
@@ -218,7 +218,7 @@ def inverse(self):
218218
"""
219219
Returns: None
220220
"""
221-
return None
221+
return
222222

223223
@property
224224
def is_one_to_many(self) -> bool:
@@ -400,7 +400,7 @@ def inverse(self):
400400
"""
401401
Returns: None
402402
"""
403-
return None
403+
return
404404

405405
@property
406406
def is_one_to_many(self) -> bool:
@@ -491,7 +491,7 @@ def inverse(self):
491491
"""
492492
Returns: None
493493
"""
494-
return None
494+
return
495495

496496

497497
class OrderDisorderedStructureTransformation(AbstractTransformation):
@@ -681,7 +681,7 @@ def inverse(self):
681681
"""
682682
Returns: None
683683
"""
684-
return None
684+
return
685685

686686
@property
687687
def is_one_to_many(self) -> bool:
@@ -739,7 +739,7 @@ def inverse(self):
739739
"""
740740
Returns: None
741741
"""
742-
return None
742+
return
743743

744744
@property
745745
def is_one_to_many(self) -> bool:
@@ -790,7 +790,7 @@ def inverse(self):
790790
"""
791791
Returns: None
792792
"""
793-
return None
793+
return
794794

795795
@property
796796
def is_one_to_many(self) -> bool:
@@ -848,7 +848,7 @@ def inverse(self):
848848
"""
849849
Returns: None
850850
"""
851-
return None
851+
return
852852

853853
@property
854854
def is_one_to_many(self) -> bool:
@@ -970,7 +970,7 @@ def inverse(self):
970970
"""
971971
Returns: None
972972
"""
973-
return None
973+
return
974974

975975
@property
976976
def is_one_to_many(self) -> bool:
@@ -1103,7 +1103,7 @@ def inverse(self):
11031103
"""
11041104
Returns: None
11051105
"""
1106-
return None
1106+
return
11071107

11081108
@property
11091109
def is_one_to_many(self) -> bool:

0 commit comments

Comments
 (0)