Skip to content

Commit be669c8

Browse files
[pre-commit.ci] pre-commit autoupdate (#497)
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.277 → v0.0.278](astral-sh/ruff-pre-commit@v0.0.277...v0.0.278) <!--pre-commit.ci end--> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com>
1 parent a091a59 commit be669c8

4 files changed

Lines changed: 5 additions & 17 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.277
26+
rev: v0.0.278
2727
hooks:
2828
- id: ruff
2929
args: ["--fix"]

dpdata/cp2k/output.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,7 @@ def handle_single_xyz_frame(self, lines):
327327
atom_num = int(lines[0].strip("\n").strip())
328328
if len(lines) != atom_num + 2:
329329
raise RuntimeError(
330-
"format error, atom_num=={}, {}!=atom_num+2".format(
331-
atom_num, len(lines)
332-
)
330+
f"format error, atom_num=={atom_num}, {len(lines)}!=atom_num+2"
333331
)
334332
data_format_line = lines[1].strip("\n").strip() + " "
335333
prop_pattern = re.compile(r"(?P<prop>\w+)\s*=\s*(?P<number>.*?)[, ]")

dpdata/system.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -797,17 +797,9 @@ def replace(self, initial_atom_type, end_atom_type, replace_num):
797797
"Must use method replace() of the instance of class dpdata.System"
798798
)
799799
if type(replace_num) is not int:
800-
raise ValueError(
801-
"replace_num must be a integer. Now is {replace_num}".format(
802-
replace_num=replace_num
803-
)
804-
)
800+
raise ValueError(f"replace_num must be a integer. Now is {replace_num}")
805801
if replace_num <= 0:
806-
raise ValueError(
807-
"replace_num must be larger than 0.Now is {replace_num}".format(
808-
replace_num=replace_num
809-
)
810-
)
802+
raise ValueError(f"replace_num must be larger than 0.Now is {replace_num}")
811803

812804
try:
813805
initial_atom_index = self.data["atom_names"].index(initial_atom_type)

dpdata/xyz/quip_gap_xyz.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ def handle_single_xyz_frame(lines):
4747
atom_num = int(lines[0].strip("\n").strip())
4848
if len(lines) != atom_num + 2:
4949
raise RuntimeError(
50-
"format error, atom_num=={}, {}!=atom_num+2".format(
51-
atom_num, len(lines)
52-
)
50+
f"format error, atom_num=={atom_num}, {len(lines)}!=atom_num+2"
5351
)
5452
data_format_line = lines[1].strip("\n").strip() + " "
5553
field_value_pattern = re.compile(

0 commit comments

Comments
 (0)