Skip to content

Commit

Permalink
[CodeStyle][task 21] enable ruff C405 rule in python/paddle/base (#…
Browse files Browse the repository at this point in the history
…58056)

* 1012

* Update python/paddle/base/multiprocess_utils.py

Co-authored-by: gouzil <[email protected]>

* clean a duplicate `if`

---------

Co-authored-by: Nyakku Shigure <[email protected]>
Co-authored-by: gouzil <[email protected]>
  • Loading branch information
3 people authored Oct 16, 2023
1 parent b72175c commit 7913940
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 5 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ ignore = [
# Temporarily ignored
"python/paddle/base/**" = [
"UP030",
"C405",
"B019", # Confirmation required
"C416",
"F821",
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/base/backward.py
Original file line number Diff line number Diff line change
Expand Up @@ -2067,7 +2067,7 @@ def append_backward(
# not support double grad in control flow sub-block now.
if not is_in_control_flow:
if program._appending_grad_times > 1:
input_grad_names_set = set([_append_grad_suffix_(loss.name)])
input_grad_names_set = {_append_grad_suffix_(loss.name)}

# TODO: support _append_backward_ops_with_checkpoints_ in
# sub-block (control flow)
Expand Down
2 changes: 0 additions & 2 deletions python/paddle/base/dygraph/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,6 @@ def check_in_out(in_out_list, name):
no_grad_vars = []
elif isinstance(no_grad_vars, core.eager.Tensor):
no_grad_vars = [no_grad_vars]
elif isinstance(no_grad_vars, core.eager.Tensor):
no_grad_vars = [no_grad_vars]
elif isinstance(no_grad_vars, (list, tuple, set)):
no_grad_vars = list(no_grad_vars)
for var in no_grad_vars:
Expand Down
1 change: 0 additions & 1 deletion python/paddle/base/multiprocess_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def _func_register(function):
if not callable(function):
raise TypeError("%s is not callable object." % (function))
# check function object whether hash-able
set([function])
if function not in cls._registered_func_set:
atexit.register(_func_exectuor)
cls._registered_func_set.add(function)
Expand Down

0 comments on commit 7913940

Please sign in to comment.