Skip to content

Commit 373b73a

Browse files
authored
[Release 1.5] Update typing_extensions stubs (#15745)
1 parent a6bd80e commit 373b73a

File tree

2 files changed

+87
-5
lines changed

2 files changed

+87
-5
lines changed

mypy/typeshed/stdlib/typing.pyi

+4
Original file line numberDiff line numberDiff line change
@@ -952,3 +952,7 @@ if sys.version_info >= (3, 12):
952952
if sys.version_info >= (3, 10):
953953
def __or__(self, right: Any) -> _SpecialForm: ...
954954
def __ror__(self, left: Any) -> _SpecialForm: ...
955+
956+
if sys.version_info >= (3, 13):
957+
def is_protocol(__tp: type) -> bool: ...
958+
def get_protocol_members(__tp: type) -> frozenset[str]: ...

mypy/typeshed/stdlib/typing_extensions.pyi

+83-5
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,68 @@ import sys
44
import typing
55
from _collections_abc import dict_items, dict_keys, dict_values
66
from _typeshed import IdentityFunction, Incomplete
7-
from collections.abc import Iterable
8-
from typing import ( # noqa: Y022,Y039
7+
from typing import ( # noqa: Y022,Y037,Y038,Y039
8+
IO as IO,
99
TYPE_CHECKING as TYPE_CHECKING,
10+
AbstractSet as AbstractSet,
1011
Any as Any,
12+
AnyStr as AnyStr,
1113
AsyncContextManager as AsyncContextManager,
1214
AsyncGenerator as AsyncGenerator,
1315
AsyncIterable as AsyncIterable,
1416
AsyncIterator as AsyncIterator,
1517
Awaitable as Awaitable,
16-
Callable,
18+
BinaryIO as BinaryIO,
19+
Callable as Callable,
1720
ChainMap as ChainMap,
1821
ClassVar as ClassVar,
22+
Collection as Collection,
23+
Container as Container,
1924
ContextManager as ContextManager,
2025
Coroutine as Coroutine,
2126
Counter as Counter,
2227
DefaultDict as DefaultDict,
2328
Deque as Deque,
24-
Mapping,
29+
Dict as Dict,
30+
ForwardRef as ForwardRef,
31+
FrozenSet as FrozenSet,
32+
Generator as Generator,
33+
Generic as Generic,
34+
Hashable as Hashable,
35+
ItemsView as ItemsView,
36+
Iterable as Iterable,
37+
Iterator as Iterator,
38+
KeysView as KeysView,
39+
List as List,
40+
Mapping as Mapping,
41+
MappingView as MappingView,
42+
Match as Match,
43+
MutableMapping as MutableMapping,
44+
MutableSequence as MutableSequence,
45+
MutableSet as MutableSet,
2546
NoReturn as NoReturn,
26-
Sequence,
47+
Optional as Optional,
48+
Pattern as Pattern,
49+
Reversible as Reversible,
50+
Sequence as Sequence,
51+
Set as Set,
52+
Sized as Sized,
2753
SupportsAbs as SupportsAbs,
2854
SupportsBytes as SupportsBytes,
2955
SupportsComplex as SupportsComplex,
3056
SupportsFloat as SupportsFloat,
3157
SupportsInt as SupportsInt,
3258
SupportsRound as SupportsRound,
3359
Text as Text,
60+
TextIO as TextIO,
61+
Tuple as Tuple,
3462
Type as Type,
63+
Union as Union,
64+
ValuesView as ValuesView,
3565
_Alias,
66+
cast as cast,
67+
no_type_check as no_type_check,
68+
no_type_check_decorator as no_type_check_decorator,
3669
overload as overload,
3770
type_check_only,
3871
)
@@ -109,6 +142,45 @@ __all__ = [
109142
"get_original_bases",
110143
"get_overloads",
111144
"get_type_hints",
145+
"AbstractSet",
146+
"AnyStr",
147+
"BinaryIO",
148+
"Callable",
149+
"Collection",
150+
"Container",
151+
"Dict",
152+
"ForwardRef",
153+
"FrozenSet",
154+
"Generator",
155+
"Generic",
156+
"Hashable",
157+
"IO",
158+
"ItemsView",
159+
"Iterable",
160+
"Iterator",
161+
"KeysView",
162+
"List",
163+
"Mapping",
164+
"MappingView",
165+
"Match",
166+
"MutableMapping",
167+
"MutableSequence",
168+
"MutableSet",
169+
"Optional",
170+
"Pattern",
171+
"Reversible",
172+
"Sequence",
173+
"Set",
174+
"Sized",
175+
"TextIO",
176+
"Tuple",
177+
"Union",
178+
"ValuesView",
179+
"cast",
180+
"get_protocol_members",
181+
"is_protocol",
182+
"no_type_check",
183+
"no_type_check_decorator",
112184
]
113185

114186
_T = typing.TypeVar("_T")
@@ -403,3 +475,9 @@ else:
403475
# Not actually a Protocol at runtime; see
404476
# https://github.com/python/typeshed/issues/10224 for why we're defining it this way
405477
def __buffer__(self, __flags: int) -> memoryview: ...
478+
479+
if sys.version_info >= (3, 13):
480+
from typing import get_protocol_members as get_protocol_members, is_protocol as is_protocol
481+
else:
482+
def is_protocol(__tp: type) -> bool: ...
483+
def get_protocol_members(__tp: type) -> frozenset[str]: ...

0 commit comments

Comments
 (0)