@debugmcp/codelldb-linux-arm64 0.0.0-stage → 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 (980) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +21 -2
  3. package/adapter/codelldb +0 -0
  4. package/adapter/scripts/codelldb/__init__.py +7 -0
  5. package/adapter/scripts/codelldb/api.py +125 -0
  6. package/adapter/scripts/codelldb/commands/__init__.py +7 -0
  7. package/adapter/scripts/codelldb/commands/debug_info.py +63 -0
  8. package/adapter/scripts/codelldb/commands/nofail.py +8 -0
  9. package/adapter/scripts/codelldb/event.py +19 -0
  10. package/adapter/scripts/codelldb/interface.py +423 -0
  11. package/adapter/scripts/codelldb/value.py +364 -0
  12. package/adapter/scripts/codelldb/webview.py +57 -0
  13. package/adapter/scripts/console.py +23 -0
  14. package/adapter/scripts/debugger.py +1 -0
  15. package/lang_support/__init__.py +23 -0
  16. package/lang_support/rust.py +87 -0
  17. package/lldb/bin/lldb +0 -0
  18. package/lldb/bin/lldb-argdumper +0 -0
  19. package/lldb/bin/lldb-server +0 -0
  20. package/lldb/lib/liblldb.so +4 -0
  21. package/lldb/lib/libpython312.so +0 -0
  22. package/lldb/lib/lldb-python/lldb/__init__.py +19655 -0
  23. package/lldb/lib/lldb-python/lldb/embedded_interpreter.py +97 -0
  24. package/lldb/lib/lldb-python/lldb/formatters/Logger.py +133 -0
  25. package/lldb/lib/lldb-python/lldb/formatters/__init__.py +11 -0
  26. package/lldb/lib/lldb-python/lldb/formatters/attrib_fromdict.py +41 -0
  27. package/lldb/lib/lldb-python/lldb/formatters/cache.py +35 -0
  28. package/lldb/lib/lldb-python/lldb/formatters/cpp/__init__.py +11 -0
  29. package/lldb/lib/lldb-python/lldb/formatters/cpp/gnu_libstdcpp.py +939 -0
  30. package/lldb/lib/lldb-python/lldb/formatters/cpp/libcxx.py +987 -0
  31. package/lldb/lib/lldb-python/lldb/formatters/metrics.py +119 -0
  32. package/lldb/lib/lldb-python/lldb/formatters/synth.py +59 -0
  33. package/lldb/lib/lldb-python/lldb/lldb-argdumper +0 -0
  34. package/lldb/lib/lldb-python/lldb/native/__init__.py +11 -0
  35. package/lldb/lib/lldb-python/lldb/plugins/__init__.py +11 -0
  36. package/lldb/lib/lldb-python/lldb/plugins/operating_system.py +103 -0
  37. package/lldb/lib/lldb-python/lldb/plugins/parsed_cmd.py +463 -0
  38. package/lldb/lib/lldb-python/lldb/plugins/scripted_frame_provider.py +188 -0
  39. package/lldb/lib/lldb-python/lldb/plugins/scripted_platform.py +96 -0
  40. package/lldb/lib/lldb-python/lldb/plugins/scripted_process.py +1475 -0
  41. package/lldb/lib/lldb-python/lldb/plugins/scripted_thread_plan.py +70 -0
  42. package/lldb/lib/lldb-python/lldb/utils/__init__.py +11 -0
  43. package/lldb/lib/lldb-python/lldb/utils/in_call_stack.py +24 -0
  44. package/lldb/lib/lldb-python/lldb/utils/symbolication.py +810 -0
  45. package/lldb/lib/python3.12/__future__.py +147 -0
  46. package/lldb/lib/python3.12/__hello__.py +16 -0
  47. package/lldb/lib/python3.12/__phello__/__init__.py +7 -0
  48. package/lldb/lib/python3.12/__phello__/spam.py +7 -0
  49. package/lldb/lib/python3.12/_aix_support.py +108 -0
  50. package/lldb/lib/python3.12/_collections_abc.py +1173 -0
  51. package/lldb/lib/python3.12/_compat_pickle.py +252 -0
  52. package/lldb/lib/python3.12/_compression.py +162 -0
  53. package/lldb/lib/python3.12/_markupbase.py +396 -0
  54. package/lldb/lib/python3.12/_osx_support.py +579 -0
  55. package/lldb/lib/python3.12/_py_abc.py +147 -0
  56. package/lldb/lib/python3.12/_pydatetime.py +2645 -0
  57. package/lldb/lib/python3.12/_pydecimal.py +6339 -0
  58. package/lldb/lib/python3.12/_pyio.py +2698 -0
  59. package/lldb/lib/python3.12/_pylong.py +329 -0
  60. package/lldb/lib/python3.12/_sitebuiltins.py +103 -0
  61. package/lldb/lib/python3.12/_strptime.py +565 -0
  62. package/lldb/lib/python3.12/_sysconfigdata__linux_aarch64-linux-gnu.py +1230 -0
  63. package/lldb/lib/python3.12/_threading_local.py +242 -0
  64. package/lldb/lib/python3.12/_weakrefset.py +205 -0
  65. package/lldb/lib/python3.12/abc.py +188 -0
  66. package/lldb/lib/python3.12/aifc.py +984 -0
  67. package/lldb/lib/python3.12/antigravity.py +17 -0
  68. package/lldb/lib/python3.12/argparse.py +2672 -0
  69. package/lldb/lib/python3.12/ast.py +1835 -0
  70. package/lldb/lib/python3.12/asyncio/__init__.py +47 -0
  71. package/lldb/lib/python3.12/asyncio/__main__.py +126 -0
  72. package/lldb/lib/python3.12/asyncio/base_events.py +2011 -0
  73. package/lldb/lib/python3.12/asyncio/base_futures.py +67 -0
  74. package/lldb/lib/python3.12/asyncio/base_subprocess.py +285 -0
  75. package/lldb/lib/python3.12/asyncio/base_tasks.py +94 -0
  76. package/lldb/lib/python3.12/asyncio/constants.py +41 -0
  77. package/lldb/lib/python3.12/asyncio/coroutines.py +109 -0
  78. package/lldb/lib/python3.12/asyncio/events.py +868 -0
  79. package/lldb/lib/python3.12/asyncio/exceptions.py +62 -0
  80. package/lldb/lib/python3.12/asyncio/format_helpers.py +76 -0
  81. package/lldb/lib/python3.12/asyncio/futures.py +432 -0
  82. package/lldb/lib/python3.12/asyncio/locks.py +586 -0
  83. package/lldb/lib/python3.12/asyncio/log.py +7 -0
  84. package/lldb/lib/python3.12/asyncio/mixins.py +21 -0
  85. package/lldb/lib/python3.12/asyncio/proactor_events.py +897 -0
  86. package/lldb/lib/python3.12/asyncio/protocols.py +216 -0
  87. package/lldb/lib/python3.12/asyncio/queues.py +244 -0
  88. package/lldb/lib/python3.12/asyncio/runners.py +215 -0
  89. package/lldb/lib/python3.12/asyncio/selector_events.py +1321 -0
  90. package/lldb/lib/python3.12/asyncio/sslproto.py +926 -0
  91. package/lldb/lib/python3.12/asyncio/staggered.py +138 -0
  92. package/lldb/lib/python3.12/asyncio/streams.py +770 -0
  93. package/lldb/lib/python3.12/asyncio/subprocess.py +229 -0
  94. package/lldb/lib/python3.12/asyncio/taskgroups.py +240 -0
  95. package/lldb/lib/python3.12/asyncio/tasks.py +1065 -0
  96. package/lldb/lib/python3.12/asyncio/threads.py +25 -0
  97. package/lldb/lib/python3.12/asyncio/timeouts.py +168 -0
  98. package/lldb/lib/python3.12/asyncio/transports.py +335 -0
  99. package/lldb/lib/python3.12/asyncio/trsock.py +98 -0
  100. package/lldb/lib/python3.12/asyncio/unix_events.py +1500 -0
  101. package/lldb/lib/python3.12/asyncio/windows_events.py +901 -0
  102. package/lldb/lib/python3.12/asyncio/windows_utils.py +173 -0
  103. package/lldb/lib/python3.12/base64.py +586 -0
  104. package/lldb/lib/python3.12/bdb.py +899 -0
  105. package/lldb/lib/python3.12/bisect.py +118 -0
  106. package/lldb/lib/python3.12/bz2.py +344 -0
  107. package/lldb/lib/python3.12/cProfile.py +195 -0
  108. package/lldb/lib/python3.12/calendar.py +798 -0
  109. package/lldb/lib/python3.12/cgi.py +1013 -0
  110. package/lldb/lib/python3.12/cgitb.py +332 -0
  111. package/lldb/lib/python3.12/chunk.py +173 -0
  112. package/lldb/lib/python3.12/cmd.py +401 -0
  113. package/lldb/lib/python3.12/code.py +324 -0
  114. package/lldb/lib/python3.12/codecs.py +1129 -0
  115. package/lldb/lib/python3.12/codeop.py +161 -0
  116. package/lldb/lib/python3.12/collections/__init__.py +1592 -0
  117. package/lldb/lib/python3.12/collections/abc.py +3 -0
  118. package/lldb/lib/python3.12/colorsys.py +166 -0
  119. package/lldb/lib/python3.12/compileall.py +469 -0
  120. package/lldb/lib/python3.12/concurrent/__init__.py +1 -0
  121. package/lldb/lib/python3.12/concurrent/futures/__init__.py +54 -0
  122. package/lldb/lib/python3.12/concurrent/futures/_base.py +654 -0
  123. package/lldb/lib/python3.12/concurrent/futures/process.py +884 -0
  124. package/lldb/lib/python3.12/concurrent/futures/thread.py +239 -0
  125. package/lldb/lib/python3.12/configparser.py +1333 -0
  126. package/lldb/lib/python3.12/contextlib.py +800 -0
  127. package/lldb/lib/python3.12/contextvars.py +4 -0
  128. package/lldb/lib/python3.12/copy.py +292 -0
  129. package/lldb/lib/python3.12/copyreg.py +217 -0
  130. package/lldb/lib/python3.12/crypt.py +124 -0
  131. package/lldb/lib/python3.12/csv.py +451 -0
  132. package/lldb/lib/python3.12/ctypes/__init__.py +582 -0
  133. package/lldb/lib/python3.12/ctypes/_aix.py +327 -0
  134. package/lldb/lib/python3.12/ctypes/_endian.py +78 -0
  135. package/lldb/lib/python3.12/ctypes/macholib/__init__.py +9 -0
  136. package/lldb/lib/python3.12/ctypes/macholib/dyld.py +165 -0
  137. package/lldb/lib/python3.12/ctypes/macholib/dylib.py +42 -0
  138. package/lldb/lib/python3.12/ctypes/macholib/framework.py +42 -0
  139. package/lldb/lib/python3.12/ctypes/util.py +379 -0
  140. package/lldb/lib/python3.12/ctypes/wintypes.py +202 -0
  141. package/lldb/lib/python3.12/dataclasses.py +1588 -0
  142. package/lldb/lib/python3.12/datetime.py +9 -0
  143. package/lldb/lib/python3.12/dbm/__init__.py +190 -0
  144. package/lldb/lib/python3.12/dbm/dumb.py +317 -0
  145. package/lldb/lib/python3.12/dbm/gnu.py +3 -0
  146. package/lldb/lib/python3.12/dbm/ndbm.py +3 -0
  147. package/lldb/lib/python3.12/decimal.py +108 -0
  148. package/lldb/lib/python3.12/difflib.py +2056 -0
  149. package/lldb/lib/python3.12/dis.py +805 -0
  150. package/lldb/lib/python3.12/doctest.py +2845 -0
  151. package/lldb/lib/python3.12/email/__init__.py +61 -0
  152. package/lldb/lib/python3.12/email/_encoded_words.py +233 -0
  153. package/lldb/lib/python3.12/email/_header_value_parser.py +3078 -0
  154. package/lldb/lib/python3.12/email/_parseaddr.py +557 -0
  155. package/lldb/lib/python3.12/email/_policybase.py +382 -0
  156. package/lldb/lib/python3.12/email/base64mime.py +115 -0
  157. package/lldb/lib/python3.12/email/charset.py +398 -0
  158. package/lldb/lib/python3.12/email/contentmanager.py +251 -0
  159. package/lldb/lib/python3.12/email/encoders.py +65 -0
  160. package/lldb/lib/python3.12/email/errors.py +117 -0
  161. package/lldb/lib/python3.12/email/feedparser.py +534 -0
  162. package/lldb/lib/python3.12/email/generator.py +520 -0
  163. package/lldb/lib/python3.12/email/header.py +573 -0
  164. package/lldb/lib/python3.12/email/headerregistry.py +604 -0
  165. package/lldb/lib/python3.12/email/iterators.py +68 -0
  166. package/lldb/lib/python3.12/email/message.py +1205 -0
  167. package/lldb/lib/python3.12/email/mime/__init__.py +0 -0
  168. package/lldb/lib/python3.12/email/mime/application.py +37 -0
  169. package/lldb/lib/python3.12/email/mime/audio.py +100 -0
  170. package/lldb/lib/python3.12/email/mime/base.py +29 -0
  171. package/lldb/lib/python3.12/email/mime/image.py +152 -0
  172. package/lldb/lib/python3.12/email/mime/message.py +33 -0
  173. package/lldb/lib/python3.12/email/mime/multipart.py +47 -0
  174. package/lldb/lib/python3.12/email/mime/nonmultipart.py +21 -0
  175. package/lldb/lib/python3.12/email/mime/text.py +40 -0
  176. package/lldb/lib/python3.12/email/parser.py +127 -0
  177. package/lldb/lib/python3.12/email/policy.py +232 -0
  178. package/lldb/lib/python3.12/email/quoprimime.py +300 -0
  179. package/lldb/lib/python3.12/email/utils.py +486 -0
  180. package/lldb/lib/python3.12/encodings/__init__.py +174 -0
  181. package/lldb/lib/python3.12/encodings/aliases.py +551 -0
  182. package/lldb/lib/python3.12/encodings/ascii.py +50 -0
  183. package/lldb/lib/python3.12/encodings/base64_codec.py +55 -0
  184. package/lldb/lib/python3.12/encodings/big5.py +39 -0
  185. package/lldb/lib/python3.12/encodings/big5hkscs.py +39 -0
  186. package/lldb/lib/python3.12/encodings/bz2_codec.py +78 -0
  187. package/lldb/lib/python3.12/encodings/charmap.py +69 -0
  188. package/lldb/lib/python3.12/encodings/cp037.py +307 -0
  189. package/lldb/lib/python3.12/encodings/cp1006.py +307 -0
  190. package/lldb/lib/python3.12/encodings/cp1026.py +307 -0
  191. package/lldb/lib/python3.12/encodings/cp1125.py +698 -0
  192. package/lldb/lib/python3.12/encodings/cp1140.py +307 -0
  193. package/lldb/lib/python3.12/encodings/cp1250.py +307 -0
  194. package/lldb/lib/python3.12/encodings/cp1251.py +307 -0
  195. package/lldb/lib/python3.12/encodings/cp1252.py +307 -0
  196. package/lldb/lib/python3.12/encodings/cp1253.py +307 -0
  197. package/lldb/lib/python3.12/encodings/cp1254.py +307 -0
  198. package/lldb/lib/python3.12/encodings/cp1255.py +307 -0
  199. package/lldb/lib/python3.12/encodings/cp1256.py +307 -0
  200. package/lldb/lib/python3.12/encodings/cp1257.py +307 -0
  201. package/lldb/lib/python3.12/encodings/cp1258.py +307 -0
  202. package/lldb/lib/python3.12/encodings/cp273.py +307 -0
  203. package/lldb/lib/python3.12/encodings/cp424.py +307 -0
  204. package/lldb/lib/python3.12/encodings/cp437.py +698 -0
  205. package/lldb/lib/python3.12/encodings/cp500.py +307 -0
  206. package/lldb/lib/python3.12/encodings/cp720.py +309 -0
  207. package/lldb/lib/python3.12/encodings/cp737.py +698 -0
  208. package/lldb/lib/python3.12/encodings/cp775.py +697 -0
  209. package/lldb/lib/python3.12/encodings/cp850.py +698 -0
  210. package/lldb/lib/python3.12/encodings/cp852.py +698 -0
  211. package/lldb/lib/python3.12/encodings/cp855.py +698 -0
  212. package/lldb/lib/python3.12/encodings/cp856.py +307 -0
  213. package/lldb/lib/python3.12/encodings/cp857.py +694 -0
  214. package/lldb/lib/python3.12/encodings/cp858.py +698 -0
  215. package/lldb/lib/python3.12/encodings/cp860.py +698 -0
  216. package/lldb/lib/python3.12/encodings/cp861.py +698 -0
  217. package/lldb/lib/python3.12/encodings/cp862.py +698 -0
  218. package/lldb/lib/python3.12/encodings/cp863.py +698 -0
  219. package/lldb/lib/python3.12/encodings/cp864.py +690 -0
  220. package/lldb/lib/python3.12/encodings/cp865.py +698 -0
  221. package/lldb/lib/python3.12/encodings/cp866.py +698 -0
  222. package/lldb/lib/python3.12/encodings/cp869.py +689 -0
  223. package/lldb/lib/python3.12/encodings/cp874.py +307 -0
  224. package/lldb/lib/python3.12/encodings/cp875.py +307 -0
  225. package/lldb/lib/python3.12/encodings/cp932.py +39 -0
  226. package/lldb/lib/python3.12/encodings/cp949.py +39 -0
  227. package/lldb/lib/python3.12/encodings/cp950.py +39 -0
  228. package/lldb/lib/python3.12/encodings/euc_jis_2004.py +39 -0
  229. package/lldb/lib/python3.12/encodings/euc_jisx0213.py +39 -0
  230. package/lldb/lib/python3.12/encodings/euc_jp.py +39 -0
  231. package/lldb/lib/python3.12/encodings/euc_kr.py +39 -0
  232. package/lldb/lib/python3.12/encodings/gb18030.py +39 -0
  233. package/lldb/lib/python3.12/encodings/gb2312.py +39 -0
  234. package/lldb/lib/python3.12/encodings/gbk.py +39 -0
  235. package/lldb/lib/python3.12/encodings/hex_codec.py +55 -0
  236. package/lldb/lib/python3.12/encodings/hp_roman8.py +314 -0
  237. package/lldb/lib/python3.12/encodings/hz.py +39 -0
  238. package/lldb/lib/python3.12/encodings/idna.py +317 -0
  239. package/lldb/lib/python3.12/encodings/iso2022_jp.py +39 -0
  240. package/lldb/lib/python3.12/encodings/iso2022_jp_1.py +39 -0
  241. package/lldb/lib/python3.12/encodings/iso2022_jp_2.py +39 -0
  242. package/lldb/lib/python3.12/encodings/iso2022_jp_2004.py +39 -0
  243. package/lldb/lib/python3.12/encodings/iso2022_jp_3.py +39 -0
  244. package/lldb/lib/python3.12/encodings/iso2022_jp_ext.py +39 -0
  245. package/lldb/lib/python3.12/encodings/iso2022_kr.py +39 -0
  246. package/lldb/lib/python3.12/encodings/iso8859_1.py +307 -0
  247. package/lldb/lib/python3.12/encodings/iso8859_10.py +307 -0
  248. package/lldb/lib/python3.12/encodings/iso8859_11.py +307 -0
  249. package/lldb/lib/python3.12/encodings/iso8859_13.py +307 -0
  250. package/lldb/lib/python3.12/encodings/iso8859_14.py +307 -0
  251. package/lldb/lib/python3.12/encodings/iso8859_15.py +307 -0
  252. package/lldb/lib/python3.12/encodings/iso8859_16.py +307 -0
  253. package/lldb/lib/python3.12/encodings/iso8859_2.py +307 -0
  254. package/lldb/lib/python3.12/encodings/iso8859_3.py +307 -0
  255. package/lldb/lib/python3.12/encodings/iso8859_4.py +307 -0
  256. package/lldb/lib/python3.12/encodings/iso8859_5.py +307 -0
  257. package/lldb/lib/python3.12/encodings/iso8859_6.py +307 -0
  258. package/lldb/lib/python3.12/encodings/iso8859_7.py +307 -0
  259. package/lldb/lib/python3.12/encodings/iso8859_8.py +307 -0
  260. package/lldb/lib/python3.12/encodings/iso8859_9.py +307 -0
  261. package/lldb/lib/python3.12/encodings/johab.py +39 -0
  262. package/lldb/lib/python3.12/encodings/koi8_r.py +307 -0
  263. package/lldb/lib/python3.12/encodings/koi8_t.py +308 -0
  264. package/lldb/lib/python3.12/encodings/koi8_u.py +307 -0
  265. package/lldb/lib/python3.12/encodings/kz1048.py +307 -0
  266. package/lldb/lib/python3.12/encodings/latin_1.py +50 -0
  267. package/lldb/lib/python3.12/encodings/mac_arabic.py +698 -0
  268. package/lldb/lib/python3.12/encodings/mac_croatian.py +307 -0
  269. package/lldb/lib/python3.12/encodings/mac_cyrillic.py +307 -0
  270. package/lldb/lib/python3.12/encodings/mac_farsi.py +307 -0
  271. package/lldb/lib/python3.12/encodings/mac_greek.py +307 -0
  272. package/lldb/lib/python3.12/encodings/mac_iceland.py +307 -0
  273. package/lldb/lib/python3.12/encodings/mac_latin2.py +312 -0
  274. package/lldb/lib/python3.12/encodings/mac_roman.py +307 -0
  275. package/lldb/lib/python3.12/encodings/mac_romanian.py +307 -0
  276. package/lldb/lib/python3.12/encodings/mac_turkish.py +307 -0
  277. package/lldb/lib/python3.12/encodings/mbcs.py +47 -0
  278. package/lldb/lib/python3.12/encodings/oem.py +41 -0
  279. package/lldb/lib/python3.12/encodings/palmos.py +308 -0
  280. package/lldb/lib/python3.12/encodings/ptcp154.py +312 -0
  281. package/lldb/lib/python3.12/encodings/punycode.py +237 -0
  282. package/lldb/lib/python3.12/encodings/quopri_codec.py +56 -0
  283. package/lldb/lib/python3.12/encodings/raw_unicode_escape.py +46 -0
  284. package/lldb/lib/python3.12/encodings/rot_13.py +113 -0
  285. package/lldb/lib/python3.12/encodings/shift_jis.py +39 -0
  286. package/lldb/lib/python3.12/encodings/shift_jis_2004.py +39 -0
  287. package/lldb/lib/python3.12/encodings/shift_jisx0213.py +39 -0
  288. package/lldb/lib/python3.12/encodings/tis_620.py +307 -0
  289. package/lldb/lib/python3.12/encodings/undefined.py +49 -0
  290. package/lldb/lib/python3.12/encodings/unicode_escape.py +46 -0
  291. package/lldb/lib/python3.12/encodings/utf_16.py +155 -0
  292. package/lldb/lib/python3.12/encodings/utf_16_be.py +42 -0
  293. package/lldb/lib/python3.12/encodings/utf_16_le.py +42 -0
  294. package/lldb/lib/python3.12/encodings/utf_32.py +150 -0
  295. package/lldb/lib/python3.12/encodings/utf_32_be.py +37 -0
  296. package/lldb/lib/python3.12/encodings/utf_32_le.py +37 -0
  297. package/lldb/lib/python3.12/encodings/utf_7.py +38 -0
  298. package/lldb/lib/python3.12/encodings/utf_8.py +42 -0
  299. package/lldb/lib/python3.12/encodings/utf_8_sig.py +130 -0
  300. package/lldb/lib/python3.12/encodings/uu_codec.py +103 -0
  301. package/lldb/lib/python3.12/encodings/zlib_codec.py +77 -0
  302. package/lldb/lib/python3.12/ensurepip/__init__.py +291 -0
  303. package/lldb/lib/python3.12/ensurepip/__main__.py +5 -0
  304. package/lldb/lib/python3.12/ensurepip/_uninstall.py +31 -0
  305. package/lldb/lib/python3.12/enum.py +2109 -0
  306. package/lldb/lib/python3.12/filecmp.py +315 -0
  307. package/lldb/lib/python3.12/fileinput.py +442 -0
  308. package/lldb/lib/python3.12/fnmatch.py +185 -0
  309. package/lldb/lib/python3.12/fractions.py +990 -0
  310. package/lldb/lib/python3.12/ftplib.py +966 -0
  311. package/lldb/lib/python3.12/functools.py +1004 -0
  312. package/lldb/lib/python3.12/genericpath.py +167 -0
  313. package/lldb/lib/python3.12/getopt.py +215 -0
  314. package/lldb/lib/python3.12/getpass.py +185 -0
  315. package/lldb/lib/python3.12/gettext.py +646 -0
  316. package/lldb/lib/python3.12/glob.py +252 -0
  317. package/lldb/lib/python3.12/graphlib.py +250 -0
  318. package/lldb/lib/python3.12/gzip.py +694 -0
  319. package/lldb/lib/python3.12/hashlib.py +253 -0
  320. package/lldb/lib/python3.12/heapq.py +603 -0
  321. package/lldb/lib/python3.12/hmac.py +219 -0
  322. package/lldb/lib/python3.12/html/__init__.py +132 -0
  323. package/lldb/lib/python3.12/html/entities.py +2513 -0
  324. package/lldb/lib/python3.12/html/parser.py +456 -0
  325. package/lldb/lib/python3.12/http/__init__.py +200 -0
  326. package/lldb/lib/python3.12/http/client.py +1548 -0
  327. package/lldb/lib/python3.12/http/cookiejar.py +2121 -0
  328. package/lldb/lib/python3.12/http/cookies.py +594 -0
  329. package/lldb/lib/python3.12/http/server.py +1320 -0
  330. package/lldb/lib/python3.12/imaplib.py +1632 -0
  331. package/lldb/lib/python3.12/imghdr.py +180 -0
  332. package/lldb/lib/python3.12/importlib/__init__.py +138 -0
  333. package/lldb/lib/python3.12/importlib/_abc.py +39 -0
  334. package/lldb/lib/python3.12/importlib/_bootstrap.py +1551 -0
  335. package/lldb/lib/python3.12/importlib/_bootstrap_external.py +1745 -0
  336. package/lldb/lib/python3.12/importlib/abc.py +239 -0
  337. package/lldb/lib/python3.12/importlib/machinery.py +20 -0
  338. package/lldb/lib/python3.12/importlib/metadata/__init__.py +966 -0
  339. package/lldb/lib/python3.12/importlib/metadata/_adapters.py +89 -0
  340. package/lldb/lib/python3.12/importlib/metadata/_collections.py +30 -0
  341. package/lldb/lib/python3.12/importlib/metadata/_functools.py +104 -0
  342. package/lldb/lib/python3.12/importlib/metadata/_itertools.py +73 -0
  343. package/lldb/lib/python3.12/importlib/metadata/_meta.py +63 -0
  344. package/lldb/lib/python3.12/importlib/metadata/_text.py +99 -0
  345. package/lldb/lib/python3.12/importlib/readers.py +12 -0
  346. package/lldb/lib/python3.12/importlib/resources/__init__.py +36 -0
  347. package/lldb/lib/python3.12/importlib/resources/_adapters.py +168 -0
  348. package/lldb/lib/python3.12/importlib/resources/_common.py +207 -0
  349. package/lldb/lib/python3.12/importlib/resources/_itertools.py +38 -0
  350. package/lldb/lib/python3.12/importlib/resources/_legacy.py +120 -0
  351. package/lldb/lib/python3.12/importlib/resources/abc.py +173 -0
  352. package/lldb/lib/python3.12/importlib/resources/readers.py +146 -0
  353. package/lldb/lib/python3.12/importlib/resources/simple.py +106 -0
  354. package/lldb/lib/python3.12/importlib/simple.py +14 -0
  355. package/lldb/lib/python3.12/importlib/util.py +270 -0
  356. package/lldb/lib/python3.12/inspect.py +3426 -0
  357. package/lldb/lib/python3.12/io.py +99 -0
  358. package/lldb/lib/python3.12/ipaddress.py +2380 -0
  359. package/lldb/lib/python3.12/json/__init__.py +359 -0
  360. package/lldb/lib/python3.12/json/decoder.py +356 -0
  361. package/lldb/lib/python3.12/json/encoder.py +443 -0
  362. package/lldb/lib/python3.12/json/scanner.py +73 -0
  363. package/lldb/lib/python3.12/json/tool.py +85 -0
  364. package/lldb/lib/python3.12/keyword.py +64 -0
  365. package/lldb/lib/python3.12/linecache.py +182 -0
  366. package/lldb/lib/python3.12/locale.py +1779 -0
  367. package/lldb/lib/python3.12/logging/__init__.py +2345 -0
  368. package/lldb/lib/python3.12/logging/config.py +1078 -0
  369. package/lldb/lib/python3.12/logging/handlers.py +1608 -0
  370. package/lldb/lib/python3.12/lzma.py +356 -0
  371. package/lldb/lib/python3.12/mailbox.py +2153 -0
  372. package/lldb/lib/python3.12/mailcap.py +302 -0
  373. package/lldb/lib/python3.12/mimetypes.py +653 -0
  374. package/lldb/lib/python3.12/modulefinder.py +666 -0
  375. package/lldb/lib/python3.12/multiprocessing/__init__.py +37 -0
  376. package/lldb/lib/python3.12/multiprocessing/connection.py +1178 -0
  377. package/lldb/lib/python3.12/multiprocessing/context.py +377 -0
  378. package/lldb/lib/python3.12/multiprocessing/dummy/__init__.py +126 -0
  379. package/lldb/lib/python3.12/multiprocessing/dummy/connection.py +75 -0
  380. package/lldb/lib/python3.12/multiprocessing/forkserver.py +348 -0
  381. package/lldb/lib/python3.12/multiprocessing/heap.py +337 -0
  382. package/lldb/lib/python3.12/multiprocessing/managers.py +1380 -0
  383. package/lldb/lib/python3.12/multiprocessing/pool.py +957 -0
  384. package/lldb/lib/python3.12/multiprocessing/popen_fork.py +83 -0
  385. package/lldb/lib/python3.12/multiprocessing/popen_forkserver.py +74 -0
  386. package/lldb/lib/python3.12/multiprocessing/popen_spawn_posix.py +72 -0
  387. package/lldb/lib/python3.12/multiprocessing/popen_spawn_win32.py +145 -0
  388. package/lldb/lib/python3.12/multiprocessing/process.py +439 -0
  389. package/lldb/lib/python3.12/multiprocessing/queues.py +401 -0
  390. package/lldb/lib/python3.12/multiprocessing/reduction.py +281 -0
  391. package/lldb/lib/python3.12/multiprocessing/resource_sharer.py +154 -0
  392. package/lldb/lib/python3.12/multiprocessing/resource_tracker.py +269 -0
  393. package/lldb/lib/python3.12/multiprocessing/shared_memory.py +534 -0
  394. package/lldb/lib/python3.12/multiprocessing/sharedctypes.py +240 -0
  395. package/lldb/lib/python3.12/multiprocessing/spawn.py +307 -0
  396. package/lldb/lib/python3.12/multiprocessing/synchronize.py +404 -0
  397. package/lldb/lib/python3.12/multiprocessing/util.py +494 -0
  398. package/lldb/lib/python3.12/netrc.py +192 -0
  399. package/lldb/lib/python3.12/nntplib.py +1093 -0
  400. package/lldb/lib/python3.12/ntpath.py +889 -0
  401. package/lldb/lib/python3.12/nturl2path.py +81 -0
  402. package/lldb/lib/python3.12/numbers.py +418 -0
  403. package/lldb/lib/python3.12/opcode.py +493 -0
  404. package/lldb/lib/python3.12/operator.py +467 -0
  405. package/lldb/lib/python3.12/optparse.py +1681 -0
  406. package/lldb/lib/python3.12/os.py +1159 -0
  407. package/lldb/lib/python3.12/pathlib.py +1435 -0
  408. package/lldb/lib/python3.12/pdb.py +1987 -0
  409. package/lldb/lib/python3.12/pickle.py +1865 -0
  410. package/lldb/lib/python3.12/pickletools.py +2901 -0
  411. package/lldb/lib/python3.12/pipes.py +250 -0
  412. package/lldb/lib/python3.12/pkgutil.py +529 -0
  413. package/lldb/lib/python3.12/platform.py +1358 -0
  414. package/lldb/lib/python3.12/plistlib.py +911 -0
  415. package/lldb/lib/python3.12/poplib.py +467 -0
  416. package/lldb/lib/python3.12/posixpath.py +573 -0
  417. package/lldb/lib/python3.12/pprint.py +658 -0
  418. package/lldb/lib/python3.12/profile.py +615 -0
  419. package/lldb/lib/python3.12/pstats.py +778 -0
  420. package/lldb/lib/python3.12/pty.py +211 -0
  421. package/lldb/lib/python3.12/py_compile.py +212 -0
  422. package/lldb/lib/python3.12/pyclbr.py +314 -0
  423. package/lldb/lib/python3.12/pydoc.py +2941 -0
  424. package/lldb/lib/python3.12/pydoc_data/__init__.py +0 -0
  425. package/lldb/lib/python3.12/pydoc_data/topics.py +16777 -0
  426. package/lldb/lib/python3.12/queue.py +326 -0
  427. package/lldb/lib/python3.12/quopri.py +237 -0
  428. package/lldb/lib/python3.12/random.py +996 -0
  429. package/lldb/lib/python3.12/re/__init__.py +385 -0
  430. package/lldb/lib/python3.12/re/_casefix.py +106 -0
  431. package/lldb/lib/python3.12/re/_compiler.py +765 -0
  432. package/lldb/lib/python3.12/re/_constants.py +220 -0
  433. package/lldb/lib/python3.12/re/_parser.py +1080 -0
  434. package/lldb/lib/python3.12/reprlib.py +193 -0
  435. package/lldb/lib/python3.12/rlcompleter.py +219 -0
  436. package/lldb/lib/python3.12/runpy.py +319 -0
  437. package/lldb/lib/python3.12/sched.py +167 -0
  438. package/lldb/lib/python3.12/secrets.py +71 -0
  439. package/lldb/lib/python3.12/selectors.py +623 -0
  440. package/lldb/lib/python3.12/shelve.py +243 -0
  441. package/lldb/lib/python3.12/shlex.py +345 -0
  442. package/lldb/lib/python3.12/shutil.py +1566 -0
  443. package/lldb/lib/python3.12/signal.py +94 -0
  444. package/lldb/lib/python3.12/site-packages/pip/__init__.py +13 -0
  445. package/lldb/lib/python3.12/site-packages/pip/__main__.py +24 -0
  446. package/lldb/lib/python3.12/site-packages/pip/__pip-runner__.py +50 -0
  447. package/lldb/lib/python3.12/site-packages/pip/_internal/__init__.py +18 -0
  448. package/lldb/lib/python3.12/site-packages/pip/_internal/build_env.py +314 -0
  449. package/lldb/lib/python3.12/site-packages/pip/_internal/cache.py +290 -0
  450. package/lldb/lib/python3.12/site-packages/pip/_internal/cli/__init__.py +4 -0
  451. package/lldb/lib/python3.12/site-packages/pip/_internal/cli/autocompletion.py +176 -0
  452. package/lldb/lib/python3.12/site-packages/pip/_internal/cli/base_command.py +234 -0
  453. package/lldb/lib/python3.12/site-packages/pip/_internal/cli/cmdoptions.py +1074 -0
  454. package/lldb/lib/python3.12/site-packages/pip/_internal/cli/command_context.py +27 -0
  455. package/lldb/lib/python3.12/site-packages/pip/_internal/cli/index_command.py +172 -0
  456. package/lldb/lib/python3.12/site-packages/pip/_internal/cli/main.py +80 -0
  457. package/lldb/lib/python3.12/site-packages/pip/_internal/cli/main_parser.py +134 -0
  458. package/lldb/lib/python3.12/site-packages/pip/_internal/cli/parser.py +294 -0
  459. package/lldb/lib/python3.12/site-packages/pip/_internal/cli/progress_bars.py +94 -0
  460. package/lldb/lib/python3.12/site-packages/pip/_internal/cli/req_command.py +329 -0
  461. package/lldb/lib/python3.12/site-packages/pip/_internal/cli/spinners.py +159 -0
  462. package/lldb/lib/python3.12/site-packages/pip/_internal/cli/status_codes.py +6 -0
  463. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/__init__.py +132 -0
  464. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/cache.py +225 -0
  465. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/check.py +52 -0
  466. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/completion.py +130 -0
  467. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/configuration.py +280 -0
  468. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/debug.py +201 -0
  469. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/download.py +146 -0
  470. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/freeze.py +108 -0
  471. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/hash.py +59 -0
  472. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/help.py +41 -0
  473. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/index.py +139 -0
  474. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/inspect.py +92 -0
  475. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/install.py +777 -0
  476. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/list.py +375 -0
  477. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/search.py +172 -0
  478. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/show.py +217 -0
  479. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/uninstall.py +114 -0
  480. package/lldb/lib/python3.12/site-packages/pip/_internal/commands/wheel.py +182 -0
  481. package/lldb/lib/python3.12/site-packages/pip/_internal/configuration.py +383 -0
  482. package/lldb/lib/python3.12/site-packages/pip/_internal/distributions/__init__.py +21 -0
  483. package/lldb/lib/python3.12/site-packages/pip/_internal/distributions/base.py +53 -0
  484. package/lldb/lib/python3.12/site-packages/pip/_internal/distributions/installed.py +29 -0
  485. package/lldb/lib/python3.12/site-packages/pip/_internal/distributions/sdist.py +158 -0
  486. package/lldb/lib/python3.12/site-packages/pip/_internal/distributions/wheel.py +42 -0
  487. package/lldb/lib/python3.12/site-packages/pip/_internal/exceptions.py +777 -0
  488. package/lldb/lib/python3.12/site-packages/pip/_internal/index/__init__.py +2 -0
  489. package/lldb/lib/python3.12/site-packages/pip/_internal/index/collector.py +494 -0
  490. package/lldb/lib/python3.12/site-packages/pip/_internal/index/package_finder.py +1021 -0
  491. package/lldb/lib/python3.12/site-packages/pip/_internal/index/sources.py +285 -0
  492. package/lldb/lib/python3.12/site-packages/pip/_internal/locations/__init__.py +456 -0
  493. package/lldb/lib/python3.12/site-packages/pip/_internal/locations/_distutils.py +172 -0
  494. package/lldb/lib/python3.12/site-packages/pip/_internal/locations/_sysconfig.py +214 -0
  495. package/lldb/lib/python3.12/site-packages/pip/_internal/locations/base.py +81 -0
  496. package/lldb/lib/python3.12/site-packages/pip/_internal/main.py +12 -0
  497. package/lldb/lib/python3.12/site-packages/pip/_internal/metadata/__init__.py +128 -0
  498. package/lldb/lib/python3.12/site-packages/pip/_internal/metadata/_json.py +84 -0
  499. package/lldb/lib/python3.12/site-packages/pip/_internal/metadata/base.py +688 -0
  500. package/lldb/lib/python3.12/site-packages/pip/_internal/metadata/importlib/__init__.py +6 -0
  501. package/lldb/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_compat.py +55 -0
  502. package/lldb/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_dists.py +228 -0
  503. package/lldb/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py +189 -0
  504. package/lldb/lib/python3.12/site-packages/pip/_internal/metadata/pkg_resources.py +301 -0
  505. package/lldb/lib/python3.12/site-packages/pip/_internal/models/__init__.py +2 -0
  506. package/lldb/lib/python3.12/site-packages/pip/_internal/models/candidate.py +25 -0
  507. package/lldb/lib/python3.12/site-packages/pip/_internal/models/direct_url.py +224 -0
  508. package/lldb/lib/python3.12/site-packages/pip/_internal/models/format_control.py +78 -0
  509. package/lldb/lib/python3.12/site-packages/pip/_internal/models/index.py +28 -0
  510. package/lldb/lib/python3.12/site-packages/pip/_internal/models/installation_report.py +56 -0
  511. package/lldb/lib/python3.12/site-packages/pip/_internal/models/link.py +590 -0
  512. package/lldb/lib/python3.12/site-packages/pip/_internal/models/scheme.py +25 -0
  513. package/lldb/lib/python3.12/site-packages/pip/_internal/models/search_scope.py +127 -0
  514. package/lldb/lib/python3.12/site-packages/pip/_internal/models/selection_prefs.py +53 -0
  515. package/lldb/lib/python3.12/site-packages/pip/_internal/models/target_python.py +121 -0
  516. package/lldb/lib/python3.12/site-packages/pip/_internal/models/wheel.py +93 -0
  517. package/lldb/lib/python3.12/site-packages/pip/_internal/network/__init__.py +2 -0
  518. package/lldb/lib/python3.12/site-packages/pip/_internal/network/auth.py +562 -0
  519. package/lldb/lib/python3.12/site-packages/pip/_internal/network/cache.py +106 -0
  520. package/lldb/lib/python3.12/site-packages/pip/_internal/network/download.py +187 -0
  521. package/lldb/lib/python3.12/site-packages/pip/_internal/network/lazy_wheel.py +210 -0
  522. package/lldb/lib/python3.12/site-packages/pip/_internal/network/session.py +522 -0
  523. package/lldb/lib/python3.12/site-packages/pip/_internal/network/utils.py +96 -0
  524. package/lldb/lib/python3.12/site-packages/pip/_internal/network/xmlrpc.py +62 -0
  525. package/lldb/lib/python3.12/site-packages/pip/_internal/operations/__init__.py +0 -0
  526. package/lldb/lib/python3.12/site-packages/pip/_internal/operations/build/__init__.py +0 -0
  527. package/lldb/lib/python3.12/site-packages/pip/_internal/operations/build/build_tracker.py +138 -0
  528. package/lldb/lib/python3.12/site-packages/pip/_internal/operations/build/metadata.py +39 -0
  529. package/lldb/lib/python3.12/site-packages/pip/_internal/operations/build/metadata_editable.py +41 -0
  530. package/lldb/lib/python3.12/site-packages/pip/_internal/operations/build/metadata_legacy.py +74 -0
  531. package/lldb/lib/python3.12/site-packages/pip/_internal/operations/build/wheel.py +37 -0
  532. package/lldb/lib/python3.12/site-packages/pip/_internal/operations/build/wheel_editable.py +46 -0
  533. package/lldb/lib/python3.12/site-packages/pip/_internal/operations/build/wheel_legacy.py +102 -0
  534. package/lldb/lib/python3.12/site-packages/pip/_internal/operations/check.py +149 -0
  535. package/lldb/lib/python3.12/site-packages/pip/_internal/operations/freeze.py +258 -0
  536. package/lldb/lib/python3.12/site-packages/pip/_internal/operations/install/__init__.py +2 -0
  537. package/lldb/lib/python3.12/site-packages/pip/_internal/operations/install/editable_legacy.py +47 -0
  538. package/lldb/lib/python3.12/site-packages/pip/_internal/operations/install/wheel.py +735 -0
  539. package/lldb/lib/python3.12/site-packages/pip/_internal/operations/prepare.py +732 -0
  540. package/lldb/lib/python3.12/site-packages/pip/_internal/pyproject.py +179 -0
  541. package/lldb/lib/python3.12/site-packages/pip/_internal/req/__init__.py +90 -0
  542. package/lldb/lib/python3.12/site-packages/pip/_internal/req/constructors.py +560 -0
  543. package/lldb/lib/python3.12/site-packages/pip/_internal/req/req_file.py +551 -0
  544. package/lldb/lib/python3.12/site-packages/pip/_internal/req/req_install.py +918 -0
  545. package/lldb/lib/python3.12/site-packages/pip/_internal/req/req_set.py +82 -0
  546. package/lldb/lib/python3.12/site-packages/pip/_internal/req/req_uninstall.py +633 -0
  547. package/lldb/lib/python3.12/site-packages/pip/_internal/resolution/__init__.py +0 -0
  548. package/lldb/lib/python3.12/site-packages/pip/_internal/resolution/base.py +20 -0
  549. package/lldb/lib/python3.12/site-packages/pip/_internal/resolution/legacy/__init__.py +0 -0
  550. package/lldb/lib/python3.12/site-packages/pip/_internal/resolution/legacy/resolver.py +597 -0
  551. package/lldb/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/__init__.py +0 -0
  552. package/lldb/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/base.py +139 -0
  553. package/lldb/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.py +569 -0
  554. package/lldb/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/factory.py +816 -0
  555. package/lldb/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py +174 -0
  556. package/lldb/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/provider.py +258 -0
  557. package/lldb/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/reporter.py +80 -0
  558. package/lldb/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/requirements.py +245 -0
  559. package/lldb/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/resolver.py +317 -0
  560. package/lldb/lib/python3.12/site-packages/pip/_internal/self_outdated_check.py +248 -0
  561. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/__init__.py +0 -0
  562. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/_jaraco_text.py +109 -0
  563. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/_log.py +38 -0
  564. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/appdirs.py +52 -0
  565. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/compat.py +79 -0
  566. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/compatibility_tags.py +165 -0
  567. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/datetime.py +11 -0
  568. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/deprecation.py +124 -0
  569. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/direct_url_helpers.py +87 -0
  570. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/egg_link.py +80 -0
  571. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/encoding.py +36 -0
  572. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/entrypoints.py +84 -0
  573. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/filesystem.py +153 -0
  574. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/filetypes.py +27 -0
  575. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/glibc.py +91 -0
  576. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/hashes.py +147 -0
  577. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/logging.py +347 -0
  578. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/misc.py +780 -0
  579. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/packaging.py +57 -0
  580. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/setuptools_build.py +146 -0
  581. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/subprocess.py +245 -0
  582. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/temp_dir.py +296 -0
  583. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/unpacking.py +337 -0
  584. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/urls.py +55 -0
  585. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/virtualenv.py +104 -0
  586. package/lldb/lib/python3.12/site-packages/pip/_internal/utils/wheel.py +134 -0
  587. package/lldb/lib/python3.12/site-packages/pip/_internal/vcs/__init__.py +15 -0
  588. package/lldb/lib/python3.12/site-packages/pip/_internal/vcs/bazaar.py +112 -0
  589. package/lldb/lib/python3.12/site-packages/pip/_internal/vcs/git.py +527 -0
  590. package/lldb/lib/python3.12/site-packages/pip/_internal/vcs/mercurial.py +163 -0
  591. package/lldb/lib/python3.12/site-packages/pip/_internal/vcs/subversion.py +324 -0
  592. package/lldb/lib/python3.12/site-packages/pip/_internal/vcs/versioncontrol.py +688 -0
  593. package/lldb/lib/python3.12/site-packages/pip/_internal/wheel_builder.py +354 -0
  594. package/lldb/lib/python3.12/site-packages/pip/_vendor/__init__.py +116 -0
  595. package/lldb/lib/python3.12/site-packages/pip/_vendor/cachecontrol/__init__.py +28 -0
  596. package/lldb/lib/python3.12/site-packages/pip/_vendor/cachecontrol/_cmd.py +70 -0
  597. package/lldb/lib/python3.12/site-packages/pip/_vendor/cachecontrol/adapter.py +161 -0
  598. package/lldb/lib/python3.12/site-packages/pip/_vendor/cachecontrol/cache.py +74 -0
  599. package/lldb/lib/python3.12/site-packages/pip/_vendor/cachecontrol/caches/__init__.py +8 -0
  600. package/lldb/lib/python3.12/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py +182 -0
  601. package/lldb/lib/python3.12/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py +48 -0
  602. package/lldb/lib/python3.12/site-packages/pip/_vendor/cachecontrol/controller.py +499 -0
  603. package/lldb/lib/python3.12/site-packages/pip/_vendor/cachecontrol/filewrapper.py +119 -0
  604. package/lldb/lib/python3.12/site-packages/pip/_vendor/cachecontrol/heuristics.py +154 -0
  605. package/lldb/lib/python3.12/site-packages/pip/_vendor/cachecontrol/serialize.py +146 -0
  606. package/lldb/lib/python3.12/site-packages/pip/_vendor/cachecontrol/wrapper.py +43 -0
  607. package/lldb/lib/python3.12/site-packages/pip/_vendor/certifi/__init__.py +4 -0
  608. package/lldb/lib/python3.12/site-packages/pip/_vendor/certifi/__main__.py +12 -0
  609. package/lldb/lib/python3.12/site-packages/pip/_vendor/certifi/cacert.pem +4814 -0
  610. package/lldb/lib/python3.12/site-packages/pip/_vendor/certifi/core.py +114 -0
  611. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/__init__.py +33 -0
  612. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/compat.py +1138 -0
  613. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/database.py +1359 -0
  614. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/index.py +508 -0
  615. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/locators.py +1303 -0
  616. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/manifest.py +384 -0
  617. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/markers.py +167 -0
  618. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/metadata.py +1068 -0
  619. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/resources.py +358 -0
  620. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/scripts.py +466 -0
  621. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/t32.exe +0 -0
  622. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/t64-arm.exe +0 -0
  623. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/t64.exe +0 -0
  624. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/util.py +2025 -0
  625. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/version.py +751 -0
  626. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/w32.exe +0 -0
  627. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/w64-arm.exe +0 -0
  628. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/w64.exe +0 -0
  629. package/lldb/lib/python3.12/site-packages/pip/_vendor/distlib/wheel.py +1099 -0
  630. package/lldb/lib/python3.12/site-packages/pip/_vendor/distro/__init__.py +54 -0
  631. package/lldb/lib/python3.12/site-packages/pip/_vendor/distro/__main__.py +4 -0
  632. package/lldb/lib/python3.12/site-packages/pip/_vendor/distro/distro.py +1403 -0
  633. package/lldb/lib/python3.12/site-packages/pip/_vendor/idna/__init__.py +44 -0
  634. package/lldb/lib/python3.12/site-packages/pip/_vendor/idna/codec.py +118 -0
  635. package/lldb/lib/python3.12/site-packages/pip/_vendor/idna/compat.py +13 -0
  636. package/lldb/lib/python3.12/site-packages/pip/_vendor/idna/core.py +395 -0
  637. package/lldb/lib/python3.12/site-packages/pip/_vendor/idna/idnadata.py +4245 -0
  638. package/lldb/lib/python3.12/site-packages/pip/_vendor/idna/intranges.py +54 -0
  639. package/lldb/lib/python3.12/site-packages/pip/_vendor/idna/package_data.py +2 -0
  640. package/lldb/lib/python3.12/site-packages/pip/_vendor/idna/uts46data.py +8598 -0
  641. package/lldb/lib/python3.12/site-packages/pip/_vendor/msgpack/__init__.py +55 -0
  642. package/lldb/lib/python3.12/site-packages/pip/_vendor/msgpack/exceptions.py +48 -0
  643. package/lldb/lib/python3.12/site-packages/pip/_vendor/msgpack/ext.py +168 -0
  644. package/lldb/lib/python3.12/site-packages/pip/_vendor/msgpack/fallback.py +951 -0
  645. package/lldb/lib/python3.12/site-packages/pip/_vendor/packaging/__init__.py +15 -0
  646. package/lldb/lib/python3.12/site-packages/pip/_vendor/packaging/_elffile.py +110 -0
  647. package/lldb/lib/python3.12/site-packages/pip/_vendor/packaging/_manylinux.py +262 -0
  648. package/lldb/lib/python3.12/site-packages/pip/_vendor/packaging/_musllinux.py +85 -0
  649. package/lldb/lib/python3.12/site-packages/pip/_vendor/packaging/_parser.py +354 -0
  650. package/lldb/lib/python3.12/site-packages/pip/_vendor/packaging/_structures.py +61 -0
  651. package/lldb/lib/python3.12/site-packages/pip/_vendor/packaging/_tokenizer.py +194 -0
  652. package/lldb/lib/python3.12/site-packages/pip/_vendor/packaging/markers.py +325 -0
  653. package/lldb/lib/python3.12/site-packages/pip/_vendor/packaging/metadata.py +804 -0
  654. package/lldb/lib/python3.12/site-packages/pip/_vendor/packaging/requirements.py +91 -0
  655. package/lldb/lib/python3.12/site-packages/pip/_vendor/packaging/specifiers.py +1009 -0
  656. package/lldb/lib/python3.12/site-packages/pip/_vendor/packaging/tags.py +568 -0
  657. package/lldb/lib/python3.12/site-packages/pip/_vendor/packaging/utils.py +174 -0
  658. package/lldb/lib/python3.12/site-packages/pip/_vendor/packaging/version.py +563 -0
  659. package/lldb/lib/python3.12/site-packages/pip/_vendor/pkg_resources/__init__.py +3325 -0
  660. package/lldb/lib/python3.12/site-packages/pip/_vendor/platformdirs/__init__.py +627 -0
  661. package/lldb/lib/python3.12/site-packages/pip/_vendor/platformdirs/__main__.py +55 -0
  662. package/lldb/lib/python3.12/site-packages/pip/_vendor/platformdirs/android.py +222 -0
  663. package/lldb/lib/python3.12/site-packages/pip/_vendor/platformdirs/api.py +292 -0
  664. package/lldb/lib/python3.12/site-packages/pip/_vendor/platformdirs/macos.py +130 -0
  665. package/lldb/lib/python3.12/site-packages/pip/_vendor/platformdirs/unix.py +275 -0
  666. package/lldb/lib/python3.12/site-packages/pip/_vendor/platformdirs/version.py +16 -0
  667. package/lldb/lib/python3.12/site-packages/pip/_vendor/platformdirs/windows.py +272 -0
  668. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/__init__.py +82 -0
  669. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/__main__.py +17 -0
  670. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/cmdline.py +668 -0
  671. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/console.py +70 -0
  672. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/filter.py +71 -0
  673. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/filters/__init__.py +940 -0
  674. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/formatter.py +124 -0
  675. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/formatters/__init__.py +158 -0
  676. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/formatters/_mapping.py +23 -0
  677. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/formatters/bbcode.py +108 -0
  678. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/formatters/groff.py +170 -0
  679. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/formatters/html.py +990 -0
  680. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/formatters/img.py +684 -0
  681. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/formatters/irc.py +154 -0
  682. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/formatters/latex.py +521 -0
  683. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/formatters/other.py +161 -0
  684. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/formatters/pangomarkup.py +83 -0
  685. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/formatters/rtf.py +146 -0
  686. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/formatters/svg.py +188 -0
  687. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/formatters/terminal.py +127 -0
  688. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/formatters/terminal256.py +338 -0
  689. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/lexer.py +961 -0
  690. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/lexers/__init__.py +363 -0
  691. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/lexers/_mapping.py +580 -0
  692. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/lexers/python.py +1198 -0
  693. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/modeline.py +43 -0
  694. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/plugin.py +88 -0
  695. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/regexopt.py +91 -0
  696. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/scanner.py +104 -0
  697. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/sphinxext.py +239 -0
  698. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/style.py +203 -0
  699. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/styles/__init__.py +61 -0
  700. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/styles/_mapping.py +53 -0
  701. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/token.py +214 -0
  702. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/unistring.py +153 -0
  703. package/lldb/lib/python3.12/site-packages/pip/_vendor/pygments/util.py +330 -0
  704. package/lldb/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/__init__.py +23 -0
  705. package/lldb/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_compat.py +8 -0
  706. package/lldb/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_impl.py +330 -0
  707. package/lldb/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/__init__.py +18 -0
  708. package/lldb/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py +353 -0
  709. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/__init__.py +179 -0
  710. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/__version__.py +14 -0
  711. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/_internal_utils.py +50 -0
  712. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/adapters.py +719 -0
  713. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/api.py +157 -0
  714. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/auth.py +314 -0
  715. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/certs.py +24 -0
  716. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/compat.py +78 -0
  717. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/cookies.py +561 -0
  718. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/exceptions.py +151 -0
  719. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/help.py +127 -0
  720. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/hooks.py +33 -0
  721. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/models.py +1037 -0
  722. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/packages.py +25 -0
  723. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/sessions.py +831 -0
  724. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/status_codes.py +128 -0
  725. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/structures.py +99 -0
  726. package/lldb/lib/python3.12/site-packages/pip/_vendor/requests/utils.py +1096 -0
  727. package/lldb/lib/python3.12/site-packages/pip/_vendor/resolvelib/__init__.py +26 -0
  728. package/lldb/lib/python3.12/site-packages/pip/_vendor/resolvelib/compat/__init__.py +0 -0
  729. package/lldb/lib/python3.12/site-packages/pip/_vendor/resolvelib/compat/collections_abc.py +6 -0
  730. package/lldb/lib/python3.12/site-packages/pip/_vendor/resolvelib/providers.py +133 -0
  731. package/lldb/lib/python3.12/site-packages/pip/_vendor/resolvelib/reporters.py +43 -0
  732. package/lldb/lib/python3.12/site-packages/pip/_vendor/resolvelib/resolvers.py +547 -0
  733. package/lldb/lib/python3.12/site-packages/pip/_vendor/resolvelib/structs.py +170 -0
  734. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/__init__.py +177 -0
  735. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/__main__.py +273 -0
  736. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_cell_widths.py +454 -0
  737. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_emoji_codes.py +3610 -0
  738. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_emoji_replace.py +32 -0
  739. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_export_format.py +76 -0
  740. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_extension.py +10 -0
  741. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_fileno.py +24 -0
  742. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_inspect.py +270 -0
  743. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_log_render.py +94 -0
  744. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_loop.py +43 -0
  745. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_null_file.py +69 -0
  746. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_palettes.py +309 -0
  747. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_pick.py +17 -0
  748. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_ratio.py +159 -0
  749. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_spinners.py +482 -0
  750. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_stack.py +16 -0
  751. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_timer.py +19 -0
  752. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_win32_console.py +662 -0
  753. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_windows.py +71 -0
  754. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_windows_renderer.py +56 -0
  755. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/_wrap.py +93 -0
  756. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/abc.py +33 -0
  757. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/align.py +311 -0
  758. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/ansi.py +240 -0
  759. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/bar.py +93 -0
  760. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/box.py +480 -0
  761. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/cells.py +167 -0
  762. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/color.py +621 -0
  763. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/color_triplet.py +38 -0
  764. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/columns.py +187 -0
  765. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/console.py +2633 -0
  766. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/constrain.py +37 -0
  767. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/containers.py +167 -0
  768. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/control.py +225 -0
  769. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/default_styles.py +190 -0
  770. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/diagnose.py +37 -0
  771. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/emoji.py +96 -0
  772. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/errors.py +34 -0
  773. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/file_proxy.py +57 -0
  774. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/filesize.py +89 -0
  775. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/highlighter.py +232 -0
  776. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/json.py +139 -0
  777. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/jupyter.py +101 -0
  778. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/layout.py +442 -0
  779. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/live.py +375 -0
  780. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/live_render.py +112 -0
  781. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/logging.py +289 -0
  782. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/markup.py +251 -0
  783. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/measure.py +151 -0
  784. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/padding.py +141 -0
  785. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/pager.py +34 -0
  786. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/palette.py +100 -0
  787. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/panel.py +312 -0
  788. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/pretty.py +995 -0
  789. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/progress.py +1699 -0
  790. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/progress_bar.py +223 -0
  791. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/prompt.py +375 -0
  792. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/protocol.py +42 -0
  793. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/region.py +10 -0
  794. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/repr.py +149 -0
  795. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/rule.py +130 -0
  796. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/scope.py +86 -0
  797. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/screen.py +54 -0
  798. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/segment.py +738 -0
  799. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/spinner.py +137 -0
  800. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/status.py +131 -0
  801. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/style.py +796 -0
  802. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/styled.py +42 -0
  803. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/syntax.py +958 -0
  804. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/table.py +1000 -0
  805. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/terminal_theme.py +153 -0
  806. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/text.py +1357 -0
  807. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/theme.py +115 -0
  808. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/themes.py +5 -0
  809. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/traceback.py +753 -0
  810. package/lldb/lib/python3.12/site-packages/pip/_vendor/rich/tree.py +249 -0
  811. package/lldb/lib/python3.12/site-packages/pip/_vendor/tenacity/__init__.py +608 -0
  812. package/lldb/lib/python3.12/site-packages/pip/_vendor/tenacity/_asyncio.py +94 -0
  813. package/lldb/lib/python3.12/site-packages/pip/_vendor/tenacity/_utils.py +76 -0
  814. package/lldb/lib/python3.12/site-packages/pip/_vendor/tenacity/after.py +51 -0
  815. package/lldb/lib/python3.12/site-packages/pip/_vendor/tenacity/before.py +46 -0
  816. package/lldb/lib/python3.12/site-packages/pip/_vendor/tenacity/before_sleep.py +71 -0
  817. package/lldb/lib/python3.12/site-packages/pip/_vendor/tenacity/nap.py +43 -0
  818. package/lldb/lib/python3.12/site-packages/pip/_vendor/tenacity/retry.py +272 -0
  819. package/lldb/lib/python3.12/site-packages/pip/_vendor/tenacity/stop.py +103 -0
  820. package/lldb/lib/python3.12/site-packages/pip/_vendor/tenacity/tornadoweb.py +59 -0
  821. package/lldb/lib/python3.12/site-packages/pip/_vendor/tenacity/wait.py +228 -0
  822. package/lldb/lib/python3.12/site-packages/pip/_vendor/tomli/__init__.py +11 -0
  823. package/lldb/lib/python3.12/site-packages/pip/_vendor/tomli/_parser.py +691 -0
  824. package/lldb/lib/python3.12/site-packages/pip/_vendor/tomli/_re.py +107 -0
  825. package/lldb/lib/python3.12/site-packages/pip/_vendor/tomli/_types.py +10 -0
  826. package/lldb/lib/python3.12/site-packages/pip/_vendor/truststore/__init__.py +13 -0
  827. package/lldb/lib/python3.12/site-packages/pip/_vendor/truststore/_api.py +313 -0
  828. package/lldb/lib/python3.12/site-packages/pip/_vendor/truststore/_macos.py +499 -0
  829. package/lldb/lib/python3.12/site-packages/pip/_vendor/truststore/_openssl.py +66 -0
  830. package/lldb/lib/python3.12/site-packages/pip/_vendor/truststore/_ssl_constants.py +31 -0
  831. package/lldb/lib/python3.12/site-packages/pip/_vendor/truststore/_windows.py +564 -0
  832. package/lldb/lib/python3.12/site-packages/pip/_vendor/typing_extensions.py +3332 -0
  833. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/__init__.py +102 -0
  834. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/_collections.py +355 -0
  835. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/_version.py +2 -0
  836. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/connection.py +572 -0
  837. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/connectionpool.py +1137 -0
  838. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/contrib/__init__.py +0 -0
  839. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/contrib/_appengine_environ.py +36 -0
  840. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__init__.py +0 -0
  841. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/contrib/_securetransport/bindings.py +519 -0
  842. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/contrib/_securetransport/low_level.py +397 -0
  843. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/contrib/appengine.py +314 -0
  844. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/contrib/ntlmpool.py +130 -0
  845. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py +518 -0
  846. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/contrib/securetransport.py +920 -0
  847. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/contrib/socks.py +216 -0
  848. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/exceptions.py +323 -0
  849. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/fields.py +274 -0
  850. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/filepost.py +98 -0
  851. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/packages/__init__.py +0 -0
  852. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/packages/backports/__init__.py +0 -0
  853. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py +51 -0
  854. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/packages/backports/weakref_finalize.py +155 -0
  855. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/packages/six.py +1076 -0
  856. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/poolmanager.py +540 -0
  857. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/request.py +191 -0
  858. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/response.py +879 -0
  859. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/util/__init__.py +49 -0
  860. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/util/connection.py +149 -0
  861. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/util/proxy.py +57 -0
  862. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/util/queue.py +22 -0
  863. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/util/request.py +137 -0
  864. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/util/response.py +107 -0
  865. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/util/retry.py +620 -0
  866. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/util/ssl_.py +495 -0
  867. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/util/ssl_match_hostname.py +159 -0
  868. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/util/ssltransport.py +221 -0
  869. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/util/timeout.py +271 -0
  870. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/util/url.py +435 -0
  871. package/lldb/lib/python3.12/site-packages/pip/_vendor/urllib3/util/wait.py +152 -0
  872. package/lldb/lib/python3.12/site.py +692 -0
  873. package/lldb/lib/python3.12/smtplib.py +1109 -0
  874. package/lldb/lib/python3.12/sndhdr.py +271 -0
  875. package/lldb/lib/python3.12/socket.py +981 -0
  876. package/lldb/lib/python3.12/socketserver.py +858 -0
  877. package/lldb/lib/python3.12/sre_compile.py +7 -0
  878. package/lldb/lib/python3.12/sre_constants.py +7 -0
  879. package/lldb/lib/python3.12/sre_parse.py +7 -0
  880. package/lldb/lib/python3.12/ssl.py +1476 -0
  881. package/lldb/lib/python3.12/stat.py +195 -0
  882. package/lldb/lib/python3.12/statistics.py +1454 -0
  883. package/lldb/lib/python3.12/string.py +309 -0
  884. package/lldb/lib/python3.12/stringprep.py +272 -0
  885. package/lldb/lib/python3.12/struct.py +15 -0
  886. package/lldb/lib/python3.12/subprocess.py +2216 -0
  887. package/lldb/lib/python3.12/sunau.py +533 -0
  888. package/lldb/lib/python3.12/symtable.py +362 -0
  889. package/lldb/lib/python3.12/sysconfig.py +876 -0
  890. package/lldb/lib/python3.12/tabnanny.py +340 -0
  891. package/lldb/lib/python3.12/tarfile.py +2933 -0
  892. package/lldb/lib/python3.12/telnetlib.py +680 -0
  893. package/lldb/lib/python3.12/tempfile.py +952 -0
  894. package/lldb/lib/python3.12/textwrap.py +491 -0
  895. package/lldb/lib/python3.12/this.py +28 -0
  896. package/lldb/lib/python3.12/threading.py +1708 -0
  897. package/lldb/lib/python3.12/timeit.py +381 -0
  898. package/lldb/lib/python3.12/token.py +142 -0
  899. package/lldb/lib/python3.12/tokenize.py +586 -0
  900. package/lldb/lib/python3.12/tomllib/__init__.py +10 -0
  901. package/lldb/lib/python3.12/tomllib/_parser.py +691 -0
  902. package/lldb/lib/python3.12/tomllib/_re.py +107 -0
  903. package/lldb/lib/python3.12/tomllib/_types.py +10 -0
  904. package/lldb/lib/python3.12/trace.py +748 -0
  905. package/lldb/lib/python3.12/traceback.py +1187 -0
  906. package/lldb/lib/python3.12/tracemalloc.py +560 -0
  907. package/lldb/lib/python3.12/tty.py +73 -0
  908. package/lldb/lib/python3.12/turtle.py +4207 -0
  909. package/lldb/lib/python3.12/types.py +333 -0
  910. package/lldb/lib/python3.12/typing.py +3489 -0
  911. package/lldb/lib/python3.12/unittest/__init__.py +85 -0
  912. package/lldb/lib/python3.12/unittest/__main__.py +18 -0
  913. package/lldb/lib/python3.12/unittest/_log.py +86 -0
  914. package/lldb/lib/python3.12/unittest/async_case.py +142 -0
  915. package/lldb/lib/python3.12/unittest/case.py +1456 -0
  916. package/lldb/lib/python3.12/unittest/loader.py +497 -0
  917. package/lldb/lib/python3.12/unittest/main.py +291 -0
  918. package/lldb/lib/python3.12/unittest/mock.py +3045 -0
  919. package/lldb/lib/python3.12/unittest/result.py +256 -0
  920. package/lldb/lib/python3.12/unittest/runner.py +292 -0
  921. package/lldb/lib/python3.12/unittest/signals.py +71 -0
  922. package/lldb/lib/python3.12/unittest/suite.py +379 -0
  923. package/lldb/lib/python3.12/unittest/util.py +170 -0
  924. package/lldb/lib/python3.12/urllib/__init__.py +0 -0
  925. package/lldb/lib/python3.12/urllib/error.py +74 -0
  926. package/lldb/lib/python3.12/urllib/parse.py +1246 -0
  927. package/lldb/lib/python3.12/urllib/request.py +2796 -0
  928. package/lldb/lib/python3.12/urllib/response.py +84 -0
  929. package/lldb/lib/python3.12/urllib/robotparser.py +273 -0
  930. package/lldb/lib/python3.12/uu.py +216 -0
  931. package/lldb/lib/python3.12/uuid.py +793 -0
  932. package/lldb/lib/python3.12/warnings.py +598 -0
  933. package/lldb/lib/python3.12/wave.py +653 -0
  934. package/lldb/lib/python3.12/weakref.py +674 -0
  935. package/lldb/lib/python3.12/webbrowser.py +689 -0
  936. package/lldb/lib/python3.12/wsgiref/__init__.py +25 -0
  937. package/lldb/lib/python3.12/wsgiref/handlers.py +573 -0
  938. package/lldb/lib/python3.12/wsgiref/headers.py +184 -0
  939. package/lldb/lib/python3.12/wsgiref/simple_server.py +165 -0
  940. package/lldb/lib/python3.12/wsgiref/types.py +54 -0
  941. package/lldb/lib/python3.12/wsgiref/util.py +159 -0
  942. package/lldb/lib/python3.12/wsgiref/validate.py +438 -0
  943. package/lldb/lib/python3.12/xdrlib.py +242 -0
  944. package/lldb/lib/python3.12/xml/__init__.py +20 -0
  945. package/lldb/lib/python3.12/xml/dom/NodeFilter.py +27 -0
  946. package/lldb/lib/python3.12/xml/dom/__init__.py +140 -0
  947. package/lldb/lib/python3.12/xml/dom/domreg.py +99 -0
  948. package/lldb/lib/python3.12/xml/dom/expatbuilder.py +962 -0
  949. package/lldb/lib/python3.12/xml/dom/minicompat.py +109 -0
  950. package/lldb/lib/python3.12/xml/dom/minidom.py +2013 -0
  951. package/lldb/lib/python3.12/xml/dom/pulldom.py +336 -0
  952. package/lldb/lib/python3.12/xml/dom/xmlbuilder.py +387 -0
  953. package/lldb/lib/python3.12/xml/etree/ElementInclude.py +186 -0
  954. package/lldb/lib/python3.12/xml/etree/ElementPath.py +423 -0
  955. package/lldb/lib/python3.12/xml/etree/ElementTree.py +2085 -0
  956. package/lldb/lib/python3.12/xml/etree/__init__.py +33 -0
  957. package/lldb/lib/python3.12/xml/etree/cElementTree.py +3 -0
  958. package/lldb/lib/python3.12/xml/parsers/__init__.py +8 -0
  959. package/lldb/lib/python3.12/xml/parsers/expat.py +8 -0
  960. package/lldb/lib/python3.12/xml/sax/__init__.py +94 -0
  961. package/lldb/lib/python3.12/xml/sax/_exceptions.py +127 -0
  962. package/lldb/lib/python3.12/xml/sax/expatreader.py +454 -0
  963. package/lldb/lib/python3.12/xml/sax/handler.py +387 -0
  964. package/lldb/lib/python3.12/xml/sax/saxutils.py +369 -0
  965. package/lldb/lib/python3.12/xml/sax/xmlreader.py +378 -0
  966. package/lldb/lib/python3.12/xmlrpc/__init__.py +1 -0
  967. package/lldb/lib/python3.12/xmlrpc/client.py +1529 -0
  968. package/lldb/lib/python3.12/xmlrpc/server.py +1002 -0
  969. package/lldb/lib/python3.12/zipapp.py +206 -0
  970. package/lldb/lib/python3.12/zipfile/__init__.py +2314 -0
  971. package/lldb/lib/python3.12/zipfile/__main__.py +4 -0
  972. package/lldb/lib/python3.12/zipfile/_path/__init__.py +412 -0
  973. package/lldb/lib/python3.12/zipfile/_path/glob.py +53 -0
  974. package/lldb/lib/python3.12/zipimport.py +712 -0
  975. package/lldb/lib/python3.12/zoneinfo/__init__.py +31 -0
  976. package/lldb/lib/python3.12/zoneinfo/_common.py +164 -0
  977. package/lldb/lib/python3.12/zoneinfo/_tzpath.py +181 -0
  978. package/lldb/lib/python3.12/zoneinfo/_zoneinfo.py +772 -0
  979. package/package.json +28 -4
  980. package/version.json +4 -0
