Skip to content
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

Add typing.TypeVarTuple, Unpack, assert_type #7501

Merged
merged 1 commit into from
Mar 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions stdlib/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ if sys.version_info >= (3, 11):
"Tuple",
"Type",
"TypeVar",
"TypeVarTuple",
"Union",
"Unpack",
"AbstractSet",
"ByteString",
"Container",
Expand Down Expand Up @@ -80,6 +82,7 @@ if sys.version_info >= (3, 11):
"TextIO",
"AnyStr",
"assert_never",
"assert_type",
"cast",
"final",
"get_args",
Expand Down Expand Up @@ -524,6 +527,12 @@ if sys.version_info >= (3, 8):
if sys.version_info >= (3, 11):
Self: _SpecialForm
Never: _SpecialForm = ...
Unpack: _SpecialForm

class TypeVarTuple:
__name__: str
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anticipating python/cpython#31954.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we wait until that's merged before merging this, or do you reckon we're good to go?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to wait I think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Converting this to a draft for now so it doesn't get accidentally merged in the meantime)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged the CPython change

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I merged this one :)

def __init__(self, name: str) -> None: ...
def __iter__(self) -> Any: ...

if sys.version_info < (3, 7):
class GenericMeta(type): ...
Expand Down Expand Up @@ -1176,6 +1185,7 @@ def cast(typ: object, val: Any) -> Any: ...
if sys.version_info >= (3, 11):
def reveal_type(__obj: _T) -> _T: ...
def assert_never(__arg: Never) -> Never: ...
def assert_type(__val: _T, __typ: Any) -> _T: ...

# Type constructors

Expand Down