Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CodeStyle][Ruff][BUAA][A-[21-25]] Fix ruff Q003 diagnostic for 5 files in python/paddle/ and test/ #67534

Merged
merged 19 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions python/paddle/nn/functional/pooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ def _update_padding_nd(padding, num_dims, channel_last=False, ceil_mode=False):
if padding == "VALID":
if ceil_mode is not False:
raise ValueError(
"When Attr(padding) is \"VALID\", Attr(ceil_mode) must be False. "
"Received ceil_mode: True."
'When Attr(padding) is "VALID", Attr(ceil_mode) must be False. '
'Received ceil_mode: True.'
)

padding_algorithm = "VALID"
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/optimizer/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ def _global_learning_rate(self, program=None):
def _append_optimize_op(self, block, param_and_grad):
"""append optimize operator to block and return all the added optimize_op"""
raise NotImplementedError(
"Class \"Optimizer\" connot be used directly as an optimizer, please use its subclasses such as \"Adam\""
'Class "Optimizer" connot be used directly as an optimizer, please use its subclasses such as "Adam"'
)

def _create_param_lr(self, param_and_grad):
Expand Down
4 changes: 2 additions & 2 deletions test/cinn/test_paddle_model_convertor.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
parser.add_argument(
"-m",
"--model_filename",
help="The filename of model file, default \"__model__\"",
help='The filename of model file, default "__model__"',
type=str,
default="__model__",
)
Expand Down Expand Up @@ -103,7 +103,7 @@ def setUp(self):
self.params_filename = args.params_filename

logger.info(
f"Run Model From \"{self.model_dir}\", which model filename is \"{self.model_filename}\", and parameter filename is \"{self.params_filename}\""
f'Run Model From "{self.model_dir}", which model filename is "{self.model_filename}", and parameter filename is "{self.params_filename}"'
)

self.load_paddle_program()
Expand Down
8 changes: 4 additions & 4 deletions test/legacy_test/op.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,15 @@ def __call__(self, *args, **kwargs):
if "type" in kwargs:
if len(args) != 0:
raise ValueError(
"Except the argument \"type\","
"all of the other arguments should be keyword arguments."
'Except the argument "type",'
'all of the other arguments should be keyword arguments.'
)
t = kwargs.pop("type")
else:
if len(args) != 1:
raise ValueError(
"Except the argument \"type\","
"all of the other arguments should be keyword arguments."
'Except the argument "type",'
'all of the other arguments should be keyword arguments.'
)
t = args[0]

Expand Down
2 changes: 1 addition & 1 deletion test/legacy_test/test_operator_desc.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_error_type(self):
self.assertFail()
except ValueError as a_err:
self.assertEqual(
str(a_err), "Operator \"no_such_op\" has not been registered."
str(a_err), 'Operator "no_such_op" has not been registered.'
)

def test_op_desc_creation(self):
Expand Down