mypy-dev 1.9.0.dev0__py3-none-any.whl

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 (1018) hide show
  1. mypy/__init__.py +1 -0
  2. mypy/__main__.py +37 -0
  3. mypy/api.py +94 -0
  4. mypy/applytype.py +156 -0
  5. mypy/argmap.py +268 -0
  6. mypy/binder.py +538 -0
  7. mypy/bogus_type.py +27 -0
  8. mypy/build.py +3562 -0
  9. mypy/checker.py +8372 -0
  10. mypy/checkexpr.py +6615 -0
  11. mypy/checkmember.py +1356 -0
  12. mypy/checkpattern.py +801 -0
  13. mypy/checkstrformat.py +1109 -0
  14. mypy/config_parser.py +670 -0
  15. mypy/constant_fold.py +187 -0
  16. mypy/constraints.py +1624 -0
  17. mypy/copytype.py +133 -0
  18. mypy/defaults.py +46 -0
  19. mypy/dmypy/__init__.py +0 -0
  20. mypy/dmypy/__main__.py +6 -0
  21. mypy/dmypy/client.py +749 -0
  22. mypy/dmypy_os.py +42 -0
  23. mypy/dmypy_server.py +1107 -0
  24. mypy/dmypy_util.py +117 -0
  25. mypy/erasetype.py +278 -0
  26. mypy/errorcodes.py +285 -0
  27. mypy/errors.py +1280 -0
  28. mypy/evalexpr.py +205 -0
  29. mypy/expandtype.py +510 -0
  30. mypy/exprtotype.py +206 -0
  31. mypy/fastparse.py +2147 -0
  32. mypy/find_sources.py +243 -0
  33. mypy/fixup.py +426 -0
  34. mypy/freetree.py +23 -0
  35. mypy/fscache.py +309 -0
  36. mypy/fswatcher.py +106 -0
  37. mypy/gclogger.py +47 -0
  38. mypy/git.py +34 -0
  39. mypy/graph_utils.py +112 -0
  40. mypy/indirection.py +121 -0
  41. mypy/infer.py +75 -0
  42. mypy/inspections.py +627 -0
  43. mypy/ipc.py +310 -0
  44. mypy/join.py +866 -0
  45. mypy/literals.py +306 -0
  46. mypy/lookup.py +61 -0
  47. mypy/main.py +1574 -0
  48. mypy/maptype.py +106 -0
  49. mypy/meet.py +1140 -0
  50. mypy/memprofile.py +121 -0
  51. mypy/message_registry.py +326 -0
  52. mypy/messages.py +3171 -0
  53. mypy/metastore.py +225 -0
  54. mypy/mixedtraverser.py +112 -0
  55. mypy/modulefinder.py +875 -0
  56. mypy/moduleinspect.py +184 -0
  57. mypy/mro.py +62 -0
  58. mypy/nodes.py +4112 -0
  59. mypy/operators.py +126 -0
  60. mypy/options.py +556 -0
  61. mypy/parse.py +30 -0
  62. mypy/partially_defined.py +675 -0
  63. mypy/patterns.py +150 -0
  64. mypy/plugin.py +901 -0
  65. mypy/plugins/__init__.py +0 -0
  66. mypy/plugins/attrs.py +1152 -0
  67. mypy/plugins/common.py +440 -0
  68. mypy/plugins/ctypes.py +245 -0
  69. mypy/plugins/dataclasses.py +1101 -0
  70. mypy/plugins/default.py +518 -0
  71. mypy/plugins/enums.py +259 -0
  72. mypy/plugins/functools.py +104 -0
  73. mypy/plugins/proper_plugin.py +175 -0
  74. mypy/plugins/singledispatch.py +224 -0
  75. mypy/py.typed +1 -0
  76. mypy/pyinfo.py +78 -0
  77. mypy/reachability.py +362 -0
  78. mypy/refinfo.py +92 -0
  79. mypy/renaming.py +568 -0
  80. mypy/report.py +924 -0
  81. mypy/scope.py +125 -0
  82. mypy/semanal.py +7023 -0
  83. mypy/semanal_classprop.py +187 -0
  84. mypy/semanal_enum.py +253 -0
  85. mypy/semanal_infer.py +128 -0
  86. mypy/semanal_main.py +511 -0
  87. mypy/semanal_namedtuple.py +670 -0
  88. mypy/semanal_newtype.py +273 -0
  89. mypy/semanal_pass1.py +156 -0
  90. mypy/semanal_shared.py +490 -0
  91. mypy/semanal_typeargs.py +265 -0
  92. mypy/semanal_typeddict.py +575 -0
  93. mypy/server/__init__.py +0 -0
  94. mypy/server/astdiff.py +518 -0
  95. mypy/server/astmerge.py +562 -0
  96. mypy/server/aststrip.py +281 -0
  97. mypy/server/deps.py +1137 -0
  98. mypy/server/mergecheck.py +83 -0
  99. mypy/server/objgraph.py +101 -0
  100. mypy/server/subexpr.py +198 -0
  101. mypy/server/target.py +11 -0
  102. mypy/server/trigger.py +26 -0
  103. mypy/server/update.py +1339 -0
  104. mypy/sharedparse.py +112 -0
  105. mypy/solve.py +562 -0
  106. mypy/split_namespace.py +35 -0
  107. mypy/state.py +28 -0
  108. mypy/stats.py +489 -0
  109. mypy/strconv.py +641 -0
  110. mypy/stubdoc.py +491 -0
  111. mypy/stubgen.py +1873 -0
  112. mypy/stubgenc.py +993 -0
  113. mypy/stubinfo.py +173 -0
  114. mypy/stubtest.py +2079 -0
  115. mypy/stubutil.py +807 -0
  116. mypy/subtypes.py +1967 -0
  117. mypy/suggestions.py +1046 -0
  118. mypy/test/__init__.py +0 -0
  119. mypy/test/config.py +28 -0
  120. mypy/test/data.py +823 -0
  121. mypy/test/helpers.py +476 -0
  122. mypy/test/meta/__init__.py +0 -0
  123. mypy/test/meta/_pytest.py +72 -0
  124. mypy/test/meta/test_diff_helper.py +47 -0
  125. mypy/test/meta/test_parse_data.py +73 -0
  126. mypy/test/meta/test_update_data.py +135 -0
  127. mypy/test/test_find_sources.py +376 -0
  128. mypy/test/test_ref_info.py +45 -0
  129. mypy/test/testapi.py +45 -0
  130. mypy/test/testargs.py +77 -0
  131. mypy/test/testcheck.py +322 -0
  132. mypy/test/testcmdline.py +152 -0
  133. mypy/test/testconstraints.py +134 -0
  134. mypy/test/testdaemon.py +132 -0
  135. mypy/test/testdeps.py +77 -0
  136. mypy/test/testdiff.py +67 -0
  137. mypy/test/testerrorstream.py +46 -0
  138. mypy/test/testfinegrained.py +438 -0
  139. mypy/test/testfinegrainedcache.py +18 -0
  140. mypy/test/testformatter.py +85 -0
  141. mypy/test/testfscache.py +101 -0
  142. mypy/test/testgraph.py +83 -0
  143. mypy/test/testinfer.py +373 -0
  144. mypy/test/testipc.py +119 -0
  145. mypy/test/testmerge.py +238 -0
  146. mypy/test/testmodulefinder.py +278 -0
  147. mypy/test/testmypyc.py +14 -0
  148. mypy/test/testparse.py +107 -0
  149. mypy/test/testpep561.py +211 -0
  150. mypy/test/testpythoneval.py +117 -0
  151. mypy/test/testreports.py +55 -0
  152. mypy/test/testsemanal.py +209 -0
  153. mypy/test/testsolve.py +285 -0
  154. mypy/test/teststubgen.py +1412 -0
  155. mypy/test/teststubinfo.py +12 -0
  156. mypy/test/teststubtest.py +2492 -0
  157. mypy/test/testsubtypes.py +303 -0
  158. mypy/test/testtransform.py +64 -0
  159. mypy/test/testtypegen.py +83 -0
  160. mypy/test/testtypes.py +1551 -0
  161. mypy/test/testutil.py +111 -0
  162. mypy/test/typefixture.py +415 -0
  163. mypy/test/update_data.py +87 -0
  164. mypy/test/visitors.py +63 -0
  165. mypy/traverser.py +961 -0
  166. mypy/treetransform.py +800 -0
  167. mypy/tvar_scope.py +147 -0
  168. mypy/type_visitor.py +564 -0
  169. mypy/typeanal.py +2510 -0
  170. mypy/typeops.py +1082 -0
  171. mypy/types.py +3686 -0
  172. mypy/types_utils.py +166 -0
  173. mypy/typeshed/LICENSE +237 -0
  174. mypy/typeshed/stdlib/VERSIONS +308 -0
  175. mypy/typeshed/stdlib/__future__.pyi +36 -0
  176. mypy/typeshed/stdlib/__main__.pyi +3 -0
  177. mypy/typeshed/stdlib/_ast.pyi +587 -0
  178. mypy/typeshed/stdlib/_bisect.pyi +84 -0
  179. mypy/typeshed/stdlib/_bootlocale.pyi +1 -0
  180. mypy/typeshed/stdlib/_codecs.pyi +133 -0
  181. mypy/typeshed/stdlib/_collections_abc.pyi +94 -0
  182. mypy/typeshed/stdlib/_compat_pickle.pyi +8 -0
  183. mypy/typeshed/stdlib/_compression.pyi +25 -0
  184. mypy/typeshed/stdlib/_csv.pyi +90 -0
  185. mypy/typeshed/stdlib/_ctypes.pyi +205 -0
  186. mypy/typeshed/stdlib/_curses.pyi +557 -0
  187. mypy/typeshed/stdlib/_decimal.pyi +281 -0
  188. mypy/typeshed/stdlib/_dummy_thread.pyi +27 -0
  189. mypy/typeshed/stdlib/_dummy_threading.pyi +164 -0
  190. mypy/typeshed/stdlib/_heapq.pyi +11 -0
  191. mypy/typeshed/stdlib/_imp.pyi +28 -0
  192. mypy/typeshed/stdlib/_json.pyi +49 -0
  193. mypy/typeshed/stdlib/_locale.pyi +100 -0
  194. mypy/typeshed/stdlib/_markupbase.pyi +16 -0
  195. mypy/typeshed/stdlib/_msi.pyi +91 -0
  196. mypy/typeshed/stdlib/_operator.pyi +147 -0
  197. mypy/typeshed/stdlib/_osx_support.pyi +34 -0
  198. mypy/typeshed/stdlib/_posixsubprocess.pyi +32 -0
  199. mypy/typeshed/stdlib/_py_abc.pyi +14 -0
  200. mypy/typeshed/stdlib/_pydecimal.pyi +43 -0
  201. mypy/typeshed/stdlib/_random.pyi +12 -0
  202. mypy/typeshed/stdlib/_sitebuiltins.pyi +16 -0
  203. mypy/typeshed/stdlib/_socket.pyi +802 -0
  204. mypy/typeshed/stdlib/_stat.pyi +103 -0
  205. mypy/typeshed/stdlib/_thread.pyi +52 -0
  206. mypy/typeshed/stdlib/_threading_local.pyi +17 -0
  207. mypy/typeshed/stdlib/_tkinter.pyi +120 -0
  208. mypy/typeshed/stdlib/_tracemalloc.pyi +17 -0
  209. mypy/typeshed/stdlib/_typeshed/__init__.pyi +347 -0
  210. mypy/typeshed/stdlib/_typeshed/dbapi.pyi +37 -0
  211. mypy/typeshed/stdlib/_typeshed/wsgi.pyi +44 -0
  212. mypy/typeshed/stdlib/_typeshed/xml.pyi +9 -0
  213. mypy/typeshed/stdlib/_warnings.pyi +55 -0
  214. mypy/typeshed/stdlib/_weakref.pyi +41 -0
  215. mypy/typeshed/stdlib/_weakrefset.pyi +51 -0
  216. mypy/typeshed/stdlib/_winapi.pyi +251 -0
  217. mypy/typeshed/stdlib/abc.pyi +49 -0
  218. mypy/typeshed/stdlib/aifc.pyi +91 -0
  219. mypy/typeshed/stdlib/antigravity.pyi +3 -0
  220. mypy/typeshed/stdlib/argparse.pyi +571 -0
  221. mypy/typeshed/stdlib/array.pyi +92 -0
  222. mypy/typeshed/stdlib/ast.pyi +277 -0
  223. mypy/typeshed/stdlib/asynchat.pyi +21 -0
  224. mypy/typeshed/stdlib/asyncio/__init__.pyi +41 -0
  225. mypy/typeshed/stdlib/asyncio/base_events.pyi +440 -0
  226. mypy/typeshed/stdlib/asyncio/base_futures.pyi +19 -0
  227. mypy/typeshed/stdlib/asyncio/base_subprocess.pyi +63 -0
  228. mypy/typeshed/stdlib/asyncio/base_tasks.pyi +9 -0
  229. mypy/typeshed/stdlib/asyncio/constants.pyi +20 -0
  230. mypy/typeshed/stdlib/asyncio/coroutines.pyi +26 -0
  231. mypy/typeshed/stdlib/asyncio/events.pyi +574 -0
  232. mypy/typeshed/stdlib/asyncio/exceptions.pyi +43 -0
  233. mypy/typeshed/stdlib/asyncio/format_helpers.pyi +20 -0
  234. mypy/typeshed/stdlib/asyncio/futures.pyi +57 -0
  235. mypy/typeshed/stdlib/asyncio/locks.pyi +121 -0
  236. mypy/typeshed/stdlib/asyncio/log.pyi +3 -0
  237. mypy/typeshed/stdlib/asyncio/mixins.pyi +9 -0
  238. mypy/typeshed/stdlib/asyncio/proactor_events.pyi +64 -0
  239. mypy/typeshed/stdlib/asyncio/protocols.pyi +34 -0
  240. mypy/typeshed/stdlib/asyncio/queues.pyi +47 -0
  241. mypy/typeshed/stdlib/asyncio/runners.pyi +32 -0
  242. mypy/typeshed/stdlib/asyncio/selector_events.pyi +8 -0
  243. mypy/typeshed/stdlib/asyncio/sslproto.pyi +163 -0
  244. mypy/typeshed/stdlib/asyncio/staggered.pyi +10 -0
  245. mypy/typeshed/stdlib/asyncio/streams.pyi +148 -0
  246. mypy/typeshed/stdlib/asyncio/subprocess.pyi +229 -0
  247. mypy/typeshed/stdlib/asyncio/taskgroups.pyi +25 -0
  248. mypy/typeshed/stdlib/asyncio/tasks.pyi +477 -0
  249. mypy/typeshed/stdlib/asyncio/threads.pyi +9 -0
  250. mypy/typeshed/stdlib/asyncio/timeouts.pyi +19 -0
  251. mypy/typeshed/stdlib/asyncio/transports.pyi +47 -0
  252. mypy/typeshed/stdlib/asyncio/trsock.pyi +98 -0
  253. mypy/typeshed/stdlib/asyncio/unix_events.pyi +173 -0
  254. mypy/typeshed/stdlib/asyncio/windows_events.pyi +83 -0
  255. mypy/typeshed/stdlib/asyncio/windows_utils.pyi +49 -0
  256. mypy/typeshed/stdlib/asyncore.pyi +90 -0
  257. mypy/typeshed/stdlib/atexit.pyi +12 -0
  258. mypy/typeshed/stdlib/audioop.pyi +42 -0
  259. mypy/typeshed/stdlib/base64.pyi +59 -0
  260. mypy/typeshed/stdlib/bdb.pyi +102 -0
  261. mypy/typeshed/stdlib/binascii.pyi +36 -0
  262. mypy/typeshed/stdlib/binhex.pyi +45 -0
  263. mypy/typeshed/stdlib/bisect.pyi +4 -0
  264. mypy/typeshed/stdlib/builtins.pyi +1937 -0
  265. mypy/typeshed/stdlib/bz2.pyi +146 -0
  266. mypy/typeshed/stdlib/cProfile.pyi +35 -0
  267. mypy/typeshed/stdlib/calendar.pyi +206 -0
  268. mypy/typeshed/stdlib/cgi.pyi +118 -0
  269. mypy/typeshed/stdlib/cgitb.pyi +32 -0
  270. mypy/typeshed/stdlib/chunk.pyi +20 -0
  271. mypy/typeshed/stdlib/cmath.pyi +36 -0
  272. mypy/typeshed/stdlib/cmd.pyi +45 -0
  273. mypy/typeshed/stdlib/code.pyi +33 -0
  274. mypy/typeshed/stdlib/codecs.pyi +285 -0
  275. mypy/typeshed/stdlib/codeop.pyi +13 -0
  276. mypy/typeshed/stdlib/collections/__init__.pyi +477 -0
  277. mypy/typeshed/stdlib/collections/abc.pyi +2 -0
  278. mypy/typeshed/stdlib/colorsys.pyi +13 -0
  279. mypy/typeshed/stdlib/compileall.pyi +111 -0
  280. mypy/typeshed/stdlib/concurrent/__init__.pyi +0 -0
  281. mypy/typeshed/stdlib/concurrent/futures/__init__.pyi +32 -0
  282. mypy/typeshed/stdlib/concurrent/futures/_base.pyi +120 -0
  283. mypy/typeshed/stdlib/concurrent/futures/process.pyi +233 -0
  284. mypy/typeshed/stdlib/concurrent/futures/thread.pyi +80 -0
  285. mypy/typeshed/stdlib/configparser.pyi +313 -0
  286. mypy/typeshed/stdlib/contextlib.pyi +207 -0
  287. mypy/typeshed/stdlib/contextvars.pyi +63 -0
  288. mypy/typeshed/stdlib/copy.pyi +16 -0
  289. mypy/typeshed/stdlib/copyreg.pyi +21 -0
  290. mypy/typeshed/stdlib/crypt.pyi +12 -0
  291. mypy/typeshed/stdlib/csv.pyi +147 -0
  292. mypy/typeshed/stdlib/ctypes/__init__.pyi +187 -0
  293. mypy/typeshed/stdlib/ctypes/_endian.pyi +19 -0
  294. mypy/typeshed/stdlib/ctypes/util.pyi +6 -0
  295. mypy/typeshed/stdlib/ctypes/wintypes.pyi +298 -0
  296. mypy/typeshed/stdlib/curses/__init__.pyi +21 -0
  297. mypy/typeshed/stdlib/curses/ascii.pyi +63 -0
  298. mypy/typeshed/stdlib/curses/has_key.pyi +4 -0
  299. mypy/typeshed/stdlib/curses/panel.pyi +25 -0
  300. mypy/typeshed/stdlib/curses/textpad.pyi +13 -0
  301. mypy/typeshed/stdlib/dataclasses.pyi +313 -0
  302. mypy/typeshed/stdlib/datetime.pyi +295 -0
  303. mypy/typeshed/stdlib/dbm/__init__.pyi +95 -0
  304. mypy/typeshed/stdlib/dbm/dumb.pyi +31 -0
  305. mypy/typeshed/stdlib/dbm/gnu.pyi +40 -0
  306. mypy/typeshed/stdlib/dbm/ndbm.pyi +36 -0
  307. mypy/typeshed/stdlib/decimal.pyi +2 -0
  308. mypy/typeshed/stdlib/difflib.pyi +140 -0
  309. mypy/typeshed/stdlib/dis.pyi +144 -0
  310. mypy/typeshed/stdlib/distutils/__init__.pyi +5 -0
  311. mypy/typeshed/stdlib/distutils/archive_util.pyi +20 -0
  312. mypy/typeshed/stdlib/distutils/bcppcompiler.pyi +3 -0
  313. mypy/typeshed/stdlib/distutils/ccompiler.pyi +152 -0
  314. mypy/typeshed/stdlib/distutils/cmd.pyi +66 -0
  315. mypy/typeshed/stdlib/distutils/command/__init__.pyi +0 -0
  316. mypy/typeshed/stdlib/distutils/command/bdist.pyi +25 -0
  317. mypy/typeshed/stdlib/distutils/command/bdist_dumb.pyi +21 -0
  318. mypy/typeshed/stdlib/distutils/command/bdist_msi.pyi +45 -0
  319. mypy/typeshed/stdlib/distutils/command/bdist_packager.pyi +0 -0
  320. mypy/typeshed/stdlib/distutils/command/bdist_rpm.pyi +52 -0
  321. mypy/typeshed/stdlib/distutils/command/bdist_wininst.pyi +16 -0
  322. mypy/typeshed/stdlib/distutils/command/build.pyi +31 -0
  323. mypy/typeshed/stdlib/distutils/command/build_clib.pyi +27 -0
  324. mypy/typeshed/stdlib/distutils/command/build_ext.pyi +50 -0
  325. mypy/typeshed/stdlib/distutils/command/build_py.pyi +44 -0
  326. mypy/typeshed/stdlib/distutils/command/build_scripts.pyi +24 -0
  327. mypy/typeshed/stdlib/distutils/command/check.pyi +39 -0
  328. mypy/typeshed/stdlib/distutils/command/clean.pyi +17 -0
  329. mypy/typeshed/stdlib/distutils/command/config.pyi +83 -0
  330. mypy/typeshed/stdlib/distutils/command/install.pyi +63 -0
  331. mypy/typeshed/stdlib/distutils/command/install_data.pyi +19 -0
  332. mypy/typeshed/stdlib/distutils/command/install_egg_info.pyi +18 -0
  333. mypy/typeshed/stdlib/distutils/command/install_headers.pyi +16 -0
  334. mypy/typeshed/stdlib/distutils/command/install_lib.pyi +25 -0
  335. mypy/typeshed/stdlib/distutils/command/install_scripts.pyi +18 -0
  336. mypy/typeshed/stdlib/distutils/command/register.pyi +18 -0
  337. mypy/typeshed/stdlib/distutils/command/sdist.pyi +42 -0
  338. mypy/typeshed/stdlib/distutils/command/upload.pyi +17 -0
  339. mypy/typeshed/stdlib/distutils/config.pyi +17 -0
  340. mypy/typeshed/stdlib/distutils/core.pyi +57 -0
  341. mypy/typeshed/stdlib/distutils/cygwinccompiler.pyi +20 -0
  342. mypy/typeshed/stdlib/distutils/debug.pyi +1 -0
  343. mypy/typeshed/stdlib/distutils/dep_util.pyi +3 -0
  344. mypy/typeshed/stdlib/distutils/dir_util.pyi +13 -0
  345. mypy/typeshed/stdlib/distutils/dist.pyi +146 -0
  346. mypy/typeshed/stdlib/distutils/errors.pyi +19 -0
  347. mypy/typeshed/stdlib/distutils/extension.pyi +36 -0
  348. mypy/typeshed/stdlib/distutils/fancy_getopt.pyi +34 -0
  349. mypy/typeshed/stdlib/distutils/file_util.pyi +14 -0
  350. mypy/typeshed/stdlib/distutils/filelist.pyi +50 -0
  351. mypy/typeshed/stdlib/distutils/log.pyi +25 -0
  352. mypy/typeshed/stdlib/distutils/msvccompiler.pyi +3 -0
  353. mypy/typeshed/stdlib/distutils/spawn.pyi +2 -0
  354. mypy/typeshed/stdlib/distutils/sysconfig.pyi +22 -0
  355. mypy/typeshed/stdlib/distutils/text_file.pyi +21 -0
  356. mypy/typeshed/stdlib/distutils/unixccompiler.pyi +3 -0
  357. mypy/typeshed/stdlib/distutils/util.pyi +46 -0
  358. mypy/typeshed/stdlib/distutils/version.pyi +36 -0
  359. mypy/typeshed/stdlib/doctest.pyi +248 -0
  360. mypy/typeshed/stdlib/dummy_threading.pyi +2 -0
  361. mypy/typeshed/stdlib/email/__init__.pyi +29 -0
  362. mypy/typeshed/stdlib/email/_header_value_parser.pyi +392 -0
  363. mypy/typeshed/stdlib/email/_policybase.pyi +51 -0
  364. mypy/typeshed/stdlib/email/base64mime.pyi +13 -0
  365. mypy/typeshed/stdlib/email/charset.pyi +34 -0
  366. mypy/typeshed/stdlib/email/contentmanager.pyi +11 -0
  367. mypy/typeshed/stdlib/email/encoders.pyi +8 -0
  368. mypy/typeshed/stdlib/email/errors.pyi +39 -0
  369. mypy/typeshed/stdlib/email/feedparser.pyi +23 -0
  370. mypy/typeshed/stdlib/email/generator.pyi +40 -0
  371. mypy/typeshed/stdlib/email/header.pyi +31 -0
  372. mypy/typeshed/stdlib/email/headerregistry.pyi +178 -0
  373. mypy/typeshed/stdlib/email/iterators.pyi +12 -0
  374. mypy/typeshed/stdlib/email/message.pyi +161 -0
  375. mypy/typeshed/stdlib/email/mime/__init__.pyi +0 -0
  376. mypy/typeshed/stdlib/email/mime/application.pyi +17 -0
  377. mypy/typeshed/stdlib/email/mime/audio.pyi +17 -0
  378. mypy/typeshed/stdlib/email/mime/base.pyi +8 -0
  379. mypy/typeshed/stdlib/email/mime/image.pyi +17 -0
  380. mypy/typeshed/stdlib/email/mime/message.pyi +8 -0
  381. mypy/typeshed/stdlib/email/mime/multipart.pyi +18 -0
  382. mypy/typeshed/stdlib/email/mime/nonmultipart.pyi +5 -0
  383. mypy/typeshed/stdlib/email/mime/text.pyi +9 -0
  384. mypy/typeshed/stdlib/email/parser.pyi +26 -0
  385. mypy/typeshed/stdlib/email/policy.pyi +38 -0
  386. mypy/typeshed/stdlib/email/quoprimime.pyi +28 -0
  387. mypy/typeshed/stdlib/email/utils.pyi +66 -0
  388. mypy/typeshed/stdlib/encodings/__init__.pyi +10 -0
  389. mypy/typeshed/stdlib/encodings/utf_8.pyi +21 -0
  390. mypy/typeshed/stdlib/encodings/utf_8_sig.pyi +22 -0
  391. mypy/typeshed/stdlib/ensurepip/__init__.pyi +12 -0
  392. mypy/typeshed/stdlib/enum.pyi +317 -0
  393. mypy/typeshed/stdlib/errno.pyi +222 -0
  394. mypy/typeshed/stdlib/faulthandler.pyi +13 -0
  395. mypy/typeshed/stdlib/fcntl.pyi +127 -0
  396. mypy/typeshed/stdlib/filecmp.pyi +57 -0
  397. mypy/typeshed/stdlib/fileinput.pyi +213 -0
  398. mypy/typeshed/stdlib/fnmatch.pyi +9 -0
  399. mypy/typeshed/stdlib/formatter.pyi +88 -0
  400. mypy/typeshed/stdlib/fractions.pyi +150 -0
  401. mypy/typeshed/stdlib/ftplib.pyi +178 -0
  402. mypy/typeshed/stdlib/functools.pyi +200 -0
  403. mypy/typeshed/stdlib/gc.pyi +37 -0
  404. mypy/typeshed/stdlib/genericpath.pyi +52 -0
  405. mypy/typeshed/stdlib/getopt.pyi +11 -0
  406. mypy/typeshed/stdlib/getpass.pyi +8 -0
  407. mypy/typeshed/stdlib/gettext.pyi +169 -0
  408. mypy/typeshed/stdlib/glob.pyi +42 -0
  409. mypy/typeshed/stdlib/graphlib.pyi +28 -0
  410. mypy/typeshed/stdlib/grp.pyi +21 -0
  411. mypy/typeshed/stdlib/gzip.pyi +160 -0
  412. mypy/typeshed/stdlib/hashlib.pyi +165 -0
  413. mypy/typeshed/stdlib/heapq.pyi +17 -0
  414. mypy/typeshed/stdlib/hmac.pyi +38 -0
  415. mypy/typeshed/stdlib/html/__init__.pyi +6 -0
  416. mypy/typeshed/stdlib/html/entities.pyi +6 -0
  417. mypy/typeshed/stdlib/html/parser.pyi +34 -0
  418. mypy/typeshed/stdlib/http/__init__.pyi +105 -0
  419. mypy/typeshed/stdlib/http/client.pyi +259 -0
  420. mypy/typeshed/stdlib/http/cookiejar.pyi +159 -0
  421. mypy/typeshed/stdlib/http/cookies.pyi +60 -0
  422. mypy/typeshed/stdlib/http/server.pyi +83 -0
  423. mypy/typeshed/stdlib/imaplib.pyi +168 -0
  424. mypy/typeshed/stdlib/imghdr.pyi +17 -0
  425. mypy/typeshed/stdlib/imp.pyi +62 -0
  426. mypy/typeshed/stdlib/importlib/__init__.pyi +24 -0
  427. mypy/typeshed/stdlib/importlib/_abc.pyi +15 -0
  428. mypy/typeshed/stdlib/importlib/abc.pyi +172 -0
  429. mypy/typeshed/stdlib/importlib/machinery.pyi +179 -0
  430. mypy/typeshed/stdlib/importlib/metadata/__init__.pyi +276 -0
  431. mypy/typeshed/stdlib/importlib/metadata/_meta.pyi +40 -0
  432. mypy/typeshed/stdlib/importlib/readers.pyi +68 -0
  433. mypy/typeshed/stdlib/importlib/resources/__init__.pyi +46 -0
  434. mypy/typeshed/stdlib/importlib/resources/abc.pyi +12 -0
  435. mypy/typeshed/stdlib/importlib/resources/readers.pyi +14 -0
  436. mypy/typeshed/stdlib/importlib/resources/simple.pyi +49 -0
  437. mypy/typeshed/stdlib/importlib/simple.pyi +11 -0
  438. mypy/typeshed/stdlib/importlib/util.pyi +43 -0
  439. mypy/typeshed/stdlib/inspect.pyi +631 -0
  440. mypy/typeshed/stdlib/io.pyi +204 -0
  441. mypy/typeshed/stdlib/ipaddress.pyi +208 -0
  442. mypy/typeshed/stdlib/itertools.pyi +293 -0
  443. mypy/typeshed/stdlib/json/__init__.pyi +61 -0
  444. mypy/typeshed/stdlib/json/decoder.pyi +32 -0
  445. mypy/typeshed/stdlib/json/encoder.pyi +38 -0
  446. mypy/typeshed/stdlib/json/tool.pyi +1 -0
  447. mypy/typeshed/stdlib/keyword.pyi +21 -0
  448. mypy/typeshed/stdlib/lib2to3/__init__.pyi +0 -0
  449. mypy/typeshed/stdlib/lib2to3/btm_matcher.pyi +28 -0
  450. mypy/typeshed/stdlib/lib2to3/fixer_base.pyi +42 -0
  451. mypy/typeshed/stdlib/lib2to3/fixes/__init__.pyi +0 -0
  452. mypy/typeshed/stdlib/lib2to3/fixes/fix_apply.pyi +8 -0
  453. mypy/typeshed/stdlib/lib2to3/fixes/fix_asserts.pyi +10 -0
  454. mypy/typeshed/stdlib/lib2to3/fixes/fix_basestring.pyi +8 -0
  455. mypy/typeshed/stdlib/lib2to3/fixes/fix_buffer.pyi +8 -0
  456. mypy/typeshed/stdlib/lib2to3/fixes/fix_dict.pyi +16 -0
  457. mypy/typeshed/stdlib/lib2to3/fixes/fix_except.pyi +14 -0
  458. mypy/typeshed/stdlib/lib2to3/fixes/fix_exec.pyi +8 -0
  459. mypy/typeshed/stdlib/lib2to3/fixes/fix_execfile.pyi +8 -0
  460. mypy/typeshed/stdlib/lib2to3/fixes/fix_exitfunc.pyi +13 -0
  461. mypy/typeshed/stdlib/lib2to3/fixes/fix_filter.pyi +9 -0
  462. mypy/typeshed/stdlib/lib2to3/fixes/fix_funcattrs.pyi +8 -0
  463. mypy/typeshed/stdlib/lib2to3/fixes/fix_future.pyi +8 -0
  464. mypy/typeshed/stdlib/lib2to3/fixes/fix_getcwdu.pyi +8 -0
  465. mypy/typeshed/stdlib/lib2to3/fixes/fix_has_key.pyi +8 -0
  466. mypy/typeshed/stdlib/lib2to3/fixes/fix_idioms.pyi +15 -0
  467. mypy/typeshed/stdlib/lib2to3/fixes/fix_import.pyi +16 -0
  468. mypy/typeshed/stdlib/lib2to3/fixes/fix_imports.pyi +21 -0
  469. mypy/typeshed/stdlib/lib2to3/fixes/fix_imports2.pyi +6 -0
  470. mypy/typeshed/stdlib/lib2to3/fixes/fix_input.pyi +11 -0
  471. mypy/typeshed/stdlib/lib2to3/fixes/fix_intern.pyi +9 -0
  472. mypy/typeshed/stdlib/lib2to3/fixes/fix_isinstance.pyi +8 -0
  473. mypy/typeshed/stdlib/lib2to3/fixes/fix_itertools.pyi +9 -0
  474. mypy/typeshed/stdlib/lib2to3/fixes/fix_itertools_imports.pyi +7 -0
  475. mypy/typeshed/stdlib/lib2to3/fixes/fix_long.pyi +7 -0
  476. mypy/typeshed/stdlib/lib2to3/fixes/fix_map.pyi +9 -0
  477. mypy/typeshed/stdlib/lib2to3/fixes/fix_metaclass.pyi +17 -0
  478. mypy/typeshed/stdlib/lib2to3/fixes/fix_methodattrs.pyi +10 -0
  479. mypy/typeshed/stdlib/lib2to3/fixes/fix_ne.pyi +8 -0
  480. mypy/typeshed/stdlib/lib2to3/fixes/fix_next.pyi +19 -0
  481. mypy/typeshed/stdlib/lib2to3/fixes/fix_nonzero.pyi +8 -0
  482. mypy/typeshed/stdlib/lib2to3/fixes/fix_numliterals.pyi +8 -0
  483. mypy/typeshed/stdlib/lib2to3/fixes/fix_operator.pyi +12 -0
  484. mypy/typeshed/stdlib/lib2to3/fixes/fix_paren.pyi +8 -0
  485. mypy/typeshed/stdlib/lib2to3/fixes/fix_print.pyi +12 -0
  486. mypy/typeshed/stdlib/lib2to3/fixes/fix_raise.pyi +8 -0
  487. mypy/typeshed/stdlib/lib2to3/fixes/fix_raw_input.pyi +8 -0
  488. mypy/typeshed/stdlib/lib2to3/fixes/fix_reduce.pyi +8 -0
  489. mypy/typeshed/stdlib/lib2to3/fixes/fix_reload.pyi +9 -0
  490. mypy/typeshed/stdlib/lib2to3/fixes/fix_renames.pyi +17 -0
  491. mypy/typeshed/stdlib/lib2to3/fixes/fix_repr.pyi +8 -0
  492. mypy/typeshed/stdlib/lib2to3/fixes/fix_set_literal.pyi +7 -0
  493. mypy/typeshed/stdlib/lib2to3/fixes/fix_standarderror.pyi +8 -0
  494. mypy/typeshed/stdlib/lib2to3/fixes/fix_sys_exc.pyi +9 -0
  495. mypy/typeshed/stdlib/lib2to3/fixes/fix_throw.pyi +8 -0
  496. mypy/typeshed/stdlib/lib2to3/fixes/fix_tuple_params.pyi +17 -0
  497. mypy/typeshed/stdlib/lib2to3/fixes/fix_types.pyi +8 -0
  498. mypy/typeshed/stdlib/lib2to3/fixes/fix_unicode.pyi +12 -0
  499. mypy/typeshed/stdlib/lib2to3/fixes/fix_urllib.pyi +15 -0
  500. mypy/typeshed/stdlib/lib2to3/fixes/fix_ws_comma.pyi +12 -0
  501. mypy/typeshed/stdlib/lib2to3/fixes/fix_xrange.pyi +20 -0
  502. mypy/typeshed/stdlib/lib2to3/fixes/fix_xreadlines.pyi +8 -0
  503. mypy/typeshed/stdlib/lib2to3/fixes/fix_zip.pyi +9 -0
  504. mypy/typeshed/stdlib/lib2to3/main.pyi +42 -0
  505. mypy/typeshed/stdlib/lib2to3/pgen2/__init__.pyi +9 -0
  506. mypy/typeshed/stdlib/lib2to3/pgen2/driver.pyi +27 -0
  507. mypy/typeshed/stdlib/lib2to3/pgen2/grammar.pyi +24 -0
  508. mypy/typeshed/stdlib/lib2to3/pgen2/literals.pyi +7 -0
  509. mypy/typeshed/stdlib/lib2to3/pgen2/parse.pyi +30 -0
  510. mypy/typeshed/stdlib/lib2to3/pgen2/pgen.pyi +50 -0
  511. mypy/typeshed/stdlib/lib2to3/pgen2/token.pyi +67 -0
  512. mypy/typeshed/stdlib/lib2to3/pgen2/tokenize.pyi +96 -0
  513. mypy/typeshed/stdlib/lib2to3/pygram.pyi +114 -0
  514. mypy/typeshed/stdlib/lib2to3/pytree.pyi +117 -0
  515. mypy/typeshed/stdlib/lib2to3/refactor.pyi +82 -0
  516. mypy/typeshed/stdlib/linecache.pyi +23 -0
  517. mypy/typeshed/stdlib/locale.pyi +152 -0
  518. mypy/typeshed/stdlib/logging/__init__.pyi +655 -0
  519. mypy/typeshed/stdlib/logging/config.pyi +134 -0
  520. mypy/typeshed/stdlib/logging/handlers.pyi +275 -0
  521. mypy/typeshed/stdlib/lzma.pyi +197 -0
  522. mypy/typeshed/stdlib/mailbox.pyi +256 -0
  523. mypy/typeshed/stdlib/mailcap.pyi +11 -0
  524. mypy/typeshed/stdlib/marshal.pyi +33 -0
  525. mypy/typeshed/stdlib/math.pyi +125 -0
  526. mypy/typeshed/stdlib/mimetypes.pyi +46 -0
  527. mypy/typeshed/stdlib/mmap.pyi +113 -0
  528. mypy/typeshed/stdlib/modulefinder.pyi +66 -0
  529. mypy/typeshed/stdlib/msilib/__init__.pyi +176 -0
  530. mypy/typeshed/stdlib/msilib/schema.pyi +94 -0
  531. mypy/typeshed/stdlib/msilib/sequence.pyi +13 -0
  532. mypy/typeshed/stdlib/msilib/text.pyi +7 -0
  533. mypy/typeshed/stdlib/msvcrt.pyi +32 -0
  534. mypy/typeshed/stdlib/multiprocessing/__init__.pyi +90 -0
  535. mypy/typeshed/stdlib/multiprocessing/connection.pyi +75 -0
  536. mypy/typeshed/stdlib/multiprocessing/context.pyi +187 -0
  537. mypy/typeshed/stdlib/multiprocessing/dummy/__init__.pyi +77 -0
  538. mypy/typeshed/stdlib/multiprocessing/dummy/connection.pyi +39 -0
  539. mypy/typeshed/stdlib/multiprocessing/forkserver.pyi +31 -0
  540. mypy/typeshed/stdlib/multiprocessing/heap.pyi +36 -0
  541. mypy/typeshed/stdlib/multiprocessing/managers.pyi +212 -0
  542. mypy/typeshed/stdlib/multiprocessing/pool.pyi +103 -0
  543. mypy/typeshed/stdlib/multiprocessing/popen_fork.pyi +23 -0
  544. mypy/typeshed/stdlib/multiprocessing/popen_forkserver.pyi +16 -0
  545. mypy/typeshed/stdlib/multiprocessing/popen_spawn_posix.pyi +20 -0
  546. mypy/typeshed/stdlib/multiprocessing/popen_spawn_win32.pyi +30 -0
  547. mypy/typeshed/stdlib/multiprocessing/process.pyi +39 -0
  548. mypy/typeshed/stdlib/multiprocessing/queues.pyi +41 -0
  549. mypy/typeshed/stdlib/multiprocessing/reduction.pyi +89 -0
  550. mypy/typeshed/stdlib/multiprocessing/resource_sharer.pyi +20 -0
  551. mypy/typeshed/stdlib/multiprocessing/resource_tracker.pyi +18 -0
  552. mypy/typeshed/stdlib/multiprocessing/shared_memory.pyi +40 -0
  553. mypy/typeshed/stdlib/multiprocessing/sharedctypes.pyi +101 -0
  554. mypy/typeshed/stdlib/multiprocessing/spawn.pyi +32 -0
  555. mypy/typeshed/stdlib/multiprocessing/synchronize.pyi +54 -0
  556. mypy/typeshed/stdlib/multiprocessing/util.pyi +79 -0
  557. mypy/typeshed/stdlib/netrc.pyi +23 -0
  558. mypy/typeshed/stdlib/nis.pyi +9 -0
  559. mypy/typeshed/stdlib/nntplib.pyi +125 -0
  560. mypy/typeshed/stdlib/nt.pyi +111 -0
  561. mypy/typeshed/stdlib/ntpath.pyi +119 -0
  562. mypy/typeshed/stdlib/nturl2path.pyi +2 -0
  563. mypy/typeshed/stdlib/numbers.pyi +154 -0
  564. mypy/typeshed/stdlib/opcode.pyi +59 -0
  565. mypy/typeshed/stdlib/operator.pyi +110 -0
  566. mypy/typeshed/stdlib/optparse.pyi +252 -0
  567. mypy/typeshed/stdlib/os/__init__.pyi +1139 -0
  568. mypy/typeshed/stdlib/os/path.pyi +8 -0
  569. mypy/typeshed/stdlib/ossaudiodev.pyi +131 -0
  570. mypy/typeshed/stdlib/parser.pyi +24 -0
  571. mypy/typeshed/stdlib/pathlib.pyi +232 -0
  572. mypy/typeshed/stdlib/pdb.pyi +181 -0
  573. mypy/typeshed/stdlib/pickle.pyi +270 -0
  574. mypy/typeshed/stdlib/pickletools.pyi +167 -0
  575. mypy/typeshed/stdlib/pipes.pyi +16 -0
  576. mypy/typeshed/stdlib/pkgutil.pyi +53 -0
  577. mypy/typeshed/stdlib/platform.pyi +42 -0
  578. mypy/typeshed/stdlib/plistlib.pyi +113 -0
  579. mypy/typeshed/stdlib/poplib.pyi +71 -0
  580. mypy/typeshed/stdlib/posix.pyi +359 -0
  581. mypy/typeshed/stdlib/posixpath.pyi +161 -0
  582. mypy/typeshed/stdlib/pprint.pyi +112 -0
  583. mypy/typeshed/stdlib/profile.pyi +31 -0
  584. mypy/typeshed/stdlib/pstats.pyi +78 -0
  585. mypy/typeshed/stdlib/pty.pyi +19 -0
  586. mypy/typeshed/stdlib/pwd.pyi +27 -0
  587. mypy/typeshed/stdlib/py_compile.pyi +34 -0
  588. mypy/typeshed/stdlib/pyclbr.pyi +74 -0
  589. mypy/typeshed/stdlib/pydoc.pyi +261 -0
  590. mypy/typeshed/stdlib/pydoc_data/__init__.pyi +0 -0
  591. mypy/typeshed/stdlib/pydoc_data/topics.pyi +1 -0
  592. mypy/typeshed/stdlib/pyexpat/__init__.pyi +80 -0
  593. mypy/typeshed/stdlib/pyexpat/errors.pyi +49 -0
  594. mypy/typeshed/stdlib/pyexpat/model.pyi +11 -0
  595. mypy/typeshed/stdlib/queue.pyi +58 -0
  596. mypy/typeshed/stdlib/quopri.pyi +11 -0
  597. mypy/typeshed/stdlib/random.pyi +138 -0
  598. mypy/typeshed/stdlib/re.pyi +290 -0
  599. mypy/typeshed/stdlib/readline.pyi +36 -0
  600. mypy/typeshed/stdlib/reprlib.pyi +65 -0
  601. mypy/typeshed/stdlib/resource.pyi +92 -0
  602. mypy/typeshed/stdlib/rlcompleter.pyi +9 -0
  603. mypy/typeshed/stdlib/runpy.pyi +24 -0
  604. mypy/typeshed/stdlib/sched.pyi +42 -0
  605. mypy/typeshed/stdlib/secrets.pyi +15 -0
  606. mypy/typeshed/stdlib/select.pyi +151 -0
  607. mypy/typeshed/stdlib/selectors.pyi +67 -0
  608. mypy/typeshed/stdlib/shelve.pyi +46 -0
  609. mypy/typeshed/stdlib/shlex.pyi +43 -0
  610. mypy/typeshed/stdlib/shutil.pyi +189 -0
  611. mypy/typeshed/stdlib/signal.pyi +189 -0
  612. mypy/typeshed/stdlib/site.pyi +27 -0
  613. mypy/typeshed/stdlib/smtpd.pyi +91 -0
  614. mypy/typeshed/stdlib/smtplib.pyi +204 -0
  615. mypy/typeshed/stdlib/sndhdr.pyi +14 -0
  616. mypy/typeshed/stdlib/socket.pyi +825 -0
  617. mypy/typeshed/stdlib/socketserver.pyi +168 -0
  618. mypy/typeshed/stdlib/spwd.pyi +40 -0
  619. mypy/typeshed/stdlib/sqlite3/__init__.pyi +1 -0
  620. mypy/typeshed/stdlib/sqlite3/dbapi2.pyi +469 -0
  621. mypy/typeshed/stdlib/sre_compile.pyi +11 -0
  622. mypy/typeshed/stdlib/sre_constants.pyi +130 -0
  623. mypy/typeshed/stdlib/sre_parse.pyi +104 -0
  624. mypy/typeshed/stdlib/ssl.pyi +529 -0
  625. mypy/typeshed/stdlib/stat.pyi +1 -0
  626. mypy/typeshed/stdlib/statistics.pyi +132 -0
  627. mypy/typeshed/stdlib/string.pyi +83 -0
  628. mypy/typeshed/stdlib/stringprep.pyi +27 -0
  629. mypy/typeshed/stdlib/struct.pyi +26 -0
  630. mypy/typeshed/stdlib/subprocess.pyi +2614 -0
  631. mypy/typeshed/stdlib/sunau.pyi +86 -0
  632. mypy/typeshed/stdlib/symbol.pyi +93 -0
  633. mypy/typeshed/stdlib/symtable.pyi +58 -0
  634. mypy/typeshed/stdlib/sys/__init__.pyi +373 -0
  635. mypy/typeshed/stdlib/sys/_monitoring.pyi +52 -0
  636. mypy/typeshed/stdlib/sysconfig.pyi +43 -0
  637. mypy/typeshed/stdlib/syslog.pyi +46 -0
  638. mypy/typeshed/stdlib/tabnanny.pyi +16 -0
  639. mypy/typeshed/stdlib/tarfile.pyi +438 -0
  640. mypy/typeshed/stdlib/telnetlib.pyi +122 -0
  641. mypy/typeshed/stdlib/tempfile.pyi +477 -0
  642. mypy/typeshed/stdlib/termios.pyi +267 -0
  643. mypy/typeshed/stdlib/textwrap.pyi +103 -0
  644. mypy/typeshed/stdlib/this.pyi +2 -0
  645. mypy/typeshed/stdlib/threading.pyi +187 -0
  646. mypy/typeshed/stdlib/time.pyi +107 -0
  647. mypy/typeshed/stdlib/timeit.pyi +32 -0
  648. mypy/typeshed/stdlib/tkinter/__init__.pyi +3641 -0
  649. mypy/typeshed/stdlib/tkinter/colorchooser.pyi +20 -0
  650. mypy/typeshed/stdlib/tkinter/commondialog.pyi +14 -0
  651. mypy/typeshed/stdlib/tkinter/constants.pyi +80 -0
  652. mypy/typeshed/stdlib/tkinter/dialog.pyi +16 -0
  653. mypy/typeshed/stdlib/tkinter/dnd.pyi +20 -0
  654. mypy/typeshed/stdlib/tkinter/filedialog.pyi +151 -0
  655. mypy/typeshed/stdlib/tkinter/font.pyi +116 -0
  656. mypy/typeshed/stdlib/tkinter/messagebox.pyi +44 -0
  657. mypy/typeshed/stdlib/tkinter/scrolledtext.pyi +10 -0
  658. mypy/typeshed/stdlib/tkinter/simpledialog.pyi +54 -0
  659. mypy/typeshed/stdlib/tkinter/tix.pyi +299 -0
  660. mypy/typeshed/stdlib/tkinter/ttk.pyi +1191 -0
  661. mypy/typeshed/stdlib/token.pyi +159 -0
  662. mypy/typeshed/stdlib/tokenize.pyi +177 -0
  663. mypy/typeshed/stdlib/tomllib.pyi +10 -0
  664. mypy/typeshed/stdlib/trace.pyi +79 -0
  665. mypy/typeshed/stdlib/traceback.pyi +260 -0
  666. mypy/typeshed/stdlib/tracemalloc.pyi +124 -0
  667. mypy/typeshed/stdlib/tty.pyi +30 -0
  668. mypy/typeshed/stdlib/turtle.pyi +713 -0
  669. mypy/typeshed/stdlib/types.pyi +605 -0
  670. mypy/typeshed/stdlib/typing.pyi +968 -0
  671. mypy/typeshed/stdlib/typing_extensions.pyi +503 -0
  672. mypy/typeshed/stdlib/unicodedata.pyi +71 -0
  673. mypy/typeshed/stdlib/unittest/__init__.pyi +67 -0
  674. mypy/typeshed/stdlib/unittest/_log.pyi +27 -0
  675. mypy/typeshed/stdlib/unittest/async_case.pyi +21 -0
  676. mypy/typeshed/stdlib/unittest/case.pyi +342 -0
  677. mypy/typeshed/stdlib/unittest/loader.pyi +51 -0
  678. mypy/typeshed/stdlib/unittest/main.pyi +69 -0
  679. mypy/typeshed/stdlib/unittest/mock.pyi +430 -0
  680. mypy/typeshed/stdlib/unittest/result.pyi +46 -0
  681. mypy/typeshed/stdlib/unittest/runner.pyi +72 -0
  682. mypy/typeshed/stdlib/unittest/signals.pyi +15 -0
  683. mypy/typeshed/stdlib/unittest/suite.pyi +22 -0
  684. mypy/typeshed/stdlib/unittest/util.pyi +23 -0
  685. mypy/typeshed/stdlib/urllib/__init__.pyi +0 -0
  686. mypy/typeshed/stdlib/urllib/error.pyi +23 -0
  687. mypy/typeshed/stdlib/urllib/parse.pyi +210 -0
  688. mypy/typeshed/stdlib/urllib/request.pyi +399 -0
  689. mypy/typeshed/stdlib/urllib/response.pyi +43 -0
  690. mypy/typeshed/stdlib/urllib/robotparser.pyi +20 -0
  691. mypy/typeshed/stdlib/uu.pyi +13 -0
  692. mypy/typeshed/stdlib/uuid.pyi +100 -0
  693. mypy/typeshed/stdlib/venv/__init__.pyi +79 -0
  694. mypy/typeshed/stdlib/warnings.pyi +112 -0
  695. mypy/typeshed/stdlib/wave.pyi +85 -0
  696. mypy/typeshed/stdlib/weakref.pyi +150 -0
  697. mypy/typeshed/stdlib/webbrowser.pyi +74 -0
  698. mypy/typeshed/stdlib/winreg.pyi +103 -0
  699. mypy/typeshed/stdlib/winsound.pyi +28 -0
  700. mypy/typeshed/stdlib/wsgiref/__init__.pyi +0 -0
  701. mypy/typeshed/stdlib/wsgiref/handlers.pyi +91 -0
  702. mypy/typeshed/stdlib/wsgiref/headers.pyi +26 -0
  703. mypy/typeshed/stdlib/wsgiref/simple_server.pyi +37 -0
  704. mypy/typeshed/stdlib/wsgiref/types.pyi +32 -0
  705. mypy/typeshed/stdlib/wsgiref/util.pyi +24 -0
  706. mypy/typeshed/stdlib/wsgiref/validate.pyi +50 -0
  707. mypy/typeshed/stdlib/xdrlib.pyi +57 -0
  708. mypy/typeshed/stdlib/xml/__init__.pyi +1 -0
  709. mypy/typeshed/stdlib/xml/dom/NodeFilter.pyi +19 -0
  710. mypy/typeshed/stdlib/xml/dom/__init__.pyi +69 -0
  711. mypy/typeshed/stdlib/xml/dom/domreg.pyi +8 -0
  712. mypy/typeshed/stdlib/xml/dom/expatbuilder.pyi +100 -0
  713. mypy/typeshed/stdlib/xml/dom/minicompat.pyi +22 -0
  714. mypy/typeshed/stdlib/xml/dom/minidom.pyi +404 -0
  715. mypy/typeshed/stdlib/xml/dom/pulldom.pyi +94 -0
  716. mypy/typeshed/stdlib/xml/dom/xmlbuilder.pyi +108 -0
  717. mypy/typeshed/stdlib/xml/etree/ElementInclude.pyi +28 -0
  718. mypy/typeshed/stdlib/xml/etree/ElementPath.pyi +34 -0
  719. mypy/typeshed/stdlib/xml/etree/ElementTree.pyi +321 -0
  720. mypy/typeshed/stdlib/xml/etree/__init__.pyi +0 -0
  721. mypy/typeshed/stdlib/xml/etree/cElementTree.pyi +1 -0
  722. mypy/typeshed/stdlib/xml/parsers/__init__.pyi +1 -0
  723. mypy/typeshed/stdlib/xml/parsers/expat/__init__.pyi +1 -0
  724. mypy/typeshed/stdlib/xml/parsers/expat/errors.pyi +1 -0
  725. mypy/typeshed/stdlib/xml/parsers/expat/model.pyi +1 -0
  726. mypy/typeshed/stdlib/xml/sax/__init__.pyi +25 -0
  727. mypy/typeshed/stdlib/xml/sax/_exceptions.pyi +19 -0
  728. mypy/typeshed/stdlib/xml/sax/handler.pyi +55 -0
  729. mypy/typeshed/stdlib/xml/sax/saxutils.pyi +60 -0
  730. mypy/typeshed/stdlib/xml/sax/xmlreader.pyi +87 -0
  731. mypy/typeshed/stdlib/xmlrpc/__init__.pyi +0 -0
  732. mypy/typeshed/stdlib/xmlrpc/client.pyi +296 -0
  733. mypy/typeshed/stdlib/xmlrpc/server.pyi +143 -0
  734. mypy/typeshed/stdlib/xxlimited.pyi +22 -0
  735. mypy/typeshed/stdlib/zipapp.pyi +20 -0
  736. mypy/typeshed/stdlib/zipfile/__init__.pyi +306 -0
  737. mypy/typeshed/stdlib/zipfile/_path.pyi +95 -0
  738. mypy/typeshed/stdlib/zipimport.pyi +32 -0
  739. mypy/typeshed/stdlib/zlib.pyi +56 -0
  740. mypy/typeshed/stdlib/zoneinfo/__init__.pyi +38 -0
  741. mypy/typeshed/stubs/mypy-extensions/mypy_extensions.pyi +218 -0
  742. mypy/typestate.py +323 -0
  743. mypy/typetraverser.py +142 -0
  744. mypy/typevars.py +93 -0
  745. mypy/typevartuples.py +32 -0
  746. mypy/util.py +869 -0
  747. mypy/version.py +1 -0
  748. mypy/visitor.py +621 -0
  749. mypy/xml/mypy-html.css +104 -0
  750. mypy/xml/mypy-html.xslt +81 -0
  751. mypy/xml/mypy-txt.xslt +100 -0
  752. mypy/xml/mypy.xsd +50 -0
  753. mypy_dev-1.9.0.dev0.dist-info/LICENSE +229 -0
  754. mypy_dev-1.9.0.dev0.dist-info/METADATA +39 -0
  755. mypy_dev-1.9.0.dev0.dist-info/RECORD +1018 -0
  756. mypy_dev-1.9.0.dev0.dist-info/WHEEL +5 -0
  757. mypy_dev-1.9.0.dev0.dist-info/entry_points.txt +6 -0
  758. mypy_dev-1.9.0.dev0.dist-info/top_level.txt +2 -0
  759. mypyc/README.md +133 -0
  760. mypyc/__init__.py +0 -0
  761. mypyc/__main__.py +57 -0
  762. mypyc/analysis/__init__.py +0 -0
  763. mypyc/analysis/attrdefined.py +436 -0
  764. mypyc/analysis/blockfreq.py +32 -0
  765. mypyc/analysis/dataflow.py +624 -0
  766. mypyc/analysis/ircheck.py +429 -0
  767. mypyc/analysis/selfleaks.py +207 -0
  768. mypyc/build.py +616 -0
  769. mypyc/codegen/__init__.py +0 -0
  770. mypyc/codegen/cstring.py +54 -0
  771. mypyc/codegen/emit.py +1193 -0
  772. mypyc/codegen/emitclass.py +1060 -0
  773. mypyc/codegen/emitfunc.py +846 -0
  774. mypyc/codegen/emitmodule.py +1131 -0
  775. mypyc/codegen/emitwrapper.py +979 -0
  776. mypyc/codegen/literals.py +302 -0
  777. mypyc/common.py +136 -0
  778. mypyc/crash.py +31 -0
  779. mypyc/doc/Makefile +20 -0
  780. mypyc/doc/bool_operations.rst +27 -0
  781. mypyc/doc/compilation_units.rst +20 -0
  782. mypyc/doc/conf.py +59 -0
  783. mypyc/doc/cpython-timings.md +25 -0
  784. mypyc/doc/dev-intro.md +548 -0
  785. mypyc/doc/dict_operations.rst +59 -0
  786. mypyc/doc/differences_from_python.rst +332 -0
  787. mypyc/doc/float_operations.rst +50 -0
  788. mypyc/doc/future.md +42 -0
  789. mypyc/doc/getting_started.rst +240 -0
  790. mypyc/doc/index.rst +61 -0
  791. mypyc/doc/int_operations.rst +162 -0
  792. mypyc/doc/introduction.rst +150 -0
  793. mypyc/doc/list_operations.rst +65 -0
  794. mypyc/doc/make.bat +35 -0
  795. mypyc/doc/native_classes.rst +206 -0
  796. mypyc/doc/native_operations.rst +55 -0
  797. mypyc/doc/performance_tips_and_tricks.rst +244 -0
  798. mypyc/doc/set_operations.rst +47 -0
  799. mypyc/doc/str_operations.rst +35 -0
  800. mypyc/doc/tuple_operations.rst +33 -0
  801. mypyc/doc/using_type_annotations.rst +398 -0
  802. mypyc/errors.py +29 -0
  803. mypyc/external/googletest/LICENSE +28 -0
  804. mypyc/external/googletest/README.md +280 -0
  805. mypyc/external/googletest/include/gtest/gtest-death-test.h +294 -0
  806. mypyc/external/googletest/include/gtest/gtest-message.h +250 -0
  807. mypyc/external/googletest/include/gtest/gtest-param-test.h +1444 -0
  808. mypyc/external/googletest/include/gtest/gtest-param-test.h.pump +510 -0
  809. mypyc/external/googletest/include/gtest/gtest-printers.h +993 -0
  810. mypyc/external/googletest/include/gtest/gtest-spi.h +232 -0
  811. mypyc/external/googletest/include/gtest/gtest-test-part.h +179 -0
  812. mypyc/external/googletest/include/gtest/gtest-typed-test.h +263 -0
  813. mypyc/external/googletest/include/gtest/gtest.h +2236 -0
  814. mypyc/external/googletest/include/gtest/gtest_pred_impl.h +358 -0
  815. mypyc/external/googletest/include/gtest/gtest_prod.h +58 -0
  816. mypyc/external/googletest/include/gtest/internal/custom/gtest-port.h +69 -0
  817. mypyc/external/googletest/include/gtest/internal/custom/gtest-printers.h +42 -0
  818. mypyc/external/googletest/include/gtest/internal/custom/gtest.h +41 -0
  819. mypyc/external/googletest/include/gtest/internal/gtest-death-test-internal.h +319 -0
  820. mypyc/external/googletest/include/gtest/internal/gtest-filepath.h +206 -0
  821. mypyc/external/googletest/include/gtest/internal/gtest-internal.h +1238 -0
  822. mypyc/external/googletest/include/gtest/internal/gtest-linked_ptr.h +243 -0
  823. mypyc/external/googletest/include/gtest/internal/gtest-param-util-generated.h +5146 -0
  824. mypyc/external/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +286 -0
  825. mypyc/external/googletest/include/gtest/internal/gtest-param-util.h +731 -0
  826. mypyc/external/googletest/include/gtest/internal/gtest-port-arch.h +93 -0
  827. mypyc/external/googletest/include/gtest/internal/gtest-port.h +2560 -0
  828. mypyc/external/googletest/include/gtest/internal/gtest-string.h +167 -0
  829. mypyc/external/googletest/include/gtest/internal/gtest-tuple.h +1020 -0
  830. mypyc/external/googletest/include/gtest/internal/gtest-tuple.h.pump +347 -0
  831. mypyc/external/googletest/include/gtest/internal/gtest-type-util.h +3331 -0
  832. mypyc/external/googletest/include/gtest/internal/gtest-type-util.h.pump +297 -0
  833. mypyc/external/googletest/make/Makefile +61 -0
  834. mypyc/external/googletest/src/gtest-all.cc +48 -0
  835. mypyc/external/googletest/src/gtest-death-test.cc +1342 -0
  836. mypyc/external/googletest/src/gtest-filepath.cc +387 -0
  837. mypyc/external/googletest/src/gtest-internal-inl.h +1183 -0
  838. mypyc/external/googletest/src/gtest-port.cc +1259 -0
  839. mypyc/external/googletest/src/gtest-printers.cc +373 -0
  840. mypyc/external/googletest/src/gtest-test-part.cc +110 -0
  841. mypyc/external/googletest/src/gtest-typed-test.cc +118 -0
  842. mypyc/external/googletest/src/gtest.cc +5388 -0
  843. mypyc/external/googletest/src/gtest_main.cc +38 -0
  844. mypyc/ir/__init__.py +0 -0
  845. mypyc/ir/class_ir.py +499 -0
  846. mypyc/ir/func_ir.py +370 -0
  847. mypyc/ir/module_ir.py +88 -0
  848. mypyc/ir/ops.py +1642 -0
  849. mypyc/ir/pprint.py +496 -0
  850. mypyc/ir/rtypes.py +1038 -0
  851. mypyc/irbuild/__init__.py +0 -0
  852. mypyc/irbuild/ast_helpers.py +120 -0
  853. mypyc/irbuild/builder.py +1398 -0
  854. mypyc/irbuild/callable_class.py +173 -0
  855. mypyc/irbuild/classdef.py +850 -0
  856. mypyc/irbuild/constant_fold.py +95 -0
  857. mypyc/irbuild/context.py +186 -0
  858. mypyc/irbuild/env_class.py +223 -0
  859. mypyc/irbuild/expression.py +1067 -0
  860. mypyc/irbuild/for_helpers.py +1046 -0
  861. mypyc/irbuild/format_str_tokenizer.py +250 -0
  862. mypyc/irbuild/function.py +1089 -0
  863. mypyc/irbuild/generator.py +346 -0
  864. mypyc/irbuild/ll_builder.py +2407 -0
  865. mypyc/irbuild/main.py +153 -0
  866. mypyc/irbuild/mapper.py +221 -0
  867. mypyc/irbuild/match.py +355 -0
  868. mypyc/irbuild/nonlocalcontrol.py +197 -0
  869. mypyc/irbuild/prebuildvisitor.py +203 -0
  870. mypyc/irbuild/prepare.py +609 -0
  871. mypyc/irbuild/specialize.py +822 -0
  872. mypyc/irbuild/statement.py +1017 -0
  873. mypyc/irbuild/targets.py +57 -0
  874. mypyc/irbuild/util.py +189 -0
  875. mypyc/irbuild/visitor.py +401 -0
  876. mypyc/irbuild/vtable.py +82 -0
  877. mypyc/lib-rt/CPy.h +643 -0
  878. mypyc/lib-rt/bytes_ops.c +143 -0
  879. mypyc/lib-rt/dict_ops.c +446 -0
  880. mypyc/lib-rt/exc_ops.c +259 -0
  881. mypyc/lib-rt/float_ops.c +192 -0
  882. mypyc/lib-rt/generic_ops.c +64 -0
  883. mypyc/lib-rt/getargs.c +450 -0
  884. mypyc/lib-rt/getargsfast.c +569 -0
  885. mypyc/lib-rt/init.c +13 -0
  886. mypyc/lib-rt/int_ops.c +803 -0
  887. mypyc/lib-rt/list_ops.c +335 -0
  888. mypyc/lib-rt/misc_ops.c +942 -0
  889. mypyc/lib-rt/module_shim.tmpl +18 -0
  890. mypyc/lib-rt/mypyc_util.h +118 -0
  891. mypyc/lib-rt/pythoncapi_compat.h +497 -0
  892. mypyc/lib-rt/pythonsupport.h +548 -0
  893. mypyc/lib-rt/set_ops.c +17 -0
  894. mypyc/lib-rt/setup.py +70 -0
  895. mypyc/lib-rt/str_ops.c +241 -0
  896. mypyc/lib-rt/test_capi.cc +585 -0
  897. mypyc/lib-rt/tuple_ops.c +61 -0
  898. mypyc/namegen.py +115 -0
  899. mypyc/options.py +32 -0
  900. mypyc/primitives/__init__.py +0 -0
  901. mypyc/primitives/bytes_ops.py +101 -0
  902. mypyc/primitives/dict_ops.py +325 -0
  903. mypyc/primitives/exc_ops.py +101 -0
  904. mypyc/primitives/float_ops.py +168 -0
  905. mypyc/primitives/generic_ops.py +384 -0
  906. mypyc/primitives/int_ops.py +304 -0
  907. mypyc/primitives/list_ops.py +300 -0
  908. mypyc/primitives/misc_ops.py +241 -0
  909. mypyc/primitives/registry.py +323 -0
  910. mypyc/primitives/set_ops.py +121 -0
  911. mypyc/primitives/str_ops.py +229 -0
  912. mypyc/primitives/tuple_ops.py +83 -0
  913. mypyc/rt_subtype.py +77 -0
  914. mypyc/sametype.py +83 -0
  915. mypyc/subtype.py +88 -0
  916. mypyc/test/__init__.py +0 -0
  917. mypyc/test/config.py +13 -0
  918. mypyc/test/test_alwaysdefined.py +46 -0
  919. mypyc/test/test_analysis.py +77 -0
  920. mypyc/test/test_cheader.py +45 -0
  921. mypyc/test/test_commandline.py +82 -0
  922. mypyc/test/test_emit.py +69 -0
  923. mypyc/test/test_emitclass.py +35 -0
  924. mypyc/test/test_emitfunc.py +926 -0
  925. mypyc/test/test_emitwrapper.py +60 -0
  926. mypyc/test/test_exceptions.py +56 -0
  927. mypyc/test/test_external.py +49 -0
  928. mypyc/test/test_irbuild.py +87 -0
  929. mypyc/test/test_ircheck.py +199 -0
  930. mypyc/test/test_literals.py +90 -0
  931. mypyc/test/test_namegen.py +48 -0
  932. mypyc/test/test_pprint.py +42 -0
  933. mypyc/test/test_rarray.py +48 -0
  934. mypyc/test/test_refcount.py +59 -0
  935. mypyc/test/test_run.py +426 -0
  936. mypyc/test/test_serialization.py +108 -0
  937. mypyc/test/test_struct.py +112 -0
  938. mypyc/test/test_tuplename.py +33 -0
  939. mypyc/test/test_typeops.py +97 -0
  940. mypyc/test/testutil.py +283 -0
  941. mypyc/test-data/alwaysdefined.test +732 -0
  942. mypyc/test-data/analysis.test +603 -0
  943. mypyc/test-data/commandline.test +245 -0
  944. mypyc/test-data/driver/driver.py +48 -0
  945. mypyc/test-data/exceptions-freq.test +125 -0
  946. mypyc/test-data/exceptions.test +713 -0
  947. mypyc/test-data/fixtures/ir.py +373 -0
  948. mypyc/test-data/fixtures/testutil.py +103 -0
  949. mypyc/test-data/fixtures/typing-full.pyi +169 -0
  950. mypyc/test-data/irbuild-any.test +238 -0
  951. mypyc/test-data/irbuild-basic.test +3690 -0
  952. mypyc/test-data/irbuild-bool.test +463 -0
  953. mypyc/test-data/irbuild-bytes.test +184 -0
  954. mypyc/test-data/irbuild-classes.test +1303 -0
  955. mypyc/test-data/irbuild-constant-fold.test +480 -0
  956. mypyc/test-data/irbuild-dict.test +585 -0
  957. mypyc/test-data/irbuild-dunders.test +223 -0
  958. mypyc/test-data/irbuild-float.test +497 -0
  959. mypyc/test-data/irbuild-generics.test +151 -0
  960. mypyc/test-data/irbuild-glue-methods.test +437 -0
  961. mypyc/test-data/irbuild-i16.test +526 -0
  962. mypyc/test-data/irbuild-i32.test +598 -0
  963. mypyc/test-data/irbuild-i64.test +2164 -0
  964. mypyc/test-data/irbuild-int.test +235 -0
  965. mypyc/test-data/irbuild-isinstance.test +109 -0
  966. mypyc/test-data/irbuild-lists.test +547 -0
  967. mypyc/test-data/irbuild-match.test +1708 -0
  968. mypyc/test-data/irbuild-math.test +64 -0
  969. mypyc/test-data/irbuild-nested.test +807 -0
  970. mypyc/test-data/irbuild-optional.test +536 -0
  971. mypyc/test-data/irbuild-set.test +838 -0
  972. mypyc/test-data/irbuild-singledispatch.test +257 -0
  973. mypyc/test-data/irbuild-statements.test +1149 -0
  974. mypyc/test-data/irbuild-str.test +314 -0
  975. mypyc/test-data/irbuild-strip-asserts.test +12 -0
  976. mypyc/test-data/irbuild-try.test +523 -0
  977. mypyc/test-data/irbuild-tuple.test +462 -0
  978. mypyc/test-data/irbuild-u8.test +543 -0
  979. mypyc/test-data/irbuild-unreachable.test +241 -0
  980. mypyc/test-data/irbuild-vectorcall.test +153 -0
  981. mypyc/test-data/refcount.test +1588 -0
  982. mypyc/test-data/run-async.test +145 -0
  983. mypyc/test-data/run-attrs.test +318 -0
  984. mypyc/test-data/run-bench.test +196 -0
  985. mypyc/test-data/run-bools.test +229 -0
  986. mypyc/test-data/run-bytes.test +302 -0
  987. mypyc/test-data/run-classes.test +2505 -0
  988. mypyc/test-data/run-dicts.test +334 -0
  989. mypyc/test-data/run-dunders.test +945 -0
  990. mypyc/test-data/run-exceptions.test +448 -0
  991. mypyc/test-data/run-floats.test +516 -0
  992. mypyc/test-data/run-functions.test +1310 -0
  993. mypyc/test-data/run-generators.test +681 -0
  994. mypyc/test-data/run-i16.test +338 -0
  995. mypyc/test-data/run-i32.test +336 -0
  996. mypyc/test-data/run-i64.test +1519 -0
  997. mypyc/test-data/run-imports.test +265 -0
  998. mypyc/test-data/run-integers.test +540 -0
  999. mypyc/test-data/run-lists.test +411 -0
  1000. mypyc/test-data/run-loops.test +485 -0
  1001. mypyc/test-data/run-match.test +283 -0
  1002. mypyc/test-data/run-math.test +106 -0
  1003. mypyc/test-data/run-misc.test +1168 -0
  1004. mypyc/test-data/run-multimodule.test +887 -0
  1005. mypyc/test-data/run-mypy-sim.test +138 -0
  1006. mypyc/test-data/run-primitives.test +375 -0
  1007. mypyc/test-data/run-python37.test +159 -0
  1008. mypyc/test-data/run-python38.test +88 -0
  1009. mypyc/test-data/run-sets.test +150 -0
  1010. mypyc/test-data/run-singledispatch.test +698 -0
  1011. mypyc/test-data/run-strings.test +641 -0
  1012. mypyc/test-data/run-traits.test +411 -0
  1013. mypyc/test-data/run-tuples.test +258 -0
  1014. mypyc/test-data/run-u8.test +303 -0
  1015. mypyc/transform/__init__.py +0 -0
  1016. mypyc/transform/exceptions.py +182 -0
  1017. mypyc/transform/refcount.py +294 -0
  1018. mypyc/transform/uninit.py +190 -0
