Repository navigation
[CodeStyle][E711] use is/is not for comparison with None - #47452
Merged
Merged
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
is/is not for comparison with Noneis/is not for comparison with None
Collaborator
是否考虑将修复工具引入precommit配置? |
Collaborator
Author
ast-grep 的话暂时不考虑,一方面它并不是 python 生态的,而是 Rust / Node.js 生态的工具,目前不方便集成,另一方面它刚刚开发几个月,非常不成熟 |
luotao1
previously approved these changes
Nov 1, 2022
luotao1
reviewed
Nov 1, 2022
| 'dim': axis if axis is not None and axis != [] and axis != () else [0], | ||
| 'keep_dim': keepdim, | ||
| 'reduce_all': reduce_all_flag, | ||
| } |
Collaborator
There was a problem hiding this comment.
2022-10-31 18:16:21 0. APIs without core.ops:
2022-10-31 18:16:21 paddle.fluid.layers.nn.reduce_any
2022-10-31 18:16:21 You must have one RD (JiabinYang (Recommend) or wanghuancoder, phlrain) approval for the api change for the opreator-related api without '_C_ops'.
2022-10-31 18:16:21 For more details, please click [https://github.com/PaddlePaddle/Paddle/wiki/paddle_api_development_manual.md]
请 @wanghuancoder @JiabinYang review
Collaborator
Collaborator
Author
Collaborator
确实如此。后续可以在 代码风格检查指南 里加一下常见错误码(无法自动格式化) 的处理方式。 |
Collaborator
|
请解决下冲突 |
Collaborator
Author
已解决~ |
luotao1
approved these changes
Nov 1, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR types
Others
PR changes
Others
Describe
解决 Flake8 E711 问题(comparison to None should be ‘if cond is None:’)
x == None->x is Nonex != None->x is not None并调整单测中的相关使用(与 None 相关的比较),如
self.assertTrue(x is None)->self.assertIsNone(x),可以优化报错信息:全部替换如下:
self.assertTrue(x is None)->self.assertIsNone(x)self.assertTrue(x is not None)->self.assertIsNotNone(x)self.assertFalse(x is None)->self.assertIsNotNone(x)self.assertFalse(x is not None)->self.assertIsNone(x)(无此情况)self.assertEqual(x, None)->self.assertIsNone(x)self.assertNotEqual(x, None)->self.assertIsNotNone(x)具体所使用工具及命令如下:
Related links