basedpyright 1.12.2 → 1.12.3

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 (236) hide show
  1. package/dist/pyright-langserver.js +1 -1
  2. package/dist/pyright-langserver.js.map +1 -1
  3. package/dist/pyright.js +1 -1
  4. package/dist/pyright.js.map +1 -1
  5. package/dist/typeshed-fallback/README.md +2 -2
  6. package/dist/typeshed-fallback/commit.txt +1 -1
  7. package/dist/typeshed-fallback/stdlib/VERSIONS +1 -1
  8. package/dist/typeshed-fallback/stdlib/_ast.pyi +661 -22
  9. package/dist/typeshed-fallback/stdlib/_ctypes.pyi +1 -1
  10. package/dist/typeshed-fallback/stdlib/_socket.pyi +2 -2
  11. package/dist/typeshed-fallback/stdlib/_stat.pyi +27 -13
  12. package/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi +2 -0
  13. package/dist/typeshed-fallback/stdlib/_typeshed/importlib.pyi +18 -0
  14. package/dist/typeshed-fallback/stdlib/_weakref.pyi +1 -1
  15. package/dist/typeshed-fallback/stdlib/_weakrefset.pyi +1 -1
  16. package/dist/typeshed-fallback/stdlib/array.pyi +1 -1
  17. package/dist/typeshed-fallback/stdlib/ast.pyi +160 -70
  18. package/dist/typeshed-fallback/stdlib/asyncio/futures.pyi +1 -1
  19. package/dist/typeshed-fallback/stdlib/asyncio/queues.pyi +1 -1
  20. package/dist/typeshed-fallback/stdlib/asyncio/tasks.pyi +1 -1
  21. package/dist/typeshed-fallback/stdlib/atexit.pyi +2 -2
  22. package/dist/typeshed-fallback/stdlib/builtins.pyi +30 -8
  23. package/dist/typeshed-fallback/stdlib/calendar.pyi +29 -29
  24. package/dist/typeshed-fallback/stdlib/code.pyi +27 -8
  25. package/dist/typeshed-fallback/stdlib/concurrent/futures/_base.pyi +1 -1
  26. package/dist/typeshed-fallback/stdlib/concurrent/futures/thread.pyi +1 -1
  27. package/dist/typeshed-fallback/stdlib/contextvars.pyi +2 -2
  28. package/dist/typeshed-fallback/stdlib/csv.pyi +4 -4
  29. package/dist/typeshed-fallback/stdlib/ctypes/__init__.pyi +1 -1
  30. package/dist/typeshed-fallback/stdlib/dataclasses.pyi +1 -1
  31. package/dist/typeshed-fallback/stdlib/dbm/__init__.pyi +9 -2
  32. package/dist/typeshed-fallback/stdlib/dbm/dumb.pyi +7 -1
  33. package/dist/typeshed-fallback/stdlib/dbm/gnu.pyi +5 -2
  34. package/dist/typeshed-fallback/stdlib/dbm/ndbm.pyi +5 -2
  35. package/dist/typeshed-fallback/stdlib/difflib.pyi +1 -1
  36. package/dist/typeshed-fallback/stdlib/dis.pyi +16 -1
  37. package/dist/typeshed-fallback/stdlib/distutils/archive_util.pyi +22 -7
  38. package/dist/typeshed-fallback/stdlib/distutils/ccompiler.pyi +37 -16
  39. package/dist/typeshed-fallback/stdlib/distutils/cmd.pyi +52 -19
  40. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_msi.pyi +4 -4
  41. package/dist/typeshed-fallback/stdlib/distutils/command/build.pyi +4 -2
  42. package/dist/typeshed-fallback/stdlib/distutils/command/build_py.pyi +2 -2
  43. package/dist/typeshed-fallback/stdlib/distutils/command/check.pyi +2 -2
  44. package/dist/typeshed-fallback/stdlib/distutils/command/config.pyi +5 -4
  45. package/dist/typeshed-fallback/stdlib/distutils/command/install.pyi +4 -2
  46. package/dist/typeshed-fallback/stdlib/distutils/command/register.pyi +4 -2
  47. package/dist/typeshed-fallback/stdlib/distutils/command/sdist.pyi +4 -2
  48. package/dist/typeshed-fallback/stdlib/distutils/core.pyi +2 -2
  49. package/dist/typeshed-fallback/stdlib/distutils/dep_util.pyi +14 -3
  50. package/dist/typeshed-fallback/stdlib/distutils/dir_util.pyi +20 -10
  51. package/dist/typeshed-fallback/stdlib/distutils/dist.pyi +8 -5
  52. package/dist/typeshed-fallback/stdlib/distutils/file_util.pyi +35 -11
  53. package/dist/typeshed-fallback/stdlib/distutils/filelist.pyi +11 -3
  54. package/dist/typeshed-fallback/stdlib/distutils/spawn.pyi +5 -1
  55. package/dist/typeshed-fallback/stdlib/distutils/sysconfig.pyi +4 -2
  56. package/dist/typeshed-fallback/stdlib/distutils/text_file.pyi +7 -7
  57. package/dist/typeshed-fallback/stdlib/distutils/util.pyi +9 -5
  58. package/dist/typeshed-fallback/stdlib/faulthandler.pyi +1 -1
  59. package/dist/typeshed-fallback/stdlib/filecmp.pyi +1 -1
  60. package/dist/typeshed-fallback/stdlib/fileinput.pyi +1 -1
  61. package/dist/typeshed-fallback/stdlib/functools.pyi +3 -3
  62. package/dist/typeshed-fallback/stdlib/genericpath.pyi +7 -0
  63. package/dist/typeshed-fallback/stdlib/graphlib.pyi +1 -1
  64. package/dist/typeshed-fallback/stdlib/gzip.pyi +3 -3
  65. package/dist/typeshed-fallback/stdlib/http/__init__.pyi +11 -4
  66. package/dist/typeshed-fallback/stdlib/http/cookies.pyi +1 -1
  67. package/dist/typeshed-fallback/stdlib/importlib/abc.pyi +2 -2
  68. package/dist/typeshed-fallback/stdlib/importlib/util.pyi +3 -2
  69. package/dist/typeshed-fallback/stdlib/inspect.pyi +6 -0
  70. package/dist/typeshed-fallback/stdlib/keyword.pyi +2 -2
  71. package/dist/typeshed-fallback/stdlib/logging/__init__.pyi +69 -42
  72. package/dist/typeshed-fallback/stdlib/mailbox.pyi +2 -2
  73. package/dist/typeshed-fallback/stdlib/marshal.pyi +12 -4
  74. package/dist/typeshed-fallback/stdlib/math.pyi +3 -0
  75. package/dist/typeshed-fallback/stdlib/multiprocessing/managers.pyi +1 -1
  76. package/dist/typeshed-fallback/stdlib/multiprocessing/pool.pyi +1 -1
  77. package/dist/typeshed-fallback/stdlib/multiprocessing/queues.pyi +1 -1
  78. package/dist/typeshed-fallback/stdlib/multiprocessing/shared_memory.pyi +1 -1
  79. package/dist/typeshed-fallback/stdlib/ntpath.pyi +8 -1
  80. package/dist/typeshed-fallback/stdlib/opcode.pyi +6 -2
  81. package/dist/typeshed-fallback/stdlib/optparse.pyi +1 -1
  82. package/dist/typeshed-fallback/stdlib/os/__init__.pyi +1 -1
  83. package/dist/typeshed-fallback/stdlib/pathlib.pyi +6 -2
  84. package/dist/typeshed-fallback/stdlib/pkgutil.pyi +6 -6
  85. package/dist/typeshed-fallback/stdlib/posixpath.pyi +5 -0
  86. package/dist/typeshed-fallback/stdlib/queue.pyi +4 -2
  87. package/dist/typeshed-fallback/stdlib/random.pyi +4 -1
  88. package/dist/typeshed-fallback/stdlib/re.pyi +20 -9
  89. package/dist/typeshed-fallback/stdlib/shelve.pyi +15 -2
  90. package/dist/typeshed-fallback/stdlib/shutil.pyi +38 -8
  91. package/dist/typeshed-fallback/stdlib/signal.pyi +1 -1
  92. package/dist/typeshed-fallback/stdlib/socket.pyi +13 -0
  93. package/dist/typeshed-fallback/stdlib/stat.pyi +6 -0
  94. package/dist/typeshed-fallback/stdlib/statistics.pyi +30 -1
  95. package/dist/typeshed-fallback/stdlib/subprocess.pyi +2 -2
  96. package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +15 -19
  97. package/dist/typeshed-fallback/stdlib/syslog.pyi +9 -0
  98. package/dist/typeshed-fallback/stdlib/tempfile.pyi +7 -3
  99. package/dist/typeshed-fallback/stdlib/threading.pyi +3 -0
  100. package/dist/typeshed-fallback/stdlib/token.pyi +5 -4
  101. package/dist/typeshed-fallback/stdlib/tokenize.pyi +10 -3
  102. package/dist/typeshed-fallback/stdlib/types.pyi +20 -18
  103. package/dist/typeshed-fallback/stdlib/typing.pyi +75 -21
  104. package/dist/typeshed-fallback/stdlib/typing_extensions.pyi +104 -83
  105. package/dist/typeshed-fallback/stdlib/unittest/case.pyi +1 -1
  106. package/dist/typeshed-fallback/stdlib/urllib/parse.pyi +1 -1
  107. package/dist/typeshed-fallback/stdlib/urllib/request.pyi +17 -10
  108. package/dist/typeshed-fallback/stdlib/venv/__init__.pyi +31 -3
  109. package/dist/typeshed-fallback/stdlib/warnings.pyi +13 -1
  110. package/dist/typeshed-fallback/stdlib/wsgiref/util.pyi +2 -0
  111. package/dist/typeshed-fallback/stubs/Pillow/PIL/DdsImagePlugin.pyi +17 -17
  112. package/dist/typeshed-fallback/stubs/Pillow/PIL/Image.pyi +29 -29
  113. package/dist/typeshed-fallback/stubs/Pillow/PIL/WalImageFile.pyi +2 -1
  114. package/dist/typeshed-fallback/stubs/Pillow/PIL/_binary.pyi +13 -13
  115. package/dist/typeshed-fallback/stubs/WebOb/webob/multidict.pyi +8 -3
  116. package/dist/typeshed-fallback/stubs/WebOb/webob/request.pyi +10 -3
  117. package/dist/typeshed-fallback/stubs/antlr4-python3-runtime/antlr4/atn/ATNType.pyi +2 -2
  118. package/dist/typeshed-fallback/stubs/antlr4-python3-runtime/antlr4/atn/LexerAction.pyi +8 -8
  119. package/dist/typeshed-fallback/stubs/antlr4-python3-runtime/antlr4/atn/PredictionMode.pyi +3 -3
  120. package/dist/typeshed-fallback/stubs/assertpy/METADATA.toml +2 -0
  121. package/dist/typeshed-fallback/stubs/assertpy/assertpy/__init__.pyi +12 -0
  122. package/dist/typeshed-fallback/stubs/assertpy/assertpy/assertpy.pyi +70 -0
  123. package/dist/typeshed-fallback/stubs/assertpy/assertpy/base.pyi +21 -0
  124. package/dist/typeshed-fallback/stubs/assertpy/assertpy/collection.pyi +11 -0
  125. package/dist/typeshed-fallback/stubs/assertpy/assertpy/contains.pyi +16 -0
  126. package/dist/typeshed-fallback/stubs/assertpy/assertpy/date.pyi +11 -0
  127. package/dist/typeshed-fallback/stubs/assertpy/assertpy/dict.pyi +12 -0
  128. package/dist/typeshed-fallback/stubs/assertpy/assertpy/dynamic.pyi +7 -0
  129. package/dist/typeshed-fallback/stubs/assertpy/assertpy/exception.pyi +8 -0
  130. package/dist/typeshed-fallback/stubs/assertpy/assertpy/extracting.pyi +7 -0
  131. package/dist/typeshed-fallback/stubs/assertpy/assertpy/file.pyi +15 -0
  132. package/dist/typeshed-fallback/stubs/assertpy/assertpy/helpers.pyi +3 -0
  133. package/dist/typeshed-fallback/stubs/assertpy/assertpy/numeric.pyi +24 -0
  134. package/dist/typeshed-fallback/stubs/assertpy/assertpy/snapshot.pyi +6 -0
  135. package/dist/typeshed-fallback/stubs/assertpy/assertpy/string.pyi +18 -0
  136. package/dist/typeshed-fallback/stubs/beautifulsoup4/bs4/element.pyi +15 -7
  137. package/dist/typeshed-fallback/stubs/docker/docker/api/container.pyi +119 -61
  138. package/dist/typeshed-fallback/stubs/docker/docker/errors.pyi +3 -3
  139. package/dist/typeshed-fallback/stubs/docker/docker/models/containers.pyi +31 -20
  140. package/dist/typeshed-fallback/stubs/docker/docker/utils/json_stream.pyi +16 -8
  141. package/dist/typeshed-fallback/stubs/flake8/METADATA.toml +3 -0
  142. package/dist/typeshed-fallback/stubs/flake8/flake8/__init__.pyi +8 -0
  143. package/dist/typeshed-fallback/stubs/flake8/flake8/_compat.pyi +5 -0
  144. package/dist/typeshed-fallback/stubs/flake8/flake8/api/__init__.pyi +0 -0
  145. package/dist/typeshed-fallback/stubs/flake8/flake8/api/legacy.pyi +27 -0
  146. package/dist/typeshed-fallback/stubs/flake8/flake8/checker.pyi +56 -0
  147. package/dist/typeshed-fallback/stubs/flake8/flake8/defaults.pyi +12 -0
  148. package/dist/typeshed-fallback/stubs/flake8/flake8/discover_files.pyi +8 -0
  149. package/dist/typeshed-fallback/stubs/flake8/flake8/exceptions.pyi +24 -0
  150. package/dist/typeshed-fallback/stubs/flake8/flake8/formatting/__init__.pyi +0 -0
  151. package/dist/typeshed-fallback/stubs/flake8/flake8/formatting/_windows_color.pyi +1 -0
  152. package/dist/typeshed-fallback/stubs/flake8/flake8/formatting/base.pyi +24 -0
  153. package/dist/typeshed-fallback/stubs/flake8/flake8/formatting/default.pyi +29 -0
  154. package/dist/typeshed-fallback/stubs/flake8/flake8/main/__init__.pyi +0 -0
  155. package/dist/typeshed-fallback/stubs/flake8/flake8/main/application.pyi +29 -0
  156. package/dist/typeshed-fallback/stubs/flake8/flake8/main/cli.pyi +3 -0
  157. package/dist/typeshed-fallback/stubs/flake8/flake8/main/debug.pyi +5 -0
  158. package/dist/typeshed-fallback/stubs/flake8/flake8/main/options.pyi +12 -0
  159. package/dist/typeshed-fallback/stubs/flake8/flake8/options/__init__.pyi +0 -0
  160. package/dist/typeshed-fallback/stubs/flake8/flake8/options/aggregator.pyi +12 -0
  161. package/dist/typeshed-fallback/stubs/flake8/flake8/options/config.pyi +10 -0
  162. package/dist/typeshed-fallback/stubs/flake8/flake8/options/manager.pyi +71 -0
  163. package/dist/typeshed-fallback/stubs/flake8/flake8/options/parse_args.pyi +6 -0
  164. package/dist/typeshed-fallback/stubs/flake8/flake8/plugins/__init__.pyi +0 -0
  165. package/dist/typeshed-fallback/stubs/flake8/flake8/plugins/finder.pyi +48 -0
  166. package/dist/typeshed-fallback/stubs/flake8/flake8/plugins/pycodestyle.pyi +32 -0
  167. package/dist/typeshed-fallback/stubs/flake8/flake8/plugins/pyflakes.pyi +21 -0
  168. package/dist/typeshed-fallback/stubs/flake8/flake8/plugins/reporter.pyi +9 -0
  169. package/dist/typeshed-fallback/stubs/flake8/flake8/processor.pyi +72 -0
  170. package/dist/typeshed-fallback/stubs/flake8/flake8/statistics.pyi +28 -0
  171. package/dist/typeshed-fallback/stubs/flake8/flake8/style_guide.pyi +70 -0
  172. package/dist/typeshed-fallback/stubs/flake8/flake8/utils.pyi +25 -0
  173. package/dist/typeshed-fallback/stubs/flake8/flake8/violation.pyi +13 -0
  174. package/dist/typeshed-fallback/stubs/fpdf2/METADATA.toml +1 -1
  175. package/dist/typeshed-fallback/stubs/fpdf2/fpdf/bidi.pyi +5 -3
  176. package/dist/typeshed-fallback/stubs/fpdf2/fpdf/drawing.pyi +5 -1
  177. package/dist/typeshed-fallback/stubs/fpdf2/fpdf/enums.pyi +15 -2
  178. package/dist/typeshed-fallback/stubs/fpdf2/fpdf/fpdf.pyi +2 -1
  179. package/dist/typeshed-fallback/stubs/fpdf2/fpdf/html.pyi +45 -32
  180. package/dist/typeshed-fallback/stubs/fpdf2/fpdf/line_break.pyi +4 -4
  181. package/dist/typeshed-fallback/stubs/fpdf2/fpdf/outline.pyi +1 -1
  182. package/dist/typeshed-fallback/stubs/fpdf2/fpdf/svg.pyi +0 -1
  183. package/dist/typeshed-fallback/stubs/fpdf2/fpdf/table.pyi +2 -1
  184. package/dist/typeshed-fallback/stubs/fpdf2/fpdf/util.pyi +4 -0
  185. package/dist/typeshed-fallback/stubs/hvac/hvac/adapters.pyi +1 -1
  186. package/dist/typeshed-fallback/stubs/hvac/hvac/v1/__init__.pyi +35 -23
  187. package/dist/typeshed-fallback/stubs/influxdb-client/METADATA.toml +1 -1
  188. package/dist/typeshed-fallback/stubs/influxdb-client/influxdb_client/client/exceptions.pyi +3 -1
  189. package/dist/typeshed-fallback/stubs/influxdb-client/influxdb_client/rest.pyi +8 -2
  190. package/dist/typeshed-fallback/stubs/networkx/networkx/algorithms/dag.pyi +2 -0
  191. package/dist/typeshed-fallback/stubs/psutil/psutil/__init__.pyi +1 -1
  192. package/dist/typeshed-fallback/stubs/psutil/psutil/_pswindows.pyi +8 -6
  193. package/dist/typeshed-fallback/stubs/pyaudio/METADATA.toml +2 -2
  194. package/dist/typeshed-fallback/stubs/pyflakes/pyflakes/scripts/__init__.pyi +0 -0
  195. package/dist/typeshed-fallback/stubs/pyflakes/pyflakes/scripts/pyflakes.pyi +8 -0
  196. package/dist/typeshed-fallback/stubs/pygit2/METADATA.toml +1 -1
  197. package/dist/typeshed-fallback/stubs/pygit2/pygit2/_pygit2.pyi +1 -15
  198. package/dist/typeshed-fallback/stubs/pygit2/pygit2/enums.pyi +313 -314
  199. package/dist/typeshed-fallback/stubs/pygit2/pygit2/index.pyi +2 -1
  200. package/dist/typeshed-fallback/stubs/pygit2/pygit2/remotes.pyi +7 -1
  201. package/dist/typeshed-fallback/stubs/pygit2/pygit2/repository.pyi +4 -14
  202. package/dist/typeshed-fallback/stubs/pygit2/pygit2/utils.pyi +7 -1
  203. package/dist/typeshed-fallback/stubs/pynput/METADATA.toml +1 -1
  204. package/dist/typeshed-fallback/stubs/regex/METADATA.toml +1 -1
  205. package/dist/typeshed-fallback/stubs/regex/regex/_regex_core.pyi +35 -35
  206. package/dist/typeshed-fallback/stubs/regex/regex/regex.pyi +10 -10
  207. package/dist/typeshed-fallback/stubs/requests/METADATA.toml +1 -1
  208. package/dist/typeshed-fallback/stubs/setuptools/pkg_resources/__init__.pyi +16 -9
  209. package/dist/typeshed-fallback/stubs/setuptools/setuptools/__init__.pyi +4 -2
  210. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/_modified.pyi +16 -5
  211. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/archive_util.pyi +25 -10
  212. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/ccompiler.pyi +38 -16
  213. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/cmd.pyi +58 -30
  214. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/build_py.pyi +2 -1
  215. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/install_lib.pyi +1 -1
  216. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/install_scripts.pyi +1 -1
  217. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/upload.pyi +2 -2
  218. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/dep_util.pyi +1 -3
  219. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/dist.pyi +8 -5
  220. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/filelist.pyi +14 -6
  221. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/sysconfig.pyi +4 -2
  222. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/util.pyi +8 -4
  223. package/dist/typeshed-fallback/stubs/setuptools/setuptools/build_meta.pyi +4 -3
  224. package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_egg.pyi +9 -1
  225. package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/build_ext.pyi +2 -2
  226. package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/install.pyi +3 -1
  227. package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/install_lib.pyi +10 -1
  228. package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/install_scripts.pyi +1 -3
  229. package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/upload_docs.pyi +2 -3
  230. package/dist/typeshed-fallback/stubs/setuptools/setuptools/config/expand.pyi +1 -1
  231. package/dist/typeshed-fallback/stubs/six/six/__init__.pyi +1 -1
  232. package/dist/typeshed-fallback/stubs/uWSGI/METADATA.toml +4 -1
  233. package/dist/typeshed-fallback/stubs/ujson/METADATA.toml +1 -1
  234. package/dist/typeshed-fallback/stubs/wurlitzer/METADATA.toml +1 -1
  235. package/dist/typeshed-fallback/stubs/wurlitzer/wurlitzer.pyi +48 -6
  236. package/package.json +1 -1
