basedpyright 1.24.0 → 1.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/dist/pyright-langserver.js +1 -1
  2. package/dist/pyright-langserver.js.LICENSE.txt +42 -0
  3. package/dist/pyright-langserver.js.map +1 -1
  4. package/dist/pyright.js +1 -1
  5. package/dist/pyright.js.map +1 -1
  6. package/dist/typeshed-fallback/stdlib/_asyncio.pyi +3 -25
  7. package/dist/typeshed-fallback/stdlib/_bisect.pyi +4 -44
  8. package/dist/typeshed-fallback/stdlib/_bootlocale.pyi +1 -1
  9. package/dist/typeshed-fallback/stdlib/_csv.pyi +2 -16
  10. package/dist/typeshed-fallback/stdlib/_dbm.pyi +1 -13
  11. package/dist/typeshed-fallback/stdlib/_decimal.pyi +1 -8
  12. package/dist/typeshed-fallback/stdlib/_dummy_thread.pyi +33 -33
  13. package/dist/typeshed-fallback/stdlib/_dummy_threading.pyi +164 -180
  14. package/dist/typeshed-fallback/stdlib/_gdbm.pyi +1 -39
  15. package/dist/typeshed-fallback/stdlib/_hashlib.pyi +7 -28
  16. package/dist/typeshed-fallback/stdlib/_imp.pyi +1 -3
  17. package/dist/typeshed-fallback/stdlib/_msi.pyi +92 -94
  18. package/dist/typeshed-fallback/stdlib/_sqlite3.pyi +6 -48
  19. package/dist/typeshed-fallback/stdlib/_ssl.pyi +1 -8
  20. package/dist/typeshed-fallback/stdlib/_thread.pyi +1 -8
  21. package/dist/typeshed-fallback/stdlib/_warnings.pyi +2 -6
  22. package/dist/typeshed-fallback/stdlib/aifc.pyi +91 -91
  23. package/dist/typeshed-fallback/stdlib/array.pyi +3 -17
  24. package/dist/typeshed-fallback/stdlib/asynchat.pyi +21 -21
  25. package/dist/typeshed-fallback/stdlib/asyncio/sslproto.pyi +4 -23
  26. package/dist/typeshed-fallback/stdlib/asyncore.pyi +90 -90
  27. package/dist/typeshed-fallback/stdlib/audioop.pyi +43 -95
  28. package/dist/typeshed-fallback/stdlib/binascii.pyi +5 -15
  29. package/dist/typeshed-fallback/stdlib/binhex.pyi +45 -45
  30. package/dist/typeshed-fallback/stdlib/builtins.pyi +8 -106
  31. package/dist/typeshed-fallback/stdlib/cgi.pyi +118 -118
  32. package/dist/typeshed-fallback/stdlib/cgitb.pyi +32 -32
  33. package/dist/typeshed-fallback/stdlib/chunk.pyi +20 -20
  34. package/dist/typeshed-fallback/stdlib/datetime.pyi +4 -12
  35. package/dist/typeshed-fallback/stdlib/distutils/__init__.pyi +5 -5
  36. package/dist/typeshed-fallback/stdlib/distutils/_msvccompiler.pyi +13 -13
  37. package/dist/typeshed-fallback/stdlib/distutils/archive_util.pyi +35 -35
  38. package/dist/typeshed-fallback/stdlib/distutils/bcppcompiler.pyi +3 -3
  39. package/dist/typeshed-fallback/stdlib/distutils/ccompiler.pyi +176 -176
  40. package/dist/typeshed-fallback/stdlib/distutils/cmd.pyi +229 -229
  41. package/dist/typeshed-fallback/stdlib/distutils/command/__init__.pyi +48 -48
  42. package/dist/typeshed-fallback/stdlib/distutils/command/bdist.pyi +27 -27
  43. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_dumb.pyi +22 -22
  44. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_msi.pyi +46 -46
  45. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_rpm.pyi +53 -53
  46. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_wininst.pyi +16 -16
  47. package/dist/typeshed-fallback/stdlib/distutils/command/build.pyi +34 -34
  48. package/dist/typeshed-fallback/stdlib/distutils/command/build_clib.pyi +29 -29
  49. package/dist/typeshed-fallback/stdlib/distutils/command/build_ext.pyi +52 -52
  50. package/dist/typeshed-fallback/stdlib/distutils/command/build_py.pyi +45 -45
  51. package/dist/typeshed-fallback/stdlib/distutils/command/build_scripts.pyi +25 -25
  52. package/dist/typeshed-fallback/stdlib/distutils/command/check.pyi +40 -40
  53. package/dist/typeshed-fallback/stdlib/distutils/command/clean.pyi +18 -18
  54. package/dist/typeshed-fallback/stdlib/distutils/command/config.pyi +84 -84
  55. package/dist/typeshed-fallback/stdlib/distutils/command/install.pyi +71 -71
  56. package/dist/typeshed-fallback/stdlib/distutils/command/install_data.pyi +20 -20
  57. package/dist/typeshed-fallback/stdlib/distutils/command/install_egg_info.pyi +19 -19
  58. package/dist/typeshed-fallback/stdlib/distutils/command/install_headers.pyi +17 -17
  59. package/dist/typeshed-fallback/stdlib/distutils/command/install_lib.pyi +26 -26
  60. package/dist/typeshed-fallback/stdlib/distutils/command/install_scripts.pyi +19 -19
  61. package/dist/typeshed-fallback/stdlib/distutils/command/register.pyi +21 -21
  62. package/dist/typeshed-fallback/stdlib/distutils/command/sdist.pyi +45 -45
  63. package/dist/typeshed-fallback/stdlib/distutils/command/upload.pyi +18 -18
  64. package/dist/typeshed-fallback/stdlib/distutils/config.pyi +17 -17
  65. package/dist/typeshed-fallback/stdlib/distutils/core.pyi +58 -58
  66. package/dist/typeshed-fallback/stdlib/distutils/cygwinccompiler.pyi +20 -20
  67. package/dist/typeshed-fallback/stdlib/distutils/debug.pyi +3 -3
  68. package/dist/typeshed-fallback/stdlib/distutils/dep_util.pyi +14 -14
  69. package/dist/typeshed-fallback/stdlib/distutils/dir_util.pyi +23 -23
  70. package/dist/typeshed-fallback/stdlib/distutils/dist.pyi +317 -317
  71. package/dist/typeshed-fallback/stdlib/distutils/errors.pyi +19 -19
  72. package/dist/typeshed-fallback/stdlib/distutils/extension.pyi +36 -36
  73. package/dist/typeshed-fallback/stdlib/distutils/fancy_getopt.pyi +34 -34
  74. package/dist/typeshed-fallback/stdlib/distutils/file_util.pyi +38 -38
  75. package/dist/typeshed-fallback/stdlib/distutils/filelist.pyi +58 -58
  76. package/dist/typeshed-fallback/stdlib/distutils/log.pyi +26 -26
  77. package/dist/typeshed-fallback/stdlib/distutils/msvccompiler.pyi +3 -3
  78. package/dist/typeshed-fallback/stdlib/distutils/spawn.pyi +10 -10
  79. package/dist/typeshed-fallback/stdlib/distutils/sysconfig.pyi +33 -33
  80. package/dist/typeshed-fallback/stdlib/distutils/text_file.pyi +21 -21
  81. package/dist/typeshed-fallback/stdlib/distutils/unixccompiler.pyi +3 -3
  82. package/dist/typeshed-fallback/stdlib/distutils/util.pyi +53 -53
  83. package/dist/typeshed-fallback/stdlib/distutils/version.pyi +36 -38
  84. package/dist/typeshed-fallback/stdlib/dummy_threading.pyi +2 -2
  85. package/dist/typeshed-fallback/stdlib/encodings/mac_centeuro.pyi +21 -21
  86. package/dist/typeshed-fallback/stdlib/formatter.pyi +88 -88
  87. package/dist/typeshed-fallback/stdlib/hmac.pyi +2 -30
  88. package/dist/typeshed-fallback/stdlib/imghdr.pyi +17 -17
  89. package/dist/typeshed-fallback/stdlib/imp.pyi +62 -62
  90. package/dist/typeshed-fallback/stdlib/importlib/metadata/__init__.pyi +7 -36
  91. package/dist/typeshed-fallback/stdlib/lib2to3/btm_matcher.pyi +28 -28
  92. package/dist/typeshed-fallback/stdlib/lib2to3/fixer_base.pyi +42 -42
  93. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_apply.pyi +8 -8
  94. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_asserts.pyi +10 -10
  95. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_basestring.pyi +8 -8
  96. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_buffer.pyi +8 -8
  97. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_dict.pyi +16 -16
  98. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_except.pyi +14 -14
  99. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_exec.pyi +8 -8
  100. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_execfile.pyi +8 -8
  101. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_exitfunc.pyi +13 -13
  102. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_filter.pyi +9 -9
  103. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_funcattrs.pyi +8 -8
  104. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_future.pyi +8 -8
  105. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_getcwdu.pyi +8 -8
  106. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_has_key.pyi +8 -8
  107. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_idioms.pyi +15 -15
  108. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_import.pyi +16 -16
  109. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_imports.pyi +21 -21
  110. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_imports2.pyi +8 -8
  111. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_input.pyi +11 -11
  112. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_intern.pyi +9 -9
  113. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_isinstance.pyi +8 -8
  114. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_itertools.pyi +9 -9
  115. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_itertools_imports.pyi +7 -7
  116. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_long.pyi +7 -7
  117. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_map.pyi +9 -9
  118. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_metaclass.pyi +17 -17
  119. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_methodattrs.pyi +10 -10
  120. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_ne.pyi +8 -8
  121. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_next.pyi +19 -19
  122. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_nonzero.pyi +8 -8
  123. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_numliterals.pyi +8 -8
  124. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_operator.pyi +12 -12
  125. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_paren.pyi +8 -8
  126. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_print.pyi +12 -12
  127. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_raise.pyi +8 -8
  128. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_raw_input.pyi +8 -8
  129. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_reduce.pyi +8 -8
  130. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_reload.pyi +9 -9
  131. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_renames.pyi +17 -17
  132. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_repr.pyi +8 -8
  133. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_set_literal.pyi +7 -7
  134. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_standarderror.pyi +8 -8
  135. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_sys_exc.pyi +9 -9
  136. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_throw.pyi +8 -8
  137. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_tuple_params.pyi +17 -17
  138. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_types.pyi +8 -8
  139. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_unicode.pyi +12 -12
  140. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_urllib.pyi +15 -15
  141. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_ws_comma.pyi +12 -12
  142. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_xrange.pyi +20 -20
  143. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_xreadlines.pyi +8 -8
  144. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_zip.pyi +9 -9
  145. package/dist/typeshed-fallback/stdlib/lib2to3/main.pyi +42 -42
  146. package/dist/typeshed-fallback/stdlib/lib2to3/pgen2/__init__.pyi +9 -9
  147. package/dist/typeshed-fallback/stdlib/lib2to3/pgen2/driver.pyi +27 -27
  148. package/dist/typeshed-fallback/stdlib/lib2to3/pgen2/grammar.pyi +24 -24
  149. package/dist/typeshed-fallback/stdlib/lib2to3/pgen2/literals.pyi +7 -7
  150. package/dist/typeshed-fallback/stdlib/lib2to3/pgen2/parse.pyi +30 -30
  151. package/dist/typeshed-fallback/stdlib/lib2to3/pgen2/pgen.pyi +50 -50
  152. package/dist/typeshed-fallback/stdlib/lib2to3/pgen2/token.pyi +69 -69
  153. package/dist/typeshed-fallback/stdlib/lib2to3/pgen2/tokenize.pyi +96 -96
  154. package/dist/typeshed-fallback/stdlib/lib2to3/pygram.pyi +114 -114
  155. package/dist/typeshed-fallback/stdlib/lib2to3/pytree.pyi +117 -127
  156. package/dist/typeshed-fallback/stdlib/lib2to3/refactor.pyi +82 -82
  157. package/dist/typeshed-fallback/stdlib/mailcap.pyi +11 -11
  158. package/dist/typeshed-fallback/stdlib/marshal.pyi +4 -52
  159. package/dist/typeshed-fallback/stdlib/math.pyi +2 -6
  160. package/dist/typeshed-fallback/stdlib/msilib/__init__.pyi +177 -177
  161. package/dist/typeshed-fallback/stdlib/msilib/schema.pyi +94 -94
  162. package/dist/typeshed-fallback/stdlib/msilib/sequence.pyi +13 -13
  163. package/dist/typeshed-fallback/stdlib/msilib/text.pyi +7 -7
  164. package/dist/typeshed-fallback/stdlib/nis.pyi +4 -31
  165. package/dist/typeshed-fallback/stdlib/nntplib.pyi +125 -125
  166. package/dist/typeshed-fallback/stdlib/os/__init__.pyi +1 -8
  167. package/dist/typeshed-fallback/stdlib/parser.pyi +24 -55
  168. package/dist/typeshed-fallback/stdlib/pipes.pyi +16 -16
  169. package/dist/typeshed-fallback/stdlib/smtpd.pyi +91 -91
  170. package/dist/typeshed-fallback/stdlib/sndhdr.pyi +14 -14
  171. package/dist/typeshed-fallback/stdlib/spwd.pyi +13 -66
  172. package/dist/typeshed-fallback/stdlib/sqlite3/__init__.pyi +2 -6
  173. package/dist/typeshed-fallback/stdlib/ssl.pyi +0 -4
  174. package/dist/typeshed-fallback/stdlib/sunau.pyi +86 -86
  175. package/dist/typeshed-fallback/stdlib/symbol.pyi +93 -93
  176. package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +4 -40
  177. package/dist/typeshed-fallback/stdlib/telnetlib.pyi +123 -123
  178. package/dist/typeshed-fallback/stdlib/tkinter/tix.pyi +299 -299
  179. package/dist/typeshed-fallback/stdlib/types.pyi +2 -6
  180. package/dist/typeshed-fallback/stdlib/typing.pyi +2 -6
  181. package/dist/typeshed-fallback/stdlib/typing_extensions.pyi +544 -559
  182. package/dist/typeshed-fallback/stdlib/unittest/__init__.pyi +1 -6
  183. package/dist/typeshed-fallback/stdlib/uu.pyi +13 -13
  184. package/dist/typeshed-fallback/stdlib/xdrlib.pyi +57 -57
  185. package/dist/typeshed-fallback/stdlib/xxlimited.pyi +1 -3
  186. package/dist/typeshed-fallback/stdlib/zipimport.pyi +0 -29
  187. package/dist/typeshed-fallback/stdlib/zlib.pyi +1 -10
  188. package/dist/typeshed-fallback/stdlib/zoneinfo/__init__.pyi +3 -9
  189. package/package.json +1 -1
