-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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][E401][F811] remove redefined imports and variables #48538
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
This comment was marked as off-topic.
This comment was marked as off-topic.
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.
@luotao1 这个 PR 可以开始 review 啦~
@@ -71,7 +71,7 @@ def test_sub_scalar(self): | |||
np.testing.assert_allclose(a_np - 10, b_np, rtol=1e-05) | |||
|
|||
@prog_scope() | |||
def test_radd_scalar(self): | |||
def test_rsub_scalar(self): |
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.
这里测试的是 __rsub__
但和上面 __radd__
重名了,因此修改前 test_radd_scalar
其实没有跑,里面有一个忘记 unpack 的 b_np
,就 unpack 了下~
@@ -184,7 +184,7 @@ def func_test_create_param_lr_with_no_1_value_for_coverage(self): | |||
z.backward() | |||
opt.step() | |||
|
|||
def func_test_create_param_lr_with_no_1_value_for_coverage(self): | |||
def test_create_param_lr_with_no_1_value_for_coverage(self): |
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.
明显的命名错误,导致这里没有被测试
with _test_eager_guard(): | ||
self.func_tensor_str_bf16() | ||
self.func_tensor_str_bf16() | ||
|
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.
和上面 1378-1381 完全一致,因此移除
@@ -117,7 +117,7 @@ def _elementwise_mul_flops(input_shapes, attrs): | |||
|
|||
|
|||
@register_flops("elementwise_div") | |||
def _elementwise_mul_flops(input_shapes, attrs): | |||
def _elementwise_div_flops(input_shapes, attrs): |
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.
明显的命名错误
python/paddle/fluid/tests/unittests/test_activation_nn_grad.py: F811 | ||
python/paddle/fluid/tests/unittests/test_lstm_cudnn_op.py: F811 | ||
python/paddle/fluid/tests/unittests/test_matmul_v2_op.py: F811 | ||
python/paddle/fluid/tests/unittests/test_rrelu_op.py: F811 |
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.
这五个单测 F811 问题导致隐藏了一些错误,修复时暴露了这些问题并需要修复下,可能需要修改下单测,因此拆分到之后 PR 处理
这个 PR 里处理的都是一些显而易见的错误~
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.
LGTM
PR types
Others
PR changes
Others
Describe
本 PR 消除 E401(multiple imports on one line)和 F811(redefinition of unused
name
from lineN
)错误码E401 就是多个 import 在一行(仅仅是
import
不包含from import
,后者推荐写在一起),拆开即可,这个本就极少,因此不单独作为一个 PR 了F811 绝大多数是重复的 import,isort 引入过程中已经解决了绝大部分,剩下的根据情况手动解决,主要包含以下问题:
noqa
Related links
name
from lineN
cattidea/paddle-flake8-project#78