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][B020] rename iterable and it's iterates when they have same name #52128

Merged
merged 2 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ select = [
# "B017",
"B018",
"B019",
# "B020",
"B020",
"B021",
"B022",
# "B023",
Expand Down
8 changes: 4 additions & 4 deletions python/paddle/distributed/auto_parallel/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,13 @@ def _prepare_feed(self, data, user_feeds, mode):
if data is not None:
if isinstance(data, (list, tuple)):
if len(data) == 1 and isinstance(data[0], dict):
for name, data in data[0].items():
feeds[name] = data
for name, value in data[0].items():
feeds[name] = value
else:
raise ValueError("Unsupported data {}".format(data))
elif isinstance(data, dict):
for name, data in data.items():
feeds[name] = data
for name, value in data.items():
feeds[name] = value
else:
raise ValueError("Unsupported data {}".format(data))
if user_feeds is not None:
Expand Down
6 changes: 3 additions & 3 deletions python/paddle/fluid/tests/unittests/eager_op_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,17 +842,17 @@ def create_var(
), "Duplicable {} should be set as list".format(name)
var_list = []
slot_name = name
for (name, np_value) in np_list[name]:
for (np_key, np_value) in np_list[name]:
gouzil marked this conversation as resolved.
Show resolved Hide resolved
v = create_var(
np_value,
name,
np_key,
is_input,
if_return_inputs_grad_dict,
self.is_calc_ref,
)
var_list.append(v)
if if_return_inputs_grad_dict:
inputs_grad_dict[name] = v
inputs_grad_dict[np_key] = v
var_dict[slot_name] = var_list
else:
nplist_value_temp = None
Expand Down
6 changes: 3 additions & 3 deletions python/paddle/fluid/tests/unittests/op_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,17 +845,17 @@ def create_var(
), "Duplicable {} should be set as list".format(name)
var_list = []
slot_name = name
for (name, np_value) in np_list[name]:
for (np_key, np_value) in np_list[name]:
v = create_var(
np_value,
name,
np_key,
is_input,
if_return_inputs_grad_dict,
self.is_calc_ref,
)
var_list.append(v)
if if_return_inputs_grad_dict:
inputs_grad_dict[name] = v
inputs_grad_dict[np_key] = v
var_dict[slot_name] = var_list
else:
nplist_value_temp = None
Expand Down
2 changes: 1 addition & 1 deletion test/legacy_test/test_progressbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class TestProgressBar(unittest.TestCase):
def prog_bar(self, num, epoch, width, verbose=1):
for epoch in range(epoch):
for i in range(epoch):
progbar = ProgressBar(num, verbose=verbose)
values = [
['loss', 50.341673],
Expand Down