Skip to content

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

Merged
luotao1 merged 2 commits into
PaddlePaddle:developfrom
gouzil:codeStyle-b020
Mar 28, 2023
Merged

luotao1 merged 2 commits into
PaddlePaddle:developfrom
gouzil:codeStyle-b020

Conversation

@gouzil

@gouzil gouzil commented Mar 24, 2023

Copy link
Copy Markdown
Collaborator

PR types

Others

PR changes

Others

Describe

触发的原因是重名

官方介绍:
B020 Loop control variable {name} overrides iterable it iterates

修复方法:

for name, data in data[0].items():
    feeds[name] = data

修复后:

for name, value in data[0].items():
    feeds[name] = value

是否可以引入本 rule:✅ 如上所述,可以引入
是否可引入自动修复:❌手动修复

Related links

@paddle-bot

paddle-bot Bot commented Mar 24, 2023

Copy link
Copy Markdown

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册。
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@gouzil gouzil changed the title [CodeStyle][B020] rename for [CodeStyle][B020] Loop control variable {name} overrides iterable it iterates; Modify the for loop name Mar 25, 2023
@SigureMo SigureMo changed the title [CodeStyle][B020] Loop control variable {name} overrides iterable it iterates; Modify the for loop name [CodeStyle][B020] rename iterable and it's iterates when they have same name Mar 25, 2023

@SigureMo SigureMo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@luotao1
luotao1 merged commit c05feb9 into PaddlePaddle:develop Mar 28, 2023
@gouzil
gouzil deleted the codeStyle-b020 branch May 15, 2023 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants