From 2ce9c58e7947e062309150313e5c85233c7472c2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 09:32:11 +0800 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#3236) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.14 → v0.2.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.14...v0.2.0) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jinzhe Zeng (cherry picked from commit 37cdccf06077c74269f87e1158c2fa5bda07e677) --- .pre-commit-config.yaml | 2 +- deepmd/descriptor/loc_frame.py | 5 ++++- deepmd/descriptor/se_a.py | 5 ++++- deepmd/descriptor/se_r.py | 5 ++++- deepmd/descriptor/se_t.py | 5 ++++- pyproject.toml | 4 ++-- 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0fd2d1b40f..85486e3901 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: exclude: ^source/3rdparty - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.1.14 + rev: v0.2.0 hooks: - id: ruff args: ["--fix"] diff --git a/deepmd/descriptor/loc_frame.py b/deepmd/descriptor/loc_frame.py index 0765be55f8..4c9b3033ae 100644 --- a/deepmd/descriptor/loc_frame.py +++ b/deepmd/descriptor/loc_frame.py @@ -343,7 +343,10 @@ def prod_force_virial( tf.summary.histogram("net_derivative", net_deriv) net_deriv_reshape = tf.reshape( net_deriv, - [np.cast["int64"](-1), natoms[0] * np.cast["int64"](self.ndescrpt)], + [ + np.asarray(-1, dtype=np.int64), + natoms[0] * np.asarray(self.ndescrpt, dtype=np.int64), + ], ) force = op_module.prod_force( net_deriv_reshape, diff --git a/deepmd/descriptor/se_a.py b/deepmd/descriptor/se_a.py index 721bb0d534..c792db12bb 100644 --- a/deepmd/descriptor/se_a.py +++ b/deepmd/descriptor/se_a.py @@ -708,7 +708,10 @@ def prod_force_virial( tf.summary.histogram("net_derivative", net_deriv) net_deriv_reshape = tf.reshape( net_deriv, - [np.cast["int64"](-1), natoms[0] * np.cast["int64"](self.ndescrpt)], + [ + np.asarray(-1, dtype=np.int64), + natoms[0] * np.asarray(self.ndescrpt, dtype=np.int64), + ], ) force = op_module.prod_force_se_a( net_deriv_reshape, diff --git a/deepmd/descriptor/se_r.py b/deepmd/descriptor/se_r.py index ae926c339f..6b9cda9363 100644 --- a/deepmd/descriptor/se_r.py +++ b/deepmd/descriptor/se_r.py @@ -500,7 +500,10 @@ def prod_force_virial( tf.summary.histogram("net_derivative", net_deriv) net_deriv_reshape = tf.reshape( net_deriv, - [np.cast["int64"](-1), natoms[0] * np.cast["int64"](self.ndescrpt)], + [ + np.asarray(-1, dtype=np.int64), + natoms[0] * np.asarray(self.ndescrpt, dtype=np.int64), + ], ) force = op_module.prod_force_se_r( net_deriv_reshape, self.descrpt_deriv, self.nlist, natoms diff --git a/deepmd/descriptor/se_t.py b/deepmd/descriptor/se_t.py index d0c9fcbc2e..8957e88538 100644 --- a/deepmd/descriptor/se_t.py +++ b/deepmd/descriptor/se_t.py @@ -513,7 +513,10 @@ def prod_force_virial( [net_deriv] = tf.gradients(atom_ener, self.descrpt_reshape) net_deriv_reshape = tf.reshape( net_deriv, - [np.cast["int64"](-1), natoms[0] * np.cast["int64"](self.ndescrpt)], + [ + np.asarray(-1, dtype=np.int64), + natoms[0] * np.asarray(self.ndescrpt, dtype=np.int64), + ], ) force = op_module.prod_force_se_a( net_deriv_reshape, diff --git a/pyproject.toml b/pyproject.toml index 9b9d24dbef..af41e6ed68 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -222,7 +222,7 @@ ignore = "D413, D416, D203, D107, D213" profile = "black" force_grid_wrap = 1 -[tool.ruff] +[tool.ruff.lint] select = [ "E", # errors "F", # pyflakes @@ -250,7 +250,7 @@ ignore = [ ] ignore-init-module-imports = true -[tool.ruff.pydocstyle] +[tool.ruff.lint.pydocstyle] convention = "numpy" [tool.pytest.ini_options]