-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Strip trailing whitespace * Add B904 - use exc chaining * Format with black * Allow explicit re-raise This is useful when you want to explicitly modify the traceback, as done by Hypothesis and Trio * Disable raises check by default
- Loading branch information
Showing
5 changed files
with
74 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" | ||
Should emit: | ||
B904 - on lines 10, 11 and 16 | ||
""" | ||
|
||
try: | ||
raise ValueError | ||
except ValueError: | ||
if "abc": | ||
raise TypeError | ||
raise UserWarning | ||
except AssertionError: | ||
raise # Bare `raise` should not be an error | ||
except Exception as err: | ||
assert err | ||
raise Exception("No cause here...") | ||
except BaseException as base_err: | ||
# Might use this instead of bare raise with the `.with_traceback()` method | ||
raise base_err | ||
finally: | ||
raise Exception("Nothing to chain from, so no warning here") |
This file contains 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