From c58c72fec7b4567999e725d9cf8fdf0f918f1a90 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Aug 2023 05:26:33 +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.282 → v0.0.284](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.282...v0.0.284) - [github.com/Lucas-C/pre-commit-hooks: v1.5.3 → v1.5.4](https://github.com/Lucas-C/pre-commit-hooks/compare/v1.5.3...v1.5.4) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3fa0b40d57..9038db4a8f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,7 +33,7 @@ repos: files: \.py$ - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.0.282 + rev: v0.0.284 hooks: - id: ruff args: ["--fix"] @@ -72,7 +72,7 @@ repos: #- id: cmake-lint # license header - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.5.3 + rev: v1.5.4 hooks: # C++, js - id: insert-license From 1fa8ed2eb27d5339c0c48286ecbd9eda058488dd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Aug 2023 05:26:57 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- deepmd/env.py | 4 ++-- deepmd/utils/argcheck.py | 4 ++-- deepmd/utils/finetune.py | 4 ++-- deepmd/utils/multi_init.py | 4 ++-- source/install/build_tf.py | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/deepmd/env.py b/deepmd/env.py index 77f36f60b3..8dd8739fac 100644 --- a/deepmd/env.py +++ b/deepmd/env.py @@ -418,9 +418,9 @@ def get_module(module_name: str) -> "ModuleType": ) from e error_message = ( "This deepmd-kit package is inconsitent with TensorFlow " - "Runtime, thus an error is raised when loading {}. " + f"Runtime, thus an error is raised when loading {module_name}. " "You need to rebuild deepmd-kit against this TensorFlow " - "runtime.".format(module_name) + "runtime." ) if TF_CXX11_ABI_FLAG == 1: # #1791 diff --git a/deepmd/utils/argcheck.py b/deepmd/utils/argcheck.py index e37e03f9e0..fecfaa80f5 100644 --- a/deepmd/utils/argcheck.py +++ b/deepmd/utils/argcheck.py @@ -1861,8 +1861,8 @@ def normalize_fitting_weight(fitting_keys, data_keys, fitting_weight=None): else: valid_fitting_keys.remove(item) log.warning( - "Fitting net '{}' has zero or invalid weight " - "and will not be used in training.".format(item) + f"Fitting net '{item}' has zero or invalid weight " + "and will not be used in training." ) new_weight[item] = 0.0 else: diff --git a/deepmd/utils/finetune.py b/deepmd/utils/finetune.py index aaa4575c86..90c828c219 100644 --- a/deepmd/utils/finetune.py +++ b/deepmd/utils/finetune.py @@ -55,8 +55,8 @@ def replace_model_params_with_pretrained_model( if i not in pretrained_type_map: out_line_type.append(i) assert not out_line_type, ( - "{} type(s) not contained in the pretrained model! " - "Please choose another suitable one.".format(str(out_line_type)) + f"{str(out_line_type)} type(s) not contained in the pretrained model! " + "Please choose another suitable one." ) if cur_type_map != pretrained_type_map: log.info( diff --git a/deepmd/utils/multi_init.py b/deepmd/utils/multi_init.py index cbd920074f..fd56f715c5 100644 --- a/deepmd/utils/multi_init.py +++ b/deepmd/utils/multi_init.py @@ -54,8 +54,8 @@ def replace_model_params_with_frz_multi_model( if i not in pretrained_type_map: out_line_type.append(i) assert not out_line_type, ( - "{} type(s) not contained in the pretrained model! " - "Please choose another suitable one.".format(str(out_line_type)) + f"{str(out_line_type)} type(s) not contained in the pretrained model! " + "Please choose another suitable one." ) if cur_type_map != pretrained_type_map: log.info( diff --git a/source/install/build_tf.py b/source/install/build_tf.py index db72bebb8b..043c4c6c81 100755 --- a/source/install/build_tf.py +++ b/source/install/build_tf.py @@ -150,9 +150,9 @@ def __call__(self): self.download() if not self.exists: raise RuntimeError( - "Download {} from {} failed! " - "You can manually download it to {} and " - "retry the script.".format(self.filename, self.url, str(self.path)) + f"Download {self.filename} from {self.url} failed! " + f"You can manually download it to {str(self.path)} and " + "retry the script." ) self.post_process() From 811f98d9ac1acc2226eddc5fe999b22ee65c8dbc Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 15 Aug 2023 15:55:03 -0400 Subject: [PATCH 3/3] fix E721 Do not compare types, use `isinstance()` Signed-off-by: Jinzhe Zeng --- deepmd/entrypoints/train.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepmd/entrypoints/train.py b/deepmd/entrypoints/train.py index 57a306dece..536b6a6c68 100755 --- a/deepmd/entrypoints/train.py +++ b/deepmd/entrypoints/train.py @@ -445,7 +445,7 @@ def get_min_nbor_dist(jdata, rcut): def parse_auto_sel(sel): - if type(sel) is not str: + if not isinstance(sel, str): return False words = sel.split(":") if words[0] == "auto":