@@ -474,6 +474,13 @@ if sys.version_info >= (3, 12):
474
474
  ETHERTYPE_VLAN as ETHERTYPE_VLAN,
475
475
  )
476
476
 
477
+ if sys.platform == "linux":
478
+ from _socket import ETH_P_ALL as ETH_P_ALL
479
+
480
+ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin":
481
+ # FreeBSD >= 14.0
482
+ from _socket import PF_DIVERT as PF_DIVERT
483
+
477
484
  # Re-exported from errno
478
485
  EBADF: int
479
486
  EAGAIN: int
@@ -525,6 +532,9 @@ class AddressFamily(IntEnum):
525
532
  AF_BLUETOOTH = 32
526
533
  if sys.platform == "win32" and sys.version_info >= (3, 12):
527
534
  AF_HYPERV = 34
535
+ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin" and sys.version_info >= (3, 12):
536
+ # FreeBSD >= 14.0
537
+ AF_DIVERT = 44
528
538
 
529
539
  AF_INET = AddressFamily.AF_INET
530
540
  AF_INET6 = AddressFamily.AF_INET6
@@ -577,6 +587,9 @@ if sys.platform != "win32" or sys.version_info >= (3, 9):
577
587
 
578
588
  if sys.platform == "win32" and sys.version_info >= (3, 12):
