未验证 提交 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 = [ ...@@ -105,7 +105,7 @@ select = [
# "B017", # "B017",
"B018", "B018",
"B019", "B019",
# "B020", "B020",
"B021", "B021",
"B022", "B022",
# "B023", # "B023",
......
...@@ -384,13 +384,13 @@ class Engine: ...@@ -384,13 +384,13 @@ class Engine:
if data is not None: if data is not None:
if isinstance(data, (list, tuple)): if isinstance(data, (list, tuple)):
if len(data) == 1 and isinstance(data[0], dict): if len(data) == 1 and isinstance(data[0], dict):
for name, data in data[0].items(): for name, value in data[0].items():
feeds[name] = data feeds[name] = value
else: else:
raise ValueError("Unsupported data {}".format(data)) raise ValueError("Unsupported data {}".format(data))
elif isinstance(data, dict): elif isinstance(data, dict):
for name, data in data.items(): for name, value in data.items():
feeds[name] = data feeds[name] = value
else: else:
raise ValueError("Unsupported data {}".format(data)) raise ValueError("Unsupported data {}".format(data))
if user_feeds is not None: if user_feeds is not None:
......
...@@ -841,7 +841,7 @@ class OpTest(unittest.TestCase): ...@@ -841,7 +841,7 @@ class OpTest(unittest.TestCase):
), "Duplicable {} should be set as list".format(name) ), "Duplicable {} should be set as list".format(name)
var_list = [] var_list = []
slot_name = name slot_name = name
for (name, np_value) in np_list[name]: for (name, np_value) in np_list[slot_name]:
v = create_var( v = create_var(
np_value, np_value,
name, name,
......
...@@ -844,7 +844,7 @@ class OpTest(unittest.TestCase): ...@@ -844,7 +844,7 @@ class OpTest(unittest.TestCase):
), "Duplicable {} should be set as list".format(name) ), "Duplicable {} should be set as list".format(name)
var_list = [] var_list = []
slot_name = name slot_name = name
for (name, np_value) in np_list[name]: for (name, np_value) in np_list[slot_name]:
v = create_var( v = create_var(
np_value, np_value,
name, name,
......
...@@ -23,7 +23,7 @@ from paddle.hapi.progressbar import ProgressBar ...@@ -23,7 +23,7 @@ from paddle.hapi.progressbar import ProgressBar
class TestProgressBar(unittest.TestCase): class TestProgressBar(unittest.TestCase):
def prog_bar(self, num, epoch, width, verbose=1): def prog_bar(self, num, epoch, width, verbose=1):
for epoch in range(epoch): for i in range(epoch):
progbar = ProgressBar(num, verbose=verbose) progbar = ProgressBar(num, verbose=verbose)
values = [ values = [
['loss', 50.341673], ['loss', 50.341673],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册