Skip to content

Commit 666d199

Browse files
[pre-commit.ci] pre-commit autoupdate (#525)
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.282 → v0.0.284](astral-sh/ruff-pre-commit@v0.0.282...v0.0.284) <!--pre-commit.ci end--> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
1 parent 40d593b commit 666d199

6 files changed

Lines changed: 10 additions & 10 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ repos:
2323
- id: black-jupyter
2424
- repo: https://github.com/astral-sh/ruff-pre-commit
2525
# Ruff version.
26-
rev: v0.0.282
26+
rev: v0.0.284
2727
hooks:
2828
- id: ruff
2929
args: ["--fix"]

dpdata/abacus/md.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def get_energy(outlines, ndump, dump_freq):
148148

149149

150150
def get_frame(fname):
151-
if type(fname) == str:
151+
if isinstance(fname, str):
152152
# if the input parameter is only one string, it is assumed that it is the
153153
# base directory containing INPUT file;
154154
path_in = os.path.join(fname, "INPUT")

dpdata/abacus/relax.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def get_coords_from_log(loglines, natoms):
167167

168168

169169
def get_frame(fname):
170-
if type(fname) == str:
170+
if isinstance(fname, str):
171171
# if the input parameter is only one string, it is assumed that it is the
172172
# base directory containing INPUT file;
173173
path_in = os.path.join(fname, "INPUT")

dpdata/abacus/scf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def get_frame(fname):
161161
"forces": [],
162162
}
163163

164-
if type(fname) == str:
164+
if isinstance(fname, str):
165165
# if the input parameter is only one string, it is assumed that it is the
166166
# base directory containing INPUT file;
167167
path_in = os.path.join(fname, "INPUT")
@@ -255,7 +255,7 @@ def get_nele_from_stru(geometry_inlines):
255255

256256

257257
def get_frame_from_stru(fname):
258-
assert type(fname) == str
258+
assert isinstance(fname, str)
259259
with open(fname) as fp:
260260
geometry_inlines = fp.read().split("\n")
261261
nele = get_nele_from_stru(geometry_inlines)
@@ -304,7 +304,7 @@ def make_unlabeled_stru(
304304
out += "\n"
305305

306306
if numerical_descriptor is not None:
307-
assert type(numerical_descriptor) == str
307+
assert isinstance(numerical_descriptor, str)
308308
out += "NUMERICAL_DESCRIPTOR\n%s\n" % numerical_descriptor
309309
out += "\n"
310310

dpdata/qe/scf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ def get_stress(lines):
129129

130130

131131
def get_frame(fname):
132-
if type(fname) == str:
132+
if isinstance(fname, str):
133133
path_out = fname
134134
outname = os.path.basename(path_out)
135135
# the name of the input file is assumed to be different from the output by 'in' and 'out'
136136
inname = outname.replace("out", "in")
137137
path_in = os.path.join(os.path.dirname(path_out), inname)
138-
elif type(fname) == list and len(fname) == 2:
138+
elif isinstance(fname, list) and len(fname) == 2:
139139
path_in = fname[0]
140140
path_out = fname[1]
141141
else:

dpdata/system.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ def replicate(self, ncopy):
654654
if len(ncopy) != 3:
655655
raise RuntimeError("ncopy must be a list or tuple with 3 int")
656656
for ii in ncopy:
657-
if type(ii) is not int:
657+
if not isinstance(ii, int):
658658
raise RuntimeError("ncopy must be a list or tuple must with 3 int")
659659

660660
tmp = System()
@@ -690,7 +690,7 @@ def replace(self, initial_atom_type, end_atom_type, replace_num):
690690
raise RuntimeError(
691691
"Must use method replace() of the instance of class dpdata.System"
692692
)
693-
if type(replace_num) is not int:
693+
if not isinstance(replace_num, int):
694694
raise ValueError(f"replace_num must be a integer. Now is {replace_num}")
695695
if replace_num <= 0:
696696
raise ValueError(f"replace_num must be larger than 0.Now is {replace_num}")

0 commit comments

Comments
 (0)