Skip to content

Commit

Permalink
fix E721 Do not compare types, use isinstance()
Browse files Browse the repository at this point in the history
  • Loading branch information
njzjz committed Aug 22, 2023
1 parent ef4e450 commit 45659ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dpdata/abacus/md.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def get_frame(fname):
data["energies"] = energy
data["forces"] = force
data["virials"] = stress
if type(data["virials"]) != np.ndarray:
if not isinstance(data["virials"], np.ndarray):
del data["virials"]
data["orig"] = np.zeros(3)

Expand Down
4 changes: 2 additions & 2 deletions dpdata/md/rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ def _compute_rdf_1frame(box, posis, atype, sel_type=[None, None], max_r=5, nbins
sel_type[0] = all_types
if sel_type[1] is None:
sel_type[1] = all_types
if type(sel_type[0]) is not list:
if not isinstance(sel_type[0], list):

Check warning on line 65 in dpdata/md/rdf.py

View check run for this annotation

Codecov / codecov/patch

dpdata/md/rdf.py#L65

Added line #L65 was not covered by tests
sel_type[0] = [sel_type[0]]
if type(sel_type[1]) is not list:
if not isinstance(sel_type[1], list):

Check warning on line 67 in dpdata/md/rdf.py

View check run for this annotation

Codecov / codecov/patch

dpdata/md/rdf.py#L67

Added line #L67 was not covered by tests
sel_type[1] = [sel_type[1]]
natoms = len(posis)
import ase.neighborlist
Expand Down

0 comments on commit 45659ad

Please sign in to comment.