-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh-104504: cases generator: Add
--warn-unreachable
to the mypy conf…
…ig (#108112)
- Loading branch information
1 parent
6323bc3
commit 05ef4ca
Showing
4 changed files
with
36 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"""Backports from newer versions of the typing module. | ||
We backport these features here so that Python can still build | ||
while using an older Python version for PYTHON_FOR_REGEN. | ||
""" | ||
|
||
from typing import NoReturn | ||
|
||
|
||
def assert_never(obj: NoReturn) -> NoReturn: | ||
"""Statically assert that a line of code is unreachable. | ||
Backport of typing.assert_never (introduced in Python 3.11). | ||
""" | ||
raise AssertionError(f"Expected code to be unreachable, but got: {obj}") |
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