-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[CodeStyle][F821] fix remaining F821 issues #47968
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][F821] fix remaining F821 issues #47968
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -59,7 +59,7 @@ def _get_item(t, i, np_dtype): | |||
raise ValueError("Not supported data type " + str(np_dtype)) | |||
|
|||
|
|||
def _set_item(t, i, e, np_dtype): | |||
def _set_item(t, i, e, np_dtype, place): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
69 行使用了 place
但没有传递进来,因此这里加一下 place
@@ -100,9 +100,9 @@ def calc_cost(self): | |||
|
|||
if dtype == paddle.float32 or dtype == paddle.int32: | |||
dtype_factor = 4 | |||
elif node.dtype == paddle.int64: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
和第一个 if 一样,这里应该就是 dtype
,不需要 node.dtype
@@ -299,6 +299,8 @@ def vlist_of_dict(x): | |||
print(paddle.jit.to_static(vlist_of_dict)(x)) | |||
|
|||
def test4(self): | |||
import numpy as np |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是否 import 不影响测试效果,因为 test2、3 也加了,所以这里就加上了
# Ignore undefined variables in CMake config and some dygraph_to_static tests | ||
.cmake-format.py: F821 | ||
python/paddle/fluid/tests/unittests/dygraph_to_static/test_loop.py: F821 | ||
python/paddle/fluid/tests/unittests/dygraph_to_static/test_closure_analysis.py: F821 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.cmake-format.py 配置里的 section 确实不存在,所以可以 ignore 掉
部分动转静单测需要测试的一些用例存在 F821 问题,所以也可以在这里直接 ignore 掉
This reverts commit 05b4c5e.
PR types
Others
PR changes
Others
Describe
本 PR 消除剩余全部 21 个 Flake8 F821 错误码(undefined variables)
noqa: F821
方式、配置里 ignore 掉本 PR 含配置修改,无需额外修改配置
Related links
name
cattidea/paddle-flake8-project#79parameterized
related code #47869