579
589
  AF_HYPERV = AddressFamily.AF_HYPERV
590
+ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin" and sys.version_info >= (3, 12):
591
+ # FreeBSD >= 14.0
592
+ AF_DIVERT = AddressFamily.AF_DIVERT
580
593
 
581
594
  class SocketKind(IntEnum):
582
595
  SOCK_STREAM = 1
@@ -1 +1,7 @@
1
+ import sys
1
2
  from _stat import *
3
+ from typing import Literal
4
+
5
+ if sys.version_info >= (3, 13):
6
+ # https://github.com/python/cpython/issues/114081#issuecomment-2119017790
7
+ SF_RESTRICTED: Literal[0x00080000]
@@ -1,6 +1,6 @@
1
1
  import sys
2
2
  from _typeshed import SupportsRichComparisonT
3
- from collections.abc import Hashable, Iterable, Sequence
3
+ from collections.abc import Callable, Hashable, Iterable, Sequence
4
4
  from decimal import Decimal
5
5
  from fractions import Fraction
6
6
  from typing import Any, Literal, NamedTuple, SupportsFloat, TypeVar
@@ -28,6 +28,8 @@ __all__ = [
28
28
 
29
29
  if sys.version_info >= (3, 10):
30
30
  __all__ += ["covariance", "correlation", "linear_regression"]
31
+ if sys.version_info >= (3, 13):
32
+ __all__ += ["kde", "kde_random"]
31
33
 
32
34
  # Most functions in this module accept homogeneous collections of one of these types
33
35
  _Number: TypeAlias = float | Decimal | Fraction
@@ -130,3 +132,30 @@ if sys.version_info >= (3, 11):
130
132
 
131
133
  elif sys.version_info >= (3, 10):
132
134
  def linear_regression(regressor: Sequence[_Number], dependent_variable: Sequence[_Number], /) -> LinearRegression: ...
135
+
136
+ if sys.version_info >= (3, 13):
137
+ _Kernel: TypeAlias = Literal[
138
+ "normal",
139
+ "gauss",
140
+ "logistic",
141
+ "sigmoid",
142
+ "rectangular",
143
+ "uniform",
144
+ "triangular",
145
+ "parabolic",
146
+ "epanechnikov",
147
+ "quartic",
148
+ "biweight",
149
+ "triweight",
150
+ "cosine",
151
+ ]
152
+ def kde(
153
+ data: Sequence[float], h: float, kernel: _Kernel = "normal", *, cumulative: bool = False
154
+ ) -> Callable[[float], float]: ...
155
+ def kde_random(
156
+ data: Sequence[float],
157
+ h: float,
158
+ kernel: _Kernel = "normal",
159
+ *,
160
+ seed: int | float | str | bytes | bytearray | None = None, # noqa: Y041
161
+ ) -> Callable[[], float]: ...
@@ -88,7 +88,7 @@ class CompletedProcess(Generic[_T]):
88
88
  def __init__(self, args: _CMD, returncode: int, stdout: _T | None = None, stderr: _T | None = None) -> None: ...
89
89
  def check_returncode(self) -> None: ...
90
90
  if sys.version_info >= (3, 9):
91
- def __class_getitem__(cls, item: Any) -> GenericAlias: ...
91
+ def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
92
92
 
93
93
  if sys.version_info >= (3, 11):
94
94
  # 3.11 adds "process_group" argument
@@ -2560,7 +2560,7 @@ class Popen(Generic[AnyStr]):
2560
2560
  ) -> None: ...
