Update typing_extensions for 4.7.* (#10344)

This commit is contained in:
Jelle Zijlstra
2023-07-22 03:51:22 -08:00
committed by GitHub
parent 65cb3735ec
commit f577c4c133
7 changed files with 152 additions and 70 deletions

View File

@@ -956,3 +956,7 @@ if sys.version_info >= (3, 12):
if sys.version_info >= (3, 10):
def __or__(self, right: Any) -> _SpecialForm: ...
def __ror__(self, left: Any) -> _SpecialForm: ...
if sys.version_info >= (3, 13):
def is_protocol(__tp: type) -> bool: ...
def get_protocol_members(__tp: type) -> frozenset[str]: ...

View File

@@ -4,26 +4,52 @@ import sys
import typing
from _collections_abc import dict_items, dict_keys, dict_values
from _typeshed import IdentityFunction, Incomplete
from collections.abc import Iterable
from typing import ( # noqa: Y022,Y039
from typing import ( # noqa: Y022,Y037,Y038,Y039
IO as IO,
TYPE_CHECKING as TYPE_CHECKING,
AbstractSet as AbstractSet,
Any as Any,
AnyStr as AnyStr,
AsyncContextManager as AsyncContextManager,
AsyncGenerator as AsyncGenerator,
AsyncIterable as AsyncIterable,
AsyncIterator as AsyncIterator,
Awaitable as Awaitable,
Callable,
BinaryIO as BinaryIO,
Callable as Callable,
ChainMap as ChainMap,
ClassVar as ClassVar,
Collection as Collection,
Container as Container,
ContextManager as ContextManager,
Coroutine as Coroutine,
Counter as Counter,
DefaultDict as DefaultDict,
Deque as Deque,
Mapping,
Dict as Dict,
ForwardRef as ForwardRef,
FrozenSet as FrozenSet,
Generator as Generator,
Generic as Generic,
Hashable as Hashable,
ItemsView as ItemsView,
Iterable as Iterable,
Iterator as Iterator,
KeysView as KeysView,
List as List,
Mapping as Mapping,
MappingView as MappingView,
Match as Match,
MutableMapping as MutableMapping,
MutableSequence as MutableSequence,
MutableSet as MutableSet,
NoReturn as NoReturn,
Sequence,
Optional as Optional,
Pattern as Pattern,
Reversible as Reversible,
Sequence as Sequence,
Set as Set,
Sized as Sized,
SupportsAbs as SupportsAbs,
SupportsBytes as SupportsBytes,
SupportsComplex as SupportsComplex,
@@ -31,8 +57,15 @@ from typing import ( # noqa: Y022,Y039
SupportsInt as SupportsInt,
SupportsRound as SupportsRound,
Text as Text,
TextIO as TextIO,
Tuple as Tuple,
Type as Type,
Union as Union,
ValuesView as ValuesView,
_Alias,
cast as cast,
no_type_check as no_type_check,
no_type_check_decorator as no_type_check_decorator,
overload as overload,
type_check_only,
)
@@ -109,6 +142,45 @@ __all__ = [
"get_original_bases",
"get_overloads",
"get_type_hints",
"AbstractSet",
"AnyStr",
"BinaryIO",
"Callable",
"Collection",
"Container",
"Dict",
"ForwardRef",
"FrozenSet",
"Generator",
"Generic",
"Hashable",
"IO",
"ItemsView",
"Iterable",
"Iterator",
"KeysView",
"List",
"Mapping",
"MappingView",
"Match",
"MutableMapping",
"MutableSequence",
"MutableSet",
"Optional",
"Pattern",
"Reversible",
"Sequence",
"Set",
"Sized",
"TextIO",
"Tuple",
"Union",
"ValuesView",
"cast",
"get_protocol_members",
"is_protocol",
"no_type_check",
"no_type_check_decorator",
]
_T = typing.TypeVar("_T")
@@ -403,3 +475,9 @@ else:
# Not actually a Protocol at runtime; see
# https://github.com/python/typeshed/issues/10224 for why we're defining it this way
def __buffer__(self, __flags: int) -> memoryview: ...
if sys.version_info >= (3, 13):
from typing import get_protocol_members as get_protocol_members, is_protocol as is_protocol
else:
def is_protocol(__tp: type) -> bool: ...
def get_protocol_members(__tp: type) -> frozenset[str]: ...