@@ -0,0 +1,1937 @@
1
+ import _ast
2
+ import _typeshed
3
+ import sys
4
+ import types
5
+ from _collections_abc import dict_items, dict_keys, dict_values
6
+ from _typeshed import (
7
+ AnyStr_co,
8
+ ConvertibleToFloat,
9
+ ConvertibleToInt,
10
+ FileDescriptorOrPath,
11
+ OpenBinaryMode,
12
+ OpenBinaryModeReading,
13
+ OpenBinaryModeUpdating,
14
+ OpenBinaryModeWriting,
15
+ OpenTextMode,
16
+ ReadableBuffer,
17
+ SupportsAdd,
18
+ SupportsAiter,
19
+ SupportsAnext,
20
+ SupportsDivMod,
21
+ SupportsFlush,
22
+ SupportsIter,
23
+ SupportsKeysAndGetItem,
24
+ SupportsLenAndGetItem,
25
+ SupportsNext,
26
+ SupportsRAdd,
27
+ SupportsRDivMod,
28
+ SupportsRichComparison,
29
+ SupportsRichComparisonT,
30
+ SupportsWrite,
31
+ )
32
+ from collections.abc import Awaitable, Callable, Iterable, Iterator, MutableSet, Reversible, Set as AbstractSet, Sized
33
+ from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
34
+ from types import CodeType, TracebackType, _Cell
35
+
36
+ # mypy crashes if any of {ByteString, Sequence, MutableSequence, Mapping, MutableMapping} are imported from collections.abc in builtins.pyi
37
+ from typing import ( # noqa: Y022
38
+ IO,
39
+ Any,
40
+ BinaryIO,
41
+ ClassVar,
42
+ Generic,
43
+ Mapping,
44
+ MutableMapping,
45
+ MutableSequence,
46
+ NoReturn,
47
+ Protocol,
48
+ Sequence,
49
+ SupportsAbs,
50
+ SupportsBytes,
51
+ SupportsComplex,
52
+ SupportsFloat,
53
+ SupportsIndex,
54
+ TypeVar,
55
+ final,
56
+ overload,
57
+ type_check_only,
58
+ )
59
+
60
+ # we can't import `Literal` from typing or mypy crashes: see #11247
61
+ from typing_extensions import ( # noqa: Y023
62
+ Concatenate,
63
+ Literal,
64
+ ParamSpec,
65
+ Self,
66
+ TypeAlias,
67
+ TypeGuard,
68
+ TypeVarTuple,
69
+ deprecated,
70
+ )
71
+
72
+ if sys.version_info >= (3, 9):
73
+ from types import GenericAlias
74
+
75
+ _T = TypeVar("_T")
76
+ _T_co = TypeVar("_T_co", covariant=True)
77
+ _T_contra = TypeVar("_T_contra", contravariant=True)
78
+ _R_co = TypeVar("_R_co", covariant=True)
79
+ _KT = TypeVar("_KT")
80
+ _VT = TypeVar("_VT")
81
+ _S = TypeVar("_S")
82
+ _T1 = TypeVar("_T1")
83
+ _T2 = TypeVar("_T2")
84
+ _T3 = TypeVar("_T3")
85
+ _T4 = TypeVar("_T4")
86
+ _T5 = TypeVar("_T5")
87
+ _SupportsNextT = TypeVar("_SupportsNextT", bound=SupportsNext[Any], covariant=True)
88
+ _SupportsAnextT = TypeVar("_SupportsAnextT", bound=SupportsAnext[Any], covariant=True)
89
+ _AwaitableT = TypeVar("_AwaitableT", bound=Awaitable[Any])
90
+ _AwaitableT_co = TypeVar("_AwaitableT_co", bound=Awaitable[Any], covariant=True)
91
+ _P = ParamSpec("_P")
92
+
93
+ class object:
94
+ __doc__: str | None
95
+ __dict__: dict[str, Any]
96
+ __module__: str
97
+ __annotations__: dict[str, Any]
98
+ @property
99
+ def __class__(self) -> type[Self]: ...
100
+ # Ignore errors about type mismatch between property getter and setter
101
+ @__class__.setter
102
+ def __class__(self, __type: type[object]) -> None: ... # noqa: F811
103
+ def __init__(self) -> None: ...
104
+ def __new__(cls) -> Self: ...
105
+ # N.B. `object.__setattr__` and `object.__delattr__` are heavily special-cased by type checkers.
106
+ # Overriding them in subclasses has different semantics, even if the override has an identical signature.
107
+ def __setattr__(self, __name: str, __value: Any) -> None: ...
108
+ def __delattr__(self, __name: str) -> None: ...
109
+ def __eq__(self, __value: object) -> bool: ...
110
+ def __ne__(self, __value: object) -> bool: ...
111
+ def __str__(self) -> str: ... # noqa: Y029
112
+ def __repr__(self) -> str: ... # noqa: Y029
113
+ def __hash__(self) -> int: ...
114
+ def __format__(self, __format_spec: str) -> str: ...
115
+ def __getattribute__(self, __name: str) -> Any: ...
116
+ def __sizeof__(self) -> int: ...
117
+ # return type of pickle methods is rather hard to express in the current type system
118
+ # see #6661 and https://docs.python.org/3/library/pickle.html#object.__reduce__
119
+ def __reduce__(self) -> str | tuple[Any, ...]: ...
120
+ def __reduce_ex__(self, __protocol: SupportsIndex) -> str | tuple[Any, ...]: ...
121
+ if sys.version_info >= (3, 11):
122
+ def __getstate__(self) -> object: ...
123
+
124
+ def __dir__(self) -> Iterable[str]: ...
125
+ def __init_subclass__(cls) -> None: ...
126
+ @classmethod
127
+ def __subclasshook__(cls, __subclass: type) -> bool: ...
128
+
129
+ class staticmethod(Generic[_P, _R_co]):
130
+ @property
131
+ def __func__(self) -> Callable[_P, _R_co]: ...
132
+ @property
133
+ def __isabstractmethod__(self) -> bool: ...
134
+ def __init__(self, __f: Callable[_P, _R_co]) -> None: ...
135
+ @overload
136
+ def __get__(self, __instance: None, __owner: type) -> Callable[_P, _R_co]: ...
137
+ @overload
138
+ def __get__(self, __instance: _T, __owner: type[_T] | None = None) -> Callable[_P, _R_co]: ...
139
+ if sys.version_info >= (3, 10):
140
+ __name__: str
141
+ __qualname__: str
142
+ @property
143
+ def __wrapped__(self) -> Callable[_P, _R_co]: ...
144
+ def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R_co: ...
145
+
146
+ class classmethod(Generic[_T, _P, _R_co]):
147
+ @property
148
+ def __func__(self) -> Callable[Concatenate[type[_T], _P], _R_co]: ...
149
+ @property
150
+ def __isabstractmethod__(self) -> bool: ...
151
+ def __init__(self, __f: Callable[Concatenate[type[_T], _P], _R_co]) -> None: ...
152
+ @overload
153
+ def __get__(self, __instance: _T, __owner: type[_T] | None = None) -> Callable[_P, _R_co]: ...
154
+ @overload
155
+ def __get__(self, __instance: None, __owner: type[_T]) -> Callable[_P, _R_co]: ...
156
+ if sys.version_info >= (3, 10):
157
+ __name__: str
158
+ __qualname__: str
159
+ @property
160
+ def __wrapped__(self) -> Callable[Concatenate[type[_T], _P], _R_co]: ...
161
+
162
+ class type:
163
+ # object.__base__ is None. Otherwise, it would be a type.
164
+ @property
165
+ def __base__(self) -> type | None: ...
166
+ __bases__: tuple[type, ...]
167
+ @property
168
+ def __basicsize__(self) -> int: ...
169
+ @property
170
+ def __dict__(self) -> types.MappingProxyType[str, Any]: ... # type: ignore[override]
171
+ @property
172
+ def __dictoffset__(self) -> int: ...
173
+ @property
174
+ def __flags__(self) -> int: ...
175
+ @property
176
+ def __itemsize__(self) -> int: ...
177
+ __module__: str
178
+ @property
179
+ def __mro__(self) -> tuple[type, ...]: ...
180
+ __name__: str
181
+ __qualname__: str
182
+ @property
183
+ def __text_signature__(self) -> str | None: ...
184
+ @property
185
+ def __weakrefoffset__(self) -> int: ...
186
+ @overload
187
+ def __init__(self, __o: object) -> None: ...
188
+ @overload
189
+ def __init__(self, __name: str, __bases: tuple[type, ...], __dict: dict[str, Any], **kwds: Any) -> None: ...
190
+ @overload
191
+ def __new__(cls, __o: object) -> type: ...
192
+ @overload
193
+ def __new__(
194
+ cls: type[_typeshed.Self], __name: str, __bases: tuple[type, ...], __namespace: dict[str, Any], **kwds: Any
195
+ ) -> _typeshed.Self: ...
196
+ def __call__(self, *args: Any, **kwds: Any) -> Any: ...
197
+ def __subclasses__(self: _typeshed.Self) -> list[_typeshed.Self]: ...
198
+ # Note: the documentation doesn't specify what the return type is, the standard
199
+ # implementation seems to be returning a list.
200
+ def mro(self) -> list[type]: ...
201
+ def __instancecheck__(self, __instance: Any) -> bool: ...
202
+ def __subclasscheck__(self, __subclass: type) -> bool: ...
203
+ @classmethod
204
+ def __prepare__(metacls, __name: str, __bases: tuple[type, ...], **kwds: Any) -> MutableMapping[str, object]: ...
205
+ if sys.version_info >= (3, 10):
206
+ def __or__(self, __value: Any) -> types.UnionType: ...
207
+ def __ror__(self, __value: Any) -> types.UnionType: ...
208
+ if sys.version_info >= (3, 12):
209
+ __type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
210
+
211
+ class super:
212
+ @overload
213
+ def __init__(self, __t: Any, __obj: Any) -> None: ...
214
+ @overload
215
+ def __init__(self, __t: Any) -> None: ...
216
+ @overload
217
+ def __init__(self) -> None: ...
218
+
219
+ _PositiveInteger: TypeAlias = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
220
+ _NegativeInteger: TypeAlias = Literal[-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20]
221
+ _LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed
222
+
223
+ class int:
224
+ @overload
225
+ def __new__(cls, __x: ConvertibleToInt = ...) -> Self: ...
226
+ @overload
227
+ def __new__(cls, __x: str | bytes | bytearray, base: SupportsIndex) -> Self: ...
228
+ def as_integer_ratio(self) -> tuple[int, Literal[1]]: ...
229
+ @property
230
+ def real(self) -> int: ...
231
+ @property
232
+ def imag(self) -> Literal[0]: ...
233
+ @property
234
+ def numerator(self) -> int: ...
235
+ @property
236
+ def denominator(self) -> Literal[1]: ...
237
+ def conjugate(self) -> int: ...
238
+ def bit_length(self) -> int: ...
239
+ if sys.version_info >= (3, 10):
240
+ def bit_count(self) -> int: ...
241
+
242
+ if sys.version_info >= (3, 11):
243
+ def to_bytes(
244
+ self, length: SupportsIndex = 1, byteorder: Literal["little", "big"] = "big", *, signed: bool = False
245
+ ) -> bytes: ...
246
+ @classmethod
247
+ def from_bytes(
248
+ cls,
249
+ bytes: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer,
250
+ byteorder: Literal["little", "big"] = "big",
251
+ *,
252
+ signed: bool = False,
253
+ ) -> Self: ...
254
+ else:
255
+ def to_bytes(self, length: SupportsIndex, byteorder: Literal["little", "big"], *, signed: bool = False) -> bytes: ...
256
+ @classmethod
257
+ def from_bytes(
258
+ cls,
259
+ bytes: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer,
260
+ byteorder: Literal["little", "big"],
261
+ *,
262
+ signed: bool = False,
263
+ ) -> Self: ...
264
+
265
+ if sys.version_info >= (3, 12):
266
+ def is_integer(self) -> Literal[True]: ...
267
+
268
+ def __add__(self, __value: int) -> int: ...
269
+ def __sub__(self, __value: int) -> int: ...
270
+ def __mul__(self, __value: int) -> int: ...
271
+ def __floordiv__(self, __value: int) -> int: ...
272
+ def __truediv__(self, __value: int) -> float: ...
273
+ def __mod__(self, __value: int) -> int: ...
274
+ def __divmod__(self, __value: int) -> tuple[int, int]: ...
275
+ def __radd__(self, __value: int) -> int: ...
276
+ def __rsub__(self, __value: int) -> int: ...
277
+ def __rmul__(self, __value: int) -> int: ...
278
+ def __rfloordiv__(self, __value: int) -> int: ...
279
+ def __rtruediv__(self, __value: int) -> float: ...
280
+ def __rmod__(self, __value: int) -> int: ...
281
+ def __rdivmod__(self, __value: int) -> tuple[int, int]: ...
282
+ @overload
283
+ def __pow__(self, __x: Literal[0]) -> Literal[1]: ...
284
+ @overload
285
+ def __pow__(self, __value: Literal[0], __mod: None) -> Literal[1]: ...
286
+ @overload
287
+ def __pow__(self, __value: _PositiveInteger, __mod: None = None) -> int: ...
288
+ @overload
289
+ def __pow__(self, __value: _NegativeInteger, __mod: None = None) -> float: ...
290
+ # positive __value -> int; negative __value -> float
291
+ # return type must be Any as `int | float` causes too many false-positive errors
292
+ @overload
293
+ def __pow__(self, __value: int, __mod: None = None) -> Any: ...
294
+ @overload
295
+ def __pow__(self, __value: int, __mod: int) -> int: ...
296
+ def __rpow__(self, __value: int, __mod: int | None = None) -> Any: ...
297
+ def __and__(self, __value: int) -> int: ...
298
+ def __or__(self, __value: int) -> int: ...
299
+ def __xor__(self, __value: int) -> int: ...
300
+ def __lshift__(self, __value: int) -> int: ...
301
+ def __rshift__(self, __value: int) -> int: ...
302
+ def __rand__(self, __value: int) -> int: ...
303
+ def __ror__(self, __value: int) -> int: ...
304
+ def __rxor__(self, __value: int) -> int: ...
305
+ def __rlshift__(self, __value: int) -> int: ...
306
+ def __rrshift__(self, __value: int) -> int: ...
307
+ def __neg__(self) -> int: ...
308
+ def __pos__(self) -> int: ...
309
+ def __invert__(self) -> int: ...
310
+ def __trunc__(self) -> int: ...
311
+ def __ceil__(self) -> int: ...
312
+ def __floor__(self) -> int: ...
313
+ def __round__(self, __ndigits: SupportsIndex = ...) -> int: ...
314
+ def __getnewargs__(self) -> tuple[int]: ...
315
+ def __eq__(self, __value: object) -> bool: ...
316
+ def __ne__(self, __value: object) -> bool: ...
317
+ def __lt__(self, __value: int) -> bool: ...
318
+ def __le__(self, __value: int) -> bool: ...
319
+ def __gt__(self, __value: int) -> bool: ...
320
+ def __ge__(self, __value: int) -> bool: ...
321
+ def __float__(self) -> float: ...
322
+ def __int__(self) -> int: ...
323
+ def __abs__(self) -> int: ...
324
+ def __hash__(self) -> int: ...
325
+ def __bool__(self) -> bool: ...
326
+ def __index__(self) -> int: ...
327
+
328
+ class float:
329
+ def __new__(cls, __x: ConvertibleToFloat = ...) -> Self: ...
330
+ def as_integer_ratio(self) -> tuple[int, int]: ...
331
+ def hex(self) -> str: ...
332
+ def is_integer(self) -> bool: ...
333
+ @classmethod
334
+ def fromhex(cls, __string: str) -> Self: ...
335
+ @property
336
+ def real(self) -> float: ...
337
+ @property
338
+ def imag(self) -> float: ...
339
+ def conjugate(self) -> float: ...
340
+ def __add__(self, __value: float) -> float: ...
341
+ def __sub__(self, __value: float) -> float: ...
342
+ def __mul__(self, __value: float) -> float: ...
343
+ def __floordiv__(self, __value: float) -> float: ...
344
+ def __truediv__(self, __value: float) -> float: ...
345
+ def __mod__(self, __value: float) -> float: ...
346
+ def __divmod__(self, __value: float) -> tuple[float, float]: ...
347
+ @overload
348
+ def __pow__(self, __value: int, __mod: None = None) -> float: ...
349
+ # positive __value -> float; negative __value -> complex
350
+ # return type must be Any as `float | complex` causes too many false-positive errors
351
+ @overload
352
+ def __pow__(self, __value: float, __mod: None = None) -> Any: ...
353
+ def __radd__(self, __value: float) -> float: ...
354
+ def __rsub__(self, __value: float) -> float: ...
355
+ def __rmul__(self, __value: float) -> float: ...
356
+ def __rfloordiv__(self, __value: float) -> float: ...
357
+ def __rtruediv__(self, __value: float) -> float: ...
358
+ def __rmod__(self, __value: float) -> float: ...
359
+ def __rdivmod__(self, __value: float) -> tuple[float, float]: ...
360
+ @overload
361
+ def __rpow__(self, __value: _PositiveInteger, __mod: None = None) -> float: ...
362
+ @overload
363
+ def __rpow__(self, __value: _NegativeInteger, __mod: None = None) -> complex: ...
364
+ # Returning `complex` for the general case gives too many false-positive errors.
365
+ @overload
366
+ def __rpow__(self, __value: float, __mod: None = None) -> Any: ...
367
+ def __getnewargs__(self) -> tuple[float]: ...
368
+ def __trunc__(self) -> int: ...
369
+ if sys.version_info >= (3, 9):
370
+ def __ceil__(self) -> int: ...
371
+ def __floor__(self) -> int: ...
372
+
373
+ @overload
374
+ def __round__(self, __ndigits: None = None) -> int: ...
375
+ @overload
376
+ def __round__(self, __ndigits: SupportsIndex) -> float: ...
377
+ def __eq__(self, __value: object) -> bool: ...
378
+ def __ne__(self, __value: object) -> bool: ...
379
+ def __lt__(self, __value: float) -> bool: ...
380
+ def __le__(self, __value: float) -> bool: ...
381
+ def __gt__(self, __value: float) -> bool: ...
382
+ def __ge__(self, __value: float) -> bool: ...
383
+ def __neg__(self) -> float: ...
384
+ def __pos__(self) -> float: ...
385
+ def __int__(self) -> int: ...
386
+ def __float__(self) -> float: ...
387
+ def __abs__(self) -> float: ...
388
+ def __hash__(self) -> int: ...
389
+ def __bool__(self) -> bool: ...
390
+
391
+ class complex:
392
+ # Python doesn't currently accept SupportsComplex for the second argument
393
+ @overload
394
+ def __new__(
395
+ cls,
396
+ real: complex | SupportsComplex | SupportsFloat | SupportsIndex = ...,
397
+ imag: complex | SupportsFloat | SupportsIndex = ...,
398
+ ) -> Self: ...
399
+ @overload
400
+ def __new__(cls, real: str | SupportsComplex | SupportsFloat | SupportsIndex | complex) -> Self: ...
401
+ @property
402
+ def real(self) -> float: ...
403
+ @property
404
+ def imag(self) -> float: ...
405
+ def conjugate(self) -> complex: ...
406
+ def __add__(self, __value: complex) -> complex: ...
407
+ def __sub__(self, __value: complex) -> complex: ...
408
+ def __mul__(self, __value: complex) -> complex: ...
409
+ def __pow__(self, __value: complex, __mod: None = None) -> complex: ...
410
+ def __truediv__(self, __value: complex) -> complex: ...
411
+ def __radd__(self, __value: complex) -> complex: ...
412
+ def __rsub__(self, __value: complex) -> complex: ...
413
+ def __rmul__(self, __value: complex) -> complex: ...
414
+ def __rpow__(self, __value: complex, __mod: None = None) -> complex: ...
415
+ def __rtruediv__(self, __value: complex) -> complex: ...
416
+ def __eq__(self, __value: object) -> bool: ...
417
+ def __ne__(self, __value: object) -> bool: ...
418
+ def __neg__(self) -> complex: ...
419
+ def __pos__(self) -> complex: ...
420
+ def __abs__(self) -> float: ...
421
+ def __hash__(self) -> int: ...
422
+ def __bool__(self) -> bool: ...
423
+ if sys.version_info >= (3, 11):
424
+ def __complex__(self) -> complex: ...
425
+
426
+ class _FormatMapMapping(Protocol):
427
+ def __getitem__(self, __key: str) -> Any: ...
428
+
429
+ class _TranslateTable(Protocol):
430
+ def __getitem__(self, __key: int) -> str | int | None: ...
431
+
432
+ class str(Sequence[str]):
433
+ @overload
434
+ def __new__(cls, object: object = ...) -> Self: ...
435
+ @overload
436
+ def __new__(cls, object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ...
437
+ def capitalize(self) -> str: ... # type: ignore[misc]
438
+ def casefold(self) -> str: ... # type: ignore[misc]
439
+ def center(self, __width: SupportsIndex, __fillchar: str = " ") -> str: ... # type: ignore[misc]
440
+ def count(self, x: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
441
+ def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
442
+ def endswith(
443
+ self, __suffix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
444
+ ) -> bool: ...
445
+ def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
446
+ def find(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
447
+ def format(self, *args: object, **kwargs: object) -> str: ...
448
+ def format_map(self, map: _FormatMapMapping) -> str: ...
449
+ def index(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
450
+ def isalnum(self) -> bool: ...
451
+ def isalpha(self) -> bool: ...
452
+ def isascii(self) -> bool: ...
453
+ def isdecimal(self) -> bool: ...
454
+ def isdigit(self) -> bool: ...
455
+ def isidentifier(self) -> bool: ...
456
+ def islower(self) -> bool: ...
457
+ def isnumeric(self) -> bool: ...
458
+ def isprintable(self) -> bool: ...
459
+ def isspace(self) -> bool: ...
460
+ def istitle(self) -> bool: ...
461
+ def isupper(self) -> bool: ...
462
+ def join(self, __iterable: Iterable[str]) -> str: ... # type: ignore[misc]
463
+ def ljust(self, __width: SupportsIndex, __fillchar: str = " ") -> str: ... # type: ignore[misc]
464
+ def lower(self) -> str: ... # type: ignore[misc]
465
+ def lstrip(self, __chars: str | None = None) -> str: ... # type: ignore[misc]
466
+ def partition(self, __sep: str) -> tuple[str, str, str]: ... # type: ignore[misc]
467
+ def replace(self, __old: str, __new: str, __count: SupportsIndex = -1) -> str: ... # type: ignore[misc]
468
+ if sys.version_info >= (3, 9):
469
+ def removeprefix(self, __prefix: str) -> str: ... # type: ignore[misc]
470
+ def removesuffix(self, __suffix: str) -> str: ... # type: ignore[misc]
471
+
472
+ def rfind(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
473
+ def rindex(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
474
+ def rjust(self, __width: SupportsIndex, __fillchar: str = " ") -> str: ... # type: ignore[misc]
475
+ def rpartition(self, __sep: str) -> tuple[str, str, str]: ... # type: ignore[misc]
476
+ def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
477
+ def rstrip(self, __chars: str | None = None) -> str: ... # type: ignore[misc]
478
+ def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
479
+ def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
480
+ def startswith(
481
+ self, __prefix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
482
+ ) -> bool: ...
483
+ def strip(self, __chars: str | None = None) -> str: ... # type: ignore[misc]
484
+ def swapcase(self) -> str: ... # type: ignore[misc]
485
+ def title(self) -> str: ... # type: ignore[misc]
486
+ def translate(self, __table: _TranslateTable) -> str: ...
487
+ def upper(self) -> str: ... # type: ignore[misc]
488
+ def zfill(self, __width: SupportsIndex) -> str: ... # type: ignore[misc]
489
+ @staticmethod
490
+ @overload
491
+ def maketrans(__x: dict[int, _T] | dict[str, _T] | dict[str | int, _T]) -> dict[int, _T]: ...
492
+ @staticmethod
493
+ @overload
494
+ def maketrans(__x: str, __y: str) -> dict[int, int]: ...
495
+ @staticmethod
496
+ @overload
497
+ def maketrans(__x: str, __y: str, __z: str) -> dict[int, int | None]: ...
498
+ def __add__(self, __value: str) -> str: ... # type: ignore[misc]
499
+ # Incompatible with Sequence.__contains__
500
+ def __contains__(self, __key: str) -> bool: ... # type: ignore[override]
501
+ def __eq__(self, __value: object) -> bool: ...
502
+ def __ge__(self, __value: str) -> bool: ...
503
+ def __getitem__(self, __key: SupportsIndex | slice) -> str: ...
504
+ def __gt__(self, __value: str) -> bool: ...
505
+ def __hash__(self) -> int: ...
506
+ def __iter__(self) -> Iterator[str]: ... # type: ignore[misc]
507
+ def __le__(self, __value: str) -> bool: ...
508
+ def __len__(self) -> int: ...
509
+ def __lt__(self, __value: str) -> bool: ...
510
+ def __mod__(self, __value: Any) -> str: ...
511
+ def __mul__(self, __value: SupportsIndex) -> str: ... # type: ignore[misc]
512
+ def __ne__(self, __value: object) -> bool: ...
513
+ def __rmul__(self, __value: SupportsIndex) -> str: ... # type: ignore[misc]
514
+ def __getnewargs__(self) -> tuple[str]: ...
515
+
516
+ class bytes(Sequence[int]):
517
+ @overload
518
+ def __new__(cls, __o: Iterable[SupportsIndex] | SupportsIndex | SupportsBytes | ReadableBuffer) -> Self: ...
519
+ @overload
520
+ def __new__(cls, __string: str, encoding: str, errors: str = ...) -> Self: ...
521
+ @overload
522
+ def __new__(cls) -> Self: ...
523
+ def capitalize(self) -> bytes: ...
524
+ def center(self, __width: SupportsIndex, __fillchar: bytes = b" ") -> bytes: ...
525
+ def count(
526
+ self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
527
+ ) -> int: ...
528
+ def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: ...
529
+ def endswith(
530
+ self,
531
+ __suffix: ReadableBuffer | tuple[ReadableBuffer, ...],
532
+ __start: SupportsIndex | None = ...,
533
+ __end: SupportsIndex | None = ...,
534
+ ) -> bool: ...
535
+ def expandtabs(self, tabsize: SupportsIndex = 8) -> bytes: ...
536
+ def find(
537
+ self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
538
+ ) -> int: ...
539
+ def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
540
+ def index(
541
+ self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
542
+ ) -> int: ...
543
+ def isalnum(self) -> bool: ...
544
+ def isalpha(self) -> bool: ...
545
+ def isascii(self) -> bool: ...
546
+ def isdigit(self) -> bool: ...
547
+ def islower(self) -> bool: ...
548
+ def isspace(self) -> bool: ...
549
+ def istitle(self) -> bool: ...
550
+ def isupper(self) -> bool: ...
551
+ def join(self, __iterable_of_bytes: Iterable[ReadableBuffer]) -> bytes: ...
552
+ def ljust(self, __width: SupportsIndex, __fillchar: bytes | bytearray = b" ") -> bytes: ...
553
+ def lower(self) -> bytes: ...
554
+ def lstrip(self, __bytes: ReadableBuffer | None = None) -> bytes: ...
555
+ def partition(self, __sep: ReadableBuffer) -> tuple[bytes, bytes, bytes]: ...
556
+ def replace(self, __old: ReadableBuffer, __new: ReadableBuffer, __count: SupportsIndex = -1) -> bytes: ...
557
+ if sys.version_info >= (3, 9):
558
+ def removeprefix(self, __prefix: ReadableBuffer) -> bytes: ...
559
+ def removesuffix(self, __suffix: ReadableBuffer) -> bytes: ...
560
+
561
+ def rfind(
562
+ self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
563
+ ) -> int: ...
564
+ def rindex(
565
+ self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
566
+ ) -> int: ...
567
+ def rjust(self, __width: SupportsIndex, __fillchar: bytes | bytearray = b" ") -> bytes: ...
568
+ def rpartition(self, __sep: ReadableBuffer) -> tuple[bytes, bytes, bytes]: ...
569
+ def rsplit(self, sep: ReadableBuffer | None = None, maxsplit: SupportsIndex = -1) -> list[bytes]: ...
570
+ def rstrip(self, __bytes: ReadableBuffer | None = None) -> bytes: ...
571
+ def split(self, sep: ReadableBuffer | None = None, maxsplit: SupportsIndex = -1) -> list[bytes]: ...
572
+ def splitlines(self, keepends: bool = False) -> list[bytes]: ...
573
+ def startswith(
574
+ self,
575
+ __prefix: ReadableBuffer | tuple[ReadableBuffer, ...],
576
+ __start: SupportsIndex | None = ...,
577
+ __end: SupportsIndex | None = ...,
578
+ ) -> bool: ...
579
+ def strip(self, __bytes: ReadableBuffer | None = None) -> bytes: ...
580
+ def swapcase(self) -> bytes: ...
581
+ def title(self) -> bytes: ...
582
+ def translate(self, __table: ReadableBuffer | None, delete: bytes = b"") -> bytes: ...
583
+ def upper(self) -> bytes: ...
584
+ def zfill(self, __width: SupportsIndex) -> bytes: ...
585
+ @classmethod
586
+ def fromhex(cls, __string: str) -> Self: ...
587
+ @staticmethod
588
+ def maketrans(__frm: ReadableBuffer, __to: ReadableBuffer) -> bytes: ...
589
+ def __len__(self) -> int: ...
590
+ def __iter__(self) -> Iterator[int]: ...
591
+ def __hash__(self) -> int: ...
592
+ @overload
593
+ def __getitem__(self, __key: SupportsIndex) -> int: ...
594
+ @overload
595
+ def __getitem__(self, __key: slice) -> bytes: ...
596
+ def __add__(self, __value: ReadableBuffer) -> bytes: ...
597
+ def __mul__(self, __value: SupportsIndex) -> bytes: ...
598
+ def __rmul__(self, __value: SupportsIndex) -> bytes: ...
599
+ def __mod__(self, __value: Any) -> bytes: ...
600
+ # Incompatible with Sequence.__contains__
601
+ def __contains__(self, __key: SupportsIndex | ReadableBuffer) -> bool: ... # type: ignore[override]
602
+ def __eq__(self, __value: object) -> bool: ...
603
+ def __ne__(self, __value: object) -> bool: ...
604
+ def __lt__(self, __value: bytes) -> bool: ...
605
+ def __le__(self, __value: bytes) -> bool: ...
606
+ def __gt__(self, __value: bytes) -> bool: ...
607
+ def __ge__(self, __value: bytes) -> bool: ...
608
+ def __getnewargs__(self) -> tuple[bytes]: ...
609
+ if sys.version_info >= (3, 11):
610
+ def __bytes__(self) -> bytes: ...
611
+
612
+ def __buffer__(self, __flags: int) -> memoryview: ...
613
+
614
+ class bytearray(MutableSequence[int]):
615
+ @overload
616
+ def __init__(self) -> None: ...
617
+ @overload
618
+ def __init__(self, __ints: Iterable[SupportsIndex] | SupportsIndex | ReadableBuffer) -> None: ...
619
+ @overload
620
+ def __init__(self, __string: str, encoding: str, errors: str = ...) -> None: ...
621
+ def append(self, __item: SupportsIndex) -> None: ...
622
+ def capitalize(self) -> bytearray: ...
623
+ def center(self, __width: SupportsIndex, __fillchar: bytes = b" ") -> bytearray: ...
624
+ def count(
625
+ self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
626
+ ) -> int: ...
627
+ def copy(self) -> bytearray: ...
628
+ def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: ...
629
+ def endswith(
630
+ self,
631
+ __suffix: ReadableBuffer | tuple[ReadableBuffer, ...],
632
+ __start: SupportsIndex | None = ...,
633
+ __end: SupportsIndex | None = ...,
634
+ ) -> bool: ...
635
+ def expandtabs(self, tabsize: SupportsIndex = 8) -> bytearray: ...
636
+ def extend(self, __iterable_of_ints: Iterable[SupportsIndex]) -> None: ...
637
+ def find(
638
+ self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
639
+ ) -> int: ...
640
+ def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
641
+ def index(
642
+ self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
643
+ ) -> int: ...
644
+ def insert(self, __index: SupportsIndex, __item: SupportsIndex) -> None: ...
645
+ def isalnum(self) -> bool: ...
646
+ def isalpha(self) -> bool: ...
647
+ def isascii(self) -> bool: ...
648
+ def isdigit(self) -> bool: ...
649
+ def islower(self) -> bool: ...
650
+ def isspace(self) -> bool: ...
651
+ def istitle(self) -> bool: ...
652
+ def isupper(self) -> bool: ...
653
+ def join(self, __iterable_of_bytes: Iterable[ReadableBuffer]) -> bytearray: ...
654
+ def ljust(self, __width: SupportsIndex, __fillchar: bytes | bytearray = b" ") -> bytearray: ...
655
+ def lower(self) -> bytearray: ...
656
+ def lstrip(self, __bytes: ReadableBuffer | None = None) -> bytearray: ...
657
+ def partition(self, __sep: ReadableBuffer) -> tuple[bytearray, bytearray, bytearray]: ...
658
+ def pop(self, __index: int = -1) -> int: ...
659
+ def remove(self, __value: int) -> None: ...
660
+ if sys.version_info >= (3, 9):
661
+ def removeprefix(self, __prefix: ReadableBuffer) -> bytearray: ...
662
+ def removesuffix(self, __suffix: ReadableBuffer) -> bytearray: ...
663
+
664
+ def replace(self, __old: ReadableBuffer, __new: ReadableBuffer, __count: SupportsIndex = -1) -> bytearray: ...
665
+ def rfind(
666
+ self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
667
+ ) -> int: ...
668
+ def rindex(
669
+ self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
670
+ ) -> int: ...
671
+ def rjust(self, __width: SupportsIndex, __fillchar: bytes | bytearray = b" ") -> bytearray: ...
672
+ def rpartition(self, __sep: ReadableBuffer) -> tuple[bytearray, bytearray, bytearray]: ...
673
+ def rsplit(self, sep: ReadableBuffer | None = None, maxsplit: SupportsIndex = -1) -> list[bytearray]: ...
674
+ def rstrip(self, __bytes: ReadableBuffer | None = None) -> bytearray: ...
675
+ def split(self, sep: ReadableBuffer | None = None, maxsplit: SupportsIndex = -1) -> list[bytearray]: ...
676
+ def splitlines(self, keepends: bool = False) -> list[bytearray]: ...
677
+ def startswith(
678
+ self,
679
+ __prefix: ReadableBuffer | tuple[ReadableBuffer, ...],
680
+ __start: SupportsIndex | None = ...,
681
+ __end: SupportsIndex | None = ...,
682
+ ) -> bool: ...
683
+ def strip(self, __bytes: ReadableBuffer | None = None) -> bytearray: ...
684
+ def swapcase(self) -> bytearray: ...
685
+ def title(self) -> bytearray: ...
686
+ def translate(self, __table: ReadableBuffer | None, delete: bytes = b"") -> bytearray: ...
687
+ def upper(self) -> bytearray: ...
688
+ def zfill(self, __width: SupportsIndex) -> bytearray: ...
689
+ @classmethod
690
+ def fromhex(cls, __string: str) -> Self: ...
691
+ @staticmethod
692
+ def maketrans(__frm: ReadableBuffer, __to: ReadableBuffer) -> bytes: ...
693
+ def __len__(self) -> int: ...
694
+ def __iter__(self) -> Iterator[int]: ...
695
+ __hash__: ClassVar[None] # type: ignore[assignment]
696
+ @overload
697
+ def __getitem__(self, __key: SupportsIndex) -> int: ...
698
+ @overload
699
+ def __getitem__(self, __key: slice) -> bytearray: ...
700
+ @overload
701
+ def __setitem__(self, __key: SupportsIndex, __value: SupportsIndex) -> None: ...
702
+ @overload
703
+ def __setitem__(self, __key: slice, __value: Iterable[SupportsIndex] | bytes) -> None: ...
704
+ def __delitem__(self, __key: SupportsIndex | slice) -> None: ...
705
+ def __add__(self, __value: ReadableBuffer) -> bytearray: ...
706
+ # The superclass wants us to accept Iterable[int], but that fails at runtime.
707
+ def __iadd__(self, __value: ReadableBuffer) -> Self: ... # type: ignore[override]
708
+ def __mul__(self, __value: SupportsIndex) -> bytearray: ...
709
+ def __rmul__(self, __value: SupportsIndex) -> bytearray: ...
710
+ def __imul__(self, __value: SupportsIndex) -> Self: ...
711
+ def __mod__(self, __value: Any) -> bytes: ...
712
+ # Incompatible with Sequence.__contains__
713
+ def __contains__(self, __key: SupportsIndex | ReadableBuffer) -> bool: ... # type: ignore[override]
714
+ def __eq__(self, __value: object) -> bool: ...
715
+ def __ne__(self, __value: object) -> bool: ...
716
+ def __lt__(self, __value: ReadableBuffer) -> bool: ...
717
+ def __le__(self, __value: ReadableBuffer) -> bool: ...
718
+ def __gt__(self, __value: ReadableBuffer) -> bool: ...
719
+ def __ge__(self, __value: ReadableBuffer) -> bool: ...
720
+ def __alloc__(self) -> int: ...
721
+ def __buffer__(self, __flags: int) -> memoryview: ...
722
+ def __release_buffer__(self, __buffer: memoryview) -> None: ...
723
+
724
+ @final
725
+ class memoryview(Sequence[int]):
726
+ @property
727
+ def format(self) -> str: ...
728
+ @property
729
+ def itemsize(self) -> int: ...
730
+ @property
731
+ def shape(self) -> tuple[int, ...] | None: ...
732
+ @property
733
+ def strides(self) -> tuple[int, ...] | None: ...
734
+ @property
735
+ def suboffsets(self) -> tuple[int, ...] | None: ...
736
+ @property
737
+ def readonly(self) -> bool: ...
738
+ @property
739
+ def ndim(self) -> int: ...
740
+ @property
741
+ def obj(self) -> ReadableBuffer: ...
742
+ @property
743
+ def c_contiguous(self) -> bool: ...
744
+ @property
745
+ def f_contiguous(self) -> bool: ...
746
+ @property
747
+ def contiguous(self) -> bool: ...
748
+ @property
749
+ def nbytes(self) -> int: ...
750
+ def __new__(cls, obj: ReadableBuffer) -> Self: ...
751
+ def __enter__(self) -> Self: ...
752
+ def __exit__(
753
+ self, __exc_type: type[BaseException] | None, __exc_val: BaseException | None, __exc_tb: TracebackType | None
754
+ ) -> None: ...
755
+ def cast(self, format: str, shape: list[int] | tuple[int, ...] = ...) -> memoryview: ...
756
+ @overload
757
+ def __getitem__(self, __key: SupportsIndex | tuple[SupportsIndex, ...]) -> int: ...
758
+ @overload
759
+ def __getitem__(self, __key: slice) -> memoryview: ...
760
+ def __contains__(self, __x: object) -> bool: ...
761
+ def __iter__(self) -> Iterator[int]: ...
762
+ def __len__(self) -> int: ...
763
+ def __eq__(self, __value: object) -> bool: ...
764
+ def __hash__(self) -> int: ...
765
+ @overload
766
+ def __setitem__(self, __key: slice, __value: ReadableBuffer) -> None: ...
767
+ @overload
768
+ def __setitem__(self, __key: SupportsIndex | tuple[SupportsIndex, ...], __value: SupportsIndex) -> None: ...
769
+ if sys.version_info >= (3, 10):
770
+ def tobytes(self, order: Literal["C", "F", "A"] | None = "C") -> bytes: ...
771
+ else:
772
+ def tobytes(self, order: Literal["C", "F", "A"] | None = None) -> bytes: ...
773
+
774
+ def tolist(self) -> list[int]: ...
775
+ def toreadonly(self) -> memoryview: ...
776
+ def release(self) -> None: ...
777
+ def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
778
+ def __buffer__(self, __flags: int) -> memoryview: ...
779
+ def __release_buffer__(self, __buffer: memoryview) -> None: ...
780
+
781
+ @final
782
+ class bool(int):
783
+ def __new__(cls, __o: object = ...) -> Self: ...
784
+ # The following overloads could be represented more elegantly with a TypeVar("_B", bool, int),
785
+ # however mypy has a bug regarding TypeVar constraints (https://github.com/python/mypy/issues/11880).
786
+ @overload
787
+ def __and__(self, __value: bool) -> bool: ...
788
+ @overload
789
+ def __and__(self, __value: int) -> int: ...
790
+ @overload
791
+ def __or__(self, __value: bool) -> bool: ...
792
+ @overload
793
+ def __or__(self, __value: int) -> int: ...
794
+ @overload
795
+ def __xor__(self, __value: bool) -> bool: ...
796
+ @overload
797
+ def __xor__(self, __value: int) -> int: ...
798
+ @overload
799
+ def __rand__(self, __value: bool) -> bool: ...
800
+ @overload
801
+ def __rand__(self, __value: int) -> int: ...
802
+ @overload
803
+ def __ror__(self, __value: bool) -> bool: ...
804
+ @overload
805
+ def __ror__(self, __value: int) -> int: ...
806
+ @overload
807
+ def __rxor__(self, __value: bool) -> bool: ...
808
+ @overload
809
+ def __rxor__(self, __value: int) -> int: ...
810
+ def __getnewargs__(self) -> tuple[int]: ...
811
+ @deprecated("Will throw an error in Python 3.14. Use `not` for logical negation of bools instead.")
812
+ def __invert__(self) -> int: ...
813
+
814
+ @final
815
+ class slice:
816
+ @property
817
+ def start(self) -> Any: ...
818
+ @property
819
+ def step(self) -> Any: ...
820
+ @property
821
+ def stop(self) -> Any: ...
822
+ @overload
823
+ def __new__(cls, __stop: Any) -> Self: ...
824
+ @overload
825
+ def __new__(cls, __start: Any, __stop: Any, __step: Any = ...) -> Self: ...
826
+ def __eq__(self, __value: object) -> bool: ...
827
+ __hash__: ClassVar[None] # type: ignore[assignment]
828
+ def indices(self, __len: SupportsIndex) -> tuple[int, int, int]: ...
829
+
830
+ class tuple(Sequence[_T_co]):
831
+ def __new__(cls, __iterable: Iterable[_T_co] = ...) -> Self: ...
832
+ def __len__(self) -> int: ...
833
+ def __contains__(self, __key: object) -> bool: ...
834
+ @overload
835
+ def __getitem__(self, __key: SupportsIndex) -> _T_co: ...
836
+ @overload
837
+ def __getitem__(self, __key: slice) -> tuple[_T_co, ...]: ...
838
+ def __iter__(self) -> Iterator[_T_co]: ...
839
+ def __lt__(self, __value: tuple[_T_co, ...]) -> bool: ...
840
+ def __le__(self, __value: tuple[_T_co, ...]) -> bool: ...
841
+ def __gt__(self, __value: tuple[_T_co, ...]) -> bool: ...
842
+ def __ge__(self, __value: tuple[_T_co, ...]) -> bool: ...
843
+ def __eq__(self, __value: object) -> bool: ...
844
+ def __hash__(self) -> int: ...
845
+ @overload
846
+ def __add__(self, __value: tuple[_T_co, ...]) -> tuple[_T_co, ...]: ...
847
+ @overload
848
+ def __add__(self, __value: tuple[_T, ...]) -> tuple[_T_co | _T, ...]: ...
849
+ def __mul__(self, __value: SupportsIndex) -> tuple[_T_co, ...]: ...
850
+ def __rmul__(self, __value: SupportsIndex) -> tuple[_T_co, ...]: ...
851
+ def count(self, __value: Any) -> int: ...
852
+ def index(self, __value: Any, __start: SupportsIndex = 0, __stop: SupportsIndex = sys.maxsize) -> int: ...
853
+ if sys.version_info >= (3, 9):
854
+ def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
855
+
856
+ # Doesn't exist at runtime, but deleting this breaks mypy. See #2999
857
+ @final
858
+ @type_check_only
859
+ class function:
860
+ # Make sure this class definition stays roughly in line with `types.FunctionType`
861
+ @property
862
+ def __closure__(self) -> tuple[_Cell, ...] | None: ...
863
+ __code__: CodeType
864
+ __defaults__: tuple[Any, ...] | None
865
+ __dict__: dict[str, Any]
866
+ @property
867
+ def __globals__(self) -> dict[str, Any]: ...
868
+ __name__: str
869
+ __qualname__: str
870
+ __annotations__: dict[str, Any]
871
+ __kwdefaults__: dict[str, Any]
872
+ if sys.version_info >= (3, 10):
873
+ @property
874
+ def __builtins__(self) -> dict[str, Any]: ...
875
+ if sys.version_info >= (3, 12):
876
+ __type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
877
+
878
+ __module__: str
879
+ # mypy uses `builtins.function.__get__` to represent methods, properties, and getset_descriptors so we type the return as Any.
880
+ def __get__(self, __instance: object, __owner: type | None = None) -> Any: ...
881
+
882
+ class list(MutableSequence[_T]):
883
+ @overload
884
+ def __init__(self) -> None: ...
885
+ @overload
886
+ def __init__(self, __iterable: Iterable[_T]) -> None: ...
887
+ def copy(self) -> list[_T]: ...
888
+ def append(self, __object: _T) -> None: ...
889
+ def extend(self, __iterable: Iterable[_T]) -> None: ...
890
+ def pop(self, __index: SupportsIndex = -1) -> _T: ...
891
+ # Signature of `list.index` should be kept in line with `collections.UserList.index()`
892
+ # and multiprocessing.managers.ListProxy.index()
893
+ def index(self, __value: _T, __start: SupportsIndex = 0, __stop: SupportsIndex = sys.maxsize) -> int: ...
894
+ def count(self, __value: _T) -> int: ...
895
+ def insert(self, __index: SupportsIndex, __object: _T) -> None: ...
896
+ def remove(self, __value: _T) -> None: ...
897
+ # Signature of `list.sort` should be kept inline with `collections.UserList.sort()`
898
+ # and multiprocessing.managers.ListProxy.sort()
899
+ #
900
+ # Use list[SupportsRichComparisonT] for the first overload rather than [SupportsRichComparison]
901
+ # to work around invariance
902
+ @overload
903
+ def sort(self: list[SupportsRichComparisonT], *, key: None = None, reverse: bool = False) -> None: ...
904
+ @overload
905
+ def sort(self, *, key: Callable[[_T], SupportsRichComparison], reverse: bool = False) -> None: ...
906
+ def __len__(self) -> int: ...
907
+ def __iter__(self) -> Iterator[_T]: ...
908
+ __hash__: ClassVar[None] # type: ignore[assignment]
909
+ @overload
910
+ def __getitem__(self, __i: SupportsIndex) -> _T: ...
911
+ @overload
912
+ def __getitem__(self, __s: slice) -> list[_T]: ...
913
+ @overload
914
+ def __setitem__(self, __key: SupportsIndex, __value: _T) -> None: ...
915
+ @overload
916
+ def __setitem__(self, __key: slice, __value: Iterable[_T]) -> None: ...
917
+ def __delitem__(self, __key: SupportsIndex | slice) -> None: ...
918
+ # Overloading looks unnecessary, but is needed to work around complex mypy problems
919
+ @overload
920
+ def __add__(self, __value: list[_T]) -> list[_T]: ...
921
+ @overload
922
+ def __add__(self, __value: list[_S]) -> list[_S | _T]: ...
923
+ def __iadd__(self, __value: Iterable[_T]) -> Self: ... # type: ignore[misc]
924
+ def __mul__(self, __value: SupportsIndex) -> list[_T]: ...
925
+ def __rmul__(self, __value: SupportsIndex) -> list[_T]: ...
926
+ def __imul__(self, __value: SupportsIndex) -> Self: ...
927
+ def __contains__(self, __key: object) -> bool: ...
928
+ def __reversed__(self) -> Iterator[_T]: ...
929
+ def __gt__(self, __value: list[_T]) -> bool: ...
930
+ def __ge__(self, __value: list[_T]) -> bool: ...
931
+ def __lt__(self, __value: list[_T]) -> bool: ...
932
+ def __le__(self, __value: list[_T]) -> bool: ...
933
+ def __eq__(self, __value: object) -> bool: ...
934
+ if sys.version_info >= (3, 9):
935
+ def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
936
+
937
+ class dict(MutableMapping[_KT, _VT]):
938
+ # __init__ should be kept roughly in line with `collections.UserDict.__init__`, which has similar semantics
939
+ # Also multiprocessing.managers.SyncManager.dict()
940
+ @overload
941
+ def __init__(self) -> None: ...
942
+ @overload
943
+ def __init__(self: dict[str, _VT], **kwargs: _VT) -> None: ...
944
+ @overload
945
+ def __init__(self, __map: SupportsKeysAndGetItem[_KT, _VT]) -> None: ...
946
+ @overload
947
+ def __init__(self: dict[str, _VT], __map: SupportsKeysAndGetItem[str, _VT], **kwargs: _VT) -> None: ...
948
+ @overload
949
+ def __init__(self, __iterable: Iterable[tuple[_KT, _VT]]) -> None: ...
950
+ @overload
951
+ def __init__(self: dict[str, _VT], __iterable: Iterable[tuple[str, _VT]], **kwargs: _VT) -> None: ...
952
+ # Next two overloads are for dict(string.split(sep) for string in iterable)
953
+ # Cannot be Iterable[Sequence[_T]] or otherwise dict(["foo", "bar", "baz"]) is not an error
954
+ @overload
955
+ def __init__(self: dict[str, str], __iterable: Iterable[list[str]]) -> None: ...
956
+ @overload
957
+ def __init__(self: dict[bytes, bytes], __iterable: Iterable[list[bytes]]) -> None: ...
958
+ def __new__(cls, *args: Any, **kwargs: Any) -> Self: ...
959
+ def copy(self) -> dict[_KT, _VT]: ...
960
+ def keys(self) -> dict_keys[_KT, _VT]: ...
961
+ def values(self) -> dict_values[_KT, _VT]: ...
962
+ def items(self) -> dict_items[_KT, _VT]: ...
963
+ # Signature of `dict.fromkeys` should be kept identical to `fromkeys` methods of `OrderedDict`/`ChainMap`/`UserDict` in `collections`
964
+ # TODO: the true signature of `dict.fromkeys` is not expressible in the current type system.
965
+ # See #3800 & https://github.com/python/typing/issues/548#issuecomment-683336963.
966
+ @classmethod
967
+ @overload
968
+ def fromkeys(cls, __iterable: Iterable[_T], __value: None = None) -> dict[_T, Any | None]: ...
969
+ @classmethod
970
+ @overload
971
+ def fromkeys(cls, __iterable: Iterable[_T], __value: _S) -> dict[_T, _S]: ...
972
+ # Positional-only in dict, but not in MutableMapping
973
+ @overload # type: ignore[override]
974
+ def get(self, __key: _KT) -> _VT | None: ...
975
+ @overload
976
+ def get(self, __key: _KT, __default: _VT) -> _VT: ...
977
+ @overload
978
+ def get(self, __key: _KT, __default: _T) -> _VT | _T: ...
979
+ @overload
980
+ def pop(self, __key: _KT) -> _VT: ...
981
+ @overload
982
+ def pop(self, __key: _KT, __default: _VT) -> _VT: ...
983
+ @overload
984
+ def pop(self, __key: _KT, __default: _T) -> _VT | _T: ...
985
+ def __len__(self) -> int: ...
986
+ def __getitem__(self, __key: _KT) -> _VT: ...
987
+ def __setitem__(self, __key: _KT, __value: _VT) -> None: ...
988
+ def __delitem__(self, __key: _KT) -> None: ...
989
+ def __iter__(self) -> Iterator[_KT]: ...
990
+ def __eq__(self, __value: object) -> bool: ...
991
+ def __reversed__(self) -> Iterator[_KT]: ...
992
+ __hash__: ClassVar[None] # type: ignore[assignment]
993
+ if sys.version_info >= (3, 9):
994
+ def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
995
+ @overload
996
+ def __or__(self, __value: dict[_KT, _VT]) -> dict[_KT, _VT]: ...
997
+ @overload
998
+ def __or__(self, __value: dict[_T1, _T2]) -> dict[_KT | _T1, _VT | _T2]: ...
999
+ @overload
1000
+ def __ror__(self, __value: dict[_KT, _VT]) -> dict[_KT, _VT]: ...
1001
+ @overload
1002
+ def __ror__(self, __value: dict[_T1, _T2]) -> dict[_KT | _T1, _VT | _T2]: ...
1003
+ # dict.__ior__ should be kept roughly in line with MutableMapping.update()
1004
+ @overload # type: ignore[misc]
1005
+ def __ior__(self, __value: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ...
1006
+ @overload
1007
+ def __ior__(self, __value: Iterable[tuple[_KT, _VT]]) -> Self: ...
1008
+
1009
+ class set(MutableSet[_T]):
1010
+ @overload
1011
+ def __init__(self) -> None: ...
1012
+ @overload
1013
+ def __init__(self, __iterable: Iterable[_T]) -> None: ...
1014
+ def add(self, __element: _T) -> None: ...
1015
+ def copy(self) -> set[_T]: ...
1016
+ def difference(self, *s: Iterable[Any]) -> set[_T]: ...
1017
+ def difference_update(self, *s: Iterable[Any]) -> None: ...
1018
+ def discard(self, __element: _T) -> None: ...
1019
+ def intersection(self, *s: Iterable[Any]) -> set[_T]: ...
1020
+ def intersection_update(self, *s: Iterable[Any]) -> None: ...
1021
+ def isdisjoint(self, __s: Iterable[Any]) -> bool: ...
1022
+ def issubset(self, __s: Iterable[Any]) -> bool: ...
1023
+ def issuperset(self, __s: Iterable[Any]) -> bool: ...
1024
+ def remove(self, __element: _T) -> None: ...
1025
+ def symmetric_difference(self, __s: Iterable[_T]) -> set[_T]: ...
1026
+ def symmetric_difference_update(self, __s: Iterable[_T]) -> None: ...
1027
+ def union(self, *s: Iterable[_S]) -> set[_T | _S]: ...
1028
+ def update(self, *s: Iterable[_T]) -> None: ...
1029
+ def __len__(self) -> int: ...
1030
+ def __contains__(self, __o: object) -> bool: ...
1031
+ def __iter__(self) -> Iterator[_T]: ...
1032
+ def __and__(self, __value: AbstractSet[object]) -> set[_T]: ...
1033
+ def __iand__(self, __value: AbstractSet[object]) -> Self: ...
1034
+ def __or__(self, __value: AbstractSet[_S]) -> set[_T | _S]: ...
1035
+ def __ior__(self, __value: AbstractSet[_T]) -> Self: ... # type: ignore[override,misc]
1036
+ def __sub__(self, __value: AbstractSet[_T | None]) -> set[_T]: ...
1037
+ def __isub__(self, __value: AbstractSet[object]) -> Self: ...
1038
+ def __xor__(self, __value: AbstractSet[_S]) -> set[_T | _S]: ...
1039
+ def __ixor__(self, __value: AbstractSet[_T]) -> Self: ... # type: ignore[override,misc]
1040
+ def __le__(self, __value: AbstractSet[object]) -> bool: ...
1041
+ def __lt__(self, __value: AbstractSet[object]) -> bool: ...
1042
+ def __ge__(self, __value: AbstractSet[object]) -> bool: ...
1043
+ def __gt__(self, __value: AbstractSet[object]) -> bool: ...
1044
+ def __eq__(self, __value: object) -> bool: ...
1045
+ __hash__: ClassVar[None] # type: ignore[assignment]
1046
+ if sys.version_info >= (3, 9):
1047
+ def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
1048
+
1049
+ class frozenset(AbstractSet[_T_co]):
1050
+ @overload
1051
+ def __new__(cls) -> Self: ...
1052
+ @overload
1053
+ def __new__(cls, __iterable: Iterable[_T_co]) -> Self: ...
1054
+ def copy(self) -> frozenset[_T_co]: ...
1055
+ def difference(self, *s: Iterable[object]) -> frozenset[_T_co]: ...
1056
+ def intersection(self, *s: Iterable[object]) -> frozenset[_T_co]: ...
1057
+ def isdisjoint(self, __s: Iterable[_T_co]) -> bool: ...
1058
+ def issubset(self, __s: Iterable[object]) -> bool: ...
1059
+ def issuperset(self, __s: Iterable[object]) -> bool: ...
1060
+ def symmetric_difference(self, __s: Iterable[_T_co]) -> frozenset[_T_co]: ...
1061
+ def union(self, *s: Iterable[_S]) -> frozenset[_T_co | _S]: ...
1062
+ def __len__(self) -> int: ...
1063
+ def __contains__(self, __o: object) -> bool: ...
1064
+ def __iter__(self) -> Iterator[_T_co]: ...
1065
+ def __and__(self, __value: AbstractSet[_T_co]) -> frozenset[_T_co]: ...
1066
+ def __or__(self, __value: AbstractSet[_S]) -> frozenset[_T_co | _S]: ...
1067
+ def __sub__(self, __value: AbstractSet[_T_co]) -> frozenset[_T_co]: ...
1068
+ def __xor__(self, __value: AbstractSet[_S]) -> frozenset[_T_co | _S]: ...
1069
+ def __le__(self, __value: AbstractSet[object]) -> bool: ...
1070
+ def __lt__(self, __value: AbstractSet[object]) -> bool: ...
1071
+ def __ge__(self, __value: AbstractSet[object]) -> bool: ...
1072
+ def __gt__(self, __value: AbstractSet[object]) -> bool: ...
1073
+ def __eq__(self, __value: object) -> bool: ...
1074
+ def __hash__(self) -> int: ...
1075
+ if sys.version_info >= (3, 9):
1076
+ def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
1077
+
1078
+ class enumerate(Iterator[tuple[int, _T]]):
1079
+ def __new__(cls, iterable: Iterable[_T], start: int = ...) -> Self: ...
1080
+ def __iter__(self) -> Self: ...
1081
+ def __next__(self) -> tuple[int, _T]: ...
1082
+ if sys.version_info >= (3, 9):
1083
+ def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
1084
+
1085
+ @final
1086
+ class range(Sequence[int]):
1087
+ @property
1088
+ def start(self) -> int: ...
1089
+ @property
1090
+ def stop(self) -> int: ...
1091
+ @property
1092
+ def step(self) -> int: ...
1093
+ @overload
1094
+ def __new__(cls, __stop: SupportsIndex) -> Self: ...
1095
+ @overload
1096
+ def __new__(cls, __start: SupportsIndex, __stop: SupportsIndex, __step: SupportsIndex = ...) -> Self: ...
1097
+ def count(self, __value: int) -> int: ...
1098
+ def index(self, __value: int) -> int: ... # type: ignore[override]
1099
+ def __len__(self) -> int: ...
1100
+ def __eq__(self, __value: object) -> bool: ...
1101
+ def __hash__(self) -> int: ...
1102
+ def __contains__(self, __key: object) -> bool: ...
1103
+ def __iter__(self) -> Iterator[int]: ...
1104
+ @overload
1105
+ def __getitem__(self, __key: SupportsIndex) -> int: ...
1106
+ @overload
1107
+ def __getitem__(self, __key: slice) -> range: ...
1108
+ def __reversed__(self) -> Iterator[int]: ...
1109
+
1110
+ class property:
1111
+ fget: Callable[[Any], Any] | None
1112
+ fset: Callable[[Any, Any], None] | None
1113
+ fdel: Callable[[Any], None] | None
1114
+ __isabstractmethod__: bool
1115
+ def __init__(
1116
+ self,
1117
+ fget: Callable[[Any], Any] | None = ...,
1118
+ fset: Callable[[Any, Any], None] | None = ...,
1119
+ fdel: Callable[[Any], None] | None = ...,
1120
+ doc: str | None = ...,
1121
+ ) -> None: ...
1122
+ def getter(self, __fget: Callable[[Any], Any]) -> property: ...
1123
+ def setter(self, __fset: Callable[[Any, Any], None]) -> property: ...
1124
+ def deleter(self, __fdel: Callable[[Any], None]) -> property: ...
1125
+ def __get__(self, __instance: Any, __owner: type | None = None) -> Any: ...
1126
+ def __set__(self, __instance: Any, __value: Any) -> None: ...
1127
+ def __delete__(self, __instance: Any) -> None: ...
1128
+
1129
+ @final
1130
+ class _NotImplementedType(Any):
1131
+ # A little weird, but typing the __call__ as NotImplemented makes the error message
1132
+ # for NotImplemented() much better
1133
+ __call__: NotImplemented # type: ignore[valid-type] # pyright: ignore[reportGeneralTypeIssues]
1134
+
1135
+ NotImplemented: _NotImplementedType
1136
+
1137
+ def abs(__x: SupportsAbs[_T]) -> _T: ...
1138
+ def all(__iterable: Iterable[object]) -> bool: ...
1139
+ def any(__iterable: Iterable[object]) -> bool: ...
1140
+ def ascii(__obj: object) -> str: ...
1141
+ def bin(__number: int | SupportsIndex) -> str: ...
1142
+ def breakpoint(*args: Any, **kws: Any) -> None: ...
1143
+ def callable(__obj: object) -> TypeGuard[Callable[..., object]]: ...
1144
+ def chr(__i: int) -> str: ...
1145
+
1146
+ # We define this here instead of using os.PathLike to avoid import cycle issues.
1147
+ # See https://github.com/python/typeshed/pull/991#issuecomment-288160993
1148
+ class _PathLike(Protocol[AnyStr_co]):
1149
+ def __fspath__(self) -> AnyStr_co: ...
1150
+
1151
+ if sys.version_info >= (3, 10):
1152
+ def aiter(__async_iterable: SupportsAiter[_SupportsAnextT]) -> _SupportsAnextT: ...
1153
+
1154
+ class _SupportsSynchronousAnext(Protocol[_AwaitableT_co]):
1155
+ def __anext__(self) -> _AwaitableT_co: ...
1156
+
1157
+ @overload
1158
+ # `anext` is not, in fact, an async function. When default is not provided
1159
+ # `anext` is just a passthrough for `obj.__anext__`
1160
+ # See discussion in #7491 and pure-Python implementation of `anext` at https://github.com/python/cpython/blob/ea786a882b9ed4261eafabad6011bc7ef3b5bf94/Lib/test/test_asyncgen.py#L52-L80
1161
+ def anext(__i: _SupportsSynchronousAnext[_AwaitableT]) -> _AwaitableT: ...
1162
+ @overload
1163
+ async def anext(__i: SupportsAnext[_T], __default: _VT) -> _T | _VT: ...
1164
+
1165
+ # compile() returns a CodeType, unless the flags argument includes PyCF_ONLY_AST (=1024),
1166
+ # in which case it returns ast.AST. We have overloads for flag 0 (the default) and for
1167
+ # explicitly passing PyCF_ONLY_AST. We fall back to Any for other values of flags.
1168
+ @overload
1169
+ def compile(
1170
+ source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
1171
+ filename: str | ReadableBuffer | _PathLike[Any],
1172
+ mode: str,
1173
+ flags: Literal[0],
1174
+ dont_inherit: bool = False,
1175
+ optimize: int = -1,
1176
+ *,
1177
+ _feature_version: int = -1,
1178
+ ) -> CodeType: ...
1179
+ @overload
1180
+ def compile(
1181
+ source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
1182
+ filename: str | ReadableBuffer | _PathLike[Any],
1183
+ mode: str,
1184
+ *,
1185
+ dont_inherit: bool = False,
1186
+ optimize: int = -1,
1187
+ _feature_version: int = -1,
1188
+ ) -> CodeType: ...
1189
+ @overload
1190
+ def compile(
1191
+ source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
1192
+ filename: str | ReadableBuffer | _PathLike[Any],
1193
+ mode: str,
1194
+ flags: Literal[1024],
1195
+ dont_inherit: bool = False,
1196
+ optimize: int = -1,
1197
+ *,
1198
+ _feature_version: int = -1,
1199
+ ) -> _ast.AST: ...
1200
+ @overload
1201
+ def compile(
1202
+ source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
1203
+ filename: str | ReadableBuffer | _PathLike[Any],
1204
+ mode: str,
1205
+ flags: int,
1206
+ dont_inherit: bool = False,
1207
+ optimize: int = -1,
1208
+ *,
1209
+ _feature_version: int = -1,
1210
+ ) -> Any: ...
1211
+ def copyright() -> None: ...
1212
+ def credits() -> None: ...
1213
+ def delattr(__obj: object, __name: str) -> None: ...
1214
+ def dir(__o: object = ...) -> list[str]: ...
1215
+ @overload
1216
+ def divmod(__x: SupportsDivMod[_T_contra, _T_co], __y: _T_contra) -> _T_co: ...
1217
+ @overload
1218
+ def divmod(__x: _T_contra, __y: SupportsRDivMod[_T_contra, _T_co]) -> _T_co: ...
1219
+
1220
+ # The `globals` argument to `eval` has to be `dict[str, Any]` rather than `dict[str, object]` due to invariance.
1221
+ # (The `globals` argument has to be a "real dict", rather than any old mapping, unlike the `locals` argument.)
1222
+ def eval(
1223
+ __source: str | ReadableBuffer | CodeType,
1224
+ __globals: dict[str, Any] | None = None,
1225
+ __locals: Mapping[str, object] | None = None,
1226
+ ) -> Any: ...
1227
+
1228
+ # Comment above regarding `eval` applies to `exec` as well
1229
+ if sys.version_info >= (3, 11):
1230
+ def exec(
1231
+ __source: str | ReadableBuffer | CodeType,
1232
+ __globals: dict[str, Any] | None = None,
1233
+ __locals: Mapping[str, object] | None = None,
1234
+ *,
1235
+ closure: tuple[_Cell, ...] | None = None,
1236
+ ) -> None: ...
1237
+
1238
+ else:
1239
+ def exec(
1240
+ __source: str | ReadableBuffer | CodeType,
1241
+ __globals: dict[str, Any] | None = None,
1242
+ __locals: Mapping[str, object] | None = None,
1243
+ ) -> None: ...
1244
+
1245
+ def exit(code: sys._ExitCode = None) -> NoReturn: ...
1246
+
1247
+ class filter(Iterator[_T]):
1248
+ @overload
1249
+ def __new__(cls, __function: None, __iterable: Iterable[_T | None]) -> Self: ...
1250
+ @overload
1251
+ def __new__(cls, __function: Callable[[_S], TypeGuard[_T]], __iterable: Iterable[_S]) -> Self: ...
1252
+ @overload
1253
+ def __new__(cls, __function: Callable[[_T], Any], __iterable: Iterable[_T]) -> Self: ...
1254
+ def __iter__(self) -> Self: ...
1255
+ def __next__(self) -> _T: ...
1256
+
1257
+ def format(__value: object, __format_spec: str = "") -> str: ...
1258
+ @overload
1259
+ def getattr(__o: object, __name: str) -> Any: ...
1260
+
1261
+ # While technically covered by the last overload, spelling out the types for None, bool
1262
+ # and basic containers help mypy out in some tricky situations involving type context
1263
+ # (aka bidirectional inference)
1264
+ @overload
1265
+ def getattr(__o: object, __name: str, __default: None) -> Any | None: ...
1266
+ @overload
1267
+ def getattr(__o: object, __name: str, __default: bool) -> Any | bool: ...
1268
+ @overload
1269
+ def getattr(__o: object, __name: str, __default: list[Any]) -> Any | list[Any]: ...
1270
+ @overload
1271
+ def getattr(__o: object, __name: str, __default: dict[Any, Any]) -> Any | dict[Any, Any]: ...
1272
+ @overload
1273
+ def getattr(__o: object, __name: str, __default: _T) -> Any | _T: ...
1274
+ def globals() -> dict[str, Any]: ...
1275
+ def hasattr(__obj: object, __name: str) -> bool: ...
1276
+ def hash(__obj: object) -> int: ...
1277
+ def help(request: object = ...) -> None: ...
1278
+ def hex(__number: int | SupportsIndex) -> str: ...
1279
+ def id(__obj: object) -> int: ...
1280
+ def input(__prompt: object = "") -> str: ...
1281
+
1282
+ class _GetItemIterable(Protocol[_T_co]):
1283
+ def __getitem__(self, __i: int) -> _T_co: ...
1284
+
1285
+ @overload
1286
+ def iter(__object: SupportsIter[_SupportsNextT]) -> _SupportsNextT: ...
1287
+ @overload
1288
+ def iter(__object: _GetItemIterable[_T]) -> Iterator[_T]: ...
1289
+ @overload
1290
+ def iter(__object: Callable[[], _T | None], __sentinel: None) -> Iterator[_T]: ...
1291
+ @overload
1292
+ def iter(__object: Callable[[], _T], __sentinel: object) -> Iterator[_T]: ...
1293
+
1294
+ # Keep this alias in sync with unittest.case._ClassInfo
1295
+ if sys.version_info >= (3, 10):
1296
+ _ClassInfo: TypeAlias = type | types.UnionType | tuple[_ClassInfo, ...]
1297
+ else:
1298
+ _ClassInfo: TypeAlias = type | tuple[_ClassInfo, ...]
1299
+
1300
+ def isinstance(__obj: object, __class_or_tuple: _ClassInfo) -> bool: ...
1301
+ def issubclass(__cls: type, __class_or_tuple: _ClassInfo) -> bool: ...
1302
+ def len(__obj: Sized) -> int: ...
1303
+ def license() -> None: ...
1304
+ def locals() -> dict[str, Any]: ...
1305
+
1306
+ class map(Iterator[_S]):
1307
+ @overload
1308
+ def __new__(cls, __func: Callable[[_T1], _S], __iter1: Iterable[_T1]) -> Self: ...
1309
+ @overload
1310
+ def __new__(cls, __func: Callable[[_T1, _T2], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> Self: ...
1311
+ @overload
1312
+ def __new__(
1313
+ cls, __func: Callable[[_T1, _T2, _T3], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]
1314
+ ) -> Self: ...
1315
+ @overload
1316
+ def __new__(
1317
+ cls,
1318
+ __func: Callable[[_T1, _T2, _T3, _T4], _S],
1319
+ __iter1: Iterable[_T1],
1320
+ __iter2: Iterable[_T2],
1321
+ __iter3: Iterable[_T3],
1322
+ __iter4: Iterable[_T4],
1323
+ ) -> Self: ...
1324
+ @overload
1325
+ def __new__(
1326
+ cls,
1327
+ __func: Callable[[_T1, _T2, _T3, _T4, _T5], _S],
1328
+ __iter1: Iterable[_T1],
1329
+ __iter2: Iterable[_T2],
1330
+ __iter3: Iterable[_T3],
1331
+ __iter4: Iterable[_T4],
1332
+ __iter5: Iterable[_T5],
1333
+ ) -> Self: ...
1334
+ @overload
1335
+ def __new__(
1336
+ cls,
1337
+ __func: Callable[..., _S],
1338
+ __iter1: Iterable[Any],
1339
+ __iter2: Iterable[Any],
1340
+ __iter3: Iterable[Any],
1341
+ __iter4: Iterable[Any],
1342
+ __iter5: Iterable[Any],
1343
+ __iter6: Iterable[Any],
1344
+ *iterables: Iterable[Any],
1345
+ ) -> Self: ...
1346
+ def __iter__(self) -> Self: ...
1347
+ def __next__(self) -> _S: ...
1348
+
1349
+ @overload
1350
+ def max(
1351
+ __arg1: SupportsRichComparisonT, __arg2: SupportsRichComparisonT, *_args: SupportsRichComparisonT, key: None = None
1352
+ ) -> SupportsRichComparisonT: ...
1353
+ @overload
1354
+ def max(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], SupportsRichComparison]) -> _T: ...
1355
+ @overload
1356
+ def max(__iterable: Iterable[SupportsRichComparisonT], *, key: None = None) -> SupportsRichComparisonT: ...
1357
+ @overload
1358
+ def max(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsRichComparison]) -> _T: ...
1359
+ @overload
1360
+ def max(__iterable: Iterable[SupportsRichComparisonT], *, key: None = None, default: _T) -> SupportsRichComparisonT | _T: ...
1361
+ @overload
1362
+ def max(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsRichComparison], default: _T2) -> _T1 | _T2: ...
1363
+ @overload
1364
+ def min(
1365
+ __arg1: SupportsRichComparisonT, __arg2: SupportsRichComparisonT, *_args: SupportsRichComparisonT, key: None = None
1366
+ ) -> SupportsRichComparisonT: ...
1367
+ @overload
1368
+ def min(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], SupportsRichComparison]) -> _T: ...
1369
+ @overload
1370
+ def min(__iterable: Iterable[SupportsRichComparisonT], *, key: None = None) -> SupportsRichComparisonT: ...
1371
+ @overload
1372
+ def min(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsRichComparison]) -> _T: ...
1373
+ @overload
1374
+ def min(__iterable: Iterable[SupportsRichComparisonT], *, key: None = None, default: _T) -> SupportsRichComparisonT | _T: ...
1375
+ @overload
1376
+ def min(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsRichComparison], default: _T2) -> _T1 | _T2: ...
1377
+ @overload
1378
+ def next(__i: SupportsNext[_T]) -> _T: ...
1379
+ @overload
1380
+ def next(__i: SupportsNext[_T], __default: _VT) -> _T | _VT: ...
1381
+ def oct(__number: int | SupportsIndex) -> str: ...
1382
+
1383
+ _Opener: TypeAlias = Callable[[str, int], int]
1384
+
1385
+ # Text mode: always returns a TextIOWrapper
1386
+ @overload
1387
+ def open(
1388
+ file: FileDescriptorOrPath,
1389
+ mode: OpenTextMode = "r",
1390
+ buffering: int = -1,
1391
+ encoding: str | None = None,
1392
+ errors: str | None = None,
1393
+ newline: str | None = None,
1394
+ closefd: bool = True,
1395
+ opener: _Opener | None = None,
1396
+ ) -> TextIOWrapper: ...
1397
+
1398
+ # Unbuffered binary mode: returns a FileIO
1399
+ @overload
1400
+ def open(
1401
+ file: FileDescriptorOrPath,
1402
+ mode: OpenBinaryMode,
1403
+ buffering: Literal[0],
1404
+ encoding: None = None,
1405
+ errors: None = None,
1406
+ newline: None = None,
1407
+ closefd: bool = True,
1408
+ opener: _Opener | None = None,
1409
+ ) -> FileIO: ...
1410
+
1411
+ # Buffering is on: return BufferedRandom, BufferedReader, or BufferedWriter
1412
+ @overload
1413
+ def open(
1414
+ file: FileDescriptorOrPath,
1415
+ mode: OpenBinaryModeUpdating,
1416
+ buffering: Literal[-1, 1] = -1,
1417
+ encoding: None = None,
1418
+ errors: None = None,
1419
+ newline: None = None,
1420
+ closefd: bool = True,
1421
+ opener: _Opener | None = None,
1422
+ ) -> BufferedRandom: ...
1423
+ @overload
1424
+ def open(
1425
+ file: FileDescriptorOrPath,
1426
+ mode: OpenBinaryModeWriting,
1427
+ buffering: Literal[-1, 1] = -1,
1428
+ encoding: None = None,
1429
+ errors: None = None,
1430
+ newline: None = None,
1431
+ closefd: bool = True,
1432
+ opener: _Opener | None = None,
1433
+ ) -> BufferedWriter: ...
1434
+ @overload
1435
+ def open(
1436
+ file: FileDescriptorOrPath,
1437
+ mode: OpenBinaryModeReading,
1438
+ buffering: Literal[-1, 1] = -1,
1439
+ encoding: None = None,
1440
+ errors: None = None,
1441
+ newline: None = None,
1442
+ closefd: bool = True,
1443
+ opener: _Opener | None = None,
1444
+ ) -> BufferedReader: ...
1445
+
1446
+ # Buffering cannot be determined: fall back to BinaryIO
1447
+ @overload
1448
+ def open(
1449
+ file: FileDescriptorOrPath,
1450
+ mode: OpenBinaryMode,
1451
+ buffering: int = -1,
1452
+ encoding: None = None,
1453
+ errors: None = None,
1454
+ newline: None = None,
1455
+ closefd: bool = True,
1456
+ opener: _Opener | None = None,
1457
+ ) -> BinaryIO: ...
1458
+
1459
+ # Fallback if mode is not specified
1460
+ @overload
1461
+ def open(
1462
+ file: FileDescriptorOrPath,
1463
+ mode: str,
1464
+ buffering: int = -1,
1465
+ encoding: str | None = None,
1466
+ errors: str | None = None,
1467
+ newline: str | None = None,
1468
+ closefd: bool = True,
1469
+ opener: _Opener | None = None,
1470
+ ) -> IO[Any]: ...
1471
+ def ord(__c: str | bytes | bytearray) -> int: ...
1472
+
1473
+ class _SupportsWriteAndFlush(SupportsWrite[_T_contra], SupportsFlush, Protocol[_T_contra]): ...
1474
+
1475
+ @overload
1476
+ def print(
1477
+ *values: object,
1478
+ sep: str | None = " ",
1479
+ end: str | None = "\n",
1480
+ file: SupportsWrite[str] | None = None,
1481
+ flush: Literal[False] = False,
1482
+ ) -> None: ...
1483
+ @overload
1484
+ def print(
1485
+ *values: object, sep: str | None = " ", end: str | None = "\n", file: _SupportsWriteAndFlush[str] | None = None, flush: bool
1486
+ ) -> None: ...
1487
+
1488
+ _E = TypeVar("_E", contravariant=True)
1489
+ _M = TypeVar("_M", contravariant=True)
1490
+
1491
+ class _SupportsPow2(Protocol[_E, _T_co]):
1492
+ def __pow__(self, __other: _E) -> _T_co: ...
1493
+
1494
+ class _SupportsPow3NoneOnly(Protocol[_E, _T_co]):
1495
+ def __pow__(self, __other: _E, __modulo: None = None) -> _T_co: ...
1496
+
1497
+ class _SupportsPow3(Protocol[_E, _M, _T_co]):
1498
+ def __pow__(self, __other: _E, __modulo: _M) -> _T_co: ...
1499
+
1500
+ _SupportsSomeKindOfPow = ( # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed
1501
+ _SupportsPow2[Any, Any] | _SupportsPow3NoneOnly[Any, Any] | _SupportsPow3[Any, Any, Any]
1502
+ )
1503
+
1504
+ # TODO: `pow(int, int, Literal[0])` fails at runtime,
1505
+ # but adding a `NoReturn` overload isn't a good solution for expressing that (see #8566).
1506
+ @overload
1507
+ def pow(base: int, exp: int, mod: int) -> int: ...
1508
+ @overload
1509
+ def pow(base: int, exp: Literal[0], mod: None = None) -> Literal[1]: ...
1510
+ @overload
1511
+ def pow(base: int, exp: _PositiveInteger, mod: None = None) -> int: ...
1512
+ @overload
1513
+ def pow(base: int, exp: _NegativeInteger, mod: None = None) -> float: ...
1514
+
1515
+ # int base & positive-int exp -> int; int base & negative-int exp -> float
1516
+ # return type must be Any as `int | float` causes too many false-positive errors
1517
+ @overload
1518
+ def pow(base: int, exp: int, mod: None = None) -> Any: ...
1519
+ @overload
1520
+ def pow(base: _PositiveInteger, exp: float, mod: None = None) -> float: ...
1521
+ @overload
1522
+ def pow(base: _NegativeInteger, exp: float, mod: None = None) -> complex: ...
1523
+ @overload
1524
+ def pow(base: float, exp: int, mod: None = None) -> float: ...
1525
+
1526
+ # float base & float exp could return float or complex
1527
+ # return type must be Any (same as complex base, complex exp),
1528
+ # as `float | complex` causes too many false-positive errors
1529
+ @overload
1530
+ def pow(base: float, exp: complex | _SupportsSomeKindOfPow, mod: None = None) -> Any: ...
1531
+ @overload
1532
+ def pow(base: complex, exp: complex | _SupportsSomeKindOfPow, mod: None = None) -> complex: ...
1533
+ @overload
1534
+ def pow(base: _SupportsPow2[_E, _T_co], exp: _E, mod: None = None) -> _T_co: ...
1535
+ @overload
1536
+ def pow(base: _SupportsPow3NoneOnly[_E, _T_co], exp: _E, mod: None = None) -> _T_co: ...
1537
+ @overload
1538
+ def pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M) -> _T_co: ...
1539
+ @overload
1540
+ def pow(base: _SupportsSomeKindOfPow, exp: float, mod: None = None) -> Any: ...
1541
+ @overload
1542
+ def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex: ...
1543
+ def quit(code: sys._ExitCode = None) -> NoReturn: ...
1544
+
1545
+ class reversed(Iterator[_T]):
1546
+ @overload
1547
+ def __init__(self, __sequence: Reversible[_T]) -> None: ...
1548
+ @overload
1549
+ def __init__(self, __sequence: SupportsLenAndGetItem[_T]) -> None: ...
1550
+ def __iter__(self) -> Self: ...
1551
+ def __next__(self) -> _T: ...
1552
+ def __length_hint__(self) -> int: ...
1553
+
1554
+ def repr(__obj: object) -> str: ...
1555
+
1556
+ # See https://github.com/python/typeshed/pull/9141
1557
+ # and https://github.com/python/typeshed/pull/9151
1558
+ # on why we don't use `SupportsRound` from `typing.pyi`
1559
+
1560
+ class _SupportsRound1(Protocol[_T_co]):
1561
+ def __round__(self) -> _T_co: ...
1562
+
1563
+ class _SupportsRound2(Protocol[_T_co]):
1564
+ def __round__(self, __ndigits: int) -> _T_co: ...
1565
+
1566
+ @overload
1567
+ def round(number: _SupportsRound1[_T], ndigits: None = None) -> _T: ...
1568
+ @overload
1569
+ def round(number: _SupportsRound2[_T], ndigits: SupportsIndex) -> _T: ...
1570
+
1571
+ # See https://github.com/python/typeshed/pull/6292#discussion_r748875189
1572
+ # for why arg 3 of `setattr` should be annotated with `Any` and not `object`
1573
+ def setattr(__obj: object, __name: str, __value: Any) -> None: ...
1574
+ @overload
1575
+ def sorted(
1576
+ __iterable: Iterable[SupportsRichComparisonT], *, key: None = None, reverse: bool = False
1577
+ ) -> list[SupportsRichComparisonT]: ...
1578
+ @overload
1579
+ def sorted(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsRichComparison], reverse: bool = False) -> list[_T]: ...
1580
+
1581
+ _AddableT1 = TypeVar("_AddableT1", bound=SupportsAdd[Any, Any])
1582
+ _AddableT2 = TypeVar("_AddableT2", bound=SupportsAdd[Any, Any])
1583
+
1584
+ class _SupportsSumWithNoDefaultGiven(SupportsAdd[Any, Any], SupportsRAdd[int, Any], Protocol): ...
1585
+
1586
+ _SupportsSumNoDefaultT = TypeVar("_SupportsSumNoDefaultT", bound=_SupportsSumWithNoDefaultGiven)
1587
+
1588
+ # In general, the return type of `x + x` is *not* guaranteed to be the same type as x.
1589
+ # However, we can't express that in the stub for `sum()`
1590
+ # without creating many false-positive errors (see #7578).
1591
+ # Instead, we special-case the most common examples of this: bool and literal integers.
1592
+ @overload
1593
+ def sum(__iterable: Iterable[bool], start: int = 0) -> int: ... # type: ignore[overload-overlap]
1594
+ @overload
1595
+ def sum(__iterable: Iterable[_SupportsSumNoDefaultT]) -> _SupportsSumNoDefaultT | Literal[0]: ...
1596
+ @overload
1597
+ def sum(__iterable: Iterable[_AddableT1], start: _AddableT2) -> _AddableT1 | _AddableT2: ...
1598
+
1599
+ # The argument to `vars()` has to have a `__dict__` attribute, so the second overload can't be annotated with `object`
1600
+ # (A "SupportsDunderDict" protocol doesn't work)
1601
+ # Use a type: ignore to make complaints about overlapping overloads go away
1602
+ @overload
1603
+ def vars(__object: type) -> types.MappingProxyType[str, Any]: ... # type: ignore[overload-overlap]
1604
+ @overload
1605
+ def vars(__object: Any = ...) -> dict[str, Any]: ...
1606
+
1607
+ class zip(Iterator[_T_co]):
1608
+ if sys.version_info >= (3, 10):
1609
+ @overload
1610
+ def __new__(cls, *, strict: bool = ...) -> zip[Any]: ...
1611
+ @overload
1612
+ def __new__(cls, __iter1: Iterable[_T1], *, strict: bool = ...) -> zip[tuple[_T1]]: ...
1613
+ @overload
1614
+ def __new__(cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], *, strict: bool = ...) -> zip[tuple[_T1, _T2]]: ...
1615
+ @overload
1616
+ def __new__(
1617
+ cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], *, strict: bool = ...
1618
+ ) -> zip[tuple[_T1, _T2, _T3]]: ...
1619
+ @overload
1620
+ def __new__(
1621
+ cls,
1622
+ __iter1: Iterable[_T1],
1623
+ __iter2: Iterable[_T2],
1624
+ __iter3: Iterable[_T3],
1625
+ __iter4: Iterable[_T4],
1626
+ *,
1627
+ strict: bool = ...,
1628
+ ) -> zip[tuple[_T1, _T2, _T3, _T4]]: ...
1629
+ @overload
1630
+ def __new__(
1631
+ cls,
1632
+ __iter1: Iterable[_T1],
1633
+ __iter2: Iterable[_T2],
1634
+ __iter3: Iterable[_T3],
1635
+ __iter4: Iterable[_T4],
1636
+ __iter5: Iterable[_T5],
1637
+ *,
1638
+ strict: bool = ...,
1639
+ ) -> zip[tuple[_T1, _T2, _T3, _T4, _T5]]: ...
1640
+ @overload
1641
+ def __new__(
1642
+ cls,
1643
+ __iter1: Iterable[Any],
1644
+ __iter2: Iterable[Any],
1645
+ __iter3: Iterable[Any],
1646
+ __iter4: Iterable[Any],
1647
+ __iter5: Iterable[Any],
1648
+ __iter6: Iterable[Any],
1649
+ *iterables: Iterable[Any],
1650
+ strict: bool = ...,
1651
+ ) -> zip[tuple[Any, ...]]: ...
1652
+ else:
1653
+ @overload
1654
+ def __new__(cls) -> zip[Any]: ...
1655
+ @overload
1656
+ def __new__(cls, __iter1: Iterable[_T1]) -> zip[tuple[_T1]]: ...
1657
+ @overload
1658
+ def __new__(cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> zip[tuple[_T1, _T2]]: ...
1659
+ @overload
1660
+ def __new__(cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> zip[tuple[_T1, _T2, _T3]]: ...
1661
+ @overload
1662
+ def __new__(
1663
+ cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4]
1664
+ ) -> zip[tuple[_T1, _T2, _T3, _T4]]: ...
1665
+ @overload
1666
+ def __new__(
1667
+ cls,
1668
+ __iter1: Iterable[_T1],
1669
+ __iter2: Iterable[_T2],
1670
+ __iter3: Iterable[_T3],
1671
+ __iter4: Iterable[_T4],
1672
+ __iter5: Iterable[_T5],
1673
+ ) -> zip[tuple[_T1, _T2, _T3, _T4, _T5]]: ...
1674
+ @overload
1675
+ def __new__(
1676
+ cls,
1677
+ __iter1: Iterable[Any],
1678
+ __iter2: Iterable[Any],
1679
+ __iter3: Iterable[Any],
1680
+ __iter4: Iterable[Any],
1681
+ __iter5: Iterable[Any],
1682
+ __iter6: Iterable[Any],
1683
+ *iterables: Iterable[Any],
1684
+ ) -> zip[tuple[Any, ...]]: ...
1685
+
1686
+ def __iter__(self) -> Self: ...
1687
+ def __next__(self) -> _T_co: ...
1688
+
1689
+ # Signature of `builtins.__import__` should be kept identical to `importlib.__import__`
1690
+ # Return type of `__import__` should be kept the same as return type of `importlib.import_module`
1691
+ def __import__(
1692
+ name: str,
1693
+ globals: Mapping[str, object] | None = None,
1694
+ locals: Mapping[str, object] | None = None,
1695
+ fromlist: Sequence[str] = (),
1696
+ level: int = 0,
1697
+ ) -> types.ModuleType: ...
1698
+ def __build_class__(__func: Callable[[], _Cell | Any], __name: str, *bases: Any, metaclass: Any = ..., **kwds: Any) -> Any: ...
1699
+
1700
+ if sys.version_info >= (3, 10):
1701
+ from types import EllipsisType
1702
+
1703
+ # Backwards compatibility hack for folks who relied on the ellipsis type
1704
+ # existing in typeshed in Python 3.9 and earlier.
1705
+ ellipsis = EllipsisType
1706
+
1707
+ Ellipsis: EllipsisType
1708
+
1709
+ else:
1710
+ # Actually the type of Ellipsis is <type 'ellipsis'>, but since it's
1711
+ # not exposed anywhere under that name, we make it private here.
1712
+ @final
1713
+ @type_check_only
1714
+ class ellipsis: ...
1715
+
1716
+ Ellipsis: ellipsis
1717
+
1718
+ class BaseException:
1719
+ args: tuple[Any, ...]
1720
+ __cause__: BaseException | None
1721
+ __context__: BaseException | None
1722
+ __suppress_context__: bool
1723
+ __traceback__: TracebackType | None
1724
+ def __init__(self, *args: object) -> None: ...
1725
+ def __setstate__(self, __state: dict[str, Any] | None) -> None: ...
1726
+ def with_traceback(self, __tb: TracebackType | None) -> Self: ...
1727
+ if sys.version_info >= (3, 11):
1728
+ # only present after add_note() is called
1729
+ __notes__: list[str]
1730
+ def add_note(self, __note: str) -> None: ...
1731
+
1732
+ class GeneratorExit(BaseException): ...
1733
+ class KeyboardInterrupt(BaseException): ...
1734
+
1735
+ class SystemExit(BaseException):
1736
+ code: sys._ExitCode
1737
+
1738
+ class Exception(BaseException): ...
1739
+
1740
+ class StopIteration(Exception):
1741
+ value: Any
1742
+
1743
+ class OSError(Exception):
1744
+ errno: int
1745
+ strerror: str
1746
+ # filename, filename2 are actually str | bytes | None
1747
+ filename: Any
1748
+ filename2: Any
1749
+ if sys.platform == "win32":
1750
+ winerror: int
1751
+
1752
+ EnvironmentError = OSError
1753
+ IOError = OSError
1754
+ if sys.platform == "win32":
1755
+ WindowsError = OSError
1756
+
1757
+ class ArithmeticError(Exception): ...
1758
+ class AssertionError(Exception): ...
1759
+
1760
+ class AttributeError(Exception):
1761
+ if sys.version_info >= (3, 10):
1762
+ def __init__(self, *args: object, name: str | None = ..., obj: object = ...) -> None: ...
1763
+ name: str
1764
+ obj: object
1765
+
1766
+ class BufferError(Exception): ...
1767
+ class EOFError(Exception): ...
1768
+
1769
+ class ImportError(Exception):
1770
+ def __init__(self, *args: object, name: str | None = ..., path: str | None = ...) -> None: ...
1771
+ name: str | None
1772
+ path: str | None
1773
+ msg: str # undocumented
1774
+ if sys.version_info >= (3, 12):
1775
+ name_from: str | None # undocumented
1776
+
1777
+ class LookupError(Exception): ...
1778
+ class MemoryError(Exception): ...
1779
+
1780
+ class NameError(Exception):
1781
+ if sys.version_info >= (3, 10):
1782
+ name: str
1783
+
1784
+ class ReferenceError(Exception): ...
1785
+ class RuntimeError(Exception): ...
1786
+
1787
+ class StopAsyncIteration(Exception):
1788
+ value: Any
1789
+
1790
+ class SyntaxError(Exception):
1791
+ msg: str
1792
+ lineno: int | None
1793
+ offset: int | None
1794
+ text: str | None
1795
+ filename: str | None
1796
+ if sys.version_info >= (3, 10):
1797
+ end_lineno: int | None
1798
+ end_offset: int | None
1799
+
1800
+ class SystemError(Exception): ...
1801
+ class TypeError(Exception): ...
1802
+ class ValueError(Exception): ...
1803
+ class FloatingPointError(ArithmeticError): ...
1804
+ class OverflowError(ArithmeticError): ...
1805
+ class ZeroDivisionError(ArithmeticError): ...
1806
+ class ModuleNotFoundError(ImportError): ...
1807
+ class IndexError(LookupError): ...
1808
+ class KeyError(LookupError): ...
1809
+ class UnboundLocalError(NameError): ...
1810
+
1811
+ class BlockingIOError(OSError):
1812
+ characters_written: int
1813
+
1814
+ class ChildProcessError(OSError): ...
1815
+ class ConnectionError(OSError): ...
1816
+ class BrokenPipeError(ConnectionError): ...
1817
+ class ConnectionAbortedError(ConnectionError): ...
1818
+ class ConnectionRefusedError(ConnectionError): ...
1819
+ class ConnectionResetError(ConnectionError): ...
1820
+ class FileExistsError(OSError): ...
1821
+ class FileNotFoundError(OSError): ...
1822
+ class InterruptedError(OSError): ...
1823
+ class IsADirectoryError(OSError): ...
1824
+ class NotADirectoryError(OSError): ...
1825
+ class PermissionError(OSError): ...
1826
+ class ProcessLookupError(OSError): ...
1827
+ class TimeoutError(OSError): ...
1828
+ class NotImplementedError(RuntimeError): ...
1829
+ class RecursionError(RuntimeError): ...
1830
+ class IndentationError(SyntaxError): ...
1831
+ class TabError(IndentationError): ...
1832
+ class UnicodeError(ValueError): ...
1833
+
1834
+ class UnicodeDecodeError(UnicodeError):
1835
+ encoding: str
1836
+ object: bytes
1837
+ start: int
1838
+ end: int
1839
+ reason: str
1840
+ def __init__(self, __encoding: str, __object: ReadableBuffer, __start: int, __end: int, __reason: str) -> None: ...
1841
+
1842
+ class UnicodeEncodeError(UnicodeError):
1843
+ encoding: str
1844
+ object: str
1845
+ start: int
1846
+ end: int
1847
+ reason: str
1848
+ def __init__(self, __encoding: str, __object: str, __start: int, __end: int, __reason: str) -> None: ...
1849
+
1850
+ class UnicodeTranslateError(UnicodeError):
1851
+ encoding: None
1852
+ object: str
1853
+ start: int
1854
+ end: int
1855
+ reason: str
1856
+ def __init__(self, __object: str, __start: int, __end: int, __reason: str) -> None: ...
1857
+
1858
+ class Warning(Exception): ...
1859
+ class UserWarning(Warning): ...
1860
+ class DeprecationWarning(Warning): ...
1861
+ class SyntaxWarning(Warning): ...
1862
+ class RuntimeWarning(Warning): ...
1863
+ class FutureWarning(Warning): ...
1864
+ class PendingDeprecationWarning(Warning): ...
1865
+ class ImportWarning(Warning): ...
1866
+ class UnicodeWarning(Warning): ...
1867
+ class BytesWarning(Warning): ...
1868
+ class ResourceWarning(Warning): ...
1869
+
1870
+ if sys.version_info >= (3, 10):
1871
+ class EncodingWarning(Warning): ...
1872
+
1873
+ if sys.version_info >= (3, 11):
1874
+ _BaseExceptionT_co = TypeVar("_BaseExceptionT_co", bound=BaseException, covariant=True)
1875
+ _BaseExceptionT = TypeVar("_BaseExceptionT", bound=BaseException)
1876
+ _ExceptionT_co = TypeVar("_ExceptionT_co", bound=Exception, covariant=True)
1877
+ _ExceptionT = TypeVar("_ExceptionT", bound=Exception)
1878
+
1879
+ # See `check_exception_group.py` for use-cases and comments.
1880
+ class BaseExceptionGroup(BaseException, Generic[_BaseExceptionT_co]):
1881
+ def __new__(cls, __message: str, __exceptions: Sequence[_BaseExceptionT_co]) -> Self: ...
1882
+ def __init__(self, __message: str, __exceptions: Sequence[_BaseExceptionT_co]) -> None: ...
1883
+ @property
1884
+ def message(self) -> str: ...
1885
+ @property
1886
+ def exceptions(self) -> tuple[_BaseExceptionT_co | BaseExceptionGroup[_BaseExceptionT_co], ...]: ...
1887
+ @overload
1888
+ def subgroup(
1889
+ self, __condition: type[_ExceptionT] | tuple[type[_ExceptionT], ...]
1890
+ ) -> ExceptionGroup[_ExceptionT] | None: ...
1891
+ @overload
1892
+ def subgroup(
1893
+ self, __condition: type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...]
1894
+ ) -> BaseExceptionGroup[_BaseExceptionT] | None: ...
1895
+ @overload
1896
+ def subgroup(
1897
+ self, __condition: Callable[[_BaseExceptionT_co | Self], bool]
1898
+ ) -> BaseExceptionGroup[_BaseExceptionT_co] | None: ...
1899
+ @overload
1900
+ def split(
1901
+ self, __condition: type[_ExceptionT] | tuple[type[_ExceptionT], ...]
1902
+ ) -> tuple[ExceptionGroup[_ExceptionT] | None, BaseExceptionGroup[_BaseExceptionT_co] | None]: ...
1903
+ @overload
1904
+ def split(
1905
+ self, __condition: type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...]
1906
+ ) -> tuple[BaseExceptionGroup[_BaseExceptionT] | None, BaseExceptionGroup[_BaseExceptionT_co] | None]: ...
1907
+ @overload
1908
+ def split(
1909
+ self, __condition: Callable[[_BaseExceptionT_co | Self], bool]
1910
+ ) -> tuple[BaseExceptionGroup[_BaseExceptionT_co] | None, BaseExceptionGroup[_BaseExceptionT_co] | None]: ...
1911
+ # In reality it is `NonEmptySequence`:
1912
+ @overload
1913
+ def derive(self, __excs: Sequence[_ExceptionT]) -> ExceptionGroup[_ExceptionT]: ...
1914
+ @overload
1915
+ def derive(self, __excs: Sequence[_BaseExceptionT]) -> BaseExceptionGroup[_BaseExceptionT]: ...
1916
+ def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
1917
+
1918
+ class ExceptionGroup(BaseExceptionGroup[_ExceptionT_co], Exception):
1919
+ def __new__(cls, __message: str, __exceptions: Sequence[_ExceptionT_co]) -> Self: ...
1920
+ def __init__(self, __message: str, __exceptions: Sequence[_ExceptionT_co]) -> None: ...
1921
+ @property
1922
+ def exceptions(self) -> tuple[_ExceptionT_co | ExceptionGroup[_ExceptionT_co], ...]: ...
1923
+ # We accept a narrower type, but that's OK.
1924
+ @overload # type: ignore[override]
1925
+ def subgroup(
1926
+ self, __condition: type[_ExceptionT] | tuple[type[_ExceptionT], ...]
1927
+ ) -> ExceptionGroup[_ExceptionT] | None: ...
1928
+ @overload
1929
+ def subgroup(self, __condition: Callable[[_ExceptionT_co | Self], bool]) -> ExceptionGroup[_ExceptionT_co] | None: ...
1930
+ @overload # type: ignore[override]
1931
+ def split(
1932
+ self, __condition: type[_ExceptionT] | tuple[type[_ExceptionT], ...]
1933
+ ) -> tuple[ExceptionGroup[_ExceptionT] | None, ExceptionGroup[_ExceptionT_co] | None]: ...
1934
+ @overload
1935
+ def split(
1936
+ self, __condition: Callable[[_ExceptionT_co | Self], bool]
1937
+ ) -> tuple[ExceptionGroup[_ExceptionT_co] | None, ExceptionGroup[_ExceptionT_co] | None]: ...