未验证 提交 c05feb90 编写于 作者: G gouzil 提交者: GitHub

[CodeStyle][B020] rename iterable and it's iterates when they have same name (#52128)

* [CodeStyle][B020] rename for

* [CodeStyle][B020] rename for
上级 2e92357b
......@@ -105,7 +105,7 @@ select = [
# "B017",
"B018",
"B019",
# "B020",
"B020",
"B021",
"B022",
# "B023",
......
......@@ -384,13 +384,13 @@ class Engine:
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:
......
......@@ -841,7 +841,7 @@ class OpTest(unittest.TestCase):
), "Duplicable {} should be set as list".format(name)
var_list = []
slot_name = name
for (name, np_value) in np_list[name]:
for (name, np_value) in np_list[slot_name]:
v = create_var(
np_value,
name,
......
......@@ -844,7 +844,7 @@ class OpTest(unittest.TestCase):
), "Duplicable {} should be set as list".format(name)
var_list = []
slot_name = name
for (name, np_value) in np_list[name]:
for (name, np_value) in np_list[slot_name]:
v = create_var(
np_value,
name,
......
......@@ -23,7 +23,7 @@ from paddle.hapi.progressbar import ProgressBar
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],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册