From 13b684c0c7f3da062e34ec047ace46db9519a173 Mon Sep 17 00:00:00 2001 From: Zeyang Lin <4020306+linzeyang@users.noreply.github.com> Date: Mon, 25 Sep 2023 17:58:41 +0800 Subject: [PATCH] CodeStyle Task No.27 - Enable Ruff B009 rule in `python/paddle/base` --- pyproject.toml | 1 - python/paddle/base/dygraph/tensor_patch_methods.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 088841222c7d0..50974c7a9de6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -110,7 +110,6 @@ ignore = [ "UP030", "C405", "B004", - "B009", "B016", "B019", # Confirmation required "C411", diff --git a/python/paddle/base/dygraph/tensor_patch_methods.py b/python/paddle/base/dygraph/tensor_patch_methods.py index 506b8edfe88b1..27629b35845a7 100644 --- a/python/paddle/base/dygraph/tensor_patch_methods.py +++ b/python/paddle/base/dygraph/tensor_patch_methods.py @@ -1010,7 +1010,7 @@ def __hash__(self): # NOTE(zhiqiu): pybind11 will set a default __str__ method of enum class. # So, we need to overwrite it to a more readable one. # See details in https://github.com/pybind/pybind11/issues/2537. - origin = getattr(core.VarDesc.VarType, "__str__") + origin = core.VarDesc.VarType.__str__ def dtype_str(dtype): if dtype in _PADDLE_DTYPE_2_NUMPY_DTYPE: