From 55cc5ed9afc64a82ba23a2c9967cb58683ad5cc9 Mon Sep 17 00:00:00 2001 From: Kaedeharai <127716752+Kaedeharai@users.noreply.github.com> Date: Wed, 18 Oct 2023 10:43:49 +0800 Subject: [PATCH] [CodeStyle][task 9] enable Ruff UP030 rule in python/paddle/base (#58162) --- pyproject.toml | 1 - python/paddle/base/layers/layer_function_generator.py | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 393d46b6f8a5f..27a2fc6c7d935 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,7 +106,6 @@ ignore = [ # Temporarily ignored "python/paddle/base/**" = [ - "UP030", "B019", # Confirmation required "C416", "F821", diff --git a/python/paddle/base/layers/layer_function_generator.py b/python/paddle/base/layers/layer_function_generator.py index f77d26ac50a5f..2cec3b7e58fa1 100644 --- a/python/paddle/base/layers/layer_function_generator.py +++ b/python/paddle/base/layers/layer_function_generator.py @@ -193,7 +193,7 @@ def infer_and_check_dtype(op_proto, *args, **kwargs): dtype = each.dtype elif dtype != each.dtype: raise ValueError( - "operator {0} must input same dtype. {1} vs {2}".format( + "operator {} must input same dtype. {} vs {}".format( op_type, dtype, each.dtype ) ) @@ -337,8 +337,8 @@ def func(x, name=None): func.__name__ = inplace_op_type func.__doc__ = """ -Inplace version of ``{0}`` API, the output Tensor will be inplaced with input ``x``. -Please refer to :ref:`api_base_layers_{1}`. +Inplace version of ``{}`` API, the output Tensor will be inplaced with input ``x``. +Please refer to :ref:`api_base_layers_{}`. """.format( origin_op_type, origin_op_type )