2561
2561
  def __del__(self) -> None: ...
2562
2562
  if sys.version_info >= (3, 9):
2563
- def __class_getitem__(cls, item: Any) -> GenericAlias: ...
2563
+ def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
2564
2564
 
2565
2565
  # The result really is always a str.
2566
2566
  if sys.version_info >= (3, 11):
@@ -1,9 +1,8 @@
1
1
  import sys
2
- from _typeshed import OptExcInfo, ProfileFunction, TraceFunction, structseq
2
+ from _typeshed import MaybeNone, OptExcInfo, ProfileFunction, TraceFunction, structseq
3
+ from _typeshed.importlib import MetaPathFinderProtocol, PathEntryFinderProtocol
3
4
  from builtins import object as _object
4
5
  from collections.abc import AsyncGenerator, Callable, Sequence
5
- from importlib.abc import PathEntryFinder
6
- from importlib.machinery import ModuleSpec
7
6
  from io import TextIOWrapper
8
7
  from types import FrameType, ModuleType, TracebackType
9
8
  from typing import Any, Final, Literal, NoReturn, Protocol, TextIO, TypeVar, final
@@ -15,10 +14,6 @@ _T = TypeVar("_T")
15
14
  _ExitCode: TypeAlias = str | int | None
16
15
  _OptExcInfo: TypeAlias = OptExcInfo # noqa: Y047 # TODO: obsolete, remove fall 2022 or later
