Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:
- id: black-jupyter
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.0.277
rev: v0.0.278
hooks:
- id: ruff
args: ["--fix"]
Expand Down
4 changes: 1 addition & 3 deletions dpdata/cp2k/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,7 @@ def handle_single_xyz_frame(self, lines):
atom_num = int(lines[0].strip("\n").strip())
if len(lines) != atom_num + 2:
raise RuntimeError(
"format error, atom_num=={}, {}!=atom_num+2".format(
atom_num, len(lines)
)
f"format error, atom_num=={atom_num}, {len(lines)}!=atom_num+2"
)
data_format_line = lines[1].strip("\n").strip() + " "
prop_pattern = re.compile(r"(?P<prop>\w+)\s*=\s*(?P<number>.*?)[, ]")
Expand Down
12 changes: 2 additions & 10 deletions dpdata/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,17 +797,9 @@ def replace(self, initial_atom_type, end_atom_type, replace_num):
"Must use method replace() of the instance of class dpdata.System"
)
if type(replace_num) is not int:
raise ValueError(
"replace_num must be a integer. Now is {replace_num}".format(
replace_num=replace_num
)
)
raise ValueError(f"replace_num must be a integer. Now is {replace_num}")
if replace_num <= 0:
raise ValueError(
"replace_num must be larger than 0.Now is {replace_num}".format(
replace_num=replace_num
)
)
raise ValueError(f"replace_num must be larger than 0.Now is {replace_num}")

try:
initial_atom_index = self.data["atom_names"].index(initial_atom_type)
Expand Down
4 changes: 1 addition & 3 deletions dpdata/xyz/quip_gap_xyz.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ def handle_single_xyz_frame(lines):
atom_num = int(lines[0].strip("\n").strip())
if len(lines) != atom_num + 2:
raise RuntimeError(
"format error, atom_num=={}, {}!=atom_num+2".format(
atom_num, len(lines)
)
f"format error, atom_num=={atom_num}, {len(lines)}!=atom_num+2"
)
data_format_line = lines[1].strip("\n").strip() + " "
field_value_pattern = re.compile(
Expand Down