@@ -1,559 +1,544 @@
1
- import abc
2
- import sys
3
- import typing
4
- from _collections_abc import dict_items, dict_keys, dict_values
5
- from _typeshed import IdentityFunction
6
- from contextlib import AbstractAsyncContextManager as AsyncContextManager, AbstractContextManager as ContextManager
7
- from typing import ( # noqa: Y022,Y037,Y038,Y039
8
- IO as IO,
9
- TYPE_CHECKING as TYPE_CHECKING,
10
- AbstractSet as AbstractSet,
11
- Any as Any,
12
- AnyStr as AnyStr,
13
- AsyncGenerator as AsyncGenerator,
14
- AsyncIterable as AsyncIterable,
15
- AsyncIterator as AsyncIterator,
16
- Awaitable as Awaitable,
17
- BinaryIO as BinaryIO,
18
- Callable as Callable,
19
- ChainMap as ChainMap,
20
- ClassVar as ClassVar,
21
- Collection as Collection,
22
- Container as Container,
23
- Coroutine as Coroutine,
24
- Counter as Counter,
25
- DefaultDict as DefaultDict,
26
- Deque as Deque,
27
- Dict as Dict,
28
- ForwardRef as ForwardRef,
29
- FrozenSet as FrozenSet,
30
- Generator as Generator,
31
- Generic as Generic,
32
- Hashable as Hashable,
33
- ItemsView as ItemsView,
34
- Iterable as Iterable,
35
- Iterator as Iterator,
36
- KeysView as KeysView,
37
- List as List,
38
- Mapping as Mapping,
39
- MappingView as MappingView,
40
- Match as Match,
41
- MutableMapping as MutableMapping,
42
- MutableSequence as MutableSequence,
43
- MutableSet as MutableSet,
44
- NoReturn as NoReturn,
45
- Optional as Optional,
46
- Pattern as Pattern,
47
- Reversible as Reversible,
48
- Sequence as Sequence,
49
- Set as Set,
50
- Sized as Sized,
51
- SupportsAbs as SupportsAbs,
52
- SupportsBytes as SupportsBytes,
53
- SupportsComplex as SupportsComplex,
54
- SupportsFloat as SupportsFloat,
55
- SupportsInt as SupportsInt,
56
- SupportsRound as SupportsRound,
57
- Text as Text,
58
- TextIO as TextIO,
59
- Tuple as Tuple,
60
- Type as Type,
61
- TypedDict as TypedDict,
62
- Union as Union,
63
- ValuesView as ValuesView,
64
- _Alias,
65
- cast as cast,
66
- no_type_check as no_type_check,
67
- no_type_check_decorator as no_type_check_decorator,
68
- overload as overload,
69
- type_check_only,
70
- )
71
-
72
- if sys.version_info >= (3, 10):
73
- from types import UnionType
74
- if sys.version_info >= (3, 9):
75
- from types import GenericAlias
76
-
77
- __all__ = [
78
- "Any",
79
- "Buffer",
80
- "ClassVar",
81
- "Concatenate",
82
- "Final",
83
- "LiteralString",
84
- "ParamSpec",
85
- "ParamSpecArgs",
86
- "ParamSpecKwargs",
87
- "Self",
88
- "Type",
89
- "TypeVar",
90
- "TypeVarTuple",
91
- "Unpack",
92
- "Awaitable",
93
- "AsyncIterator",
94
- "AsyncIterable",
95
- "Coroutine",
96
- "AsyncGenerator",
97
- "AsyncContextManager",
98
- "CapsuleType",
99
- "ChainMap",
100
- "ContextManager",
101
- "Counter",
102
- "Deque",
103
- "DefaultDict",
104
- "NamedTuple",
105
- "OrderedDict",
106
- "TypedDict",
107
- "SupportsIndex",
108
- "SupportsAbs",
109
- "SupportsRound",
110
- "SupportsBytes",
111
- "SupportsComplex",
112
- "SupportsFloat",
113
- "SupportsInt",
114
- "Annotated",
115
- "assert_never",
116
- "assert_type",
117
- "dataclass_transform",
118
- "deprecated",
119
- "final",
120
- "IntVar",
121
- "is_typeddict",
122
- "Literal",
123
- "NewType",
124
- "overload",
125
- "override",
126
- "Protocol",
127
- "reveal_type",
128
- "runtime",
129
- "runtime_checkable",
130
- "Text",
131
- "TypeAlias",
132
- "TypeAliasType",
133
- "TypeGuard",
134
- "TYPE_CHECKING",
135
- "Never",
136
- "NoReturn",
137
- "Required",
138
- "NotRequired",
139
- "clear_overloads",
140
- "get_args",
141
- "get_origin",
142
- "get_original_bases",
143
- "get_overloads",
144
- "get_type_hints",
145
- "AbstractSet",
146
- "AnyStr",
147
- "BinaryIO",
148
- "Callable",
149
- "Collection",
150
- "Container",
151
- "Dict",
152
- "Doc",
153
- "ForwardRef",
154
- "FrozenSet",
155
- "Generator",
156
- "Generic",
157
- "Hashable",
158
- "IO",
159
- "ItemsView",
160
- "Iterable",
161
- "Iterator",
162
- "KeysView",
163
- "List",
164
- "Mapping",
165
- "MappingView",
166
- "Match",
167
- "MutableMapping",
168
- "MutableSequence",
169
- "MutableSet",
170
- "NoDefault",
171
- "Optional",
172
- "Pattern",
173
- "Reversible",
174
- "Sequence",
175
- "Set",
176
- "Sized",
177
- "TextIO",
178
- "Tuple",
179
- "Union",
180
- "ValuesView",
181
- "cast",
182
- "get_protocol_members",
183
- "is_protocol",
184
- "no_type_check",
185
- "no_type_check_decorator",
186
- "ReadOnly",
187
- "TypeIs",
188
- ]
189
-
190
- _T = typing.TypeVar("_T")
191
- _F = typing.TypeVar("_F", bound=Callable[..., Any])
192
- _TC = typing.TypeVar("_TC", bound=type[object])
193
-
194
- class _Final: ... # This should be imported from typing but that breaks pytype
195
-
196
- # unfortunately we have to duplicate this class definition from typing.pyi or we break pytype
197
- class _SpecialForm(_Final):
198
- def __getitem__(self, parameters: Any) -> object: ...
199
- if sys.version_info >= (3, 10):
200
- def __or__(self, other: Any) -> _SpecialForm: ...
201
- def __ror__(self, other: Any) -> _SpecialForm: ...
202
-
203
- # Do not import (and re-export) Protocol or runtime_checkable from
204
- # typing module because type checkers need to be able to distinguish
205
- # typing.Protocol and typing_extensions.Protocol so they can properly
206
- # warn users about potential runtime exceptions when using typing.Protocol
207
- # on older versions of Python.
208
- Protocol: _SpecialForm
209
-
210
- def runtime_checkable(cls: _TC) -> _TC: ...
211
-
212
- # This alias for above is kept here for backwards compatibility.
213
- runtime = runtime_checkable
214
- Final: _SpecialForm
215
-
216
- def final(f: _F) -> _F: ...
217
-
218
- Literal: _SpecialForm
219
-
220
- def IntVar(name: str) -> Any: ... # returns a new TypeVar
221
-
222
- # Internal mypy fallback type for all typed dicts (does not exist at runtime)
223
- # N.B. Keep this mostly in sync with typing._TypedDict/mypy_extensions._TypedDict
224
- @type_check_only
225
- class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
226
- __required_keys__: ClassVar[frozenset[str]]
227
- __optional_keys__: ClassVar[frozenset[str]]
228
- __total__: ClassVar[bool]
229
- __orig_bases__: ClassVar[tuple[Any, ...]]
230
- # PEP 705
231
- __readonly_keys__: ClassVar[frozenset[str]]
232
- __mutable_keys__: ClassVar[frozenset[str]]
233
- # PEP 728
234
- __closed__: ClassVar[bool]
235
- __extra_items__: ClassVar[Any]
236
- def copy(self) -> Self: ...
237
- # Using Never so that only calls using mypy plugin hook that specialize the signature
238
- # can go through.
239
- def setdefault(self, k: Never, default: object) -> object: ...
240
- # Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
241
- def pop(self, k: Never, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse]
242
- def update(self: _T, m: _T, /) -> None: ...
243
- def items(self) -> dict_items[str, object]: ...
244
- def keys(self) -> dict_keys[str, object]: ...
245
- def values(self) -> dict_values[str, object]: ...
246
- def __delitem__(self, k: Never) -> None: ...
247
- if sys.version_info >= (3, 9):
248
- @overload
249
- def __or__(self, value: Self, /) -> Self: ...
250
- @overload
251
- def __or__(self, value: dict[str, Any], /) -> dict[str, object]: ...
252
- @overload
253
- def __ror__(self, value: Self, /) -> Self: ...
254
- @overload
255
- def __ror__(self, value: dict[str, Any], /) -> dict[str, object]: ...
256
- # supposedly incompatible definitions of `__ior__` and `__or__`:
257
- def __ior__(self, value: Self, /) -> Self: ... # type: ignore[misc]
258
-
259
- OrderedDict = _Alias()
260
-
261
- def get_type_hints(
262
- obj: Callable[..., Any],
263
- globalns: dict[str, Any] | None = None,
264
- localns: Mapping[str, Any] | None = None,
265
- include_extras: bool = False,
266
- ) -> dict[str, Any]: ...
267
- def get_args(tp: Any) -> tuple[Any, ...]: ...
268
-
269
- if sys.version_info >= (3, 10):
270
- @overload
271
- def get_origin(tp: UnionType) -> type[UnionType]: ...
272
-
273
- if sys.version_info >= (3, 9):
274
- @overload
275
- def get_origin(tp: GenericAlias) -> type: ...
276
-
277
- @overload
278
- def get_origin(tp: ParamSpecArgs | ParamSpecKwargs) -> ParamSpec: ...
279
- @overload
280
- def get_origin(tp: Any) -> Any | None: ...
281
-
282
- Annotated: _SpecialForm
283
- _AnnotatedAlias: Any # undocumented
284
-
285
- @runtime_checkable
286
- class SupportsIndex(Protocol, metaclass=abc.ABCMeta):
287
- @abc.abstractmethod
288
- def __index__(self) -> int: ...
289
-
290
- # New and changed things in 3.10
291
- if sys.version_info >= (3, 10):
292
- from typing import (
293
- Concatenate as Concatenate,
294
- ParamSpecArgs as ParamSpecArgs,
295
- ParamSpecKwargs as ParamSpecKwargs,
296
- TypeAlias as TypeAlias,
297
- TypeGuard as TypeGuard,
298
- is_typeddict as is_typeddict,
299
- )
300
- else:
301
- @final
302
- class ParamSpecArgs:
303
- @property
304
- def __origin__(self) -> ParamSpec: ...
305
- def __init__(self, origin: ParamSpec) -> None: ...
306
-
307
- @final
308
- class ParamSpecKwargs:
309
- @property
310
- def __origin__(self) -> ParamSpec: ...
311
- def __init__(self, origin: ParamSpec) -> None: ...
312
-
313
- Concatenate: _SpecialForm
314
- TypeAlias: _SpecialForm
315
- TypeGuard: _SpecialForm
316
- def is_typeddict(tp: object) -> bool: ...
317
-
318
- # New and changed things in 3.11
319
- if sys.version_info >= (3, 11):
320
- from typing import (
321
- LiteralString as LiteralString,
322
- NamedTuple as NamedTuple,
323
- Never as Never,
324
- NewType as NewType,
325
- NotRequired as NotRequired,
326
- Required as Required,
327
- Self as Self,
328
- Unpack as Unpack,
329
- assert_never as assert_never,
330
- assert_type as assert_type,
331
- clear_overloads as clear_overloads,
332
- dataclass_transform as dataclass_transform,
333
- get_overloads as get_overloads,
334
- reveal_type as reveal_type,
335
- )
336
- else:
337
- Self: _SpecialForm
338
- Never: _SpecialForm
339
- def reveal_type(obj: _T, /) -> _T: ...
340
- def assert_never(arg: Never, /) -> Never: ...
341
- def assert_type(val: _T, typ: Any, /) -> _T: ...
342
- def clear_overloads() -> None: ...
343
- def get_overloads(func: Callable[..., object]) -> Sequence[Callable[..., object]]: ...
344
-
345
- Required: _SpecialForm
346
- NotRequired: _SpecialForm
347
- LiteralString: _SpecialForm
348
- Unpack: _SpecialForm
349
-
350
- def dataclass_transform(
351
- *,
352
- eq_default: bool = True,
353
- order_default: bool = False,
354
- kw_only_default: bool = False,
355
- frozen_default: bool = False,
356
- field_specifiers: tuple[type[Any] | Callable[..., Any], ...] = (),
357
- **kwargs: object,
358
- ) -> IdentityFunction: ...
359
-
360
- class NamedTuple(tuple[Any, ...]):
361
- if sys.version_info < (3, 9):
362
- _field_types: ClassVar[dict[str, type]]
363
- _field_defaults: ClassVar[dict[str, Any]]
364
- _fields: ClassVar[tuple[str, ...]]
365
- __orig_bases__: ClassVar[tuple[Any, ...]]
366
- @overload
367
- def __init__(self, typename: str, fields: Iterable[tuple[str, Any]] = ...) -> None:
368
- """Initialize self. See help(type(self)) for accurate signature."""
369
- ...
370
- @overload
371
- def __init__(self, typename: str, fields: None = None, **kwargs: Any) -> None:
372
- """Initialize self. See help(type(self)) for accurate signature."""
373
- ...
374
- @classmethod
375
- def _make(cls, iterable: Iterable[Any]) -> Self: ...
376
- def _asdict(self) -> dict[str, Any]: ...
377
- def _replace(self, **kwargs: Any) -> Self: ...
378
-
379
- class NewType:
380
- def __init__(self, name: str, tp: Any) -> None: ...
381
- def __call__(self, obj: _T, /) -> _T: ...
382
- __supertype__: type | NewType
383
- if sys.version_info >= (3, 10):
384
- def __or__(self, other: Any) -> _SpecialForm: ...
385
- def __ror__(self, other: Any) -> _SpecialForm: ...
386
-
387
- if sys.version_info >= (3, 12):
388
- from collections.abc import Buffer as Buffer
389
- from types import get_original_bases as get_original_bases
390
- from typing import TypeAliasType as TypeAliasType, override as override
391
- else:
392
- def override(arg: _F, /) -> _F: ...
393
- def get_original_bases(cls: type, /) -> tuple[Any, ...]: ...
394
- @final
395
- class TypeAliasType:
396
- def __init__(
397
- self, name: str, value: Any, *, type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] = ()
398
- ) -> None: ...
399
- @property
400
- def __value__(self) -> Any: ...
401
- @property
402
- def __type_params__(self) -> tuple[TypeVar | ParamSpec | TypeVarTuple, ...]: ...
403
- @property
404
- def __parameters__(self) -> tuple[Any, ...]: ...
405
- @property
406
- def __name__(self) -> str: ...
407
- # It's writable on types, but not on instances of TypeAliasType.
408
- @property
409
- def __module__(self) -> str | None: ... # type: ignore[override]
410
- # Returns typing._GenericAlias, which isn't stubbed.
411
- def __getitem__(self, parameters: Any) -> Any: ...
412
- if sys.version_info >= (3, 10):
413
- def __or__(self, right: Any) -> _SpecialForm: ...
414
- def __ror__(self, left: Any) -> _SpecialForm: ...
415
-
416
- # mypy and pyright object to this being both ABC and Protocol.
417
- # At runtime it inherits from ABC and is not a Protocol, but it is on the
418
- # allowlist for use as a Protocol.
419
- @runtime_checkable
420
- class Buffer(Protocol, abc.ABC): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
421
- # Not actually a Protocol at runtime; see
422
- # https://github.com/python/typeshed/issues/10224 for why we're defining it this way
423
- def __buffer__(self, flags: int, /) -> memoryview: ...
424
-
425
- if sys.version_info >= (3, 13):
426
- from types import CapsuleType as CapsuleType
427
- from typing import (
428
- NoDefault as NoDefault,
429
- ParamSpec as ParamSpec,
430
- ReadOnly as ReadOnly,
431
- TypeIs as TypeIs,
432
- TypeVar as TypeVar,
433
- TypeVarTuple as TypeVarTuple,
434
- get_protocol_members as get_protocol_members,
435
- is_protocol as is_protocol,
436
- )
437
- from warnings import deprecated as deprecated
438
- else:
439
- def is_protocol(tp: type, /) -> bool: ...
440
- def get_protocol_members(tp: type, /) -> frozenset[str]: ...
441
- @final
442
- class _NoDefaultType: ...
443
-
444
- NoDefault: _NoDefaultType
445
- @final
446
- class CapsuleType:
447
- """
448
- Capsule objects let you wrap a C "void *" pointer in a Python
449
- object. They're a way of passing data through the Python interpreter
450
- without creating your own custom type.
451
-
452
- Capsules are used for communication between extension modules.
453
- They provide a way for an extension module to export a C interface
454
- to other extension modules, so that extension modules can use the
455
- Python import mechanism to link to one another.
456
- """
457
- ...
458
-
459
- class deprecated:
460
- message: LiteralString
461
- category: type[Warning] | None
462
- stacklevel: int
463
- def __init__(self, message: LiteralString, /, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> None: ...
464
- def __call__(self, arg: _T, /) -> _T: ...
465
-
466
- @final
467
- class TypeVar:
468
- @property
469
- def __name__(self) -> str: ...
470
- @property
471
- def __bound__(self) -> Any | None: ...
472
- @property
473
- def __constraints__(self) -> tuple[Any, ...]: ...
474
- @property
475
- def __covariant__(self) -> bool: ...
476
- @property
477
- def __contravariant__(self) -> bool: ...
478
- @property
479
- def __infer_variance__(self) -> bool: ...
480
- @property
481
- def __default__(self) -> Any: ...
482
- def __init__(
483
- self,
484
- name: str,
485
- *constraints: Any,
486
- bound: Any | None = None,
487
- covariant: bool = False,
488
- contravariant: bool = False,
489
- default: Any = ...,
490
- infer_variance: bool = False,
491
- ) -> None: ...
492
- def has_default(self) -> bool: ...
493
- def __typing_prepare_subst__(self, alias: Any, args: Any) -> tuple[Any, ...]: ...
494
- if sys.version_info >= (3, 10):
495
- def __or__(self, right: Any) -> _SpecialForm: ...
496
- def __ror__(self, left: Any) -> _SpecialForm: ...
497
- if sys.version_info >= (3, 11):
498
- def __typing_subst__(self, arg: Any) -> Any: ...
499
-
500
- @final
501
- class ParamSpec:
502
- @property
503
- def __name__(self) -> str: ...
504
- @property
505
- def __bound__(self) -> Any | None: ...
506
- @property
507
- def __covariant__(self) -> bool: ...
508
- @property
509
- def __contravariant__(self) -> bool: ...
510
- @property
511
- def __infer_variance__(self) -> bool: ...
512
- @property
513
- def __default__(self) -> Any: ...
514
- def __init__(
515
- self,
516
- name: str,
517
- *,
518
- bound: None | type[Any] | str = None,
519
- contravariant: bool = False,
520
- covariant: bool = False,
521
- default: Any = ...,
522
- ) -> None: ...
523
- @property
524
- def args(self) -> ParamSpecArgs: ...
525
- @property
526
- def kwargs(self) -> ParamSpecKwargs: ...
527
- def has_default(self) -> bool: ...
528
- def __typing_prepare_subst__(self, alias: Any, args: Any) -> tuple[Any, ...]: ...
529
- if sys.version_info >= (3, 10):
530
- def __or__(self, right: Any) -> _SpecialForm: ...
531
- def __ror__(self, left: Any) -> _SpecialForm: ...
532
-
533
- @final
534
- class TypeVarTuple:
535
- @property
536
- def __name__(self) -> str: ...
537
- @property
538
- def __default__(self) -> Any: ...
539
- def __init__(self, name: str, *, default: Any = ...) -> None: ...
540
- def __iter__(self) -> Any: ... # Unpack[Self]
541
- def has_default(self) -> bool: ...
542
- def __typing_prepare_subst__(self, alias: Any, args: Any) -> tuple[Any, ...]: ...
543
-
544
- ReadOnly: _SpecialForm
545
- TypeIs: _SpecialForm
546
-
547
- class Doc:
548
- documentation: str
549
- def __init__(self, documentation: str, /) -> None: ...
550
- def __hash__(self) -> int: ...
551
- def __eq__(self, other: object) -> bool: ...
552
-
553
-
554
- # PEP 747 (Draft)
555
-
556
- if sys.version_info >= (3, 14):
557
- from typing import TypeForm
558
- else:
559
- TypeForm: _SpecialForm
1
+ import abc
2
+ import sys
3
+ import typing
4
+ from _collections_abc import dict_items, dict_keys, dict_values
5
+ from _typeshed import IdentityFunction
6
+ from contextlib import AbstractAsyncContextManager as AsyncContextManager, AbstractContextManager as ContextManager
7
+ from typing import ( # noqa: Y022,Y037,Y038,Y039
8
+ IO as IO,
9
+ TYPE_CHECKING as TYPE_CHECKING,
10
+ AbstractSet as AbstractSet,
11
+ Any as Any,
12
+ AnyStr as AnyStr,
13
+ AsyncGenerator as AsyncGenerator,
14
+ AsyncIterable as AsyncIterable,
15
+ AsyncIterator as AsyncIterator,
16
+ Awaitable as Awaitable,
17
+ BinaryIO as BinaryIO,
18
+ Callable as Callable,
19
+ ChainMap as ChainMap,
20
+ ClassVar as ClassVar,
21
+ Collection as Collection,
22
+ Container as Container,
23
+ Coroutine as Coroutine,
24
+ Counter as Counter,
25
+ DefaultDict as DefaultDict,
26
+ Deque as Deque,
27
+ Dict as Dict,
28
+ ForwardRef as ForwardRef,
29
+ FrozenSet as FrozenSet,
30
+ Generator as Generator,
31
+ Generic as Generic,
32
+ Hashable as Hashable,
33
+ ItemsView as ItemsView,
34
+ Iterable as Iterable,
35
+ Iterator as Iterator,
36
+ KeysView as KeysView,
37
+ List as List,
38
+ Mapping as Mapping,
39
+ MappingView as MappingView,
40
+ Match as Match,
41
+ MutableMapping as MutableMapping,
42
+ MutableSequence as MutableSequence,
43
+ MutableSet as MutableSet,
44
+ NoReturn as NoReturn,
45
+ Optional as Optional,
46
+ Pattern as Pattern,
47
+ Reversible as Reversible,
48
+ Sequence as Sequence,
49
+ Set as Set,
50
+ Sized as Sized,
51
+ SupportsAbs as SupportsAbs,
52
+ SupportsBytes as SupportsBytes,
53
+ SupportsComplex as SupportsComplex,
54
+ SupportsFloat as SupportsFloat,
55
+ SupportsInt as SupportsInt,
56
+ SupportsRound as SupportsRound,
57
+ Text as Text,
58
+ TextIO as TextIO,
59
+ Tuple as Tuple,
60
+ Type as Type,
61
+ TypedDict as TypedDict,
62
+ Union as Union,
63
+ ValuesView as ValuesView,
64
+ _Alias,
65
+ cast as cast,
66
+ no_type_check as no_type_check,
67
+ no_type_check_decorator as no_type_check_decorator,
68
+ overload as overload,
69
+ type_check_only,
70
+ )
71
+
72
+ if sys.version_info >= (3, 10):
73
+ from types import UnionType
74
+ if sys.version_info >= (3, 9):
75
+ from types import GenericAlias
76
+
77
+ __all__ = [
78
+ "Any",
79
+ "Buffer",
80
+ "ClassVar",
81
+ "Concatenate",
82
+ "Final",
83
+ "LiteralString",
84
+ "ParamSpec",
85
+ "ParamSpecArgs",
86
+ "ParamSpecKwargs",
87
+ "Self",
88
+ "Type",
89
+ "TypeVar",
90
+ "TypeVarTuple",
91
+ "Unpack",
92
+ "Awaitable",
93
+ "AsyncIterator",
94
+ "AsyncIterable",
95
+ "Coroutine",
96
+ "AsyncGenerator",
97
+ "AsyncContextManager",
98
+ "CapsuleType",
99
+ "ChainMap",
100
+ "ContextManager",
101
+ "Counter",
102
+ "Deque",
103
+ "DefaultDict",
104
+ "NamedTuple",
105
+ "OrderedDict",
106
+ "TypedDict",
107
+ "SupportsIndex",
108
+ "SupportsAbs",
109
+ "SupportsRound",
110
+ "SupportsBytes",
111
+ "SupportsComplex",
112
+ "SupportsFloat",
113
+ "SupportsInt",
114
+ "Annotated",
115
+ "assert_never",
116
+ "assert_type",
117
+ "dataclass_transform",
118
+ "deprecated",
119
+ "final",
120
+ "IntVar",
121
+ "is_typeddict",
122
+ "Literal",
123
+ "NewType",
124
+ "overload",
125
+ "override",
126
+ "Protocol",
127
+ "reveal_type",
128
+ "runtime",
129
+ "runtime_checkable",
130
+ "Text",
131
+ "TypeAlias",
132
+ "TypeAliasType",
133
+ "TypeGuard",
134
+ "TYPE_CHECKING",
135
+ "Never",
136
+ "NoReturn",
137
+ "Required",
138
+ "NotRequired",
139
+ "clear_overloads",
140
+ "get_args",
141
+ "get_origin",
142
+ "get_original_bases",
143
+ "get_overloads",
144
+ "get_type_hints",
145
+ "AbstractSet",
146
+ "AnyStr",
147
+ "BinaryIO",
148
+ "Callable",
149
+ "Collection",
150
+ "Container",
151
+ "Dict",
152
+ "Doc",
153
+ "ForwardRef",
154
+ "FrozenSet",
155
+ "Generator",
156
+ "Generic",
157
+ "Hashable",
158
+ "IO",
159
+ "ItemsView",
160
+ "Iterable",
161
+ "Iterator",
162
+ "KeysView",
163
+ "List",
164
+ "Mapping",
165
+ "MappingView",
166
+ "Match",
167
+ "MutableMapping",
168
+ "MutableSequence",
169
+ "MutableSet",
170
+ "NoDefault",
171
+ "Optional",
172
+ "Pattern",
173
+ "Reversible",
174
+ "Sequence",
175
+ "Set",
176
+ "Sized",
177
+ "TextIO",
178
+ "Tuple",
179
+ "Union",
180
+ "ValuesView",
181
+ "cast",
182
+ "get_protocol_members",
183
+ "is_protocol",
184
+ "no_type_check",
185
+ "no_type_check_decorator",
186
+ "ReadOnly",
187
+ "TypeIs",
188
+ ]
189
+
190
+ _T = typing.TypeVar("_T")
191
+ _F = typing.TypeVar("_F", bound=Callable[..., Any])
192
+ _TC = typing.TypeVar("_TC", bound=type[object])
193
+
194
+ class _Final: ... # This should be imported from typing but that breaks pytype
195
+
196
+ # unfortunately we have to duplicate this class definition from typing.pyi or we break pytype
197
+ class _SpecialForm(_Final):
198
+ def __getitem__(self, parameters: Any) -> object: ...
199
+ if sys.version_info >= (3, 10):
200
+ def __or__(self, other: Any) -> _SpecialForm: ...
201
+ def __ror__(self, other: Any) -> _SpecialForm: ...
202
+
203
+ # Do not import (and re-export) Protocol or runtime_checkable from
204
+ # typing module because type checkers need to be able to distinguish
205
+ # typing.Protocol and typing_extensions.Protocol so they can properly
206
+ # warn users about potential runtime exceptions when using typing.Protocol
207
+ # on older versions of Python.
208
+ Protocol: _SpecialForm
209
+
210
+ def runtime_checkable(cls: _TC) -> _TC: ...
211
+
212
+ # This alias for above is kept here for backwards compatibility.
213
+ runtime = runtime_checkable
214
+ Final: _SpecialForm
215
+
216
+ def final(f: _F) -> _F: ...
217
+
218
+ Literal: _SpecialForm
219
+
220
+ def IntVar(name: str) -> Any: ... # returns a new TypeVar
221
+
222
+ # Internal mypy fallback type for all typed dicts (does not exist at runtime)
223
+ # N.B. Keep this mostly in sync with typing._TypedDict/mypy_extensions._TypedDict
224
+ @type_check_only
225
+ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
226
+ __required_keys__: ClassVar[frozenset[str]]
227
+ __optional_keys__: ClassVar[frozenset[str]]
228
+ __total__: ClassVar[bool]
229
+ __orig_bases__: ClassVar[tuple[Any, ...]]
230
+ # PEP 705
231
+ __readonly_keys__: ClassVar[frozenset[str]]
232
+ __mutable_keys__: ClassVar[frozenset[str]]
233
+ # PEP 728
234
+ __closed__: ClassVar[bool]
235
+ __extra_items__: ClassVar[Any]
236
+ def copy(self) -> Self: ...
237
+ # Using Never so that only calls using mypy plugin hook that specialize the signature
238
+ # can go through.
239
+ def setdefault(self, k: Never, default: object) -> object: ...
240
+ # Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
241
+ def pop(self, k: Never, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse]
242
+ def update(self: _T, m: _T, /) -> None: ...
243
+ def items(self) -> dict_items[str, object]: ...
244
+ def keys(self) -> dict_keys[str, object]: ...
245
+ def values(self) -> dict_values[str, object]: ...
246
+ def __delitem__(self, k: Never) -> None: ...
247
+ if sys.version_info >= (3, 9):
248
+ @overload
249
+ def __or__(self, value: Self, /) -> Self: ...
250
+ @overload
251
+ def __or__(self, value: dict[str, Any], /) -> dict[str, object]: ...
252
+ @overload
253
+ def __ror__(self, value: Self, /) -> Self: ...
254
+ @overload
255
+ def __ror__(self, value: dict[str, Any], /) -> dict[str, object]: ...
256
+ # supposedly incompatible definitions of `__ior__` and `__or__`:
257
+ def __ior__(self, value: Self, /) -> Self: ... # type: ignore[misc]
258
+
259
+ OrderedDict = _Alias()
260
+
261
+ def get_type_hints(
262
+ obj: Callable[..., Any],
263
+ globalns: dict[str, Any] | None = None,
264
+ localns: Mapping[str, Any] | None = None,
265
+ include_extras: bool = False,
266
+ ) -> dict[str, Any]: ...
267
+ def get_args(tp: Any) -> tuple[Any, ...]: ...
268
+
269
+ if sys.version_info >= (3, 10):
270
+ @overload
271
+ def get_origin(tp: UnionType) -> type[UnionType]: ...
272
+
273
+ if sys.version_info >= (3, 9):
274
+ @overload
275
+ def get_origin(tp: GenericAlias) -> type: ...
276
+
277
+ @overload
278
+ def get_origin(tp: ParamSpecArgs | ParamSpecKwargs) -> ParamSpec: ...
279
+ @overload
280
+ def get_origin(tp: Any) -> Any | None: ...
281
+
282
+ Annotated: _SpecialForm
283
+ _AnnotatedAlias: Any # undocumented
284
+
285
+ @runtime_checkable
286
+ class SupportsIndex(Protocol, metaclass=abc.ABCMeta):
287
+ @abc.abstractmethod
288
+ def __index__(self) -> int: ...
289
+
290
+ # New and changed things in 3.10
291
+ if sys.version_info >= (3, 10):
292
+ from typing import (
293
+ Concatenate as Concatenate,
294
+ ParamSpecArgs as ParamSpecArgs,
295
+ ParamSpecKwargs as ParamSpecKwargs,
296
+ TypeAlias as TypeAlias,
297
+ TypeGuard as TypeGuard,
298
+ is_typeddict as is_typeddict,
299
+ )
300
+ else:
301
+ @final
302
+ class ParamSpecArgs:
303
+ @property
304
+ def __origin__(self) -> ParamSpec: ...
305
+ def __init__(self, origin: ParamSpec) -> None: ...
306
+
307
+ @final
308
+ class ParamSpecKwargs:
309
+ @property
310
+ def __origin__(self) -> ParamSpec: ...
311
+ def __init__(self, origin: ParamSpec) -> None: ...
312
+
313
+ Concatenate: _SpecialForm
314
+ TypeAlias: _SpecialForm
315
+ TypeGuard: _SpecialForm
316
+ def is_typeddict(tp: object) -> bool: ...
317
+
318
+ # New and changed things in 3.11
319
+ if sys.version_info >= (3, 11):
320
+ from typing import (
321
+ LiteralString as LiteralString,
322
+ NamedTuple as NamedTuple,
323
+ Never as Never,
324
+ NewType as NewType,
325
+ NotRequired as NotRequired,
326
+ Required as Required,
327
+ Self as Self,
328
+ Unpack as Unpack,
329
+ assert_never as assert_never,
330
+ assert_type as assert_type,
331
+ clear_overloads as clear_overloads,
332
+ dataclass_transform as dataclass_transform,
333
+ get_overloads as get_overloads,
334
+ reveal_type as reveal_type,
335
+ )
336
+ else:
337
+ Self: _SpecialForm
338
+ Never: _SpecialForm
339
+ def reveal_type(obj: _T, /) -> _T: ...
340
+ def assert_never(arg: Never, /) -> Never: ...
341
+ def assert_type(val: _T, typ: Any, /) -> _T: ...
342
+ def clear_overloads() -> None: ...
343
+ def get_overloads(func: Callable[..., object]) -> Sequence[Callable[..., object]]: ...
344
+
345
+ Required: _SpecialForm
346
+ NotRequired: _SpecialForm
347
+ LiteralString: _SpecialForm
348
+ Unpack: _SpecialForm
349
+
350
+ def dataclass_transform(
351
+ *,
352
+ eq_default: bool = True,
353
+ order_default: bool = False,
354
+ kw_only_default: bool = False,
355
+ frozen_default: bool = False,
356
+ field_specifiers: tuple[type[Any] | Callable[..., Any], ...] = (),
357
+ **kwargs: object,
358
+ ) -> IdentityFunction: ...
359
+
360
+ class NamedTuple(tuple[Any, ...]):
361
+ if sys.version_info < (3, 9):
362
+ _field_types: ClassVar[dict[str, type]]
363
+ _field_defaults: ClassVar[dict[str, Any]]
364
+ _fields: ClassVar[tuple[str, ...]]
365
+ __orig_bases__: ClassVar[tuple[Any, ...]]
366
+ @overload
367
+ def __init__(self, typename: str, fields: Iterable[tuple[str, Any]] = ...) -> None: ...
368
+ @overload
369
+ def __init__(self, typename: str, fields: None = None, **kwargs: Any) -> None: ...
370
+ @classmethod
371
+ def _make(cls, iterable: Iterable[Any]) -> Self: ...
372
+ def _asdict(self) -> dict[str, Any]: ...
373
+ def _replace(self, **kwargs: Any) -> Self: ...
374
+
375
+ class NewType:
376
+ def __init__(self, name: str, tp: Any) -> None: ...
377
+ def __call__(self, obj: _T, /) -> _T: ...
378
+ __supertype__: type | NewType
379
+ if sys.version_info >= (3, 10):
380
+ def __or__(self, other: Any) -> _SpecialForm: ...
381
+ def __ror__(self, other: Any) -> _SpecialForm: ...
382
+
383
+ if sys.version_info >= (3, 12):
384
+ from collections.abc import Buffer as Buffer
385
+ from types import get_original_bases as get_original_bases
386
+ from typing import TypeAliasType as TypeAliasType, override as override
387
+ else:
388
+ def override(arg: _F, /) -> _F: ...
389
+ def get_original_bases(cls: type, /) -> tuple[Any, ...]: ...
390
+ @final
391
+ class TypeAliasType:
392
+ def __init__(
393
+ self, name: str, value: Any, *, type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] = ()
394
+ ) -> None: ...
395
+ @property
396
+ def __value__(self) -> Any: ...
397
+ @property
398
+ def __type_params__(self) -> tuple[TypeVar | ParamSpec | TypeVarTuple, ...]: ...
399
+ @property
400
+ def __parameters__(self) -> tuple[Any, ...]: ...
401
+ @property
402
+ def __name__(self) -> str: ...
403
+ # It's writable on types, but not on instances of TypeAliasType.
404
+ @property
405
+ def __module__(self) -> str | None: ... # type: ignore[override]
406
+ # Returns typing._GenericAlias, which isn't stubbed.
407
+ def __getitem__(self, parameters: Any) -> Any: ...
408
+ if sys.version_info >= (3, 10):
409
+ def __or__(self, right: Any) -> _SpecialForm: ...
410
+ def __ror__(self, left: Any) -> _SpecialForm: ...
411
+
412
+ # mypy and pyright object to this being both ABC and Protocol.
413
+ # At runtime it inherits from ABC and is not a Protocol, but it is on the
414
+ # allowlist for use as a Protocol.
415
+ @runtime_checkable
416
+ class Buffer(Protocol, abc.ABC): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
417
+ # Not actually a Protocol at runtime; see
418
+ # https://github.com/python/typeshed/issues/10224 for why we're defining it this way
419
+ def __buffer__(self, flags: int, /) -> memoryview: ...
420
+
421
+ if sys.version_info >= (3, 13):
422
+ from types import CapsuleType as CapsuleType
423
+ from typing import (
424
+ NoDefault as NoDefault,
425
+ ParamSpec as ParamSpec,
426
+ ReadOnly as ReadOnly,
427
+ TypeIs as TypeIs,
428
+ TypeVar as TypeVar,
429
+ TypeVarTuple as TypeVarTuple,
430
+ get_protocol_members as get_protocol_members,
431
+ is_protocol as is_protocol,
432
+ )
433
+ from warnings import deprecated as deprecated
434
+ else:
435
+ def is_protocol(tp: type, /) -> bool: ...
436
+ def get_protocol_members(tp: type, /) -> frozenset[str]: ...
437
+ @final
438
+ class _NoDefaultType: ...
439
+
440
+ NoDefault: _NoDefaultType
441
+ @final
442
+ class CapsuleType: ...
443
+
444
+ class deprecated:
445
+ message: LiteralString
446
+ category: type[Warning] | None
447
+ stacklevel: int
448
+ def __init__(self, message: LiteralString, /, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> None: ...
449
+ def __call__(self, arg: _T, /) -> _T: ...
450
+
451
+ @final
452
+ class TypeVar:
453
+ @property
454
+ def __name__(self) -> str: ...
455
+ @property
456
+ def __bound__(self) -> Any | None: ...
457
+ @property
458
+ def __constraints__(self) -> tuple[Any, ...]: ...
459
+ @property
460
+ def __covariant__(self) -> bool: ...
461
+ @property
462
+ def __contravariant__(self) -> bool: ...
463
+ @property
464
+ def __infer_variance__(self) -> bool: ...
465
+ @property
466
+ def __default__(self) -> Any: ...
467
+ def __init__(
468
+ self,
469
+ name: str,
470
+ *constraints: Any,
471
+ bound: Any | None = None,
472
+ covariant: bool = False,
473
+ contravariant: bool = False,
474
+ default: Any = ...,
475
+ infer_variance: bool = False,
476
+ ) -> None: ...
477
+ def has_default(self) -> bool: ...
478
+ def __typing_prepare_subst__(self, alias: Any, args: Any) -> tuple[Any, ...]: ...
479
+ if sys.version_info >= (3, 10):
480
+ def __or__(self, right: Any) -> _SpecialForm: ...
481
+ def __ror__(self, left: Any) -> _SpecialForm: ...
482
+ if sys.version_info >= (3, 11):
483
+ def __typing_subst__(self, arg: Any) -> Any: ...
484
+
485
+ @final
486
+ class ParamSpec:
487
+ @property
488
+ def __name__(self) -> str: ...
489
+ @property
490
+ def __bound__(self) -> Any | None: ...
491
+ @property
492
+ def __covariant__(self) -> bool: ...
493
+ @property
494
+ def __contravariant__(self) -> bool: ...
495
+ @property
496
+ def __infer_variance__(self) -> bool: ...
497
+ @property
498
+ def __default__(self) -> Any: ...
499
+ def __init__(
500
+ self,
501
+ name: str,
502
+ *,
503
+ bound: None | type[Any] | str = None,
504
+ contravariant: bool = False,
505
+ covariant: bool = False,
506
+ default: Any = ...,
507
+ ) -> None: ...
508
+ @property
509
+ def args(self) -> ParamSpecArgs: ...
510
+ @property
511
+ def kwargs(self) -> ParamSpecKwargs: ...
512
+ def has_default(self) -> bool: ...
513
+ def __typing_prepare_subst__(self, alias: Any, args: Any) -> tuple[Any, ...]: ...
514
+ if sys.version_info >= (3, 10):
515
+ def __or__(self, right: Any) -> _SpecialForm: ...
516
+ def __ror__(self, left: Any) -> _SpecialForm: ...
517
+
518
+ @final
519
+ class TypeVarTuple:
520
+ @property
521
+ def __name__(self) -> str: ...
522
+ @property
523
+ def __default__(self) -> Any: ...
524
+ def __init__(self, name: str, *, default: Any = ...) -> None: ...
525
+ def __iter__(self) -> Any: ... # Unpack[Self]
526
+ def has_default(self) -> bool: ...
527
+ def __typing_prepare_subst__(self, alias: Any, args: Any) -> tuple[Any, ...]: ...
528
+
529
+ ReadOnly: _SpecialForm
530
+ TypeIs: _SpecialForm
531
+
532
+ class Doc:
533
+ documentation: str
534
+ def __init__(self, documentation: str, /) -> None: ...
535
+ def __hash__(self) -> int: ...
536
+ def __eq__(self, other: object) -> bool: ...
537
+
538
+
539
+ # PEP 747 (Draft)
540
+
541
+ if sys.version_info >= (3, 14):
542
+ from typing import TypeForm
543
+ else:
544
+ TypeForm: _SpecialForm