From 4ae543f169bf427b8f5749536df57858fe9fd4f4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 18 Jul 2023 04:47:32 +0000 Subject: [PATCH 1/3] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.277 → v0.0.278](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.277...v0.0.278) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 30d14c225..cd2658ab4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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"] From 05cdb4d6869a2ec2a1d91ebfd36f52bf40721408 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 18 Jul 2023 04:48:24 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- dpdata/cp2k/output.py | 4 +--- dpdata/system.py | 8 ++------ dpdata/xyz/quip_gap_xyz.py | 4 +--- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/dpdata/cp2k/output.py b/dpdata/cp2k/output.py index ed3ab5af3..7b3aeb649 100644 --- a/dpdata/cp2k/output.py +++ b/dpdata/cp2k/output.py @@ -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\w+)\s*=\s*(?P.*?)[, ]") diff --git a/dpdata/system.py b/dpdata/system.py index 57308eb19..2a330deaf 100644 --- a/dpdata/system.py +++ b/dpdata/system.py @@ -798,15 +798,11 @@ def replace(self, initial_atom_type, end_atom_type, replace_num): ) if type(replace_num) is not int: raise ValueError( - "replace_num must be a integer. Now is {replace_num}".format( - replace_num=replace_num - ) + 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 - ) + f"replace_num must be larger than 0.Now is {replace_num}" ) try: diff --git a/dpdata/xyz/quip_gap_xyz.py b/dpdata/xyz/quip_gap_xyz.py index c2d4118c4..8b3f164be 100644 --- a/dpdata/xyz/quip_gap_xyz.py +++ b/dpdata/xyz/quip_gap_xyz.py @@ -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( From 574e6818fa27cc3764a6bea6062ffc6ac71bc805 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 20 Jul 2023 06:17:57 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- dpdata/system.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/dpdata/system.py b/dpdata/system.py index 2a330deaf..bfec97c6b 100644 --- a/dpdata/system.py +++ b/dpdata/system.py @@ -797,13 +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( - f"replace_num must be a integer. Now is {replace_num}" - ) + raise ValueError(f"replace_num must be a integer. Now is {replace_num}") if replace_num <= 0: - raise ValueError( - f"replace_num must be larger than 0.Now is {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)