From 80b5f3a1d76fc9b5a383f19f5b288d148e8b27d9 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 16 Mar 2022 21:14:35 -0700 Subject: [PATCH] Add typing.TypeVarTuple, Unpack, assert_type python/cpython#31021 and python/cpython#30843. --- stdlib/typing.pyi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 457ad21b72d2..fe2a80f04c4d 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -28,7 +28,9 @@ if sys.version_info >= (3, 11): "Tuple", "Type", "TypeVar", + "TypeVarTuple", "Union", + "Unpack", "AbstractSet", "ByteString", "Container", @@ -80,6 +82,7 @@ if sys.version_info >= (3, 11): "TextIO", "AnyStr", "assert_never", + "assert_type", "cast", "final", "get_args", @@ -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 + def __init__(self, name: str) -> None: ... + def __iter__(self) -> Any: ... if sys.version_info < (3, 7): class GenericMeta(type): ... @@ -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