17
16
 
18
- # Intentionally omits one deprecated and one optional method of `importlib.abc.MetaPathFinder`
19
- class _MetaPathFinder(Protocol):
20
- def find_spec(self, fullname: str, path: Sequence[str] | None, target: ModuleType | None = ..., /) -> ModuleSpec | None: ...
21
-
22
17
  # ----- sys variables -----
23
18
  if sys.platform != "win32":
24
19
  abiflags: str
@@ -44,13 +39,13 @@ if sys.version_info >= (3, 12):
44
39
  last_exc: BaseException # or undefined.
45
40
  maxsize: int
46
41
  maxunicode: int
47
- meta_path: list[_MetaPathFinder]
42
+ meta_path: list[MetaPathFinderProtocol]
48
43
  modules: dict[str, ModuleType]
49
44
  if sys.version_info >= (3, 10):
50
45
  orig_argv: list[str]
51
46
  path: list[str]
52
- path_hooks: list[Callable[[str], PathEntryFinder]]
53
- path_importer_cache: dict[str, PathEntryFinder | None]
47
+ path_hooks: list[Callable[[str], PathEntryFinderProtocol]]
48
+ path_importer_cache: dict[str, PathEntryFinderProtocol | None]
54
49
  platform: str
55
50
  if sys.version_info >= (3, 9):
56
51
  platlibdir: str
@@ -61,23 +56,24 @@ ps2: object
61
56
 
62
57
  # TextIO is used instead of more specific types for the standard streams,
63
58
  # since they are often monkeypatched at runtime. At startup, the objects
64
- # are initialized to instances of TextIOWrapper.
59
+ # are initialized to instances of TextIOWrapper, but can also be None under
60
+ # some circumstances.
65
61
  #
66
62
  # To use methods from TextIOWrapper, use an isinstance check to ensure that
67
63
  # the streams have not been overridden:
68
64
  #
69
65
  # if isinstance(sys.stdout, io.TextIOWrapper):
70
66
  # sys.stdout.reconfigure(...)
71
- stdin: TextIO
72
- stdout: TextIO
73
- stderr: TextIO
67
+ stdin: TextIO | MaybeNone
68
+ stdout: TextIO | MaybeNone
69
+ stderr: TextIO | MaybeNone
74
70
 
75
71
  if sys.version_info >= (3, 10):
76
72
  stdlib_module_names: frozenset[str]
77
73
 
78
- __stdin__: Final[TextIOWrapper] # Contains the original value of stdin
79
- __stdout__: Final[TextIOWrapper] # Contains the original value of stdout
80
- __stderr__: Final[TextIOWrapper] # Contains the original value of stderr
74
+ __stdin__: Final[TextIOWrapper | None] # Contains the original value of stdin
75
+ __stdout__: Final[TextIOWrapper | None] # Contains the original value of stdout
76
+ __stderr__: Final[TextIOWrapper | None] # Contains the original value of stderr
81
77
  tracebacklimit: int
82
78
  version: str
83
79
  api_version: int
@@ -269,9 +265,9 @@ def getrecursionlimit() -> int: ...
269
265
  def getsizeof(obj: object, default: int = ...) -> int: ...
270
266
  def getswitchinterval() -> float: ...
271
267
  def getprofile() -> ProfileFunction | None: ...
272
- def setprofile(profilefunc: ProfileFunction | None) -> None: ...
268
+ def setprofile(function: ProfileFunction | None, /) -> None: ...
273
269
  def gettrace() -> TraceFunction | None: ...
274
- def settrace(tracefunc: TraceFunction | None) -> None: ...
270
+ def settrace(function: TraceFunction | None, /) -> None: ...
275
271
 
276
272
  if sys.platform == "win32":
277
273
  # A tuple of length 5, even though it has more than 5 attributes.
@@ -35,6 +35,15 @@ if sys.platform != "win32":
35
35
  LOG_USER: Literal[8]
36
36
  LOG_UUCP: Literal[64]
37
37
  LOG_WARNING: Literal[4]
38
+
39
+ if sys.version_info >= (3, 13):
40
+ LOG_FTP: Literal[88]
41
+ LOG_INSTALL: Literal[112]
42
+ LOG_LAUNCHD: Literal[192]
43
+ LOG_NETINFO: Literal[96]
44
+ LOG_RAS: Literal[120]
45
+ LOG_REMOTEAUTH: Literal[104]
46
+
38
47
  def LOG_MASK(pri: int, /) -> int: ...
39
48
  def LOG_UPTO(pri: int, /) -> int: ...
40
49
  def closelog() -> None: ...
@@ -374,7 +374,11 @@ class SpooledTemporaryFile(IO[AnyStr], _SpooledTemporaryFileBase):
374
374
  def readlines(self, hint: int = ..., /) -> list[AnyStr]: ... # type: ignore[override]
375
375
  def seek(self, offset: int, whence: int = ...) -> int: ...
376
376
  def tell(self) -> int: ...
377
- def truncate(self, size: int | None = None) -> None: ... # type: ignore[override]
377
+ if sys.version_info >= (3, 11):
378
+ def truncate(self, size: int | None = None) -> int: ...
379
+ else:
380
+ def truncate(self, size: int | None = None) -> None: ... # type: ignore[override]
381
+
378
382
  @overload
379
383
  def write(self: SpooledTemporaryFile[str], s: str) -> int: ...
380
384
  @overload
@@ -394,7 +398,7 @@ class SpooledTemporaryFile(IO[AnyStr], _SpooledTemporaryFileBase):
394
398
  def writable(self) -> bool: ...
395
399
  def __next__(self) -> AnyStr: ... # type: ignore[override]
396
400
  if sys.version_info >= (3, 9):
397
- def __class_getitem__(cls, item: Any) -> GenericAlias: ...
401
+ def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
398
402
 
399
403
  class TemporaryDirectory(Generic[AnyStr]):
400
404
  name: AnyStr
@@ -453,7 +457,7 @@ class TemporaryDirectory(Generic[AnyStr]):
453
457
  def __enter__(self) -> AnyStr: ...
454
458
  def __exit__(self, exc: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None) -> None: ...
455
459
  if sys.version_info >= (3, 9):
456
- def __class_getitem__(cls, item: Any) -> GenericAlias: ...
460
+ def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
457
461
 
458
462
  # The overloads overlap, but they should still work fine.
459
463
  @overload
@@ -109,6 +109,9 @@ class Lock:
109
109
  def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
110
110
  def release(self) -> None: ...
111
111
  def locked(self) -> bool: ...
