Skip to content

Commit

Permalink
Merge pull request #21 from benrich37/cleanup
Browse files Browse the repository at this point in the history
Not currently understood pre-commit bug fix
  • Loading branch information
benrich37 authored Nov 13, 2024
2 parents 412a099 + 0152f43 commit 6155328
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/pymatgen/core/periodic_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ def __getattr__(self, item: str) -> Any:
if val is None or str(val).startswith("no data"):
warnings.warn(f"No data available for {item} for {self.symbol}")
val = None
# elif isinstance(val, dict | list):
elif type(val) in [list, dict]: # pre-commit fix
elif isinstance(val, dict | list):
pass
else:
try:
Expand Down Expand Up @@ -532,8 +531,7 @@ def term_symbols(self) -> list[list[str]]:
# Total ML = sum(ml1, ml2), Total MS = sum(ms1, ms2)
TL = [sum(ml_ms[comb[e]][0] for e in range(v_e)) for comb in e_config_combs]
TS = [sum(ml_ms[comb[e]][1] for e in range(v_e)) for comb in e_config_combs]
# comb_counter: Counter = Counter(zip(TL, TS, strict=True))
comb_counter: Counter = Counter([(TL[i], TS[i]) for i in range(len(TL))]) # pre-commit edit
comb_counter: Counter = Counter(zip(TL, TS, strict=True))

term_symbols = []
L_symbols = "SPDFGHIKLMNOQRTUVWXYZ"
Expand Down Expand Up @@ -1657,17 +1655,9 @@ def get_el_sp(obj: int | SpeciesLike) -> Element | Species | DummySpecies:
"""
# If obj is already an Element or Species, return as is
# TODO: Why do we need to check "_is_named_isotope"?
if isinstance(obj, Element):
if isinstance(obj, Element | Species | DummySpecies):
if getattr(obj, "_is_named_isotope", None):
return Element(obj.name)
return obj
if isinstance(obj, Species):
if getattr(obj, "_is_named_isotope", None):
return Species(str(obj))
return obj
if isinstance(obj, Species):
if getattr(obj, "_is_named_isotope", None):
return Species(str(obj))
return Element(obj.name) if isinstance(obj, Element) else Species(str(obj))
return obj

# If obj is an integer, return the Element with atomic number obj
Expand Down

0 comments on commit 6155328

Please sign in to comment.