Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #377

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.1
rev: v0.9.6
hooks:
# Run the linting tool
- id: ruff
Expand All @@ -10,13 +10,13 @@ repos:
- id: ruff-format
types_or: [python, pyi] # TODO: Fix notebooks to remove this
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.41.0
rev: v0.44.0
hooks:
- id: markdownlint
# MD013: line too long
Expand Down Expand Up @@ -44,24 +44,24 @@ repos:
additional_dependencies:
- prettier
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
rev: 0.8.1
hooks:
- id: nbstripout
args: [--drop-empty-cells, --keep-output]
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell
stages: [commit, commit-msg]
stages: [pre-commit, commit-msg]
args: [--toml, pyproject.toml]
additional_dependencies:
- tomli
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.376
rev: v1.1.393
hooks:
- id: pyright
args: [--level, error]
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.18.0
rev: 1.19.1
hooks:
- id: blacken-docs
22 changes: 11 additions & 11 deletions smact/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def lookup_element_oxidation_states(symbol, copy=True):
return _el_ox_states[symbol]
else:
if _print_warnings:
print(f"WARNING: Oxidation states for element {symbol} " "not found.")
print(f"WARNING: Oxidation states for element {symbol} not found.")
return None


Expand Down Expand Up @@ -149,7 +149,7 @@ def lookup_element_oxidation_states_icsd(symbol, copy=True):
return _el_ox_states_icsd[symbol]
else:
if _print_warnings:
print(f"WARNING: Oxidation states for element {symbol}" "not found.")
print(f"WARNING: Oxidation states for element {symbol}not found.")
return None


Expand Down Expand Up @@ -197,7 +197,7 @@ def lookup_element_oxidation_states_sp(symbol, copy=True):
return _el_ox_states_sp[symbol]
else:
if _print_warnings:
print(f"WARNING: Oxidation states for element {symbol} " "not found.")
print(f"WARNING: Oxidation states for element {symbol} not found.")
return None


Expand Down Expand Up @@ -245,7 +245,7 @@ def lookup_element_oxidation_states_wiki(symbol, copy=True):
return _el_ox_states_wiki[symbol]
else:
if _print_warnings:
print(f"WARNING: Oxidation states for element {symbol} " "not found.")
print(f"WARNING: Oxidation states for element {symbol} not found.")
return None


Expand Down Expand Up @@ -294,7 +294,7 @@ def lookup_element_oxidation_states_custom(symbol, filepath, copy=True):
return _el_ox_states_custom[symbol]
else:
if _print_warnings:
print(f"WARNING: Oxidation states for element {symbol} " "not found.")
print(f"WARNING: Oxidation states for element {symbol} not found.")
return None


Expand Down Expand Up @@ -339,7 +339,7 @@ def lookup_element_oxidation_states_icsd24(symbol, copy=True):
return _el_ox_states_icsd24[symbol]
else:
if _print_warnings:
print(f"WARNING: Oxidation states for element {symbol} " "not found.")
print(f"WARNING: Oxidation states for element {symbol} not found.")
return None


Expand Down Expand Up @@ -548,7 +548,7 @@ def lookup_element_shannon_radius_data(symbol, copy=True):
return _element_shannon_radii_data[symbol]
else:
if _print_warnings:
print(f"WARNING: Shannon-radius data for element {symbol} not " "found.")
print(f"WARNING: Shannon-radius data for element {symbol} not found.")

return None

Expand Down Expand Up @@ -646,7 +646,7 @@ def lookup_element_shannon_radius_data_extendedML(symbol, copy=True):
return _element_shannon_radii_data_extendedML[symbol]
else:
if _print_warnings:
print(f"WARNING: Extended Shannon-radius data for element {symbol} not " "found.")
print(f"WARNING: Extended Shannon-radius data for element {symbol} not found.")

return None

Expand Down Expand Up @@ -712,7 +712,7 @@ def lookup_element_sse_data(symbol):
return _element_ssedata[symbol]
else:
if _print_warnings:
print(f"WARNING: Solid-state energy data for element {symbol} not" " found.")
print(f"WARNING: Solid-state energy data for element {symbol} not found.")

return None

Expand Down Expand Up @@ -909,7 +909,7 @@ def lookup_element_magpie_data(symbol: str, copy: bool = True):
return _element_magpie_data[symbol]
else:
if _print_warnings:
print(f"WARNING: Magpie data for element {symbol} not " "found.")
print(f"WARNING: Magpie data for element {symbol} not found.")

return None

Expand Down Expand Up @@ -954,6 +954,6 @@ def lookup_element_valence_data(symbol: str, copy: bool = True):
return _element_valence_data[symbol]
else:
if _print_warnings:
print(f"WARNING: Valence data for element {symbol} not " "found.")
print(f"WARNING: Valence data for element {symbol} not found.")

return None
2 changes: 1 addition & 1 deletion smact/oxidation_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def get_included_species(self):

def compound_probability(self, structure: Structure, ignore_stoichiometry: bool = True) -> float:
"""
calculate overall probability for structure or composition.
Calculate overall probability for structure or composition.

Args:
----
Expand Down
23 changes: 6 additions & 17 deletions smact/screening.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,8 @@ def _no_repeats(
else:
anions.append(symbol)
return not (
not repeat_anions
and len(anions) != len(set(anions))
or not repeat_cations
and len(cations) != len(set(cations))
(not repeat_anions and len(anions) != len(set(anions)))
or (not repeat_cations and len(cations) != len(set(cations)))
)


Expand Down Expand Up @@ -209,12 +207,8 @@ def eneg_states_test(ox_states: list[int], enegs: list[float]):
if (
eneg1 is None
or eneg2 is None
or (ox1 > 0)
and (ox2 < 0)
and (eneg1 >= eneg2)
or (ox1 < 0)
and (ox2 > 0)
and (eneg1 <= eneg2)
or ((ox1 > 0) and (ox2 < 0) and (eneg1 >= eneg2))
or ((ox1 < 0) and (ox2 > 0) and (eneg1 <= eneg2))
):
return False
return True
Expand Down Expand Up @@ -248,13 +242,8 @@ def eneg_states_test_threshold(ox_states: list[int], enegs: list[float], thresho

"""
for (ox1, eneg1), (ox2, eneg2) in combinations(list(zip(ox_states, enegs, strict=False)), 2):
if (
(ox1 > 0)
and (ox2 < 0)
and ((eneg1 - eneg2) > threshold)
or (ox1 < 0)
and (ox2 > 0)
and (eneg2 - eneg1) > threshold
if ((ox1 > 0) and (ox2 < 0) and ((eneg1 - eneg2) > threshold)) or (
(ox1 < 0) and (ox2 > 0) and (eneg2 - eneg1) > threshold
):
return False
return True
Expand Down
2 changes: 1 addition & 1 deletion smact/structure_prediction/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def from_mp(
structs = m.get_structures(chemsys_formula=formula)

if len(structs) == 0:
raise ValueError("Could not find composition in Materials Project Database, " "please supply a structure.")
raise ValueError("Could not find composition in Materials Project Database, please supply a structure.")

# Default to first found structure
struct = structs[0]["structure"] if isinstance(structs[0], dict) else structs[0]
Expand Down
Loading