generated from ni/github-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 3
_typing: Redirect more typing classes and hide _typing from doc gen #19
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
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f470ba1
_typing: Redirect more typing classes
bkeryan f608db5
docs: Work around autoapi conditional definition bug
bkeryan b7425ce
Hide _typing from doc gen by using it as an ImportError fallback
bkeryan cea745b
github: Use Python 3.13.3 for docs
bkeryan 0e123ca
Revert "docs: Work around autoapi conditional definition bug"
bkeryan 7148b85
waveform: Fix lint error
bkeryan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ on: | |
|
|
||
| env: | ||
| POETRY_VERSION: 1.8.2 | ||
| PYTHON_VERSION: 3.11.9 | ||
| PYTHON_VERSION: 3.13.3 | ||
|
|
||
| jobs: | ||
| check_docs: | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,41 +1,133 @@ | ||
| """Single source for typing backports to avoid depending on typing_extensions at run time.""" | ||
| """Version-specific compatibility shims for the standard `typing` module. | ||
|
|
||
| For `typing` symbols that require Python 3.10 or later, this submodule redirects to the standard | ||
| `typing` module (when appropriate), the `typing_extensions` package, or provides a minimial stub | ||
| implementation for run time. This allows us to use new typing features without littering the rest of | ||
| our code with conditionals or making our Python packages depend on `typing_extenions` at run time. | ||
|
|
||
| For `typing` symbols that are supported in Python 3.9, you do not need this submodule. Import these | ||
| symbols directly from the standard `typing` module. | ||
|
|
||
| This submodule is vendored in multiple packages (nitypes, nipanel, etc.) to avoid compatibility | ||
| breakage when upgrading these packages. | ||
|
|
||
| Do not add project-specific types to this submodule. | ||
|
|
||
| Many of these symbosl are references to `None` at run time. Clients of this submodule should use | ||
| `from __future__ import annotations` to avoid parsing type hints at run time. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import sys | ||
| from typing import TYPE_CHECKING | ||
|
|
||
| if sys.version_info >= (3, 10): | ||
| from typing import TypeAlias | ||
| from typing import ( | ||
| Concatenate, | ||
| ParamSpec, | ||
| ParamSpecArgs, | ||
| ParamSpecKwargs, | ||
| TypeAlias, | ||
| TypeGuard, | ||
| ) | ||
| elif TYPE_CHECKING: | ||
| from typing_extensions import TypeAlias | ||
| from typing_extensions import ( | ||
| Concatenate, | ||
| ParamSpec, | ||
| ParamSpecArgs, | ||
| ParamSpecKwargs, | ||
| TypeAlias, | ||
| TypeGuard, | ||
| ) | ||
| else: | ||
| TypeAlias = None | ||
| Concatenate = ParamSpecArgs = ParamSpecKwargs = TypeAlias = TypeGuard = None | ||
|
|
||
| def ParamSpec( # noqa: D103, N802 - Missing docstring, wrong case | ||
| name, *, bound=None, covariant=False, contravariant=False | ||
| ): | ||
| return None | ||
|
|
||
|
|
||
| if sys.version_info >= (3, 11): | ||
| from typing import Self, assert_type | ||
| from typing import ( | ||
| LiteralString, | ||
| Never, | ||
| NotRequired, | ||
| Required, | ||
| Self, | ||
| TypeVarTuple, | ||
| Unpack, | ||
| assert_never, | ||
| assert_type, | ||
| reveal_type, | ||
| ) | ||
| elif TYPE_CHECKING: | ||
| from typing_extensions import Self, assert_type | ||
| from typing_extensions import ( | ||
| LiteralString, | ||
| Never, | ||
| NotRequired, | ||
| Required, | ||
| Self, | ||
| TypeVarTuple, | ||
| Unpack, | ||
| assert_never, | ||
| assert_type, | ||
| reveal_type, | ||
| ) | ||
| else: | ||
| Self = None | ||
| LiteralString = Never = NotRequired = Required = Self = Unpack = None | ||
|
|
||
| def assert_never(arg, /): # noqa: D103 - Missing docstring in public function | ||
| pass | ||
|
|
||
| def assert_type(val, typ, /): # noqa: D103 - Missing docstring in public function | ||
| pass | ||
|
|
||
| def reveal_type(obj, /): # noqa: D103 - Missing docstring in public function | ||
| pass | ||
|
|
||
| def TypeVarTuple(name): # noqa: D103, N802 - Missing docstring, wrong case | ||
| return None | ||
|
|
||
|
|
||
| if sys.version_info >= (3, 12): | ||
| from typing import override | ||
| from typing import TypeAliasType, override | ||
| elif TYPE_CHECKING: | ||
| from typing_extensions import override | ||
| from typing_extensions import TypeAliasType, override | ||
| else: | ||
| TypeAliasType = None | ||
|
|
||
| def override(arg, /): # noqa: D103 - Missing docstring in public function | ||
| return arg | ||
|
|
||
|
|
||
| if sys.version_info >= (3, 13): | ||
| from typing import ReadOnly, TypeIs | ||
| elif TYPE_CHECKING: | ||
| from typing_extensions import ReadOnly, TypeIs | ||
| else: | ||
| ReadOnly = TypeIs = None | ||
|
|
||
| __all__ = [ | ||
| "assert_never", | ||
| "assert_type", | ||
| "Concatenate", | ||
| "LiteralString", | ||
| "Never", | ||
| "NotRequired", | ||
| "override", | ||
| "ParamSpec", | ||
| "ParamSpecArgs", | ||
| "ParamSpecKwargs", | ||
| "ReadOnly", | ||
| "Required", | ||
| "reveal_type", | ||
| "Self", | ||
| "TypeAlias", | ||
| "TypeAliasType", | ||
| "TypeGuard", | ||
| "TypeIs", | ||
| "TypeVarTuple", | ||
| "Unpack", | ||
| ] |
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
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.