112
+ def acquire_lock(self, blocking: bool = ..., timeout: float = ...) -> bool: ... # undocumented
113
+ def release_lock(self) -> None: ... # undocumented
114
+ def locked_lock(self) -> bool: ... # undocumented
112
115
 
113
116
  @final
114
117
  class _RLock:
@@ -3,10 +3,8 @@ import sys
3
3
  __all__ = [
4
4
  "AMPER",
5
5
  "AMPEREQUAL",
6
- "ASYNC",
7
6
  "AT",
8
7
  "ATEQUAL",
9
- "AWAIT",
10
8
  "CIRCUMFLEX",
11
9
  "CIRCUMFLEXEQUAL",
12
10
  "COLON",
@@ -71,6 +69,8 @@ __all__ = [
71
69
  "NL",
72
70
  "COMMENT",
73
71
  ]
72
+ if sys.version_info < (3, 13):
73
+ __all__ += ["ASYNC", "AWAIT"]
74
74
 
75
75
  if sys.version_info >= (3, 10):
76
76
  __all__ += ["SOFT_KEYWORD"]
@@ -131,8 +131,9 @@ AT: int
131
131
  RARROW: int
132
132
  ELLIPSIS: int
133
133
  ATEQUAL: int
134
- AWAIT: int
135
- ASYNC: int
134
+ if sys.version_info < (3, 13):
135
+ AWAIT: int
136
+ ASYNC: int
136
137
  OP: int
137
138
  ERRORTOKEN: int
138
139
  N_TOKENS: int
@@ -10,10 +10,8 @@ from typing_extensions import TypeAlias
10
10
  __all__ = [
11
11
  "AMPER",
12
12
  "AMPEREQUAL",
13
- "ASYNC",
14
13
  "AT",
15
14
  "ATEQUAL",
16
- "AWAIT",
17
15
  "CIRCUMFLEX",
18
16
  "CIRCUMFLEXEQUAL",
19
17
  "COLON",
@@ -83,6 +81,8 @@ __all__ = [
83
81
  "tokenize",
84
82
  "untokenize",
85
83
  ]
84
+ if sys.version_info < (3, 13):
85
+ __all__ += ["ASYNC", "AWAIT"]
86
86
 
87
87
  if sys.version_info >= (3, 10):
88
88
  __all__ += ["SOFT_KEYWORD"]
@@ -90,6 +90,9 @@ if sys.version_info >= (3, 10):
90
90
  if sys.version_info >= (3, 12):
91
91
  __all__ += ["EXCLAMATION", "FSTRING_END", "FSTRING_MIDDLE", "FSTRING_START"]
92
92
 
93
+ if sys.version_info >= (3, 13):
94
+ __all__ += ["TokenError", "open"]
95
+
93
96
  cookie_re: Pattern[str]
94
97
  blank_re: Pattern[bytes]
95
98
 
@@ -110,7 +113,9 @@ class TokenInfo(_TokenInfo):
110
113
  _Token: TypeAlias = TokenInfo | Sequence[int | str | _Position]
111
114
 
112
115
  class TokenError(Exception): ...
113
- class StopTokenizing(Exception): ... # undocumented
116
+
117
+ if sys.version_info < (3, 13):
118
+ class StopTokenizing(Exception): ... # undocumented
114
119
 
115
120
  class Untokenizer:
116
121
  tokens: list[str]
@@ -120,6 +125,8 @@ class Untokenizer:
120
125
  def add_whitespace(self, start: _Position) -> None: ...
121
126
  def untokenize(self, iterable: Iterable[_Token]) -> str: ...
122
127
  def compat(self, token: Sequence[int | str], iterable: Iterable[_Token]) -> None: ...
128
+ if sys.version_info >= (3, 13):
129
+ def escape_brackets(self, token: str) -> str: ...
123
130
 
124
131
  # the docstring says "returns bytes" but is incorrect --
125
132
  # if the ENCODING token is missing, it skips the encode
@@ -1,5 +1,6 @@
1
1
  import sys
2
2
  from _typeshed import SupportsKeysAndGetItem
3
+ from _typeshed.importlib import LoaderProtocol
3
4
  from collections.abc import (
4
5
  AsyncGenerator,
5
6
  Awaitable,
@@ -16,7 +17,7 @@ from collections.abc import (
16
17
  from importlib.machinery import ModuleSpec
17
18
 
18
19
  # pytype crashes if types.MappingProxyType inherits from collections.abc.Mapping instead of typing.Mapping
19
- from typing import Any, ClassVar, Literal, Mapping, Protocol, TypeVar, final, overload # noqa: Y022
20
+ from typing import Any, ClassVar, Literal, Mapping, TypeVar, final, overload # noqa: Y022
20
21
  from typing_extensions import ParamSpec, Self, TypeVarTuple, deprecated
21
22
 
22
23
  __all__ = [
@@ -57,6 +58,9 @@ if sys.version_info >= (3, 10):
57
58
  if sys.version_info >= (3, 12):
58
59
  __all__ += ["get_original_bases"]
59
60
 
61
+ if sys.version_info >= (3, 13):
62
+ __all__ += ["CapsuleType"]
63
+
60
64
  # Note, all classes "defined" here require special handling.
61
65
 
62
66
  _T1 = TypeVar("_T1")
@@ -64,18 +68,11 @@ _T2 = TypeVar("_T2")
64
68
  _KT = TypeVar("_KT")
65
69
  _VT_co = TypeVar("_VT_co", covariant=True)
66
70
 
67
- @final
68
- class _Cell:
69
- def __new__(cls, contents: object = ..., /) -> Self: ...
70
- def __eq__(self, value: object, /) -> bool: ...
71
- __hash__: ClassVar[None] # type: ignore[assignment]
72
- cell_contents: Any
73
-
74
71
  # Make sure this class definition stays roughly in line with `builtins.function`
75
72
  @final
76
73
  class FunctionType:
77
74
  @property
78
- def __closure__(self) -> tuple[_Cell, ...] | None: ...
75
+ def __closure__(self) -> tuple[CellType, ...] | None: ...
79
76
  __code__: CodeType
80
77
  __defaults__: tuple[Any, ...] | None
81
78
  __dict__: dict[str, Any]
@@ -98,7 +95,7 @@ class FunctionType:
98
95
  globals: dict[str, Any],
99
96
  name: str | None = ...,
100
97
  argdefs: tuple[object, ...] | None = ...,
101
- closure: tuple[_Cell, ...] | None = ...,
98
+ closure: tuple[CellType, ...] | None = ...,
102
99
  ) -> Self: ...
103
100
  def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
104
101
  @overload
@@ -305,7 +302,7 @@ class MappingProxyType(Mapping[_KT, _VT_co]):
305
302
  def values(self) -> ValuesView[_VT_co]: ...
306
303
  def items(self) -> ItemsView[_KT, _VT_co]: ...
307
304
  if sys.version_info >= (3, 9):
308
- def __class_getitem__(cls, item: Any) -> GenericAlias: ...
305
+ def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
309
306
  def __reversed__(self) -> Iterator[_KT]: ...
310
307
  def __or__(self, value: Mapping[_T1, _T2], /) -> dict[_KT | _T1, _VT_co | _T2]: ...
311
308
  def __ror__(self, value: Mapping[_T1, _T2], /) -> dict[_KT | _T1, _VT_co | _T2]: ...
@@ -318,15 +315,12 @@ class SimpleNamespace:
318
315
  def __setattr__(self, name: str, value: Any, /) -> None: ...
319
316
  def __delattr__(self, name: str, /) -> None: ...
320
317
 
321
- class _LoaderProtocol(Protocol):
322
- def load_module(self, fullname: str, /) -> ModuleType: ...
323
-
324
318
  class ModuleType:
325
319
  __name__: str
326
320
  __file__: str | None
327
321
  @property
328
322
  def __dict__(self) -> dict[str, Any]: ... # type: ignore[override]
329
- __loader__: _LoaderProtocol | None
323
+ __loader__: LoaderProtocol | None
330
324
  __package__: str | None
331
325
  __path__: MutableSequence[str]
332
326
  __spec__: ModuleSpec | None
@@ -336,6 +330,12 @@ class ModuleType:
336
330
  # using `builtins.__import__` or `importlib.import_module` less painful
337
331
  def __getattr__(self, name: str) -> Any: ...
338
332
 
333
+ @final
334
+ class CellType:
335
+ def __new__(cls, contents: object = ..., /) -> Self: ...
336
+ __hash__: ClassVar[None] # type: ignore[assignment]
337
+ cell_contents: Any
338
+
339
339
  _YieldT_co = TypeVar("_YieldT_co", covariant=True)
340
340
  _SendT_contra = TypeVar("_SendT_contra", contravariant=True)
341
341
  _ReturnT_co = TypeVar("_ReturnT_co", covariant=True)
@@ -405,7 +405,7 @@ class CoroutineType(Coroutine[_YieldT_co, _SendT_contra, _ReturnT_co]):
405
405
  @final
406
406
  class MethodType:
407
407
  @property
408
- def __closure__(self) -> tuple[_Cell, ...] | None: ... # inherited from the added function
408
+ def __closure__(self) -> tuple[CellType, ...] | None: ... # inherited from the added function
409
409
  @property
410
410
  def __defaults__(self) -> tuple[Any, ...] | None: ... # inherited from the added function
411
411
  @property
@@ -570,8 +570,6 @@ def coroutine(func: Callable[_P, Generator[Any, Any, _R]]) -> Callable[_P, Await
570
570
  @overload
571
571
  def coroutine(func: _Fn) -> _Fn: ...
572
572
 
573
- CellType = _Cell
574
-
575
573
  if sys.version_info >= (3, 9):
576
574
  class GenericAlias:
577
575
  @property
@@ -612,3 +610,7 @@ if sys.version_info >= (3, 10):
612
610
  def __ror__(self, value: Any, /) -> UnionType: ...
613
611
  def __eq__(self, value: object, /) -> bool: ...
614
612
  def __hash__(self) -> int: ...
613
+
614
+ if sys.version_info >= (3, 13):
615
+ @final
616
+ class CapsuleType: ...
@@ -8,7 +8,6 @@ import typing_extensions
8
8
  from _collections_abc import dict_items, dict_keys, dict_values
9
9
  from _typeshed import IdentityFunction, ReadableBuffer, SupportsKeysAndGetItem
10
10
  from abc import ABCMeta, abstractmethod
11
- from contextlib import AbstractAsyncContextManager, AbstractContextManager
12
11
  from re import Match as Match, Pattern as Pattern
13
12
  from types import (
14
13
  BuiltinFunctionType,
@@ -24,10 +23,10 @@ from types import (
24
23
  )
25
24
  from typing_extensions import Never as _Never, ParamSpec as _ParamSpec
26
25
 
27
- if sys.version_info >= (3, 10):
28
- from types import UnionType
29
26
  if sys.version_info >= (3, 9):
30
27
  from types import GenericAlias
28
+ if sys.version_info >= (3, 10):
29
+ from types import UnionType
31
30
 
32
31
  __all__ = [
33
32
  "AbstractSet",
@@ -129,6 +128,9 @@ if sys.version_info >= (3, 11):
129
128
  if sys.version_info >= (3, 12):
130
129
  __all__ += ["TypeAliasType", "override"]
131
130
 
131
+ if sys.version_info >= (3, 13):
132
+ __all__ += ["get_protocol_members", "is_protocol", "NoDefault"]
133
+
132
134
  Any = object()
133
135
 
134
136
  def final(f: _T) -> _T: ...
@@ -147,6 +149,21 @@ class TypeVar:
147
149
  if sys.version_info >= (3, 12):
148
150
  @property
149
151
  def __infer_variance__(self) -> bool: ...
152
+ if sys.version_info >= (3, 13):
153
+ @property
154
+ def __default__(self) -> Any: ...
155
+ if sys.version_info >= (3, 13):
156
+ def __init__(
157
+ self,
158
+ name: str,
159
+ *constraints: Any,
160
+ bound: Any | None = None,
161
+ contravariant: bool = False,
162
+ covariant: bool = False,
163
+ infer_variance: bool = False,
164
+ default: Any = ...,
165
+ ) -> None: ...
166
+ elif sys.version_info >= (3, 12):
150
167
  def __init__(
151
168
  self,
152
169
  name: str,
@@ -165,6 +182,8 @@ class TypeVar:
165
182
  def __ror__(self, left: Any) -> _SpecialForm: ...
166
183
  if sys.version_info >= (3, 11):
167
184
  def __typing_subst__(self, arg: Any) -> Any: ...
185
+ if sys.version_info >= (3, 13):
186
+ def has_default(self) -> bool: ...
168
187
 
169
188
  # Used for an undocumented mypy feature. Does not exist at runtime.
170
189
  _promote = object()
@@ -206,7 +225,15 @@ if sys.version_info >= (3, 11):
206
225
  class TypeVarTuple:
207
226
  @property
208
227
  def __name__(self) -> str: ...
209
- def __init__(self, name: str) -> None: ...
228
+ if sys.version_info >= (3, 13):
229
+ @property
230
+ def __default__(self) -> Any: ...
231
+ def has_default(self) -> bool: ...
232
+ if sys.version_info >= (3, 13):
233
+ def __init__(self, name: str, *, default: Any = ...) -> None: ...
234
+ else:
235
+ def __init__(self, name: str) -> None: ...
236
+
210
237
  def __iter__(self) -> Any: ...
211
238
  def __typing_subst__(self, arg: Never) -> Never: ...
212
239
  def __typing_prepare_subst__(self, alias: Any, args: Any) -> tuple[Any, ...]: ...
@@ -239,6 +266,21 @@ if sys.version_info >= (3, 10):
239
266
  if sys.version_info >= (3, 12):
240
267
  @property
241
268
  def __infer_variance__(self) -> bool: ...
269
+ if sys.version_info >= (3, 13):
270
+ @property
271
+ def __default__(self) -> Any: ...
272
+ if sys.version_info >= (3, 13):
273
+ def __init__(
274
+ self,
275
+ name: str,
276
+ *,
277
+ bound: Any | None = None,
278
+ contravariant: bool = False,
279
+ covariant: bool = False,
280
+ infer_variance: bool = False,
281
+ default: Any = ...,
282
+ ) -> None: ...
283
+ elif sys.version_info >= (3, 12):
242
284
  def __init__(
243
285
  self,
244
286
  name: str,
@@ -263,6 +305,8 @@ if sys.version_info >= (3, 10):
263
305
 
264
306
  def __or__(self, right: Any) -> _SpecialForm: ...
265
307
  def __ror__(self, left: Any) -> _SpecialForm: ...
308
+ if sys.version_info >= (3, 13):
309
+ def has_default(self) -> bool: ...
266
310
 
267
311
  Concatenate: _SpecialForm
268
312
  TypeAlias: _SpecialForm
@@ -402,8 +446,8 @@ class Reversible(Iterable[_T_co], Protocol[_T_co]):
402
446
  def __reversed__(self) -> Iterator[_T_co]: ...
403
447
 
404
448
  _YieldT_co = TypeVar("_YieldT_co", covariant=True)
405
- _SendT_contra = TypeVar("_SendT_contra", contravariant=True)
406
- _ReturnT_co = TypeVar("_ReturnT_co", covariant=True)
449
+ _SendT_contra = TypeVar("_SendT_contra", contravariant=True, default=None)
450
+ _ReturnT_co = TypeVar("_ReturnT_co", covariant=True, default=None)
407
451
 
408
452
  class Generator(Iterator[_YieldT_co], Generic[_YieldT_co, _SendT_contra, _ReturnT_co]):
409
453
  def __next__(self) -> _YieldT_co: ...
@@ -428,24 +472,28 @@ class Generator(Iterator[_YieldT_co], Generic[_YieldT_co, _SendT_contra, _Return
428
472
  @property
429
473
  def gi_yieldfrom(self) -> Generator[Any, Any, Any] | None: ...
430
474
 
431
- # NOTE: Technically we would like this to be able to accept a second parameter as well, just
432
- # like it's counterpart in contextlib, however `typing._SpecialGenericAlias` enforces the
433
- # correct number of arguments at runtime, so we would be hiding runtime errors.
434
- @runtime_checkable
435
- class ContextManager(AbstractContextManager[_T_co, bool | None], Protocol[_T_co]): ...
475
+ # NOTE: Prior to Python 3.13 these aliases are lacking the second _ExitT_co parameter
476
+ if sys.version_info >= (3, 13):
477
+ from contextlib import AbstractAsyncContextManager as AsyncContextManager, AbstractContextManager as ContextManager
478
+ else:
479
+ from contextlib import AbstractAsyncContextManager, AbstractContextManager
436
480
 
437
- # NOTE: Technically we would like this to be able to accept a second parameter as well, just
438
- # like it's counterpart in contextlib, however `typing._SpecialGenericAlias` enforces the
439
- # correct number of arguments at runtime, so we would be hiding runtime errors.
440
- @runtime_checkable
441
- class AsyncContextManager(AbstractAsyncContextManager[_T_co, bool | None], Protocol[_T_co]): ...
481
+ @runtime_checkable
482
+ class ContextManager(AbstractContextManager[_T_co, bool | None], Protocol[_T_co]): ...
483
+
484
+ @runtime_checkable
485
+ class AsyncContextManager(AbstractAsyncContextManager[_T_co, bool | None], Protocol[_T_co]): ...
442
486
 
443
487
  @runtime_checkable
444
488
  class Awaitable(Protocol[_T_co]):
445
489
  @abstractmethod
446
490
  def __await__(self) -> Generator[Any, Any, _T_co]: ...
447
491
 
448
- class Coroutine(Awaitable[_ReturnT_co], Generic[_YieldT_co, _SendT_contra, _ReturnT_co]):
492
+ # Non-default variations to accommodate couroutines, and `AwaitableGenerator` having a 4th type parameter.
493
+ _SendT_contra_nd = TypeVar("_SendT_contra_nd", contravariant=True)
494
+ _ReturnT_co_nd = TypeVar("_ReturnT_co_nd", covariant=True)
495
+
496
+ class Coroutine(Awaitable[_ReturnT_co_nd], Generic[_YieldT_co, _SendT_contra_nd, _ReturnT_co_nd]):
449
497
  __name__: str
450
498
  __qualname__: str
451
499
  @property
@@ -457,7 +505,7 @@ class Coroutine(Awaitable[_ReturnT_co], Generic[_YieldT_co, _SendT_contra, _Retu
457
505
  @property
458
506
  def cr_running(self) -> bool: ...
459
507
  @abstractmethod
460
- def send(self, value: _SendT_contra, /) -> _YieldT_co: ...
508
+ def send(self, value: _SendT_contra_nd, /) -> _YieldT_co: ...
461
509
  @overload
462
510
  @abstractmethod
463
511
  def throw(
@@ -473,9 +521,9 @@ class Coroutine(Awaitable[_ReturnT_co], Generic[_YieldT_co, _SendT_contra, _Retu
473
521
  # The parameters correspond to Generator, but the 4th is the original type.
474
522
  @type_check_only
475
523
  class AwaitableGenerator(
476
- Awaitable[_ReturnT_co],
477
- Generator[_YieldT_co, _SendT_contra, _ReturnT_co],
478
- Generic[_YieldT_co, _SendT_contra, _ReturnT_co, _S],
524
+ Awaitable[_ReturnT_co_nd],
525
+ Generator[_YieldT_co, _SendT_contra_nd, _ReturnT_co_nd],
526
+ Generic[_YieldT_co, _SendT_contra_nd, _ReturnT_co_nd, _S],
479
527
  metaclass=ABCMeta,
480
528
  ): ...
481
529
 
@@ -887,6 +935,8 @@ class NamedTuple(tuple[Any, ...]):
887
935
  def _make(cls, iterable: Iterable[Any]) -> typing_extensions.Self: ...
888
936
  def _asdict(self) -> dict[str, Any]: ...
889
937
  def _replace(self, **kwargs: Any) -> typing_extensions.Self: ...
938
+ if sys.version_info >= (3, 13):
939
+ def __replace__(self, **kwargs: Any) -> typing_extensions.Self: ...
890
940
 
891
941
  # Internal mypy fallback type for all typed dicts (does not exist at runtime)
892
942
  # N.B. Keep this mostly in sync with typing_extensions._TypedDict/mypy_extensions._TypedDict
@@ -982,3 +1032,7 @@ if sys.version_info >= (3, 12):
982
1032
  if sys.version_info >= (3, 13):
983
1033
  def is_protocol(tp: type, /) -> bool: ...
984
1034
  def get_protocol_members(tp: type, /) -> frozenset[str]: ...
1035
+ @final
1036
+ class _NoDefaultType: ...
1037
+
1038
+ NoDefault: _NoDefaultType