Repository navigation
[CodeStyle][task 10] enable ruff B017 rule in python/paddle/base - #58185
Merged
SigureMo merged 8 commits intoOct 23, 2023
Merged
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
Collaborator
|
@gouzil 可以review了 |
gouzil
reviewed
Oct 22, 2023
| paddle.jit.enable_to_static(to_static) | ||
| if with_exception: | ||
| with self.assertRaises(BaseException): | ||
| with self.assertRaises(BaseException): # noqa: B017 |
Collaborator
There was a problem hiding this comment.
Suggested change
| with self.assertRaises(BaseException): # noqa: B017 | |
| with self.assertRaises(AssertionError): |
Collaborator
There was a problem hiding this comment.
这里从语义上来看,就是应该捕获各种异常的,noqa 是可以的,除非重构代码,不是传入 True/False 而是传入异常类型
gouzil
reviewed
Oct 22, 2023
| ] | ||
| for device in wrong_device: | ||
| with self.assertRaises(BaseException): | ||
| with self.assertRaises(BaseException): # noqa: B017 |
Collaborator
There was a problem hiding this comment.
Suggested change
| with self.assertRaises(BaseException): # noqa: B017 | |
| with self.assertRaises((ValueError, AssertionError)): |
Collaborator
There was a problem hiding this comment.
这四个 memory 的为什么是 ValueError, AssertionError 呢?这是能全部捕获的么?
gouzil
reviewed
Oct 22, 2023
| ] | ||
| for device in wrong_device: | ||
| with self.assertRaises(BaseException): | ||
| with self.assertRaises(BaseException): # noqa: B017 |
Collaborator
There was a problem hiding this comment.
Suggested change
| with self.assertRaises(BaseException): # noqa: B017 | |
| with self.assertRaises((ValueError, AssertionError)): |
gouzil
reviewed
Oct 22, 2023
| ] | ||
| for device in wrong_device: | ||
| with self.assertRaises(BaseException): | ||
| with self.assertRaises(BaseException): # noqa: B017 |
Collaborator
There was a problem hiding this comment.
Suggested change
| with self.assertRaises(BaseException): # noqa: B017 | |
| with self.assertRaises((ValueError, AssertionError)): |
gouzil
reviewed
Oct 22, 2023
| ] | ||
| for device in wrong_device: | ||
| with self.assertRaises(BaseException): | ||
| with self.assertRaises(BaseException): # noqa: B017 |
Collaborator
There was a problem hiding this comment.
Suggested change
| with self.assertRaises(BaseException): # noqa: B017 | |
| with self.assertRaises((ValueError, AssertionError)): |
gouzil
reviewed
Oct 22, 2023
gouzil
approved these changes
Oct 23, 2023
hitywt
pushed a commit
to hitywt/Paddle
that referenced
this pull request
Oct 24, 2023
jiahy0825
pushed a commit
to jiahy0825/Paddle
that referenced
this pull request
Oct 26, 2023
danleifeng
pushed a commit
to danleifeng/Paddle
that referenced
this pull request
Nov 14, 2023
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
Description
paddle.basecheck #57367Task 10 B017