Skip to content

Commit

Permalink
fix UP038 Use X | Y in isinstance call instead of (X, Y)
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Sep 16, 2024
1 parent 24d1657 commit 8ede53b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion chgnet/model/dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ def __init__(
"""
self.ensemble = ensemble
self.thermostat = thermostat
if isinstance(atoms, (Structure, Molecule)):
if isinstance(atoms, Structure | Molecule):
atoms = AseAtomsAdaptor().get_atoms(atoms)
# atoms = atoms.to_ase_atoms()

Expand Down
2 changes: 1 addition & 1 deletion chgnet/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ def predict_graph(
m (Tensor) : magnetic moments of sites [num_atoms, 3] in Bohr
magneton mu_B
"""
if not isinstance(graph, (CrystalGraph, Sequence)):
if not isinstance(graph, CrystalGraph | Sequence):
raise TypeError(
f"{type(graph)=} must be CrystalGraph or list of CrystalGraphs"
)
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ build-backend = "setuptools.build_meta"

[tool.ruff]
target-version = "py310"
output-format = "concise"

[tool.ruff.lint]
select = ["ALL"]
Expand Down

0 comments on commit 8ede53b

Please sign in to comment.