-
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][task 10] enable ruff B017 rule in python/paddle/base #58185
Changes from all commits
e6f2c59
023921e
bbcf3c7
17b9275
e071188
899ca97
2090f9b
e37064d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -61,10 +61,10 @@ def test_max_memory_allocated_exception(self): | |||||
"gpu1", | ||||||
] | ||||||
for device in wrong_device: | ||||||
with self.assertRaises(BaseException): | ||||||
with self.assertRaises(BaseException): # noqa: B017 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这四个 memory 的为什么是 |
||||||
max_memory_allocated(device) | ||||||
else: | ||||||
with self.assertRaises(BaseException): | ||||||
with self.assertRaises(ValueError): | ||||||
max_memory_allocated() | ||||||
|
||||||
|
||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -61,10 +61,10 @@ def test_max_memory_reserved_exception(self): | |||||
"gpu1", | ||||||
] | ||||||
for device in wrong_device: | ||||||
with self.assertRaises(BaseException): | ||||||
with self.assertRaises(BaseException): # noqa: B017 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
max_memory_reserved(device) | ||||||
else: | ||||||
with self.assertRaises(BaseException): | ||||||
with self.assertRaises(ValueError): | ||||||
max_memory_reserved() | ||||||
|
||||||
|
||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -46,10 +46,10 @@ def test_memory_allocated_exception(self): | |||||
"gpu1", | ||||||
] | ||||||
for device in wrong_device: | ||||||
with self.assertRaises(BaseException): | ||||||
with self.assertRaises(BaseException): # noqa: B017 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
memory_allocated(device) | ||||||
else: | ||||||
with self.assertRaises(BaseException): | ||||||
with self.assertRaises(ValueError): | ||||||
memory_allocated() | ||||||
|
||||||
|
||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -46,10 +46,10 @@ def test_memory_reserved_exception(self): | |||||
"gpu1", | ||||||
] | ||||||
for device in wrong_device: | ||||||
with self.assertRaises(BaseException): | ||||||
with self.assertRaises(BaseException): # noqa: B017 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
memory_reserved(device) | ||||||
else: | ||||||
with self.assertRaises(BaseException): | ||||||
with self.assertRaises(ValueError): | ||||||
memory_reserved() | ||||||
|
||||||
|
||||||
|
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.
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.
这里从语义上来看,就是应该捕获各种异常的,noqa 是可以的,除非重构代码,不是传入 True/False 而是传入异常类型
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.
OK