@@ -0,0 +1,3332 @@
1
+ import abc
2
+ import collections
3
+ import collections.abc
4
+ import functools
5
+ import inspect
6
+ import operator
7
+ import sys
8
+ import types as _types
9
+ import typing
10
+ import warnings
11
+
12
+ __all__ = [
13
+ # Super-special typing primitives.
14
+ 'Any',
15
+ 'ClassVar',
16
+ 'Concatenate',
17
+ 'Final',
18
+ 'LiteralString',
19
+ 'ParamSpec',
20
+ 'ParamSpecArgs',
21
+ 'ParamSpecKwargs',
22
+ 'Self',
23
+ 'Type',
24
+ 'TypeVar',
25
+ 'TypeVarTuple',
26
+ 'Unpack',
27
+
28
+ # ABCs (from collections.abc).
29
+ 'Awaitable',
30
+ 'AsyncIterator',
31
+ 'AsyncIterable',
32
+ 'Coroutine',
33
+ 'AsyncGenerator',
34
+ 'AsyncContextManager',
35
+ 'Buffer',
36
+ 'ChainMap',
37
+
38
+ # Concrete collection types.
39
+ 'ContextManager',
40
+ 'Counter',
41
+ 'Deque',
42
+ 'DefaultDict',
43
+ 'NamedTuple',
44
+ 'OrderedDict',
45
+ 'TypedDict',
46
+
47
+ # Structural checks, a.k.a. protocols.
48
+ 'SupportsAbs',
49
+ 'SupportsBytes',
50
+ 'SupportsComplex',
51
+ 'SupportsFloat',
52
+ 'SupportsIndex',
53
+ 'SupportsInt',
54
+ 'SupportsRound',
55
+
56
+ # One-off things.
57
+ 'Annotated',
58
+ 'assert_never',
59
+ 'assert_type',
60
+ 'clear_overloads',
61
+ 'dataclass_transform',
62
+ 'deprecated',
63
+ 'Doc',
64
+ 'get_overloads',
65
+ 'final',
66
+ 'get_args',
67
+ 'get_origin',
68
+ 'get_original_bases',
69
+ 'get_protocol_members',
70
+ 'get_type_hints',
71
+ 'IntVar',
72
+ 'is_protocol',
73
+ 'is_typeddict',
74
+ 'Literal',
75
+ 'NewType',
76
+ 'overload',
77
+ 'override',
78
+ 'Protocol',
79
+ 'reveal_type',
80
+ 'runtime',
81
+ 'runtime_checkable',
82
+ 'Text',
83
+ 'TypeAlias',
84
+ 'TypeAliasType',
85
+ 'TypeGuard',
86
+ 'TypeIs',
87
+ 'TYPE_CHECKING',
88
+ 'Never',
89
+ 'NoReturn',
90
+ 'ReadOnly',
91
+ 'Required',
92
+ 'NotRequired',
93
+
94
+ # Pure aliases, have always been in typing
95
+ 'AbstractSet',
96
+ 'AnyStr',
97
+ 'BinaryIO',
98
+ 'Callable',
99
+ 'Collection',
100
+ 'Container',
101
+ 'Dict',
102
+ 'ForwardRef',
103
+ 'FrozenSet',
104
+ 'Generator',
105
+ 'Generic',
106
+ 'Hashable',
107
+ 'IO',
108
+ 'ItemsView',
109
+ 'Iterable',
110
+ 'Iterator',
111
+ 'KeysView',
112
+ 'List',
113
+ 'Mapping',
114
+ 'MappingView',
115
+ 'Match',
116
+ 'MutableMapping',
117
+ 'MutableSequence',
118
+ 'MutableSet',
119
+ 'Optional',
120
+ 'Pattern',
121
+ 'Reversible',
122
+ 'Sequence',
123
+ 'Set',
124
+ 'Sized',
125
+ 'TextIO',
126
+ 'Tuple',
127
+ 'Union',
128
+ 'ValuesView',
129
+ 'cast',
130
+ 'no_type_check',
131
+ 'no_type_check_decorator',
132
+ ]
133
+
134
+ # for backward compatibility
135
+ PEP_560 = True
136
+ GenericMeta = type
137
+
138
+ # The functions below are modified copies of typing internal helpers.
139
+ # They are needed by _ProtocolMeta and they provide support for PEP 646.
140
+
141
+
142
+ class _Sentinel:
143
+ def __repr__(self):
144
+ return "<sentinel>"
145
+
146
+
147
+ _marker = _Sentinel()
148
+
149
+
150
+ if sys.version_info >= (3, 10):
151
+ def _should_collect_from_parameters(t):
152
+ return isinstance(
153
+ t, (typing._GenericAlias, _types.GenericAlias, _types.UnionType)
154
+ )
155
+ elif sys.version_info >= (3, 9):
156
+ def _should_collect_from_parameters(t):
157
+ return isinstance(t, (typing._GenericAlias, _types.GenericAlias))
158
+ else:
159
+ def _should_collect_from_parameters(t):
160
+ return isinstance(t, typing._GenericAlias) and not t._special
161
+
162
+
163
+ NoReturn = typing.NoReturn
164
+
165
+ # Some unconstrained type variables. These are used by the container types.
166
+ # (These are not for export.)
167
+ T = typing.TypeVar('T') # Any type.
168
+ KT = typing.TypeVar('KT') # Key type.
169
+ VT = typing.TypeVar('VT') # Value type.
170
+ T_co = typing.TypeVar('T_co', covariant=True) # Any type covariant containers.
171
+ T_contra = typing.TypeVar('T_contra', contravariant=True) # Ditto contravariant.
172
+
173
+
174
+ if sys.version_info >= (3, 11):
175
+ from typing import Any
176
+ else:
177
+
178
+ class _AnyMeta(type):
179
+ def __instancecheck__(self, obj):
180
+ if self is Any:
181
+ raise TypeError("typing_extensions.Any cannot be used with isinstance()")
182
+ return super().__instancecheck__(obj)
183
+
184
+ def __repr__(self):
185
+ if self is Any:
186
+ return "typing_extensions.Any"
187
+ return super().__repr__()
188
+
189
+ class Any(metaclass=_AnyMeta):
190
+ """Special type indicating an unconstrained type.
191
+ - Any is compatible with every type.
192
+ - Any assumed to have all methods.
193
+ - All values assumed to be instances of Any.
194
+ Note that all the above statements are true from the point of view of
195
+ static type checkers. At runtime, Any should not be used with instance
196
+ checks.
197
+ """
198
+ def __new__(cls, *args, **kwargs):
199
+ if cls is Any:
200
+ raise TypeError("Any cannot be instantiated")
201
+ return super().__new__(cls, *args, **kwargs)
202
+
203
+
204
+ ClassVar = typing.ClassVar
205
+
206
+
207
+ class _ExtensionsSpecialForm(typing._SpecialForm, _root=True):
208
+ def __repr__(self):
209
+ return 'typing_extensions.' + self._name
210
+
211
+
212
+ Final = typing.Final
213
+
214
+ if sys.version_info >= (3, 11):
215
+ final = typing.final
216
+ else:
217
+ # @final exists in 3.8+, but we backport it for all versions
218
+ # before 3.11 to keep support for the __final__ attribute.
219
+ # See https://bugs.python.org/issue46342
220
+ def final(f):
221
+ """This decorator can be used to indicate to type checkers that
222
+ the decorated method cannot be overridden, and decorated class
223
+ cannot be subclassed. For example:
224
+
225
+ class Base:
226
+ @final
227
+ def done(self) -> None:
228
+ ...
229
+ class Sub(Base):
230
+ def done(self) -> None: # Error reported by type checker
231
+ ...
232
+ @final
233
+ class Leaf:
234
+ ...
235
+ class Other(Leaf): # Error reported by type checker
236
+ ...
237
+
238
+ There is no runtime checking of these properties. The decorator
239
+ sets the ``__final__`` attribute to ``True`` on the decorated object
240
+ to allow runtime introspection.
241
+ """
242
+ try:
243
+ f.__final__ = True
244
+ except (AttributeError, TypeError):
245
+ # Skip the attribute silently if it is not writable.
246
+ # AttributeError happens if the object has __slots__ or a
247
+ # read-only property, TypeError if it's a builtin class.
248
+ pass
249
+ return f
250
+
251
+
252
+ def IntVar(name):
253
+ return typing.TypeVar(name)
254
+
255
+
256
+ # A Literal bug was fixed in 3.11.0, 3.10.1 and 3.9.8
257
+ if sys.version_info >= (3, 10, 1):
258
+ Literal = typing.Literal
259
+ else:
260
+ def _flatten_literal_params(parameters):
261
+ """An internal helper for Literal creation: flatten Literals among parameters"""
262
+ params = []
263
+ for p in parameters:
264
+ if isinstance(p, _LiteralGenericAlias):
265
+ params.extend(p.__args__)
266
+ else:
267
+ params.append(p)
268
+ return tuple(params)
269
+
270
+ def _value_and_type_iter(params):
271
+ for p in params:
272
+ yield p, type(p)
273
+
274
+ class _LiteralGenericAlias(typing._GenericAlias, _root=True):
275
+ def __eq__(self, other):
276
+ if not isinstance(other, _LiteralGenericAlias):
277
+ return NotImplemented
278
+ these_args_deduped = set(_value_and_type_iter(self.__args__))
279
+ other_args_deduped = set(_value_and_type_iter(other.__args__))
280
+ return these_args_deduped == other_args_deduped
281
+
282
+ def __hash__(self):
283
+ return hash(frozenset(_value_and_type_iter(self.__args__)))
284
+
285
+ class _LiteralForm(_ExtensionsSpecialForm, _root=True):
286
+ def __init__(self, doc: str):
287
+ self._name = 'Literal'
288
+ self._doc = self.__doc__ = doc
289
+
290
+ def __getitem__(self, parameters):
291
+ if not isinstance(parameters, tuple):
292
+ parameters = (parameters,)
293
+
294
+ parameters = _flatten_literal_params(parameters)
295
+
296
+ val_type_pairs = list(_value_and_type_iter(parameters))
297
+ try:
298
+ deduped_pairs = set(val_type_pairs)
299
+ except TypeError:
300
+ # unhashable parameters
301
+ pass
302
+ else:
303
+ # similar logic to typing._deduplicate on Python 3.9+
304
+ if len(deduped_pairs) < len(val_type_pairs):
305
+ new_parameters = []
306
+ for pair in val_type_pairs:
307
+ if pair in deduped_pairs:
308
+ new_parameters.append(pair[0])
309
+ deduped_pairs.remove(pair)
310
+ assert not deduped_pairs, deduped_pairs
311
+ parameters = tuple(new_parameters)
312
+
313
+ return _LiteralGenericAlias(self, parameters)
314
+
315
+ Literal = _LiteralForm(doc="""\
316
+ A type that can be used to indicate to type checkers
317
+ that the corresponding value has a value literally equivalent
318
+ to the provided parameter. For example:
319
+
320
+ var: Literal[4] = 4
321
+
322
+ The type checker understands that 'var' is literally equal to
323
+ the value 4 and no other value.
324
+
325
+ Literal[...] cannot be subclassed. There is no runtime
326
+ checking verifying that the parameter is actually a value
327
+ instead of a type.""")
328
+
329
+
330
+ _overload_dummy = typing._overload_dummy
331
+
332
+
333
+ if hasattr(typing, "get_overloads"): # 3.11+
334
+ overload = typing.overload
335
+ get_overloads = typing.get_overloads
336
+ clear_overloads = typing.clear_overloads
337
+ else:
338
+ # {module: {qualname: {firstlineno: func}}}
339
+ _overload_registry = collections.defaultdict(
340
+ functools.partial(collections.defaultdict, dict)
341
+ )
342
+
343
+ def overload(func):
344
+ """Decorator for overloaded functions/methods.
345
+
346
+ In a stub file, place two or more stub definitions for the same
347
+ function in a row, each decorated with @overload. For example:
348
+
349
+ @overload
350
+ def utf8(value: None) -> None: ...
351
+ @overload
352
+ def utf8(value: bytes) -> bytes: ...
353
+ @overload
354
+ def utf8(value: str) -> bytes: ...
355
+
356
+ In a non-stub file (i.e. a regular .py file), do the same but
357
+ follow it with an implementation. The implementation should *not*
358
+ be decorated with @overload. For example:
359
+
360
+ @overload
361
+ def utf8(value: None) -> None: ...
362
+ @overload
363
+ def utf8(value: bytes) -> bytes: ...
364
+ @overload
365
+ def utf8(value: str) -> bytes: ...
366
+ def utf8(value):
367
+ # implementation goes here
368
+
369
+ The overloads for a function can be retrieved at runtime using the
370
+ get_overloads() function.
371
+ """
372
+ # classmethod and staticmethod
373
+ f = getattr(func, "__func__", func)
374
+ try:
375
+ _overload_registry[f.__module__][f.__qualname__][
376
+ f.__code__.co_firstlineno
377
+ ] = func
378
+ except AttributeError:
379
+ # Not a normal function; ignore.
380
+ pass
381
+ return _overload_dummy
382
+
383
+ def get_overloads(func):
384
+ """Return all defined overloads for *func* as a sequence."""
385
+ # classmethod and staticmethod
386
+ f = getattr(func, "__func__", func)
387
+ if f.__module__ not in _overload_registry:
388
+ return []
389
+ mod_dict = _overload_registry[f.__module__]
390
+ if f.__qualname__ not in mod_dict:
391
+ return []
392
+ return list(mod_dict[f.__qualname__].values())
393
+
394
+ def clear_overloads():
395
+ """Clear all overloads in the registry."""
396
+ _overload_registry.clear()
397
+
398
+
399
+ # This is not a real generic class. Don't use outside annotations.
400
+ Type = typing.Type
401
+
402
+ # Various ABCs mimicking those in collections.abc.
403
+ # A few are simply re-exported for completeness.
404
+ Awaitable = typing.Awaitable
405
+ Coroutine = typing.Coroutine
406
+ AsyncIterable = typing.AsyncIterable
407
+ AsyncIterator = typing.AsyncIterator
408
+ Deque = typing.Deque
409
+ ContextManager = typing.ContextManager
410
+ AsyncContextManager = typing.AsyncContextManager
411
+ DefaultDict = typing.DefaultDict
412
+ OrderedDict = typing.OrderedDict
413
+ Counter = typing.Counter
414
+ ChainMap = typing.ChainMap
415
+ AsyncGenerator = typing.AsyncGenerator
416
+ Text = typing.Text
417
+ TYPE_CHECKING = typing.TYPE_CHECKING
418
+
419
+
420
+ _PROTO_ALLOWLIST = {
421
+ 'collections.abc': [
422
+ 'Callable', 'Awaitable', 'Iterable', 'Iterator', 'AsyncIterable',
423
+ 'Hashable', 'Sized', 'Container', 'Collection', 'Reversible', 'Buffer',
424
+ ],
425
+ 'contextlib': ['AbstractContextManager', 'AbstractAsyncContextManager'],
426
+ 'typing_extensions': ['Buffer'],
427
+ }
428
+
429
+
430
+ _EXCLUDED_ATTRS = {
431
+ "__abstractmethods__", "__annotations__", "__weakref__", "_is_protocol",
432
+ "_is_runtime_protocol", "__dict__", "__slots__", "__parameters__",
433
+ "__orig_bases__", "__module__", "_MutableMapping__marker", "__doc__",
434
+ "__subclasshook__", "__orig_class__", "__init__", "__new__",
435
+ "__protocol_attrs__", "__non_callable_proto_members__",
436
+ "__match_args__",
437
+ }
438
+
439
+ if sys.version_info >= (3, 9):
440
+ _EXCLUDED_ATTRS.add("__class_getitem__")
441
+
442
+ if sys.version_info >= (3, 12):
443
+ _EXCLUDED_ATTRS.add("__type_params__")
444
+
445
+ _EXCLUDED_ATTRS = frozenset(_EXCLUDED_ATTRS)
446
+
447
+
448
+ def _get_protocol_attrs(cls):
449
+ attrs = set()
450
+ for base in cls.__mro__[:-1]: # without object
451
+ if base.__name__ in {'Protocol', 'Generic'}:
452
+ continue
453
+ annotations = getattr(base, '__annotations__', {})
454
+ for attr in (*base.__dict__, *annotations):
455
+ if (not attr.startswith('_abc_') and attr not in _EXCLUDED_ATTRS):
456
+ attrs.add(attr)
457
+ return attrs
458
+
459
+
460
+ def _caller(depth=2):
461
+ try:
462
+ return sys._getframe(depth).f_globals.get('__name__', '__main__')
463
+ except (AttributeError, ValueError): # For platforms without _getframe()
464
+ return None
465
+
466
+
467
+ # `__match_args__` attribute was removed from protocol members in 3.13,
468
+ # we want to backport this change to older Python versions.
469
+ if sys.version_info >= (3, 13):
470
+ Protocol = typing.Protocol
471
+ else:
472
+ def _allow_reckless_class_checks(depth=3):
473
+ """Allow instance and class checks for special stdlib modules.
474
+ The abc and functools modules indiscriminately call isinstance() and
475
+ issubclass() on the whole MRO of a user class, which may contain protocols.
476
+ """
477
+ return _caller(depth) in {'abc', 'functools', None}
478
+
479
+ def _no_init(self, *args, **kwargs):
480
+ if type(self)._is_protocol:
481
+ raise TypeError('Protocols cannot be instantiated')
482
+
483
+ def _type_check_issubclass_arg_1(arg):
484
+ """Raise TypeError if `arg` is not an instance of `type`
485
+ in `issubclass(arg, <protocol>)`.
486
+
487
+ In most cases, this is verified by type.__subclasscheck__.
488
+ Checking it again unnecessarily would slow down issubclass() checks,
489
+ so, we don't perform this check unless we absolutely have to.
490
+
491
+ For various error paths, however,
492
+ we want to ensure that *this* error message is shown to the user
493
+ where relevant, rather than a typing.py-specific error message.
494
+ """
495
+ if not isinstance(arg, type):
496
+ # Same error message as for issubclass(1, int).
497
+ raise TypeError('issubclass() arg 1 must be a class')
498
+
499
+ # Inheriting from typing._ProtocolMeta isn't actually desirable,
500
+ # but is necessary to allow typing.Protocol and typing_extensions.Protocol
501
+ # to mix without getting TypeErrors about "metaclass conflict"
502
+ class _ProtocolMeta(type(typing.Protocol)):
503
+ # This metaclass is somewhat unfortunate,
504
+ # but is necessary for several reasons...
505
+ #
506
+ # NOTE: DO NOT call super() in any methods in this class
507
+ # That would call the methods on typing._ProtocolMeta on Python 3.8-3.11
508
+ # and those are slow
509
+ def __new__(mcls, name, bases, namespace, **kwargs):
510
+ if name == "Protocol" and len(bases) < 2:
511
+ pass
512
+ elif {Protocol, typing.Protocol} & set(bases):
513
+ for base in bases:
514
+ if not (
515
+ base in {object, typing.Generic, Protocol, typing.Protocol}
516
+ or base.__name__ in _PROTO_ALLOWLIST.get(base.__module__, [])
517
+ or is_protocol(base)
518
+ ):
519
+ raise TypeError(
520
+ f"Protocols can only inherit from other protocols, "
521
+ f"got {base!r}"
522
+ )
523
+ return abc.ABCMeta.__new__(mcls, name, bases, namespace, **kwargs)
524
+
525
+ def __init__(cls, *args, **kwargs):
526
+ abc.ABCMeta.__init__(cls, *args, **kwargs)
527
+ if getattr(cls, "_is_protocol", False):
528
+ cls.__protocol_attrs__ = _get_protocol_attrs(cls)
529
+
530
+ def __subclasscheck__(cls, other):
531
+ if cls is Protocol:
532
+ return type.__subclasscheck__(cls, other)
533
+ if (
534
+ getattr(cls, '_is_protocol', False)
535
+ and not _allow_reckless_class_checks()
536
+ ):
537
+ if not getattr(cls, '_is_runtime_protocol', False):
538
+ _type_check_issubclass_arg_1(other)
539
+ raise TypeError(
540
+ "Instance and class checks can only be used with "
541
+ "@runtime_checkable protocols"
542
+ )
543
+ if (
544
+ # this attribute is set by @runtime_checkable:
545
+ cls.__non_callable_proto_members__
546
+ and cls.__dict__.get("__subclasshook__") is _proto_hook
547
+ ):
548
+ _type_check_issubclass_arg_1(other)
549
+ non_method_attrs = sorted(cls.__non_callable_proto_members__)
550
+ raise TypeError(
551
+ "Protocols with non-method members don't support issubclass()."
552
+ f" Non-method members: {str(non_method_attrs)[1:-1]}."
553
+ )
554
+ return abc.ABCMeta.__subclasscheck__(cls, other)
555
+
556
+ def __instancecheck__(cls, instance):
557
+ # We need this method for situations where attributes are
558
+ # assigned in __init__.
559
+ if cls is Protocol:
560
+ return type.__instancecheck__(cls, instance)
561
+ if not getattr(cls, "_is_protocol", False):
562
+ # i.e., it's a concrete subclass of a protocol
563
+ return abc.ABCMeta.__instancecheck__(cls, instance)
564
+
565
+ if (
566
+ not getattr(cls, '_is_runtime_protocol', False) and
567
+ not _allow_reckless_class_checks()
568
+ ):
569
+ raise TypeError("Instance and class checks can only be used with"
570
+ " @runtime_checkable protocols")
571
+
572
+ if abc.ABCMeta.__instancecheck__(cls, instance):
573
+ return True
574
+
575
+ for attr in cls.__protocol_attrs__:
576
+ try:
577
+ val = inspect.getattr_static(instance, attr)
578
+ except AttributeError:
579
+ break
580
+ # this attribute is set by @runtime_checkable:
581
+ if val is None and attr not in cls.__non_callable_proto_members__:
582
+ break
583
+ else:
584
+ return True
585
+
586
+ return False
587
+
588
+ def __eq__(cls, other):
589
+ # Hack so that typing.Generic.__class_getitem__
590
+ # treats typing_extensions.Protocol
591
+ # as equivalent to typing.Protocol
592
+ if abc.ABCMeta.__eq__(cls, other) is True:
593
+ return True
594
+ return cls is Protocol and other is typing.Protocol
595
+
596
+ # This has to be defined, or the abc-module cache
597
+ # complains about classes with this metaclass being unhashable,
598
+ # if we define only __eq__!
599
+ def __hash__(cls) -> int:
600
+ return type.__hash__(cls)
601
+
602
+ @classmethod
603
+ def _proto_hook(cls, other):
604
+ if not cls.__dict__.get('_is_protocol', False):
605
+ return NotImplemented
606
+
607
+ for attr in cls.__protocol_attrs__:
608
+ for base in other.__mro__:
609
+ # Check if the members appears in the class dictionary...
610
+ if attr in base.__dict__:
611
+ if base.__dict__[attr] is None:
612
+ return NotImplemented
613
+ break
614
+
615
+ # ...or in annotations, if it is a sub-protocol.
616
+ annotations = getattr(base, '__annotations__', {})
617
+ if (
618
+ isinstance(annotations, collections.abc.Mapping)
619
+ and attr in annotations
620
+ and is_protocol(other)
621
+ ):
622
+ break
623
+ else:
624
+ return NotImplemented
625
+ return True
626
+
627
+ class Protocol(typing.Generic, metaclass=_ProtocolMeta):
628
+ __doc__ = typing.Protocol.__doc__
629
+ __slots__ = ()
630
+ _is_protocol = True
631
+ _is_runtime_protocol = False
632
+
633
+ def __init_subclass__(cls, *args, **kwargs):
634
+ super().__init_subclass__(*args, **kwargs)
635
+
636
+ # Determine if this is a protocol or a concrete subclass.
637
+ if not cls.__dict__.get('_is_protocol', False):
638
+ cls._is_protocol = any(b is Protocol for b in cls.__bases__)
639
+
640
+ # Set (or override) the protocol subclass hook.
641
+ if '__subclasshook__' not in cls.__dict__:
642
+ cls.__subclasshook__ = _proto_hook
643
+
644
+ # Prohibit instantiation for protocol classes
645
+ if cls._is_protocol and cls.__init__ is Protocol.__init__:
646
+ cls.__init__ = _no_init
647
+
648
+
649
+ if sys.version_info >= (3, 13):
650
+ runtime_checkable = typing.runtime_checkable
651
+ else:
652
+ def runtime_checkable(cls):
653
+ """Mark a protocol class as a runtime protocol.
654
+
655
+ Such protocol can be used with isinstance() and issubclass().
656
+ Raise TypeError if applied to a non-protocol class.
657
+ This allows a simple-minded structural check very similar to
658
+ one trick ponies in collections.abc such as Iterable.
659
+
660
+ For example::
661
+
662
+ @runtime_checkable
663
+ class Closable(Protocol):
664
+ def close(self): ...
665
+
666
+ assert isinstance(open('/some/file'), Closable)
667
+
668
+ Warning: this will check only the presence of the required methods,
669
+ not their type signatures!
670
+ """
671
+ if not issubclass(cls, typing.Generic) or not getattr(cls, '_is_protocol', False):
672
+ raise TypeError('@runtime_checkable can be only applied to protocol classes,'
673
+ ' got %r' % cls)
674
+ cls._is_runtime_protocol = True
675
+
676
+ # Only execute the following block if it's a typing_extensions.Protocol class.
677
+ # typing.Protocol classes don't need it.
678
+ if isinstance(cls, _ProtocolMeta):
679
+ # PEP 544 prohibits using issubclass()
680
+ # with protocols that have non-method members.
681
+ # See gh-113320 for why we compute this attribute here,
682
+ # rather than in `_ProtocolMeta.__init__`
683
+ cls.__non_callable_proto_members__ = set()
684
+ for attr in cls.__protocol_attrs__:
685
+ try:
686
+ is_callable = callable(getattr(cls, attr, None))
687
+ except Exception as e:
688
+ raise TypeError(
689
+ f"Failed to determine whether protocol member {attr!r} "
690
+ "is a method member"
691
+ ) from e
692
+ else:
693
+ if not is_callable:
694
+ cls.__non_callable_proto_members__.add(attr)
695
+
696
+ return cls
697
+
698
+
699
+ # The "runtime" alias exists for backwards compatibility.
700
+ runtime = runtime_checkable
701
+
702
+
703
+ # Our version of runtime-checkable protocols is faster on Python 3.8-3.11
704
+ if sys.version_info >= (3, 12):
705
+ SupportsInt = typing.SupportsInt
706
+ SupportsFloat = typing.SupportsFloat
707
+ SupportsComplex = typing.SupportsComplex
708
+ SupportsBytes = typing.SupportsBytes
709
+ SupportsIndex = typing.SupportsIndex
710
+ SupportsAbs = typing.SupportsAbs
711
+ SupportsRound = typing.SupportsRound
712
+ else:
713
+ @runtime_checkable
714
+ class SupportsInt(Protocol):
715
+ """An ABC with one abstract method __int__."""
716
+ __slots__ = ()
717
+
718
+ @abc.abstractmethod
719
+ def __int__(self) -> int:
720
+ pass
721
+
722
+ @runtime_checkable
723
+ class SupportsFloat(Protocol):
724
+ """An ABC with one abstract method __float__."""
725
+ __slots__ = ()
726
+
727
+ @abc.abstractmethod
728
+ def __float__(self) -> float:
729
+ pass
730
+
731
+ @runtime_checkable
732
+ class SupportsComplex(Protocol):
733
+ """An ABC with one abstract method __complex__."""
734
+ __slots__ = ()
735
+
736
+ @abc.abstractmethod
737
+ def __complex__(self) -> complex:
738
+ pass
739
+
740
+ @runtime_checkable
741
+ class SupportsBytes(Protocol):
742
+ """An ABC with one abstract method __bytes__."""
743
+ __slots__ = ()
744
+
745
+ @abc.abstractmethod
746
+ def __bytes__(self) -> bytes:
747
+ pass
748
+
749
+ @runtime_checkable
750
+ class SupportsIndex(Protocol):
751
+ __slots__ = ()
752
+
753
+ @abc.abstractmethod
754
+ def __index__(self) -> int:
755
+ pass
756
+
757
+ @runtime_checkable
758
+ class SupportsAbs(Protocol[T_co]):
759
+ """
760
+ An ABC with one abstract method __abs__ that is covariant in its return type.
761
+ """
762
+ __slots__ = ()
763
+
764
+ @abc.abstractmethod
765
+ def __abs__(self) -> T_co:
766
+ pass
767
+
768
+ @runtime_checkable
769
+ class SupportsRound(Protocol[T_co]):
770
+ """
771
+ An ABC with one abstract method __round__ that is covariant in its return type.
772
+ """
773
+ __slots__ = ()
774
+
775
+ @abc.abstractmethod
776
+ def __round__(self, ndigits: int = 0) -> T_co:
777
+ pass
778
+
779
+
780
+ def _ensure_subclassable(mro_entries):
781
+ def inner(func):
782
+ if sys.implementation.name == "pypy" and sys.version_info < (3, 9):
783
+ cls_dict = {
784
+ "__call__": staticmethod(func),
785
+ "__mro_entries__": staticmethod(mro_entries)
786
+ }
787
+ t = type(func.__name__, (), cls_dict)
788
+ return functools.update_wrapper(t(), func)
789
+ else:
790
+ func.__mro_entries__ = mro_entries
791
+ return func
792
+ return inner
793
+
794
+
795
+ # Update this to something like >=3.13.0b1 if and when
796
+ # PEP 728 is implemented in CPython
797
+ _PEP_728_IMPLEMENTED = False
798
+
799
+ if _PEP_728_IMPLEMENTED:
800
+ # The standard library TypedDict in Python 3.8 does not store runtime information
801
+ # about which (if any) keys are optional. See https://bugs.python.org/issue38834
802
+ # The standard library TypedDict in Python 3.9.0/1 does not honour the "total"
803
+ # keyword with old-style TypedDict(). See https://bugs.python.org/issue42059
804
+ # The standard library TypedDict below Python 3.11 does not store runtime
805
+ # information about optional and required keys when using Required or NotRequired.
806
+ # Generic TypedDicts are also impossible using typing.TypedDict on Python <3.11.
807
+ # Aaaand on 3.12 we add __orig_bases__ to TypedDict
808
+ # to enable better runtime introspection.
809
+ # On 3.13 we deprecate some odd ways of creating TypedDicts.
810
+ # Also on 3.13, PEP 705 adds the ReadOnly[] qualifier.
811
+ # PEP 728 (still pending) makes more changes.
812
+ TypedDict = typing.TypedDict
813
+ _TypedDictMeta = typing._TypedDictMeta
814
+ is_typeddict = typing.is_typeddict
815
+ else:
816
+ # 3.10.0 and later
817
+ _TAKES_MODULE = "module" in inspect.signature(typing._type_check).parameters
818
+
819
+ def _get_typeddict_qualifiers(annotation_type):
820
+ while True:
821
+ annotation_origin = get_origin(annotation_type)
822
+ if annotation_origin is Annotated:
823
+ annotation_args = get_args(annotation_type)
824
+ if annotation_args:
825
+ annotation_type = annotation_args[0]
826
+ else:
827
+ break
828
+ elif annotation_origin is Required:
829
+ yield Required
830
+ annotation_type, = get_args(annotation_type)
831
+ elif annotation_origin is NotRequired:
832
+ yield NotRequired
833
+ annotation_type, = get_args(annotation_type)
834
+ elif annotation_origin is ReadOnly:
835
+ yield ReadOnly
836
+ annotation_type, = get_args(annotation_type)
837
+ else:
838
+ break
839
+
840
+ class _TypedDictMeta(type):
841
+ def __new__(cls, name, bases, ns, *, total=True, closed=False):
842
+ """Create new typed dict class object.
843
+
844
+ This method is called when TypedDict is subclassed,
845
+ or when TypedDict is instantiated. This way
846
+ TypedDict supports all three syntax forms described in its docstring.
847
+ Subclasses and instances of TypedDict return actual dictionaries.
848
+ """
849
+ for base in bases:
850
+ if type(base) is not _TypedDictMeta and base is not typing.Generic:
851
+ raise TypeError('cannot inherit from both a TypedDict type '
852
+ 'and a non-TypedDict base class')
853
+
854
+ if any(issubclass(b, typing.Generic) for b in bases):
855
+ generic_base = (typing.Generic,)
856
+ else:
857
+ generic_base = ()
858
+
859
+ # typing.py generally doesn't let you inherit from plain Generic, unless
860
+ # the name of the class happens to be "Protocol"
861
+ tp_dict = type.__new__(_TypedDictMeta, "Protocol", (*generic_base, dict), ns)
862
+ tp_dict.__name__ = name
863
+ if tp_dict.__qualname__ == "Protocol":
864
+ tp_dict.__qualname__ = name
865
+
866
+ if not hasattr(tp_dict, '__orig_bases__'):
867
+ tp_dict.__orig_bases__ = bases
868
+
869
+ annotations = {}
870
+ own_annotations = ns.get('__annotations__', {})
871
+ msg = "TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a type"
872
+ if _TAKES_MODULE:
873
+ own_annotations = {
874
+ n: typing._type_check(tp, msg, module=tp_dict.__module__)
875
+ for n, tp in own_annotations.items()
876
+ }
877
+ else:
878
+ own_annotations = {
879
+ n: typing._type_check(tp, msg)
880
+ for n, tp in own_annotations.items()
881
+ }
882
+ required_keys = set()
883
+ optional_keys = set()
884
+ readonly_keys = set()
885
+ mutable_keys = set()
886
+ extra_items_type = None
887
+
888
+ for base in bases:
889
+ base_dict = base.__dict__
890
+
891
+ annotations.update(base_dict.get('__annotations__', {}))
892
+ required_keys.update(base_dict.get('__required_keys__', ()))
893
+ optional_keys.update(base_dict.get('__optional_keys__', ()))
894
+ readonly_keys.update(base_dict.get('__readonly_keys__', ()))
895
+ mutable_keys.update(base_dict.get('__mutable_keys__', ()))
896
+ base_extra_items_type = base_dict.get('__extra_items__', None)
897
+ if base_extra_items_type is not None:
898
+ extra_items_type = base_extra_items_type
899
+
900
+ if closed and extra_items_type is None:
901
+ extra_items_type = Never
902
+ if closed and "__extra_items__" in own_annotations:
903
+ annotation_type = own_annotations.pop("__extra_items__")
904
+ qualifiers = set(_get_typeddict_qualifiers(annotation_type))
905
+ if Required in qualifiers:
906
+ raise TypeError(
907
+ "Special key __extra_items__ does not support "
908
+ "Required"
909
+ )
910
+ if NotRequired in qualifiers:
911
+ raise TypeError(
912
+ "Special key __extra_items__ does not support "
913
+ "NotRequired"
914
+ )
915
+ extra_items_type = annotation_type
916
+
917
+ annotations.update(own_annotations)
918
+ for annotation_key, annotation_type in own_annotations.items():
919
+ qualifiers = set(_get_typeddict_qualifiers(annotation_type))
920
+
921
+ if Required in qualifiers:
922
+ required_keys.add(annotation_key)
923
+ elif NotRequired in qualifiers:
924
+ optional_keys.add(annotation_key)
925
+ elif total:
926
+ required_keys.add(annotation_key)
927
+ else:
928
+ optional_keys.add(annotation_key)
929
+ if ReadOnly in qualifiers:
930
+ mutable_keys.discard(annotation_key)
931
+ readonly_keys.add(annotation_key)
932
+ else:
933
+ mutable_keys.add(annotation_key)
934
+ readonly_keys.discard(annotation_key)
935
+
936
+ tp_dict.__annotations__ = annotations
937
+ tp_dict.__required_keys__ = frozenset(required_keys)
938
+ tp_dict.__optional_keys__ = frozenset(optional_keys)
939
+ tp_dict.__readonly_keys__ = frozenset(readonly_keys)
940
+ tp_dict.__mutable_keys__ = frozenset(mutable_keys)
941
+ if not hasattr(tp_dict, '__total__'):
942
+ tp_dict.__total__ = total
943
+ tp_dict.__closed__ = closed
944
+ tp_dict.__extra_items__ = extra_items_type
945
+ return tp_dict
946
+
947
+ __call__ = dict # static method
948
+
949
+ def __subclasscheck__(cls, other):
950
+ # Typed dicts are only for static structural subtyping.
951
+ raise TypeError('TypedDict does not support instance and class checks')
952
+
953
+ __instancecheck__ = __subclasscheck__
954
+
955
+ _TypedDict = type.__new__(_TypedDictMeta, 'TypedDict', (), {})
956
+
957
+ @_ensure_subclassable(lambda bases: (_TypedDict,))
958
+ def TypedDict(typename, fields=_marker, /, *, total=True, closed=False, **kwargs):
959
+ """A simple typed namespace. At runtime it is equivalent to a plain dict.
960
+
961
+ TypedDict creates a dictionary type such that a type checker will expect all
962
+ instances to have a certain set of keys, where each key is
963
+ associated with a value of a consistent type. This expectation
964
+ is not checked at runtime.
965
+
966
+ Usage::
967
+
968
+ class Point2D(TypedDict):
969
+ x: int
970
+ y: int
971
+ label: str
972
+
973
+ a: Point2D = {'x': 1, 'y': 2, 'label': 'good'} # OK
974
+ b: Point2D = {'z': 3, 'label': 'bad'} # Fails type check
975
+
976
+ assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')
977
+
978
+ The type info can be accessed via the Point2D.__annotations__ dict, and
979
+ the Point2D.__required_keys__ and Point2D.__optional_keys__ frozensets.
980
+ TypedDict supports an additional equivalent form::
981
+
982
+ Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})
983
+
984
+ By default, all keys must be present in a TypedDict. It is possible
985
+ to override this by specifying totality::
986
+
987
+ class Point2D(TypedDict, total=False):
988
+ x: int
989
+ y: int
990
+
991
+ This means that a Point2D TypedDict can have any of the keys omitted. A type
992
+ checker is only expected to support a literal False or True as the value of
993
+ the total argument. True is the default, and makes all items defined in the
994
+ class body be required.
995
+
996
+ The Required and NotRequired special forms can also be used to mark
997
+ individual keys as being required or not required::
998
+
999
+ class Point2D(TypedDict):
1000
+ x: int # the "x" key must always be present (Required is the default)
1001
+ y: NotRequired[int] # the "y" key can be omitted
1002
+
1003
+ See PEP 655 for more details on Required and NotRequired.
1004
+ """
1005
+ if fields is _marker or fields is None:
1006
+ if fields is _marker:
1007
+ deprecated_thing = "Failing to pass a value for the 'fields' parameter"
1008
+ else:
1009
+ deprecated_thing = "Passing `None` as the 'fields' parameter"
1010
+
1011
+ example = f"`{typename} = TypedDict({typename!r}, {{}})`"
1012
+ deprecation_msg = (
1013
+ f"{deprecated_thing} is deprecated and will be disallowed in "
1014
+ "Python 3.15. To create a TypedDict class with 0 fields "
1015
+ "using the functional syntax, pass an empty dictionary, e.g. "
1016
+ ) + example + "."
1017
+ warnings.warn(deprecation_msg, DeprecationWarning, stacklevel=2)
1018
+ if closed is not False and closed is not True:
1019
+ kwargs["closed"] = closed
1020
+ closed = False
1021
+ fields = kwargs
1022
+ elif kwargs:
1023
+ raise TypeError("TypedDict takes either a dict or keyword arguments,"
1024
+ " but not both")
1025
+ if kwargs:
1026
+ if sys.version_info >= (3, 13):
1027
+ raise TypeError("TypedDict takes no keyword arguments")
1028
+ warnings.warn(
1029
+ "The kwargs-based syntax for TypedDict definitions is deprecated "
1030
+ "in Python 3.11, will be removed in Python 3.13, and may not be "
1031
+ "understood by third-party type checkers.",
1032
+ DeprecationWarning,
1033
+ stacklevel=2,
1034
+ )
1035
+
1036
+ ns = {'__annotations__': dict(fields)}
1037
+ module = _caller()
1038
+ if module is not None:
1039
+ # Setting correct module is necessary to make typed dict classes pickleable.
1040
+ ns['__module__'] = module
1041
+
1042
+ td = _TypedDictMeta(typename, (), ns, total=total, closed=closed)
1043
+ td.__orig_bases__ = (TypedDict,)
1044
+ return td
1045
+
1046
+ if hasattr(typing, "_TypedDictMeta"):
1047
+ _TYPEDDICT_TYPES = (typing._TypedDictMeta, _TypedDictMeta)
1048
+ else:
1049
+ _TYPEDDICT_TYPES = (_TypedDictMeta,)
1050
+
1051
+ def is_typeddict(tp):
1052
+ """Check if an annotation is a TypedDict class
1053
+
1054
+ For example::
1055
+ class Film(TypedDict):
1056
+ title: str
1057
+ year: int
1058
+
1059
+ is_typeddict(Film) # => True
1060
+ is_typeddict(Union[list, str]) # => False
1061
+ """
1062
+ # On 3.8, this would otherwise return True
1063
+ if hasattr(typing, "TypedDict") and tp is typing.TypedDict:
1064
+ return False
1065
+ return isinstance(tp, _TYPEDDICT_TYPES)
1066
+
1067
+
1068
+ if hasattr(typing, "assert_type"):
1069
+ assert_type = typing.assert_type
1070
+
1071
+ else:
1072
+ def assert_type(val, typ, /):
1073
+ """Assert (to the type checker) that the value is of the given type.
1074
+
1075
+ When the type checker encounters a call to assert_type(), it
1076
+ emits an error if the value is not of the specified type::
1077
+
1078
+ def greet(name: str) -> None:
1079
+ assert_type(name, str) # ok
1080
+ assert_type(name, int) # type checker error
1081
+
1082
+ At runtime this returns the first argument unchanged and otherwise
1083
+ does nothing.
1084
+ """
1085
+ return val
1086
+
1087
+
1088
+ if hasattr(typing, "ReadOnly"): # 3.13+
1089
+ get_type_hints = typing.get_type_hints
1090
+ else: # <=3.13
1091
+ # replaces _strip_annotations()
1092
+ def _strip_extras(t):
1093
+ """Strips Annotated, Required and NotRequired from a given type."""
1094
+ if isinstance(t, _AnnotatedAlias):
1095
+ return _strip_extras(t.__origin__)
1096
+ if hasattr(t, "__origin__") and t.__origin__ in (Required, NotRequired, ReadOnly):
1097
+ return _strip_extras(t.__args__[0])
1098
+ if isinstance(t, typing._GenericAlias):
1099
+ stripped_args = tuple(_strip_extras(a) for a in t.__args__)
1100
+ if stripped_args == t.__args__:
1101
+ return t
1102
+ return t.copy_with(stripped_args)
1103
+ if hasattr(_types, "GenericAlias") and isinstance(t, _types.GenericAlias):
1104
+ stripped_args = tuple(_strip_extras(a) for a in t.__args__)
1105
+ if stripped_args == t.__args__:
1106
+ return t
1107
+ return _types.GenericAlias(t.__origin__, stripped_args)
1108
+ if hasattr(_types, "UnionType") and isinstance(t, _types.UnionType):
1109
+ stripped_args = tuple(_strip_extras(a) for a in t.__args__)
1110
+ if stripped_args == t.__args__:
1111
+ return t
1112
+ return functools.reduce(operator.or_, stripped_args)
1113
+
1114
+ return t
1115
+
1116
+ def get_type_hints(obj, globalns=None, localns=None, include_extras=False):
1117
+ """Return type hints for an object.
1118
+
1119
+ This is often the same as obj.__annotations__, but it handles
1120
+ forward references encoded as string literals, adds Optional[t] if a
1121
+ default value equal to None is set and recursively replaces all
1122
+ 'Annotated[T, ...]', 'Required[T]' or 'NotRequired[T]' with 'T'
1123
+ (unless 'include_extras=True').
1124
+
1125
+ The argument may be a module, class, method, or function. The annotations
1126
+ are returned as a dictionary. For classes, annotations include also
1127
+ inherited members.
1128
+
1129
+ TypeError is raised if the argument is not of a type that can contain
1130
+ annotations, and an empty dictionary is returned if no annotations are
1131
+ present.
1132
+
1133
+ BEWARE -- the behavior of globalns and localns is counterintuitive
1134
+ (unless you are familiar with how eval() and exec() work). The
1135
+ search order is locals first, then globals.
1136
+
1137
+ - If no dict arguments are passed, an attempt is made to use the
1138
+ globals from obj (or the respective module's globals for classes),
1139
+ and these are also used as the locals. If the object does not appear
1140
+ to have globals, an empty dictionary is used.
1141
+
1142
+ - If one dict argument is passed, it is used for both globals and
1143
+ locals.
1144
+
1145
+ - If two dict arguments are passed, they specify globals and
1146
+ locals, respectively.
1147
+ """
1148
+ if hasattr(typing, "Annotated"): # 3.9+
1149
+ hint = typing.get_type_hints(
1150
+ obj, globalns=globalns, localns=localns, include_extras=True
1151
+ )
1152
+ else: # 3.8
1153
+ hint = typing.get_type_hints(obj, globalns=globalns, localns=localns)
1154
+ if include_extras:
1155
+ return hint
1156
+ return {k: _strip_extras(t) for k, t in hint.items()}
1157
+
1158
+
1159
+ # Python 3.9+ has PEP 593 (Annotated)
1160
+ if hasattr(typing, 'Annotated'):
1161
+ Annotated = typing.Annotated
1162
+ # Not exported and not a public API, but needed for get_origin() and get_args()
1163
+ # to work.
1164
+ _AnnotatedAlias = typing._AnnotatedAlias
1165
+ # 3.8
1166
+ else:
1167
+ class _AnnotatedAlias(typing._GenericAlias, _root=True):
1168
+ """Runtime representation of an annotated type.
1169
+
1170
+ At its core 'Annotated[t, dec1, dec2, ...]' is an alias for the type 't'
1171
+ with extra annotations. The alias behaves like a normal typing alias,
1172
+ instantiating is the same as instantiating the underlying type, binding
1173
+ it to types is also the same.
1174
+ """
1175
+ def __init__(self, origin, metadata):
1176
+ if isinstance(origin, _AnnotatedAlias):
1177
+ metadata = origin.__metadata__ + metadata
1178
+ origin = origin.__origin__
1179
+ super().__init__(origin, origin)
1180
+ self.__metadata__ = metadata
1181
+
1182
+ def copy_with(self, params):
1183
+ assert len(params) == 1
1184
+ new_type = params[0]
1185
+ return _AnnotatedAlias(new_type, self.__metadata__)
1186
+
1187
+ def __repr__(self):
1188
+ return (f"typing_extensions.Annotated[{typing._type_repr(self.__origin__)}, "
1189
+ f"{', '.join(repr(a) for a in self.__metadata__)}]")
1190
+
1191
+ def __reduce__(self):
1192
+ return operator.getitem, (
1193
+ Annotated, (self.__origin__,) + self.__metadata__
1194
+ )
1195
+
1196
+ def __eq__(self, other):
1197
+ if not isinstance(other, _AnnotatedAlias):
1198
+ return NotImplemented
1199
+ if self.__origin__ != other.__origin__:
1200
+ return False
1201
+ return self.__metadata__ == other.__metadata__
1202
+
1203
+ def __hash__(self):
1204
+ return hash((self.__origin__, self.__metadata__))
1205
+
1206
+ class Annotated:
1207
+ """Add context specific metadata to a type.
1208
+
1209
+ Example: Annotated[int, runtime_check.Unsigned] indicates to the
1210
+ hypothetical runtime_check module that this type is an unsigned int.
1211
+ Every other consumer of this type can ignore this metadata and treat
1212
+ this type as int.
1213
+
1214
+ The first argument to Annotated must be a valid type (and will be in
1215
+ the __origin__ field), the remaining arguments are kept as a tuple in
1216
+ the __extra__ field.
1217
+
1218
+ Details:
1219
+
1220
+ - It's an error to call `Annotated` with less than two arguments.
1221
+ - Nested Annotated are flattened::
1222
+
1223
+ Annotated[Annotated[T, Ann1, Ann2], Ann3] == Annotated[T, Ann1, Ann2, Ann3]
1224
+
1225
+ - Instantiating an annotated type is equivalent to instantiating the
1226
+ underlying type::
1227
+
1228
+ Annotated[C, Ann1](5) == C(5)
1229
+
1230
+ - Annotated can be used as a generic type alias::
1231
+
1232
+ Optimized = Annotated[T, runtime.Optimize()]
1233
+ Optimized[int] == Annotated[int, runtime.Optimize()]
1234
+
1235
+ OptimizedList = Annotated[List[T], runtime.Optimize()]
1236
+ OptimizedList[int] == Annotated[List[int], runtime.Optimize()]
1237
+ """
1238
+
1239
+ __slots__ = ()
1240
+
1241
+ def __new__(cls, *args, **kwargs):
1242
+ raise TypeError("Type Annotated cannot be instantiated.")
1243
+
1244
+ @typing._tp_cache
1245
+ def __class_getitem__(cls, params):
1246
+ if not isinstance(params, tuple) or len(params) < 2:
1247
+ raise TypeError("Annotated[...] should be used "
1248
+ "with at least two arguments (a type and an "
1249
+ "annotation).")
1250
+ allowed_special_forms = (ClassVar, Final)
1251
+ if get_origin(params[0]) in allowed_special_forms:
1252
+ origin = params[0]
1253
+ else:
1254
+ msg = "Annotated[t, ...]: t must be a type."
1255
+ origin = typing._type_check(params[0], msg)
1256
+ metadata = tuple(params[1:])
1257
+ return _AnnotatedAlias(origin, metadata)
1258
+
1259
+ def __init_subclass__(cls, *args, **kwargs):
1260
+ raise TypeError(
1261
+ f"Cannot subclass {cls.__module__}.Annotated"
1262
+ )
1263
+
1264
+ # Python 3.8 has get_origin() and get_args() but those implementations aren't
1265
+ # Annotated-aware, so we can't use those. Python 3.9's versions don't support
1266
+ # ParamSpecArgs and ParamSpecKwargs, so only Python 3.10's versions will do.
1267
+ if sys.version_info[:2] >= (3, 10):
1268
+ get_origin = typing.get_origin
1269
+ get_args = typing.get_args
1270
+ # 3.8-3.9
1271
+ else:
1272
+ try:
1273
+ # 3.9+
1274
+ from typing import _BaseGenericAlias
1275
+ except ImportError:
1276
+ _BaseGenericAlias = typing._GenericAlias
1277
+ try:
1278
+ # 3.9+
1279
+ from typing import GenericAlias as _typing_GenericAlias
1280
+ except ImportError:
1281
+ _typing_GenericAlias = typing._GenericAlias
1282
+
1283
+ def get_origin(tp):
1284
+ """Get the unsubscripted version of a type.
1285
+
1286
+ This supports generic types, Callable, Tuple, Union, Literal, Final, ClassVar
1287
+ and Annotated. Return None for unsupported types. Examples::
1288
+
1289
+ get_origin(Literal[42]) is Literal
1290
+ get_origin(int) is None
1291
+ get_origin(ClassVar[int]) is ClassVar
1292
+ get_origin(Generic) is Generic
1293
+ get_origin(Generic[T]) is Generic
1294
+ get_origin(Union[T, int]) is Union
1295
+ get_origin(List[Tuple[T, T]][int]) == list
1296
+ get_origin(P.args) is P
1297
+ """
1298
+ if isinstance(tp, _AnnotatedAlias):
1299
+ return Annotated
1300
+ if isinstance(tp, (typing._GenericAlias, _typing_GenericAlias, _BaseGenericAlias,
1301
+ ParamSpecArgs, ParamSpecKwargs)):
1302
+ return tp.__origin__
1303
+ if tp is typing.Generic:
1304
+ return typing.Generic
1305
+ return None
1306
+
1307
+ def get_args(tp):
1308
+ """Get type arguments with all substitutions performed.
1309
+
1310
+ For unions, basic simplifications used by Union constructor are performed.
1311
+ Examples::
1312
+ get_args(Dict[str, int]) == (str, int)
1313
+ get_args(int) == ()
1314
+ get_args(Union[int, Union[T, int], str][int]) == (int, str)
1315
+ get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, int])
1316
+ get_args(Callable[[], T][int]) == ([], int)
1317
+ """
1318
+ if isinstance(tp, _AnnotatedAlias):
1319
+ return (tp.__origin__,) + tp.__metadata__
1320
+ if isinstance(tp, (typing._GenericAlias, _typing_GenericAlias)):
1321
+ if getattr(tp, "_special", False):
1322
+ return ()
1323
+ res = tp.__args__
1324
+ if get_origin(tp) is collections.abc.Callable and res[0] is not Ellipsis:
1325
+ res = (list(res[:-1]), res[-1])
1326
+ return res
1327
+ return ()
1328
+
1329
+
1330
+ # 3.10+
1331
+ if hasattr(typing, 'TypeAlias'):
1332
+ TypeAlias = typing.TypeAlias
1333
+ # 3.9
1334
+ elif sys.version_info[:2] >= (3, 9):
1335
+ @_ExtensionsSpecialForm
1336
+ def TypeAlias(self, parameters):
1337
+ """Special marker indicating that an assignment should
1338
+ be recognized as a proper type alias definition by type
1339
+ checkers.
1340
+
1341
+ For example::
1342
+
1343
+ Predicate: TypeAlias = Callable[..., bool]
1344
+
1345
+ It's invalid when used anywhere except as in the example above.
1346
+ """
1347
+ raise TypeError(f"{self} is not subscriptable")
1348
+ # 3.8
1349
+ else:
1350
+ TypeAlias = _ExtensionsSpecialForm(
1351
+ 'TypeAlias',
1352
+ doc="""Special marker indicating that an assignment should
1353
+ be recognized as a proper type alias definition by type
1354
+ checkers.
1355
+
1356
+ For example::
1357
+
1358
+ Predicate: TypeAlias = Callable[..., bool]
1359
+
1360
+ It's invalid when used anywhere except as in the example
1361
+ above."""
1362
+ )
1363
+
1364
+
1365
+ def _set_default(type_param, default):
1366
+ if isinstance(default, (tuple, list)):
1367
+ type_param.__default__ = tuple((typing._type_check(d, "Default must be a type")
1368
+ for d in default))
1369
+ elif default != _marker:
1370
+ if isinstance(type_param, ParamSpec) and default is ...: # ... not valid <3.11
1371
+ type_param.__default__ = default
1372
+ else:
1373
+ type_param.__default__ = typing._type_check(default, "Default must be a type")
1374
+ else:
1375
+ type_param.__default__ = None
1376
+
1377
+
1378
+ def _set_module(typevarlike):
1379
+ # for pickling:
1380
+ def_mod = _caller(depth=3)
1381
+ if def_mod != 'typing_extensions':
1382
+ typevarlike.__module__ = def_mod
1383
+
1384
+
1385
+ class _DefaultMixin:
1386
+ """Mixin for TypeVarLike defaults."""
1387
+
1388
+ __slots__ = ()
1389
+ __init__ = _set_default
1390
+
1391
+
1392
+ # Classes using this metaclass must provide a _backported_typevarlike ClassVar
1393
+ class _TypeVarLikeMeta(type):
1394
+ def __instancecheck__(cls, __instance: Any) -> bool:
1395
+ return isinstance(__instance, cls._backported_typevarlike)
1396
+
1397
+
1398
+ # Add default and infer_variance parameters from PEP 696 and 695
1399
+ class TypeVar(metaclass=_TypeVarLikeMeta):
1400
+ """Type variable."""
1401
+
1402
+ _backported_typevarlike = typing.TypeVar
1403
+
1404
+ def __new__(cls, name, *constraints, bound=None,
1405
+ covariant=False, contravariant=False,
1406
+ default=_marker, infer_variance=False):
1407
+ if hasattr(typing, "TypeAliasType"):
1408
+ # PEP 695 implemented (3.12+), can pass infer_variance to typing.TypeVar
1409
+ typevar = typing.TypeVar(name, *constraints, bound=bound,
1410
+ covariant=covariant, contravariant=contravariant,
1411
+ infer_variance=infer_variance)
1412
+ else:
1413
+ typevar = typing.TypeVar(name, *constraints, bound=bound,
1414
+ covariant=covariant, contravariant=contravariant)
1415
+ if infer_variance and (covariant or contravariant):
1416
+ raise ValueError("Variance cannot be specified with infer_variance.")
1417
+ typevar.__infer_variance__ = infer_variance
1418
+ _set_default(typevar, default)
1419
+ _set_module(typevar)
1420
+ return typevar
1421
+
1422
+ def __init_subclass__(cls) -> None:
1423
+ raise TypeError(f"type '{__name__}.TypeVar' is not an acceptable base type")
1424
+
1425
+
1426
+ # Python 3.10+ has PEP 612
1427
+ if hasattr(typing, 'ParamSpecArgs'):
1428
+ ParamSpecArgs = typing.ParamSpecArgs
1429
+ ParamSpecKwargs = typing.ParamSpecKwargs
1430
+ # 3.8-3.9
1431
+ else:
1432
+ class _Immutable:
1433
+ """Mixin to indicate that object should not be copied."""
1434
+ __slots__ = ()
1435
+
1436
+ def __copy__(self):
1437
+ return self
1438
+
1439
+ def __deepcopy__(self, memo):
1440
+ return self
1441
+
1442
+ class ParamSpecArgs(_Immutable):
1443
+ """The args for a ParamSpec object.
1444
+
1445
+ Given a ParamSpec object P, P.args is an instance of ParamSpecArgs.
1446
+
1447
+ ParamSpecArgs objects have a reference back to their ParamSpec:
1448
+
1449
+ P.args.__origin__ is P
1450
+
1451
+ This type is meant for runtime introspection and has no special meaning to
1452
+ static type checkers.
1453
+ """
1454
+ def __init__(self, origin):
1455
+ self.__origin__ = origin
1456
+
1457
+ def __repr__(self):
1458
+ return f"{self.__origin__.__name__}.args"
1459
+
1460
+ def __eq__(self, other):
1461
+ if not isinstance(other, ParamSpecArgs):
1462
+ return NotImplemented
1463
+ return self.__origin__ == other.__origin__
1464
+
1465
+ class ParamSpecKwargs(_Immutable):
1466
+ """The kwargs for a ParamSpec object.
1467
+
1468
+ Given a ParamSpec object P, P.kwargs is an instance of ParamSpecKwargs.
1469
+
1470
+ ParamSpecKwargs objects have a reference back to their ParamSpec:
1471
+
1472
+ P.kwargs.__origin__ is P
1473
+
1474
+ This type is meant for runtime introspection and has no special meaning to
1475
+ static type checkers.
1476
+ """
1477
+ def __init__(self, origin):
1478
+ self.__origin__ = origin
1479
+
1480
+ def __repr__(self):
1481
+ return f"{self.__origin__.__name__}.kwargs"
1482
+
1483
+ def __eq__(self, other):
1484
+ if not isinstance(other, ParamSpecKwargs):
1485
+ return NotImplemented
1486
+ return self.__origin__ == other.__origin__
1487
+
1488
+ # 3.10+
1489
+ if hasattr(typing, 'ParamSpec'):
1490
+
1491
+ # Add default parameter - PEP 696
1492
+ class ParamSpec(metaclass=_TypeVarLikeMeta):
1493
+ """Parameter specification."""
1494
+
1495
+ _backported_typevarlike = typing.ParamSpec
1496
+
1497
+ def __new__(cls, name, *, bound=None,
1498
+ covariant=False, contravariant=False,
1499
+ infer_variance=False, default=_marker):
1500
+ if hasattr(typing, "TypeAliasType"):
1501
+ # PEP 695 implemented, can pass infer_variance to typing.TypeVar
1502
+ paramspec = typing.ParamSpec(name, bound=bound,
1503
+ covariant=covariant,
1504
+ contravariant=contravariant,
1505
+ infer_variance=infer_variance)
1506
+ else:
1507
+ paramspec = typing.ParamSpec(name, bound=bound,
1508
+ covariant=covariant,
1509
+ contravariant=contravariant)
1510
+ paramspec.__infer_variance__ = infer_variance
1511
+
1512
+ _set_default(paramspec, default)
1513
+ _set_module(paramspec)
1514
+ return paramspec
1515
+
1516
+ def __init_subclass__(cls) -> None:
1517
+ raise TypeError(f"type '{__name__}.ParamSpec' is not an acceptable base type")
1518
+
1519
+ # 3.8-3.9
1520
+ else:
1521
+
1522
+ # Inherits from list as a workaround for Callable checks in Python < 3.9.2.
1523
+ class ParamSpec(list, _DefaultMixin):
1524
+ """Parameter specification variable.
1525
+
1526
+ Usage::
1527
+
1528
+ P = ParamSpec('P')
1529
+
1530
+ Parameter specification variables exist primarily for the benefit of static
1531
+ type checkers. They are used to forward the parameter types of one
1532
+ callable to another callable, a pattern commonly found in higher order
1533
+ functions and decorators. They are only valid when used in ``Concatenate``,
1534
+ or s the first argument to ``Callable``. In Python 3.10 and higher,
1535
+ they are also supported in user-defined Generics at runtime.
1536
+ See class Generic for more information on generic types. An
1537
+ example for annotating a decorator::
1538
+
1539
+ T = TypeVar('T')
1540
+ P = ParamSpec('P')
1541
+
1542
+ def add_logging(f: Callable[P, T]) -> Callable[P, T]:
1543
+ '''A type-safe decorator to add logging to a function.'''
1544
+ def inner(*args: P.args, **kwargs: P.kwargs) -> T:
1545
+ logging.info(f'{f.__name__} was called')
1546
+ return f(*args, **kwargs)
1547
+ return inner
1548
+
1549
+ @add_logging
1550
+ def add_two(x: float, y: float) -> float:
1551
+ '''Add two numbers together.'''
1552
+ return x + y
1553
+
1554
+ Parameter specification variables defined with covariant=True or
1555
+ contravariant=True can be used to declare covariant or contravariant
1556
+ generic types. These keyword arguments are valid, but their actual semantics
1557
+ are yet to be decided. See PEP 612 for details.
1558
+
1559
+ Parameter specification variables can be introspected. e.g.:
1560
+
1561
+ P.__name__ == 'T'
1562
+ P.__bound__ == None
1563
+ P.__covariant__ == False
1564
+ P.__contravariant__ == False
1565
+
1566
+ Note that only parameter specification variables defined in global scope can
1567
+ be pickled.
1568
+ """
1569
+
1570
+ # Trick Generic __parameters__.
1571
+ __class__ = typing.TypeVar
1572
+
1573
+ @property
1574
+ def args(self):
1575
+ return ParamSpecArgs(self)
1576
+
1577
+ @property
1578
+ def kwargs(self):
1579
+ return ParamSpecKwargs(self)
1580
+
1581
+ def __init__(self, name, *, bound=None, covariant=False, contravariant=False,
1582
+ infer_variance=False, default=_marker):
1583
+ super().__init__([self])
1584
+ self.__name__ = name
1585
+ self.__covariant__ = bool(covariant)
1586
+ self.__contravariant__ = bool(contravariant)
1587
+ self.__infer_variance__ = bool(infer_variance)
1588
+ if bound:
1589
+ self.__bound__ = typing._type_check(bound, 'Bound must be a type.')
1590
+ else:
1591
+ self.__bound__ = None
1592
+ _DefaultMixin.__init__(self, default)
1593
+
1594
+ # for pickling:
1595
+ def_mod = _caller()
1596
+ if def_mod != 'typing_extensions':
1597
+ self.__module__ = def_mod
1598
+
1599
+ def __repr__(self):
1600
+ if self.__infer_variance__:
1601
+ prefix = ''
1602
+ elif self.__covariant__:
1603
+ prefix = '+'
1604
+ elif self.__contravariant__:
1605
+ prefix = '-'
1606
+ else:
1607
+ prefix = '~'
1608
+ return prefix + self.__name__
1609
+
1610
+ def __hash__(self):
1611
+ return object.__hash__(self)
1612
+
1613
+ def __eq__(self, other):
1614
+ return self is other
1615
+
1616
+ def __reduce__(self):
1617
+ return self.__name__
1618
+
1619
+ # Hack to get typing._type_check to pass.
1620
+ def __call__(self, *args, **kwargs):
1621
+ pass
1622
+
1623
+
1624
+ # 3.8-3.9
1625
+ if not hasattr(typing, 'Concatenate'):
1626
+ # Inherits from list as a workaround for Callable checks in Python < 3.9.2.
1627
+ class _ConcatenateGenericAlias(list):
1628
+
1629
+ # Trick Generic into looking into this for __parameters__.
1630
+ __class__ = typing._GenericAlias
1631
+
1632
+ # Flag in 3.8.
1633
+ _special = False
1634
+
1635
+ def __init__(self, origin, args):
1636
+ super().__init__(args)
1637
+ self.__origin__ = origin
1638
+ self.__args__ = args
1639
+
1640
+ def __repr__(self):
1641
+ _type_repr = typing._type_repr
1642
+ return (f'{_type_repr(self.__origin__)}'
1643
+ f'[{", ".join(_type_repr(arg) for arg in self.__args__)}]')
1644
+
1645
+ def __hash__(self):
1646
+ return hash((self.__origin__, self.__args__))
1647
+
1648
+ # Hack to get typing._type_check to pass in Generic.
1649
+ def __call__(self, *args, **kwargs):
1650
+ pass
1651
+
1652
+ @property
1653
+ def __parameters__(self):
1654
+ return tuple(
1655
+ tp for tp in self.__args__ if isinstance(tp, (typing.TypeVar, ParamSpec))
1656
+ )
1657
+
1658
+
1659
+ # 3.8-3.9
1660
+ @typing._tp_cache
1661
+ def _concatenate_getitem(self, parameters):
1662
+ if parameters == ():
1663
+ raise TypeError("Cannot take a Concatenate of no types.")
1664
+ if not isinstance(parameters, tuple):
1665
+ parameters = (parameters,)
1666
+ if not isinstance(parameters[-1], ParamSpec):
1667
+ raise TypeError("The last parameter to Concatenate should be a "
1668
+ "ParamSpec variable.")
1669
+ msg = "Concatenate[arg, ...]: each arg must be a type."
1670
+ parameters = tuple(typing._type_check(p, msg) for p in parameters)
1671
+ return _ConcatenateGenericAlias(self, parameters)
1672
+
1673
+
1674
+ # 3.10+
1675
+ if hasattr(typing, 'Concatenate'):
1676
+ Concatenate = typing.Concatenate
1677
+ _ConcatenateGenericAlias = typing._ConcatenateGenericAlias # noqa: F811
1678
+ # 3.9
1679
+ elif sys.version_info[:2] >= (3, 9):
1680
+ @_ExtensionsSpecialForm
1681
+ def Concatenate(self, parameters):
1682
+ """Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a
1683
+ higher order function which adds, removes or transforms parameters of a
1684
+ callable.
1685
+
1686
+ For example::
1687
+
1688
+ Callable[Concatenate[int, P], int]
1689
+
1690
+ See PEP 612 for detailed information.
1691
+ """
1692
+ return _concatenate_getitem(self, parameters)
1693
+ # 3.8
1694
+ else:
1695
+ class _ConcatenateForm(_ExtensionsSpecialForm, _root=True):
1696
+ def __getitem__(self, parameters):
1697
+ return _concatenate_getitem(self, parameters)
1698
+
1699
+ Concatenate = _ConcatenateForm(
1700
+ 'Concatenate',
1701
+ doc="""Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a
1702
+ higher order function which adds, removes or transforms parameters of a
1703
+ callable.
1704
+
1705
+ For example::
1706
+
1707
+ Callable[Concatenate[int, P], int]
1708
+
1709
+ See PEP 612 for detailed information.
1710
+ """)
1711
+
1712
+ # 3.10+
1713
+ if hasattr(typing, 'TypeGuard'):
1714
+ TypeGuard = typing.TypeGuard
1715
+ # 3.9
1716
+ elif sys.version_info[:2] >= (3, 9):
1717
+ @_ExtensionsSpecialForm
1718
+ def TypeGuard(self, parameters):
1719
+ """Special typing form used to annotate the return type of a user-defined
1720
+ type guard function. ``TypeGuard`` only accepts a single type argument.
1721
+ At runtime, functions marked this way should return a boolean.
1722
+
1723
+ ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static
1724
+ type checkers to determine a more precise type of an expression within a
1725
+ program's code flow. Usually type narrowing is done by analyzing
1726
+ conditional code flow and applying the narrowing to a block of code. The
1727
+ conditional expression here is sometimes referred to as a "type guard".
1728
+
1729
+ Sometimes it would be convenient to use a user-defined boolean function
1730
+ as a type guard. Such a function should use ``TypeGuard[...]`` as its
1731
+ return type to alert static type checkers to this intention.
1732
+
1733
+ Using ``-> TypeGuard`` tells the static type checker that for a given
1734
+ function:
1735
+
1736
+ 1. The return value is a boolean.
1737
+ 2. If the return value is ``True``, the type of its argument
1738
+ is the type inside ``TypeGuard``.
1739
+
1740
+ For example::
1741
+
1742
+ def is_str(val: Union[str, float]):
1743
+ # "isinstance" type guard
1744
+ if isinstance(val, str):
1745
+ # Type of ``val`` is narrowed to ``str``
1746
+ ...
1747
+ else:
1748
+ # Else, type of ``val`` is narrowed to ``float``.
1749
+ ...
1750
+
1751
+ Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower
1752
+ form of ``TypeA`` (it can even be a wider form) and this may lead to
1753
+ type-unsafe results. The main reason is to allow for things like
1754
+ narrowing ``List[object]`` to ``List[str]`` even though the latter is not
1755
+ a subtype of the former, since ``List`` is invariant. The responsibility of
1756
+ writing type-safe type guards is left to the user.
1757
+
1758
+ ``TypeGuard`` also works with type variables. For more information, see
1759
+ PEP 647 (User-Defined Type Guards).
1760
+ """
1761
+ item = typing._type_check(parameters, f'{self} accepts only a single type.')
1762
+ return typing._GenericAlias(self, (item,))
1763
+ # 3.8
1764
+ else:
1765
+ class _TypeGuardForm(_ExtensionsSpecialForm, _root=True):
1766
+ def __getitem__(self, parameters):
1767
+ item = typing._type_check(parameters,
1768
+ f'{self._name} accepts only a single type')
1769
+ return typing._GenericAlias(self, (item,))
1770
+
1771
+ TypeGuard = _TypeGuardForm(
1772
+ 'TypeGuard',
1773
+ doc="""Special typing form used to annotate the return type of a user-defined
1774
+ type guard function. ``TypeGuard`` only accepts a single type argument.
1775
+ At runtime, functions marked this way should return a boolean.
1776
+
1777
+ ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static
1778
+ type checkers to determine a more precise type of an expression within a
1779
+ program's code flow. Usually type narrowing is done by analyzing
1780
+ conditional code flow and applying the narrowing to a block of code. The
1781
+ conditional expression here is sometimes referred to as a "type guard".
1782
+
1783
+ Sometimes it would be convenient to use a user-defined boolean function
1784
+ as a type guard. Such a function should use ``TypeGuard[...]`` as its
1785
+ return type to alert static type checkers to this intention.
1786
+
1787
+ Using ``-> TypeGuard`` tells the static type checker that for a given
1788
+ function:
1789
+
1790
+ 1. The return value is a boolean.
1791
+ 2. If the return value is ``True``, the type of its argument
1792
+ is the type inside ``TypeGuard``.
1793
+
1794
+ For example::
1795
+
1796
+ def is_str(val: Union[str, float]):
1797
+ # "isinstance" type guard
1798
+ if isinstance(val, str):
1799
+ # Type of ``val`` is narrowed to ``str``
1800
+ ...
1801
+ else:
1802
+ # Else, type of ``val`` is narrowed to ``float``.
1803
+ ...
1804
+
1805
+ Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower
1806
+ form of ``TypeA`` (it can even be a wider form) and this may lead to
1807
+ type-unsafe results. The main reason is to allow for things like
1808
+ narrowing ``List[object]`` to ``List[str]`` even though the latter is not
1809
+ a subtype of the former, since ``List`` is invariant. The responsibility of
1810
+ writing type-safe type guards is left to the user.
1811
+
1812
+ ``TypeGuard`` also works with type variables. For more information, see
1813
+ PEP 647 (User-Defined Type Guards).
1814
+ """)
1815
+
1816
+ # 3.13+
1817
+ if hasattr(typing, 'TypeIs'):
1818
+ TypeIs = typing.TypeIs
1819
+ # 3.9
1820
+ elif sys.version_info[:2] >= (3, 9):
1821
+ @_ExtensionsSpecialForm
1822
+ def TypeIs(self, parameters):
1823
+ """Special typing form used to annotate the return type of a user-defined
1824
+ type narrower function. ``TypeIs`` only accepts a single type argument.
1825
+ At runtime, functions marked this way should return a boolean.
1826
+
1827
+ ``TypeIs`` aims to benefit *type narrowing* -- a technique used by static
1828
+ type checkers to determine a more precise type of an expression within a
1829
+ program's code flow. Usually type narrowing is done by analyzing
1830
+ conditional code flow and applying the narrowing to a block of code. The
1831
+ conditional expression here is sometimes referred to as a "type guard".
1832
+
1833
+ Sometimes it would be convenient to use a user-defined boolean function
1834
+ as a type guard. Such a function should use ``TypeIs[...]`` as its
1835
+ return type to alert static type checkers to this intention.
1836
+
1837
+ Using ``-> TypeIs`` tells the static type checker that for a given
1838
+ function:
1839
+
1840
+ 1. The return value is a boolean.
1841
+ 2. If the return value is ``True``, the type of its argument
1842
+ is the intersection of the type inside ``TypeGuard`` and the argument's
1843
+ previously known type.
1844
+
1845
+ For example::
1846
+
1847
+ def is_awaitable(val: object) -> TypeIs[Awaitable[Any]]:
1848
+ return hasattr(val, '__await__')
1849
+
1850
+ def f(val: Union[int, Awaitable[int]]) -> int:
1851
+ if is_awaitable(val):
1852
+ assert_type(val, Awaitable[int])
1853
+ else:
1854
+ assert_type(val, int)
1855
+
1856
+ ``TypeIs`` also works with type variables. For more information, see
1857
+ PEP 742 (Narrowing types with TypeIs).
1858
+ """
1859
+ item = typing._type_check(parameters, f'{self} accepts only a single type.')
1860
+ return typing._GenericAlias(self, (item,))
1861
+ # 3.8
1862
+ else:
1863
+ class _TypeIsForm(_ExtensionsSpecialForm, _root=True):
1864
+ def __getitem__(self, parameters):
1865
+ item = typing._type_check(parameters,
1866
+ f'{self._name} accepts only a single type')
1867
+ return typing._GenericAlias(self, (item,))
1868
+
1869
+ TypeIs = _TypeIsForm(
1870
+ 'TypeIs',
1871
+ doc="""Special typing form used to annotate the return type of a user-defined
1872
+ type narrower function. ``TypeIs`` only accepts a single type argument.
1873
+ At runtime, functions marked this way should return a boolean.
1874
+
1875
+ ``TypeIs`` aims to benefit *type narrowing* -- a technique used by static
1876
+ type checkers to determine a more precise type of an expression within a
1877
+ program's code flow. Usually type narrowing is done by analyzing
1878
+ conditional code flow and applying the narrowing to a block of code. The
1879
+ conditional expression here is sometimes referred to as a "type guard".
1880
+
1881
+ Sometimes it would be convenient to use a user-defined boolean function
1882
+ as a type guard. Such a function should use ``TypeIs[...]`` as its
1883
+ return type to alert static type checkers to this intention.
1884
+
1885
+ Using ``-> TypeIs`` tells the static type checker that for a given
1886
+ function:
1887
+
1888
+ 1. The return value is a boolean.
1889
+ 2. If the return value is ``True``, the type of its argument
1890
+ is the intersection of the type inside ``TypeGuard`` and the argument's
1891
+ previously known type.
1892
+
1893
+ For example::
1894
+
1895
+ def is_awaitable(val: object) -> TypeIs[Awaitable[Any]]:
1896
+ return hasattr(val, '__await__')
1897
+
1898
+ def f(val: Union[int, Awaitable[int]]) -> int:
1899
+ if is_awaitable(val):
1900
+ assert_type(val, Awaitable[int])
1901
+ else:
1902
+ assert_type(val, int)
1903
+
1904
+ ``TypeIs`` also works with type variables. For more information, see
1905
+ PEP 742 (Narrowing types with TypeIs).
1906
+ """)
1907
+
1908
+
1909
+ # Vendored from cpython typing._SpecialFrom
1910
+ class _SpecialForm(typing._Final, _root=True):
1911
+ __slots__ = ('_name', '__doc__', '_getitem')
1912
+
1913
+ def __init__(self, getitem):
1914
+ self._getitem = getitem
1915
+ self._name = getitem.__name__
1916
+ self.__doc__ = getitem.__doc__
1917
+
1918
+ def __getattr__(self, item):
1919
+ if item in {'__name__', '__qualname__'}:
1920
+ return self._name
1921
+
1922
+ raise AttributeError(item)
1923
+
1924
+ def __mro_entries__(self, bases):
1925
+ raise TypeError(f"Cannot subclass {self!r}")
1926
+
1927
+ def __repr__(self):
1928
+ return f'typing_extensions.{self._name}'
1929
+
1930
+ def __reduce__(self):
1931
+ return self._name
1932
+
1933
+ def __call__(self, *args, **kwds):
1934
+ raise TypeError(f"Cannot instantiate {self!r}")
1935
+
1936
+ def __or__(self, other):
1937
+ return typing.Union[self, other]
1938
+
1939
+ def __ror__(self, other):
1940
+ return typing.Union[other, self]
1941
+
1942
+ def __instancecheck__(self, obj):
1943
+ raise TypeError(f"{self} cannot be used with isinstance()")
1944
+
1945
+ def __subclasscheck__(self, cls):
1946
+ raise TypeError(f"{self} cannot be used with issubclass()")
1947
+
1948
+ @typing._tp_cache
1949
+ def __getitem__(self, parameters):
1950
+ return self._getitem(self, parameters)
1951
+
1952
+
1953
+ if hasattr(typing, "LiteralString"): # 3.11+
1954
+ LiteralString = typing.LiteralString
1955
+ else:
1956
+ @_SpecialForm
1957
+ def LiteralString(self, params):
1958
+ """Represents an arbitrary literal string.
1959
+
1960
+ Example::
1961
+
1962
+ from pip._vendor.typing_extensions import LiteralString
1963
+
1964
+ def query(sql: LiteralString) -> ...:
1965
+ ...
1966
+
1967
+ query("SELECT * FROM table") # ok
1968
+ query(f"SELECT * FROM {input()}") # not ok
1969
+
1970
+ See PEP 675 for details.
1971
+
1972
+ """
1973
+ raise TypeError(f"{self} is not subscriptable")
1974
+
1975
+
1976
+ if hasattr(typing, "Self"): # 3.11+
1977
+ Self = typing.Self
1978
+ else:
1979
+ @_SpecialForm
1980
+ def Self(self, params):
1981
+ """Used to spell the type of "self" in classes.
1982
+
1983
+ Example::
1984
+
1985
+ from typing import Self
1986
+
1987
+ class ReturnsSelf:
1988
+ def parse(self, data: bytes) -> Self:
1989
+ ...
1990
+ return self
1991
+
1992
+ """
1993
+
1994
+ raise TypeError(f"{self} is not subscriptable")
1995
+
1996
+
1997
+ if hasattr(typing, "Never"): # 3.11+
1998
+ Never = typing.Never
1999
+ else:
2000
+ @_SpecialForm
2001
+ def Never(self, params):
2002
+ """The bottom type, a type that has no members.
2003
+
2004
+ This can be used to define a function that should never be
2005
+ called, or a function that never returns::
2006
+
2007
+ from pip._vendor.typing_extensions import Never
2008
+
2009
+ def never_call_me(arg: Never) -> None:
2010
+ pass
2011
+
2012
+ def int_or_str(arg: int | str) -> None:
2013
+ never_call_me(arg) # type checker error
2014
+ match arg:
2015
+ case int():
2016
+ print("It's an int")
2017
+ case str():
2018
+ print("It's a str")
2019
+ case _:
2020
+ never_call_me(arg) # ok, arg is of type Never
2021
+
2022
+ """
2023
+
2024
+ raise TypeError(f"{self} is not subscriptable")
2025
+
2026
+
2027
+ if hasattr(typing, 'Required'): # 3.11+
2028
+ Required = typing.Required
2029
+ NotRequired = typing.NotRequired
2030
+ elif sys.version_info[:2] >= (3, 9): # 3.9-3.10
2031
+ @_ExtensionsSpecialForm
2032
+ def Required(self, parameters):
2033
+ """A special typing construct to mark a key of a total=False TypedDict
2034
+ as required. For example:
2035
+
2036
+ class Movie(TypedDict, total=False):
2037
+ title: Required[str]
2038
+ year: int
2039
+
2040
+ m = Movie(
2041
+ title='The Matrix', # typechecker error if key is omitted
2042
+ year=1999,
2043
+ )
2044
+
2045
+ There is no runtime checking that a required key is actually provided
2046
+ when instantiating a related TypedDict.
2047
+ """
2048
+ item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
2049
+ return typing._GenericAlias(self, (item,))
2050
+
2051
+ @_ExtensionsSpecialForm
2052
+ def NotRequired(self, parameters):
2053
+ """A special typing construct to mark a key of a TypedDict as
2054
+ potentially missing. For example:
2055
+
2056
+ class Movie(TypedDict):
2057
+ title: str
2058
+ year: NotRequired[int]
2059
+
2060
+ m = Movie(
2061
+ title='The Matrix', # typechecker error if key is omitted
2062
+ year=1999,
2063
+ )
2064
+ """
2065
+ item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
2066
+ return typing._GenericAlias(self, (item,))
2067
+
2068
+ else: # 3.8
2069
+ class _RequiredForm(_ExtensionsSpecialForm, _root=True):
2070
+ def __getitem__(self, parameters):
2071
+ item = typing._type_check(parameters,
2072
+ f'{self._name} accepts only a single type.')
2073
+ return typing._GenericAlias(self, (item,))
2074
+
2075
+ Required = _RequiredForm(
2076
+ 'Required',
2077
+ doc="""A special typing construct to mark a key of a total=False TypedDict
2078
+ as required. For example:
2079
+
2080
+ class Movie(TypedDict, total=False):
2081
+ title: Required[str]
2082
+ year: int
2083
+
2084
+ m = Movie(
2085
+ title='The Matrix', # typechecker error if key is omitted
2086
+ year=1999,
2087
+ )
2088
+
2089
+ There is no runtime checking that a required key is actually provided
2090
+ when instantiating a related TypedDict.
2091
+ """)
2092
+ NotRequired = _RequiredForm(
2093
+ 'NotRequired',
2094
+ doc="""A special typing construct to mark a key of a TypedDict as
2095
+ potentially missing. For example:
2096
+
2097
+ class Movie(TypedDict):
2098
+ title: str
2099
+ year: NotRequired[int]
2100
+
2101
+ m = Movie(
2102
+ title='The Matrix', # typechecker error if key is omitted
2103
+ year=1999,
2104
+ )
2105
+ """)
2106
+
2107
+
2108
+ if hasattr(typing, 'ReadOnly'):
2109
+ ReadOnly = typing.ReadOnly
2110
+ elif sys.version_info[:2] >= (3, 9): # 3.9-3.12
2111
+ @_ExtensionsSpecialForm
2112
+ def ReadOnly(self, parameters):
2113
+ """A special typing construct to mark an item of a TypedDict as read-only.
2114
+
2115
+ For example:
2116
+
2117
+ class Movie(TypedDict):
2118
+ title: ReadOnly[str]
2119
+ year: int
2120
+
2121
+ def mutate_movie(m: Movie) -> None:
2122
+ m["year"] = 1992 # allowed
2123
+ m["title"] = "The Matrix" # typechecker error
2124
+
2125
+ There is no runtime checking for this property.
2126
+ """
2127
+ item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
2128
+ return typing._GenericAlias(self, (item,))
2129
+
2130
+ else: # 3.8
2131
+ class _ReadOnlyForm(_ExtensionsSpecialForm, _root=True):
2132
+ def __getitem__(self, parameters):
2133
+ item = typing._type_check(parameters,
2134
+ f'{self._name} accepts only a single type.')
2135
+ return typing._GenericAlias(self, (item,))
2136
+
2137
+ ReadOnly = _ReadOnlyForm(
2138
+ 'ReadOnly',
2139
+ doc="""A special typing construct to mark a key of a TypedDict as read-only.
2140
+
2141
+ For example:
2142
+
2143
+ class Movie(TypedDict):
2144
+ title: ReadOnly[str]
2145
+ year: int
2146
+
2147
+ def mutate_movie(m: Movie) -> None:
2148
+ m["year"] = 1992 # allowed
2149
+ m["title"] = "The Matrix" # typechecker error
2150
+
2151
+ There is no runtime checking for this propery.
2152
+ """)
2153
+
2154
+
2155
+ _UNPACK_DOC = """\
2156
+ Type unpack operator.
2157
+
2158
+ The type unpack operator takes the child types from some container type,
2159
+ such as `tuple[int, str]` or a `TypeVarTuple`, and 'pulls them out'. For
2160
+ example:
2161
+
2162
+ # For some generic class `Foo`:
2163
+ Foo[Unpack[tuple[int, str]]] # Equivalent to Foo[int, str]
2164
+
2165
+ Ts = TypeVarTuple('Ts')
2166
+ # Specifies that `Bar` is generic in an arbitrary number of types.
2167
+ # (Think of `Ts` as a tuple of an arbitrary number of individual
2168
+ # `TypeVar`s, which the `Unpack` is 'pulling out' directly into the
2169
+ # `Generic[]`.)
2170
+ class Bar(Generic[Unpack[Ts]]): ...
2171
+ Bar[int] # Valid
2172
+ Bar[int, str] # Also valid
2173
+
2174
+ From Python 3.11, this can also be done using the `*` operator:
2175
+
2176
+ Foo[*tuple[int, str]]
2177
+ class Bar(Generic[*Ts]): ...
2178
+
2179
+ The operator can also be used along with a `TypedDict` to annotate
2180
+ `**kwargs` in a function signature. For instance:
2181
+
2182
+ class Movie(TypedDict):
2183
+ name: str
2184
+ year: int
2185
+
2186
+ # This function expects two keyword arguments - *name* of type `str` and
2187
+ # *year* of type `int`.
2188
+ def foo(**kwargs: Unpack[Movie]): ...
2189
+
2190
+ Note that there is only some runtime checking of this operator. Not
2191
+ everything the runtime allows may be accepted by static type checkers.
2192
+
2193
+ For more information, see PEP 646 and PEP 692.
2194
+ """
2195
+
2196
+
2197
+ if sys.version_info >= (3, 12): # PEP 692 changed the repr of Unpack[]
2198
+ Unpack = typing.Unpack
2199
+
2200
+ def _is_unpack(obj):
2201
+ return get_origin(obj) is Unpack
2202
+
2203
+ elif sys.version_info[:2] >= (3, 9): # 3.9+
2204
+ class _UnpackSpecialForm(_ExtensionsSpecialForm, _root=True):
2205
+ def __init__(self, getitem):
2206
+ super().__init__(getitem)
2207
+ self.__doc__ = _UNPACK_DOC
2208
+
2209
+ class _UnpackAlias(typing._GenericAlias, _root=True):
2210
+ __class__ = typing.TypeVar
2211
+
2212
+ @_UnpackSpecialForm
2213
+ def Unpack(self, parameters):
2214
+ item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
2215
+ return _UnpackAlias(self, (item,))
2216
+
2217
+ def _is_unpack(obj):
2218
+ return isinstance(obj, _UnpackAlias)
2219
+
2220
+ else: # 3.8
2221
+ class _UnpackAlias(typing._GenericAlias, _root=True):
2222
+ __class__ = typing.TypeVar
2223
+
2224
+ class _UnpackForm(_ExtensionsSpecialForm, _root=True):
2225
+ def __getitem__(self, parameters):
2226
+ item = typing._type_check(parameters,
2227
+ f'{self._name} accepts only a single type.')
2228
+ return _UnpackAlias(self, (item,))
2229
+
2230
+ Unpack = _UnpackForm('Unpack', doc=_UNPACK_DOC)
2231
+
2232
+ def _is_unpack(obj):
2233
+ return isinstance(obj, _UnpackAlias)
2234
+
2235
+
2236
+ if hasattr(typing, "TypeVarTuple"): # 3.11+
2237
+
2238
+ # Add default parameter - PEP 696
2239
+ class TypeVarTuple(metaclass=_TypeVarLikeMeta):
2240
+ """Type variable tuple."""
2241
+
2242
+ _backported_typevarlike = typing.TypeVarTuple
2243
+
2244
+ def __new__(cls, name, *, default=_marker):
2245
+ tvt = typing.TypeVarTuple(name)
2246
+ _set_default(tvt, default)
2247
+ _set_module(tvt)
2248
+ return tvt
2249
+
2250
+ def __init_subclass__(self, *args, **kwds):
2251
+ raise TypeError("Cannot subclass special typing classes")
2252
+
2253
+ else: # <=3.10
2254
+ class TypeVarTuple(_DefaultMixin):
2255
+ """Type variable tuple.
2256
+
2257
+ Usage::
2258
+
2259
+ Ts = TypeVarTuple('Ts')
2260
+
2261
+ In the same way that a normal type variable is a stand-in for a single
2262
+ type such as ``int``, a type variable *tuple* is a stand-in for a *tuple*
2263
+ type such as ``Tuple[int, str]``.
2264
+
2265
+ Type variable tuples can be used in ``Generic`` declarations.
2266
+ Consider the following example::
2267
+
2268
+ class Array(Generic[*Ts]): ...
2269
+
2270
+ The ``Ts`` type variable tuple here behaves like ``tuple[T1, T2]``,
2271
+ where ``T1`` and ``T2`` are type variables. To use these type variables
2272
+ as type parameters of ``Array``, we must *unpack* the type variable tuple using
2273
+ the star operator: ``*Ts``. The signature of ``Array`` then behaves
2274
+ as if we had simply written ``class Array(Generic[T1, T2]): ...``.
2275
+ In contrast to ``Generic[T1, T2]``, however, ``Generic[*Shape]`` allows
2276
+ us to parameterise the class with an *arbitrary* number of type parameters.
2277
+
2278
+ Type variable tuples can be used anywhere a normal ``TypeVar`` can.
2279
+ This includes class definitions, as shown above, as well as function
2280
+ signatures and variable annotations::
2281
+
2282
+ class Array(Generic[*Ts]):
2283
+
2284
+ def __init__(self, shape: Tuple[*Ts]):
2285
+ self._shape: Tuple[*Ts] = shape
2286
+
2287
+ def get_shape(self) -> Tuple[*Ts]:
2288
+ return self._shape
2289
+
2290
+ shape = (Height(480), Width(640))
2291
+ x: Array[Height, Width] = Array(shape)
2292
+ y = abs(x) # Inferred type is Array[Height, Width]
2293
+ z = x + x # ... is Array[Height, Width]
2294
+ x.get_shape() # ... is tuple[Height, Width]
2295
+
2296
+ """
2297
+
2298
+ # Trick Generic __parameters__.
2299
+ __class__ = typing.TypeVar
2300
+
2301
+ def __iter__(self):
2302
+ yield self.__unpacked__
2303
+
2304
+ def __init__(self, name, *, default=_marker):
2305
+ self.__name__ = name
2306
+ _DefaultMixin.__init__(self, default)
2307
+
2308
+ # for pickling:
2309
+ def_mod = _caller()
2310
+ if def_mod != 'typing_extensions':
2311
+ self.__module__ = def_mod
2312
+
2313
+ self.__unpacked__ = Unpack[self]
2314
+
2315
+ def __repr__(self):
2316
+ return self.__name__
2317
+
2318
+ def __hash__(self):
2319
+ return object.__hash__(self)
2320
+
2321
+ def __eq__(self, other):
2322
+ return self is other
2323
+
2324
+ def __reduce__(self):
2325
+ return self.__name__
2326
+
2327
+ def __init_subclass__(self, *args, **kwds):
2328
+ if '_root' not in kwds:
2329
+ raise TypeError("Cannot subclass special typing classes")
2330
+
2331
+
2332
+ if hasattr(typing, "reveal_type"): # 3.11+
2333
+ reveal_type = typing.reveal_type
2334
+ else: # <=3.10
2335
+ def reveal_type(obj: T, /) -> T:
2336
+ """Reveal the inferred type of a variable.
2337
+
2338
+ When a static type checker encounters a call to ``reveal_type()``,
2339
+ it will emit the inferred type of the argument::
2340
+
2341
+ x: int = 1
2342
+ reveal_type(x)
2343
+
2344
+ Running a static type checker (e.g., ``mypy``) on this example
2345
+ will produce output similar to 'Revealed type is "builtins.int"'.
2346
+
2347
+ At runtime, the function prints the runtime type of the
2348
+ argument and returns it unchanged.
2349
+
2350
+ """
2351
+ print(f"Runtime type is {type(obj).__name__!r}", file=sys.stderr)
2352
+ return obj
2353
+
2354
+
2355
+ if hasattr(typing, "assert_never"): # 3.11+
2356
+ assert_never = typing.assert_never
2357
+ else: # <=3.10
2358
+ def assert_never(arg: Never, /) -> Never:
2359
+ """Assert to the type checker that a line of code is unreachable.
2360
+
2361
+ Example::
2362
+
2363
+ def int_or_str(arg: int | str) -> None:
2364
+ match arg:
2365
+ case int():
2366
+ print("It's an int")
2367
+ case str():
2368
+ print("It's a str")
2369
+ case _:
2370
+ assert_never(arg)
2371
+
2372
+ If a type checker finds that a call to assert_never() is
2373
+ reachable, it will emit an error.
2374
+
2375
+ At runtime, this throws an exception when called.
2376
+
2377
+ """
2378
+ raise AssertionError("Expected code to be unreachable")
2379
+
2380
+
2381
+ if sys.version_info >= (3, 12): # 3.12+
2382
+ # dataclass_transform exists in 3.11 but lacks the frozen_default parameter
2383
+ dataclass_transform = typing.dataclass_transform
2384
+ else: # <=3.11
2385
+ def dataclass_transform(
2386
+ *,
2387
+ eq_default: bool = True,
2388
+ order_default: bool = False,
2389
+ kw_only_default: bool = False,
2390
+ frozen_default: bool = False,
2391
+ field_specifiers: typing.Tuple[
2392
+ typing.Union[typing.Type[typing.Any], typing.Callable[..., typing.Any]],
2393
+ ...
2394
+ ] = (),
2395
+ **kwargs: typing.Any,
2396
+ ) -> typing.Callable[[T], T]:
2397
+ """Decorator that marks a function, class, or metaclass as providing
2398
+ dataclass-like behavior.
2399
+
2400
+ Example:
2401
+
2402
+ from pip._vendor.typing_extensions import dataclass_transform
2403
+
2404
+ _T = TypeVar("_T")
2405
+
2406
+ # Used on a decorator function
2407
+ @dataclass_transform()
2408
+ def create_model(cls: type[_T]) -> type[_T]:
2409
+ ...
2410
+ return cls
2411
+
2412
+ @create_model
2413
+ class CustomerModel:
2414
+ id: int
2415
+ name: str
2416
+
2417
+ # Used on a base class
2418
+ @dataclass_transform()
2419
+ class ModelBase: ...
2420
+
2421
+ class CustomerModel(ModelBase):
2422
+ id: int
2423
+ name: str
2424
+
2425
+ # Used on a metaclass
2426
+ @dataclass_transform()
2427
+ class ModelMeta(type): ...
2428
+
2429
+ class ModelBase(metaclass=ModelMeta): ...
2430
+
2431
+ class CustomerModel(ModelBase):
2432
+ id: int
2433
+ name: str
2434
+
2435
+ Each of the ``CustomerModel`` classes defined in this example will now
2436
+ behave similarly to a dataclass created with the ``@dataclasses.dataclass``
2437
+ decorator. For example, the type checker will synthesize an ``__init__``
2438
+ method.
2439
+
2440
+ The arguments to this decorator can be used to customize this behavior:
2441
+ - ``eq_default`` indicates whether the ``eq`` parameter is assumed to be
2442
+ True or False if it is omitted by the caller.
2443
+ - ``order_default`` indicates whether the ``order`` parameter is
2444
+ assumed to be True or False if it is omitted by the caller.
2445
+ - ``kw_only_default`` indicates whether the ``kw_only`` parameter is
2446
+ assumed to be True or False if it is omitted by the caller.
2447
+ - ``frozen_default`` indicates whether the ``frozen`` parameter is
2448
+ assumed to be True or False if it is omitted by the caller.
2449
+ - ``field_specifiers`` specifies a static list of supported classes
2450
+ or functions that describe fields, similar to ``dataclasses.field()``.
2451
+
2452
+ At runtime, this decorator records its arguments in the
2453
+ ``__dataclass_transform__`` attribute on the decorated object.
2454
+
2455
+ See PEP 681 for details.
2456
+
2457
+ """
2458
+ def decorator(cls_or_fn):
2459
+ cls_or_fn.__dataclass_transform__ = {
2460
+ "eq_default": eq_default,
2461
+ "order_default": order_default,
2462
+ "kw_only_default": kw_only_default,
2463
+ "frozen_default": frozen_default,
2464
+ "field_specifiers": field_specifiers,
2465
+ "kwargs": kwargs,
2466
+ }
2467
+ return cls_or_fn
2468
+ return decorator
2469
+
2470
+
2471
+ if hasattr(typing, "override"): # 3.12+
2472
+ override = typing.override
2473
+ else: # <=3.11
2474
+ _F = typing.TypeVar("_F", bound=typing.Callable[..., typing.Any])
2475
+
2476
+ def override(arg: _F, /) -> _F:
2477
+ """Indicate that a method is intended to override a method in a base class.
2478
+
2479
+ Usage:
2480
+
2481
+ class Base:
2482
+ def method(self) -> None:
2483
+ pass
2484
+
2485
+ class Child(Base):
2486
+ @override
2487
+ def method(self) -> None:
2488
+ super().method()
2489
+
2490
+ When this decorator is applied to a method, the type checker will
2491
+ validate that it overrides a method with the same name on a base class.
2492
+ This helps prevent bugs that may occur when a base class is changed
2493
+ without an equivalent change to a child class.
2494
+
2495
+ There is no runtime checking of these properties. The decorator
2496
+ sets the ``__override__`` attribute to ``True`` on the decorated object
2497
+ to allow runtime introspection.
2498
+
2499
+ See PEP 698 for details.
2500
+
2501
+ """
2502
+ try:
2503
+ arg.__override__ = True
2504
+ except (AttributeError, TypeError):
2505
+ # Skip the attribute silently if it is not writable.
2506
+ # AttributeError happens if the object has __slots__ or a
2507
+ # read-only property, TypeError if it's a builtin class.
2508
+ pass
2509
+ return arg
2510
+
2511
+
2512
+ if hasattr(warnings, "deprecated"):
2513
+ deprecated = warnings.deprecated
2514
+ else:
2515
+ _T = typing.TypeVar("_T")
2516
+
2517
+ class deprecated:
2518
+ """Indicate that a class, function or overload is deprecated.
2519
+
2520
+ When this decorator is applied to an object, the type checker
2521
+ will generate a diagnostic on usage of the deprecated object.
2522
+
2523
+ Usage:
2524
+
2525
+ @deprecated("Use B instead")
2526
+ class A:
2527
+ pass
2528
+
2529
+ @deprecated("Use g instead")
2530
+ def f():
2531
+ pass
2532
+
2533
+ @overload
2534
+ @deprecated("int support is deprecated")
2535
+ def g(x: int) -> int: ...
2536
+ @overload
2537
+ def g(x: str) -> int: ...
2538
+
2539
+ The warning specified by *category* will be emitted at runtime
2540
+ on use of deprecated objects. For functions, that happens on calls;
2541
+ for classes, on instantiation and on creation of subclasses.
2542
+ If the *category* is ``None``, no warning is emitted at runtime.
2543
+ The *stacklevel* determines where the
2544
+ warning is emitted. If it is ``1`` (the default), the warning
2545
+ is emitted at the direct caller of the deprecated object; if it
2546
+ is higher, it is emitted further up the stack.
2547
+ Static type checker behavior is not affected by the *category*
2548
+ and *stacklevel* arguments.
2549
+
2550
+ The deprecation message passed to the decorator is saved in the
2551
+ ``__deprecated__`` attribute on the decorated object.
2552
+ If applied to an overload, the decorator
2553
+ must be after the ``@overload`` decorator for the attribute to
2554
+ exist on the overload as returned by ``get_overloads()``.
2555
+
2556
+ See PEP 702 for details.
2557
+
2558
+ """
2559
+ def __init__(
2560
+ self,
2561
+ message: str,
2562
+ /,
2563
+ *,
2564
+ category: typing.Optional[typing.Type[Warning]] = DeprecationWarning,
2565
+ stacklevel: int = 1,
2566
+ ) -> None:
2567
+ if not isinstance(message, str):
2568
+ raise TypeError(
2569
+ "Expected an object of type str for 'message', not "
2570
+ f"{type(message).__name__!r}"
2571
+ )
2572
+ self.message = message
2573
+ self.category = category
2574
+ self.stacklevel = stacklevel
2575
+
2576
+ def __call__(self, arg: _T, /) -> _T:
2577
+ # Make sure the inner functions created below don't
2578
+ # retain a reference to self.
2579
+ msg = self.message
2580
+ category = self.category
2581
+ stacklevel = self.stacklevel
2582
+ if category is None:
2583
+ arg.__deprecated__ = msg
2584
+ return arg
2585
+ elif isinstance(arg, type):
2586
+ import functools
2587
+ from types import MethodType
2588
+
2589
+ original_new = arg.__new__
2590
+
2591
+ @functools.wraps(original_new)
2592
+ def __new__(cls, *args, **kwargs):
2593
+ if cls is arg:
2594
+ warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
2595
+ if original_new is not object.__new__:
2596
+ return original_new(cls, *args, **kwargs)
2597
+ # Mirrors a similar check in object.__new__.
2598
+ elif cls.__init__ is object.__init__ and (args or kwargs):
2599
+ raise TypeError(f"{cls.__name__}() takes no arguments")
2600
+ else:
2601
+ return original_new(cls)
2602
+
2603
+ arg.__new__ = staticmethod(__new__)
2604
+
2605
+ original_init_subclass = arg.__init_subclass__
2606
+ # We need slightly different behavior if __init_subclass__
2607
+ # is a bound method (likely if it was implemented in Python)
2608
+ if isinstance(original_init_subclass, MethodType):
2609
+ original_init_subclass = original_init_subclass.__func__
2610
+
2611
+ @functools.wraps(original_init_subclass)
2612
+ def __init_subclass__(*args, **kwargs):
2613
+ warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
2614
+ return original_init_subclass(*args, **kwargs)
2615
+
2616
+ arg.__init_subclass__ = classmethod(__init_subclass__)
2617
+ # Or otherwise, which likely means it's a builtin such as
2618
+ # object's implementation of __init_subclass__.
2619
+ else:
2620
+ @functools.wraps(original_init_subclass)
2621
+ def __init_subclass__(*args, **kwargs):
2622
+ warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
2623
+ return original_init_subclass(*args, **kwargs)
2624
+
2625
+ arg.__init_subclass__ = __init_subclass__
2626
+
2627
+ arg.__deprecated__ = __new__.__deprecated__ = msg
2628
+ __init_subclass__.__deprecated__ = msg
2629
+ return arg
2630
+ elif callable(arg):
2631
+ import functools
2632
+
2633
+ @functools.wraps(arg)
2634
+ def wrapper(*args, **kwargs):
2635
+ warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
2636
+ return arg(*args, **kwargs)
2637
+
2638
+ arg.__deprecated__ = wrapper.__deprecated__ = msg
2639
+ return wrapper
2640
+ else:
2641
+ raise TypeError(
2642
+ "@deprecated decorator with non-None category must be applied to "
2643
+ f"a class or callable, not {arg!r}"
2644
+ )
2645
+
2646
+
2647
+ # We have to do some monkey patching to deal with the dual nature of
2648
+ # Unpack/TypeVarTuple:
2649
+ # - We want Unpack to be a kind of TypeVar so it gets accepted in
2650
+ # Generic[Unpack[Ts]]
2651
+ # - We want it to *not* be treated as a TypeVar for the purposes of
2652
+ # counting generic parameters, so that when we subscript a generic,
2653
+ # the runtime doesn't try to substitute the Unpack with the subscripted type.
2654
+ if not hasattr(typing, "TypeVarTuple"):
2655
+ def _check_generic(cls, parameters, elen=_marker):
2656
+ """Check correct count for parameters of a generic cls (internal helper).
2657
+
2658
+ This gives a nice error message in case of count mismatch.
2659
+ """
2660
+ if not elen:
2661
+ raise TypeError(f"{cls} is not a generic class")
2662
+ if elen is _marker:
2663
+ if not hasattr(cls, "__parameters__") or not cls.__parameters__:
2664
+ raise TypeError(f"{cls} is not a generic class")
2665
+ elen = len(cls.__parameters__)
2666
+ alen = len(parameters)
2667
+ if alen != elen:
2668
+ expect_val = elen
2669
+ if hasattr(cls, "__parameters__"):
2670
+ parameters = [p for p in cls.__parameters__ if not _is_unpack(p)]
2671
+ num_tv_tuples = sum(isinstance(p, TypeVarTuple) for p in parameters)
2672
+ if (num_tv_tuples > 0) and (alen >= elen - num_tv_tuples):
2673
+ return
2674
+
2675
+ # deal with TypeVarLike defaults
2676
+ # required TypeVarLikes cannot appear after a defaulted one.
2677
+ if alen < elen:
2678
+ # since we validate TypeVarLike default in _collect_type_vars
2679
+ # or _collect_parameters we can safely check parameters[alen]
2680
+ if getattr(parameters[alen], '__default__', None) is not None:
2681
+ return
2682
+
2683
+ num_default_tv = sum(getattr(p, '__default__', None)
2684
+ is not None for p in parameters)
2685
+
2686
+ elen -= num_default_tv
2687
+
2688
+ expect_val = f"at least {elen}"
2689
+
2690
+ things = "arguments" if sys.version_info >= (3, 10) else "parameters"
2691
+ raise TypeError(f"Too {'many' if alen > elen else 'few'} {things}"
2692
+ f" for {cls}; actual {alen}, expected {expect_val}")
2693
+ else:
2694
+ # Python 3.11+
2695
+
2696
+ def _check_generic(cls, parameters, elen):
2697
+ """Check correct count for parameters of a generic cls (internal helper).
2698
+
2699
+ This gives a nice error message in case of count mismatch.
2700
+ """
2701
+ if not elen:
2702
+ raise TypeError(f"{cls} is not a generic class")
2703
+ alen = len(parameters)
2704
+ if alen != elen:
2705
+ expect_val = elen
2706
+ if hasattr(cls, "__parameters__"):
2707
+ parameters = [p for p in cls.__parameters__ if not _is_unpack(p)]
2708
+
2709
+ # deal with TypeVarLike defaults
2710
+ # required TypeVarLikes cannot appear after a defaulted one.
2711
+ if alen < elen:
2712
+ # since we validate TypeVarLike default in _collect_type_vars
2713
+ # or _collect_parameters we can safely check parameters[alen]
2714
+ if getattr(parameters[alen], '__default__', None) is not None:
2715
+ return
2716
+
2717
+ num_default_tv = sum(getattr(p, '__default__', None)
2718
+ is not None for p in parameters)
2719
+
2720
+ elen -= num_default_tv
2721
+
2722
+ expect_val = f"at least {elen}"
2723
+
2724
+ raise TypeError(f"Too {'many' if alen > elen else 'few'} arguments"
2725
+ f" for {cls}; actual {alen}, expected {expect_val}")
2726
+
2727
+ typing._check_generic = _check_generic
2728
+
2729
+ # Python 3.11+ _collect_type_vars was renamed to _collect_parameters
2730
+ if hasattr(typing, '_collect_type_vars'):
2731
+ def _collect_type_vars(types, typevar_types=None):
2732
+ """Collect all type variable contained in types in order of
2733
+ first appearance (lexicographic order). For example::
2734
+
2735
+ _collect_type_vars((T, List[S, T])) == (T, S)
2736
+ """
2737
+ if typevar_types is None:
2738
+ typevar_types = typing.TypeVar
2739
+ tvars = []
2740
+ # required TypeVarLike cannot appear after TypeVarLike with default
2741
+ default_encountered = False
2742
+ for t in types:
2743
+ if (
2744
+ isinstance(t, typevar_types) and
2745
+ t not in tvars and
2746
+ not _is_unpack(t)
2747
+ ):
2748
+ if getattr(t, '__default__', None) is not None:
2749
+ default_encountered = True
2750
+ elif default_encountered:
2751
+ raise TypeError(f'Type parameter {t!r} without a default'
2752
+ ' follows type parameter with a default')
2753
+
2754
+ tvars.append(t)
2755
+ if _should_collect_from_parameters(t):
2756
+ tvars.extend([t for t in t.__parameters__ if t not in tvars])
2757
+ return tuple(tvars)
2758
+
2759
+ typing._collect_type_vars = _collect_type_vars
2760
+ else:
2761
+ def _collect_parameters(args):
2762
+ """Collect all type variables and parameter specifications in args
2763
+ in order of first appearance (lexicographic order).
2764
+
2765
+ For example::
2766
+
2767
+ assert _collect_parameters((T, Callable[P, T])) == (T, P)
2768
+ """
2769
+ parameters = []
2770
+ # required TypeVarLike cannot appear after TypeVarLike with default
2771
+ default_encountered = False
2772
+ for t in args:
2773
+ if isinstance(t, type):
2774
+ # We don't want __parameters__ descriptor of a bare Python class.
2775
+ pass
2776
+ elif isinstance(t, tuple):
2777
+ # `t` might be a tuple, when `ParamSpec` is substituted with
2778
+ # `[T, int]`, or `[int, *Ts]`, etc.
2779
+ for x in t:
2780
+ for collected in _collect_parameters([x]):
2781
+ if collected not in parameters:
2782
+ parameters.append(collected)
2783
+ elif hasattr(t, '__typing_subst__'):
2784
+ if t not in parameters:
2785
+ if getattr(t, '__default__', None) is not None:
2786
+ default_encountered = True
2787
+ elif default_encountered:
2788
+ raise TypeError(f'Type parameter {t!r} without a default'
2789
+ ' follows type parameter with a default')
2790
+
2791
+ parameters.append(t)
2792
+ else:
2793
+ for x in getattr(t, '__parameters__', ()):
2794
+ if x not in parameters:
2795
+ parameters.append(x)
2796
+
2797
+ return tuple(parameters)
2798
+
2799
+ typing._collect_parameters = _collect_parameters
2800
+
2801
+ # Backport typing.NamedTuple as it exists in Python 3.13.
2802
+ # In 3.11, the ability to define generic `NamedTuple`s was supported.
2803
+ # This was explicitly disallowed in 3.9-3.10, and only half-worked in <=3.8.
2804
+ # On 3.12, we added __orig_bases__ to call-based NamedTuples
2805
+ # On 3.13, we deprecated kwargs-based NamedTuples
2806
+ if sys.version_info >= (3, 13):
2807
+ NamedTuple = typing.NamedTuple
2808
+ else:
2809
+ def _make_nmtuple(name, types, module, defaults=()):
2810
+ fields = [n for n, t in types]
2811
+ annotations = {n: typing._type_check(t, f"field {n} annotation must be a type")
2812
+ for n, t in types}
2813
+ nm_tpl = collections.namedtuple(name, fields,
2814
+ defaults=defaults, module=module)
2815
+ nm_tpl.__annotations__ = nm_tpl.__new__.__annotations__ = annotations
2816
+ # The `_field_types` attribute was removed in 3.9;
2817
+ # in earlier versions, it is the same as the `__annotations__` attribute
2818
+ if sys.version_info < (3, 9):
2819
+ nm_tpl._field_types = annotations
2820
+ return nm_tpl
2821
+
2822
+ _prohibited_namedtuple_fields = typing._prohibited
2823
+ _special_namedtuple_fields = frozenset({'__module__', '__name__', '__annotations__'})
2824
+
2825
+ class _NamedTupleMeta(type):
2826
+ def __new__(cls, typename, bases, ns):
2827
+ assert _NamedTuple in bases
2828
+ for base in bases:
2829
+ if base is not _NamedTuple and base is not typing.Generic:
2830
+ raise TypeError(
2831
+ 'can only inherit from a NamedTuple type and Generic')
2832
+ bases = tuple(tuple if base is _NamedTuple else base for base in bases)
2833
+ types = ns.get('__annotations__', {})
2834
+ default_names = []
2835
+ for field_name in types:
2836
+ if field_name in ns:
2837
+ default_names.append(field_name)
2838
+ elif default_names:
2839
+ raise TypeError(f"Non-default namedtuple field {field_name} "
2840
+ f"cannot follow default field"
2841
+ f"{'s' if len(default_names) > 1 else ''} "
2842
+ f"{', '.join(default_names)}")
2843
+ nm_tpl = _make_nmtuple(
2844
+ typename, types.items(),
2845
+ defaults=[ns[n] for n in default_names],
2846
+ module=ns['__module__']
2847
+ )
2848
+ nm_tpl.__bases__ = bases
2849
+ if typing.Generic in bases:
2850
+ if hasattr(typing, '_generic_class_getitem'): # 3.12+
2851
+ nm_tpl.__class_getitem__ = classmethod(typing._generic_class_getitem)
2852
+ else:
2853
+ class_getitem = typing.Generic.__class_getitem__.__func__
2854
+ nm_tpl.__class_getitem__ = classmethod(class_getitem)
2855
+ # update from user namespace without overriding special namedtuple attributes
2856
+ for key, val in ns.items():
2857
+ if key in _prohibited_namedtuple_fields:
2858
+ raise AttributeError("Cannot overwrite NamedTuple attribute " + key)
2859
+ elif key not in _special_namedtuple_fields:
2860
+ if key not in nm_tpl._fields:
2861
+ setattr(nm_tpl, key, ns[key])
2862
+ try:
2863
+ set_name = type(val).__set_name__
2864
+ except AttributeError:
2865
+ pass
2866
+ else:
2867
+ try:
2868
+ set_name(val, nm_tpl, key)
2869
+ except BaseException as e:
2870
+ msg = (
2871
+ f"Error calling __set_name__ on {type(val).__name__!r} "
2872
+ f"instance {key!r} in {typename!r}"
2873
+ )
2874
+ # BaseException.add_note() existed on py311,
2875
+ # but the __set_name__ machinery didn't start
2876
+ # using add_note() until py312.
2877
+ # Making sure exceptions are raised in the same way
2878
+ # as in "normal" classes seems most important here.
2879
+ if sys.version_info >= (3, 12):
2880
+ e.add_note(msg)
2881
+ raise
2882
+ else:
2883
+ raise RuntimeError(msg) from e
2884
+
2885
+ if typing.Generic in bases:
2886
+ nm_tpl.__init_subclass__()
2887
+ return nm_tpl
2888
+
2889
+ _NamedTuple = type.__new__(_NamedTupleMeta, 'NamedTuple', (), {})
2890
+
2891
+ def _namedtuple_mro_entries(bases):
2892
+ assert NamedTuple in bases
2893
+ return (_NamedTuple,)
2894
+
2895
+ @_ensure_subclassable(_namedtuple_mro_entries)
2896
+ def NamedTuple(typename, fields=_marker, /, **kwargs):
2897
+ """Typed version of namedtuple.
2898
+
2899
+ Usage::
2900
+
2901
+ class Employee(NamedTuple):
2902
+ name: str
2903
+ id: int
2904
+
2905
+ This is equivalent to::
2906
+
2907
+ Employee = collections.namedtuple('Employee', ['name', 'id'])
2908
+
2909
+ The resulting class has an extra __annotations__ attribute, giving a
2910
+ dict that maps field names to types. (The field names are also in
2911
+ the _fields attribute, which is part of the namedtuple API.)
2912
+ An alternative equivalent functional syntax is also accepted::
2913
+
2914
+ Employee = NamedTuple('Employee', [('name', str), ('id', int)])
2915
+ """
2916
+ if fields is _marker:
2917
+ if kwargs:
2918
+ deprecated_thing = "Creating NamedTuple classes using keyword arguments"
2919
+ deprecation_msg = (
2920
+ "{name} is deprecated and will be disallowed in Python {remove}. "
2921
+ "Use the class-based or functional syntax instead."
2922
+ )
2923
+ else:
2924
+ deprecated_thing = "Failing to pass a value for the 'fields' parameter"
2925
+ example = f"`{typename} = NamedTuple({typename!r}, [])`"
2926
+ deprecation_msg = (
2927
+ "{name} is deprecated and will be disallowed in Python {remove}. "
2928
+ "To create a NamedTuple class with 0 fields "
2929
+ "using the functional syntax, "
2930
+ "pass an empty list, e.g. "
2931
+ ) + example + "."
2932
+ elif fields is None:
2933
+ if kwargs:
2934
+ raise TypeError(
2935
+ "Cannot pass `None` as the 'fields' parameter "
2936
+ "and also specify fields using keyword arguments"
2937
+ )
2938
+ else:
2939
+ deprecated_thing = "Passing `None` as the 'fields' parameter"
2940
+ example = f"`{typename} = NamedTuple({typename!r}, [])`"
2941
+ deprecation_msg = (
2942
+ "{name} is deprecated and will be disallowed in Python {remove}. "
2943
+ "To create a NamedTuple class with 0 fields "
2944
+ "using the functional syntax, "
2945
+ "pass an empty list, e.g. "
2946
+ ) + example + "."
2947
+ elif kwargs:
2948
+ raise TypeError("Either list of fields or keywords"
2949
+ " can be provided to NamedTuple, not both")
2950
+ if fields is _marker or fields is None:
2951
+ warnings.warn(
2952
+ deprecation_msg.format(name=deprecated_thing, remove="3.15"),
2953
+ DeprecationWarning,
2954
+ stacklevel=2,
2955
+ )
2956
+ fields = kwargs.items()
2957
+ nt = _make_nmtuple(typename, fields, module=_caller())
2958
+ nt.__orig_bases__ = (NamedTuple,)
2959
+ return nt
2960
+
2961
+
2962
+ if hasattr(collections.abc, "Buffer"):
2963
+ Buffer = collections.abc.Buffer
2964
+ else:
2965
+ class Buffer(abc.ABC):
2966
+ """Base class for classes that implement the buffer protocol.
2967
+
2968
+ The buffer protocol allows Python objects to expose a low-level
2969
+ memory buffer interface. Before Python 3.12, it is not possible
2970
+ to implement the buffer protocol in pure Python code, or even
2971
+ to check whether a class implements the buffer protocol. In
2972
+ Python 3.12 and higher, the ``__buffer__`` method allows access
2973
+ to the buffer protocol from Python code, and the
2974
+ ``collections.abc.Buffer`` ABC allows checking whether a class
2975
+ implements the buffer protocol.
2976
+
2977
+ To indicate support for the buffer protocol in earlier versions,
2978
+ inherit from this ABC, either in a stub file or at runtime,
2979
+ or use ABC registration. This ABC provides no methods, because
2980
+ there is no Python-accessible methods shared by pre-3.12 buffer
2981
+ classes. It is useful primarily for static checks.
2982
+
2983
+ """
2984
+
2985
+ # As a courtesy, register the most common stdlib buffer classes.
2986
+ Buffer.register(memoryview)
2987
+ Buffer.register(bytearray)
2988
+ Buffer.register(bytes)
2989
+
2990
+
2991
+ # Backport of types.get_original_bases, available on 3.12+ in CPython
2992
+ if hasattr(_types, "get_original_bases"):
2993
+ get_original_bases = _types.get_original_bases
2994
+ else:
2995
+ def get_original_bases(cls, /):
2996
+ """Return the class's "original" bases prior to modification by `__mro_entries__`.
2997
+
2998
+ Examples::
2999
+
3000
+ from typing import TypeVar, Generic
3001
+ from pip._vendor.typing_extensions import NamedTuple, TypedDict
3002
+
3003
+ T = TypeVar("T")
3004
+ class Foo(Generic[T]): ...
3005
+ class Bar(Foo[int], float): ...
3006
+ class Baz(list[str]): ...
3007
+ Eggs = NamedTuple("Eggs", [("a", int), ("b", str)])
3008
+ Spam = TypedDict("Spam", {"a": int, "b": str})
3009
+
3010
+ assert get_original_bases(Bar) == (Foo[int], float)
3011
+ assert get_original_bases(Baz) == (list[str],)
3012
+ assert get_original_bases(Eggs) == (NamedTuple,)
3013
+ assert get_original_bases(Spam) == (TypedDict,)
3014
+ assert get_original_bases(int) == (object,)
3015
+ """
3016
+ try:
3017
+ return cls.__dict__.get("__orig_bases__", cls.__bases__)
3018
+ except AttributeError:
3019
+ raise TypeError(
3020
+ f'Expected an instance of type, not {type(cls).__name__!r}'
3021
+ ) from None
3022
+
3023
+
3024
+ # NewType is a class on Python 3.10+, making it pickleable
3025
+ # The error message for subclassing instances of NewType was improved on 3.11+
3026
+ if sys.version_info >= (3, 11):
3027
+ NewType = typing.NewType
3028
+ else:
3029
+ class NewType:
3030
+ """NewType creates simple unique types with almost zero
3031
+ runtime overhead. NewType(name, tp) is considered a subtype of tp
3032
+ by static type checkers. At runtime, NewType(name, tp) returns
3033
+ a dummy callable that simply returns its argument. Usage::
3034
+ UserId = NewType('UserId', int)
3035
+ def name_by_id(user_id: UserId) -> str:
3036
+ ...
3037
+ UserId('user') # Fails type check
3038
+ name_by_id(42) # Fails type check
3039
+ name_by_id(UserId(42)) # OK
3040
+ num = UserId(5) + 1 # type: int
3041
+ """
3042
+
3043
+ def __call__(self, obj, /):
3044
+ return obj
3045
+
3046
+ def __init__(self, name, tp):
3047
+ self.__qualname__ = name
3048
+ if '.' in name:
3049
+ name = name.rpartition('.')[-1]
3050
+ self.__name__ = name
3051
+ self.__supertype__ = tp
3052
+ def_mod = _caller()
3053
+ if def_mod != 'typing_extensions':
3054
+ self.__module__ = def_mod
3055
+
3056
+ def __mro_entries__(self, bases):
3057
+ # We defined __mro_entries__ to get a better error message
3058
+ # if a user attempts to subclass a NewType instance. bpo-46170
3059
+ supercls_name = self.__name__
3060
+
3061
+ class Dummy:
3062
+ def __init_subclass__(cls):
3063
+ subcls_name = cls.__name__
3064
+ raise TypeError(
3065
+ f"Cannot subclass an instance of NewType. "
3066
+ f"Perhaps you were looking for: "
3067
+ f"`{subcls_name} = NewType({subcls_name!r}, {supercls_name})`"
3068
+ )
3069
+
3070
+ return (Dummy,)
3071
+
3072
+ def __repr__(self):
3073
+ return f'{self.__module__}.{self.__qualname__}'
3074
+
3075
+ def __reduce__(self):
3076
+ return self.__qualname__
3077
+
3078
+ if sys.version_info >= (3, 10):
3079
+ # PEP 604 methods
3080
+ # It doesn't make sense to have these methods on Python <3.10
3081
+
3082
+ def __or__(self, other):
3083
+ return typing.Union[self, other]
3084
+
3085
+ def __ror__(self, other):
3086
+ return typing.Union[other, self]
3087
+
3088
+
3089
+ if hasattr(typing, "TypeAliasType"):
3090
+ TypeAliasType = typing.TypeAliasType
3091
+ else:
3092
+ def _is_unionable(obj):
3093
+ """Corresponds to is_unionable() in unionobject.c in CPython."""
3094
+ return obj is None or isinstance(obj, (
3095
+ type,
3096
+ _types.GenericAlias,
3097
+ _types.UnionType,
3098
+ TypeAliasType,
3099
+ ))
3100
+
3101
+ class TypeAliasType:
3102
+ """Create named, parameterized type aliases.
3103
+
3104
+ This provides a backport of the new `type` statement in Python 3.12:
3105
+
3106
+ type ListOrSet[T] = list[T] | set[T]
3107
+
3108
+ is equivalent to:
3109
+
3110
+ T = TypeVar("T")
3111
+ ListOrSet = TypeAliasType("ListOrSet", list[T] | set[T], type_params=(T,))
3112
+
3113
+ The name ListOrSet can then be used as an alias for the type it refers to.
3114
+
3115
+ The type_params argument should contain all the type parameters used
3116
+ in the value of the type alias. If the alias is not generic, this
3117
+ argument is omitted.
3118
+
3119
+ Static type checkers should only support type aliases declared using
3120
+ TypeAliasType that follow these rules:
3121
+
3122
+ - The first argument (the name) must be a string literal.
3123
+ - The TypeAliasType instance must be immediately assigned to a variable
3124
+ of the same name. (For example, 'X = TypeAliasType("Y", int)' is invalid,
3125
+ as is 'X, Y = TypeAliasType("X", int), TypeAliasType("Y", int)').
3126
+
3127
+ """
3128
+
3129
+ def __init__(self, name: str, value, *, type_params=()):
3130
+ if not isinstance(name, str):
3131
+ raise TypeError("TypeAliasType name must be a string")
3132
+ self.__value__ = value
3133
+ self.__type_params__ = type_params
3134
+
3135
+ parameters = []
3136
+ for type_param in type_params:
3137
+ if isinstance(type_param, TypeVarTuple):
3138
+ parameters.extend(type_param)
3139
+ else:
3140
+ parameters.append(type_param)
3141
+ self.__parameters__ = tuple(parameters)
3142
+ def_mod = _caller()
3143
+ if def_mod != 'typing_extensions':
3144
+ self.__module__ = def_mod
3145
+ # Setting this attribute closes the TypeAliasType from further modification
3146
+ self.__name__ = name
3147
+
3148
+ def __setattr__(self, name: str, value: object, /) -> None:
3149
+ if hasattr(self, "__name__"):
3150
+ self._raise_attribute_error(name)
3151
+ super().__setattr__(name, value)
3152
+
3153
+ def __delattr__(self, name: str, /) -> Never:
3154
+ self._raise_attribute_error(name)
3155
+
3156
+ def _raise_attribute_error(self, name: str) -> Never:
3157
+ # Match the Python 3.12 error messages exactly
3158
+ if name == "__name__":
3159
+ raise AttributeError("readonly attribute")
3160
+ elif name in {"__value__", "__type_params__", "__parameters__", "__module__"}:
3161
+ raise AttributeError(
3162
+ f"attribute '{name}' of 'typing.TypeAliasType' objects "
3163
+ "is not writable"
3164
+ )
3165
+ else:
3166
+ raise AttributeError(
3167
+ f"'typing.TypeAliasType' object has no attribute '{name}'"
3168
+ )
3169
+
3170
+ def __repr__(self) -> str:
3171
+ return self.__name__
3172
+
3173
+ def __getitem__(self, parameters):
3174
+ if not isinstance(parameters, tuple):
3175
+ parameters = (parameters,)
3176
+ parameters = [
3177
+ typing._type_check(
3178
+ item, f'Subscripting {self.__name__} requires a type.'
3179
+ )
3180
+ for item in parameters
3181
+ ]
3182
+ return typing._GenericAlias(self, tuple(parameters))
3183
+
3184
+ def __reduce__(self):
3185
+ return self.__name__
3186
+
3187
+ def __init_subclass__(cls, *args, **kwargs):
3188
+ raise TypeError(
3189
+ "type 'typing_extensions.TypeAliasType' is not an acceptable base type"
3190
+ )
3191
+
3192
+ # The presence of this method convinces typing._type_check
3193
+ # that TypeAliasTypes are types.
3194
+ def __call__(self):
3195
+ raise TypeError("Type alias is not callable")
3196
+
3197
+ if sys.version_info >= (3, 10):
3198
+ def __or__(self, right):
3199
+ # For forward compatibility with 3.12, reject Unions
3200
+ # that are not accepted by the built-in Union.
3201
+ if not _is_unionable(right):
3202
+ return NotImplemented
3203
+ return typing.Union[self, right]
3204
+
3205
+ def __ror__(self, left):
3206
+ if not _is_unionable(left):
3207
+ return NotImplemented
3208
+ return typing.Union[left, self]
3209
+
3210
+
3211
+ if hasattr(typing, "is_protocol"):
3212
+ is_protocol = typing.is_protocol
3213
+ get_protocol_members = typing.get_protocol_members
3214
+ else:
3215
+ def is_protocol(tp: type, /) -> bool:
3216
+ """Return True if the given type is a Protocol.
3217
+
3218
+ Example::
3219
+
3220
+ >>> from typing_extensions import Protocol, is_protocol
3221
+ >>> class P(Protocol):
3222
+ ... def a(self) -> str: ...
3223
+ ... b: int
3224
+ >>> is_protocol(P)
3225
+ True
3226
+ >>> is_protocol(int)
3227
+ False
3228
+ """
3229
+ return (
3230
+ isinstance(tp, type)
3231
+ and getattr(tp, '_is_protocol', False)
3232
+ and tp is not Protocol
3233
+ and tp is not typing.Protocol
3234
+ )
3235
+
3236
+ def get_protocol_members(tp: type, /) -> typing.FrozenSet[str]:
3237
+ """Return the set of members defined in a Protocol.
3238
+
3239
+ Example::
3240
+
3241
+ >>> from typing_extensions import Protocol, get_protocol_members
3242
+ >>> class P(Protocol):
3243
+ ... def a(self) -> str: ...
3244
+ ... b: int
3245
+ >>> get_protocol_members(P)
3246
+ frozenset({'a', 'b'})
3247
+
3248
+ Raise a TypeError for arguments that are not Protocols.
3249
+ """
3250
+ if not is_protocol(tp):
3251
+ raise TypeError(f'{tp!r} is not a Protocol')
3252
+ if hasattr(tp, '__protocol_attrs__'):
3253
+ return frozenset(tp.__protocol_attrs__)
3254
+ return frozenset(_get_protocol_attrs(tp))
3255
+
3256
+
3257
+ if hasattr(typing, "Doc"):
3258
+ Doc = typing.Doc
3259
+ else:
3260
+ class Doc:
3261
+ """Define the documentation of a type annotation using ``Annotated``, to be
3262
+ used in class attributes, function and method parameters, return values,
3263
+ and variables.
3264
+
3265
+ The value should be a positional-only string literal to allow static tools
3266
+ like editors and documentation generators to use it.
3267
+
3268
+ This complements docstrings.
3269
+
3270
+ The string value passed is available in the attribute ``documentation``.
3271
+
3272
+ Example::
3273
+
3274
+ >>> from typing_extensions import Annotated, Doc
3275
+ >>> def hi(to: Annotated[str, Doc("Who to say hi to")]) -> None: ...
3276
+ """
3277
+ def __init__(self, documentation: str, /) -> None:
3278
+ self.documentation = documentation
3279
+
3280
+ def __repr__(self) -> str:
3281
+ return f"Doc({self.documentation!r})"
3282
+
3283
+ def __hash__(self) -> int:
3284
+ return hash(self.documentation)
3285
+
3286
+ def __eq__(self, other: object) -> bool:
3287
+ if not isinstance(other, Doc):
3288
+ return NotImplemented
3289
+ return self.documentation == other.documentation
3290
+
3291
+
3292
+ # Aliases for items that have always been in typing.
3293
+ # Explicitly assign these (rather than using `from typing import *` at the top),
3294
+ # so that we get a CI error if one of these is deleted from typing.py
3295
+ # in a future version of Python
3296
+ AbstractSet = typing.AbstractSet
3297
+ AnyStr = typing.AnyStr
3298
+ BinaryIO = typing.BinaryIO
3299
+ Callable = typing.Callable
3300
+ Collection = typing.Collection
3301
+ Container = typing.Container
3302
+ Dict = typing.Dict
3303
+ ForwardRef = typing.ForwardRef
3304
+ FrozenSet = typing.FrozenSet
3305
+ Generator = typing.Generator
3306
+ Generic = typing.Generic
3307
+ Hashable = typing.Hashable
3308
+ IO = typing.IO
3309
+ ItemsView = typing.ItemsView
3310
+ Iterable = typing.Iterable
3311
+ Iterator = typing.Iterator
3312
+ KeysView = typing.KeysView
3313
+ List = typing.List
3314
+ Mapping = typing.Mapping
3315
+ MappingView = typing.MappingView
3316
+ Match = typing.Match
3317
+ MutableMapping = typing.MutableMapping
3318
+ MutableSequence = typing.MutableSequence
3319
+ MutableSet = typing.MutableSet
3320
+ Optional = typing.Optional
3321
+ Pattern = typing.Pattern
3322
+ Reversible = typing.Reversible
3323
+ Sequence = typing.Sequence
3324
+ Set = typing.Set
3325
+ Sized = typing.Sized
3326
+ TextIO = typing.TextIO
3327
+ Tuple = typing.Tuple
3328
+ Union = typing.Union
3329
+ ValuesView = typing.ValuesView
3330
+ cast = typing.cast
3331
+ no_type_check = typing.no_type_check
3332
+ no_type_check_decorator = typing.no_type_check_decorator