claude-all-hands 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1463) hide show
  1. package/.claude/agents/curator.md +128 -0
  2. package/.claude/agents/explorer.md +70 -0
  3. package/.claude/agents/parallel-worker.md +104 -0
  4. package/.claude/agents/planner.md +131 -0
  5. package/.claude/agents/researcher.md +48 -0
  6. package/.claude/commands/curation-fix.md +68 -0
  7. package/.claude/commands/new-branch.md +11 -0
  8. package/.claude/commands/parallel-discovery.md +51 -0
  9. package/.claude/commands/parallel-orchestration.md +81 -0
  10. package/.claude/commands/plan-checkpoint.md +12 -0
  11. package/.claude/commands/plan.md +64 -0
  12. package/.claude/envoy/.venv/.requirements.txt +2 -0
  13. package/.claude/envoy/.venv/bin/Activate.ps1 +241 -0
  14. package/.claude/envoy/.venv/bin/activate +66 -0
  15. package/.claude/envoy/.venv/bin/activate.csh +25 -0
  16. package/.claude/envoy/.venv/bin/activate.fish +64 -0
  17. package/.claude/envoy/.venv/bin/httpx +8 -0
  18. package/.claude/envoy/.venv/bin/normalizer +8 -0
  19. package/.claude/envoy/.venv/bin/pip +8 -0
  20. package/.claude/envoy/.venv/bin/pip3 +8 -0
  21. package/.claude/envoy/.venv/bin/pip3.9 +8 -0
  22. package/.claude/envoy/.venv/bin/pyrsa-decrypt +8 -0
  23. package/.claude/envoy/.venv/bin/pyrsa-encrypt +8 -0
  24. package/.claude/envoy/.venv/bin/pyrsa-keygen +8 -0
  25. package/.claude/envoy/.venv/bin/pyrsa-priv2pub +8 -0
  26. package/.claude/envoy/.venv/bin/pyrsa-sign +8 -0
  27. package/.claude/envoy/.venv/bin/pyrsa-verify +8 -0
  28. package/.claude/envoy/.venv/bin/websockets +8 -0
  29. package/.claude/envoy/.venv/lib/python3.9/site-packages/_distutils_hack/__init__.py +128 -0
  30. package/.claude/envoy/.venv/lib/python3.9/site-packages/_distutils_hack/override.py +1 -0
  31. package/.claude/envoy/.venv/lib/python3.9/site-packages/annotated_types/__init__.py +432 -0
  32. package/.claude/envoy/.venv/lib/python3.9/site-packages/annotated_types/py.typed +0 -0
  33. package/.claude/envoy/.venv/lib/python3.9/site-packages/annotated_types/test_cases.py +151 -0
  34. package/.claude/envoy/.venv/lib/python3.9/site-packages/annotated_types-0.7.0.dist-info/INSTALLER +1 -0
  35. package/.claude/envoy/.venv/lib/python3.9/site-packages/annotated_types-0.7.0.dist-info/METADATA +295 -0
  36. package/.claude/envoy/.venv/lib/python3.9/site-packages/annotated_types-0.7.0.dist-info/RECORD +10 -0
  37. package/.claude/envoy/.venv/lib/python3.9/site-packages/annotated_types-0.7.0.dist-info/WHEEL +4 -0
  38. package/.claude/envoy/.venv/lib/python3.9/site-packages/annotated_types-0.7.0.dist-info/licenses/LICENSE +21 -0
  39. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/__init__.py +111 -0
  40. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_backends/__init__.py +0 -0
  41. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_backends/_asyncio.py +3007 -0
  42. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_backends/_trio.py +1384 -0
  43. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_core/__init__.py +0 -0
  44. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_core/_asyncio_selector_thread.py +167 -0
  45. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_core/_contextmanagers.py +200 -0
  46. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_core/_eventloop.py +229 -0
  47. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_core/_exceptions.py +153 -0
  48. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_core/_fileio.py +797 -0
  49. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_core/_resources.py +18 -0
  50. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_core/_signals.py +27 -0
  51. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_core/_sockets.py +991 -0
  52. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_core/_streams.py +52 -0
  53. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_core/_subprocesses.py +202 -0
  54. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_core/_synchronization.py +753 -0
  55. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_core/_tasks.py +163 -0
  56. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_core/_tempfile.py +616 -0
  57. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_core/_testing.py +78 -0
  58. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/_core/_typedattr.py +81 -0
  59. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/abc/__init__.py +58 -0
  60. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/abc/_eventloop.py +420 -0
  61. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/abc/_resources.py +33 -0
  62. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/abc/_sockets.py +405 -0
  63. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/abc/_streams.py +239 -0
  64. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/abc/_subprocesses.py +79 -0
  65. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/abc/_tasks.py +117 -0
  66. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/abc/_testing.py +65 -0
  67. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/from_thread.py +570 -0
  68. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/functools.py +347 -0
  69. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/lowlevel.py +195 -0
  70. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/py.typed +0 -0
  71. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/pytest_plugin.py +302 -0
  72. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/streams/__init__.py +0 -0
  73. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/streams/buffered.py +188 -0
  74. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/streams/file.py +154 -0
  75. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/streams/memory.py +325 -0
  76. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/streams/stapled.py +147 -0
  77. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/streams/text.py +176 -0
  78. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/streams/tls.py +424 -0
  79. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/to_interpreter.py +246 -0
  80. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/to_process.py +264 -0
  81. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio/to_thread.py +74 -0
  82. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio-4.12.0.dist-info/INSTALLER +1 -0
  83. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio-4.12.0.dist-info/METADATA +96 -0
  84. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio-4.12.0.dist-info/RECORD +92 -0
  85. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio-4.12.0.dist-info/WHEEL +5 -0
  86. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio-4.12.0.dist-info/entry_points.txt +2 -0
  87. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio-4.12.0.dist-info/licenses/LICENSE +20 -0
  88. package/.claude/envoy/.venv/lib/python3.9/site-packages/anyio-4.12.0.dist-info/top_level.txt +1 -0
  89. package/.claude/envoy/.venv/lib/python3.9/site-packages/cachetools/__init__.py +718 -0
  90. package/.claude/envoy/.venv/lib/python3.9/site-packages/cachetools/_cached.py +247 -0
  91. package/.claude/envoy/.venv/lib/python3.9/site-packages/cachetools/_cachedmethod.py +128 -0
  92. package/.claude/envoy/.venv/lib/python3.9/site-packages/cachetools/func.py +102 -0
  93. package/.claude/envoy/.venv/lib/python3.9/site-packages/cachetools/keys.py +62 -0
  94. package/.claude/envoy/.venv/lib/python3.9/site-packages/cachetools-6.2.2.dist-info/INSTALLER +1 -0
  95. package/.claude/envoy/.venv/lib/python3.9/site-packages/cachetools-6.2.2.dist-info/METADATA +156 -0
  96. package/.claude/envoy/.venv/lib/python3.9/site-packages/cachetools-6.2.2.dist-info/RECORD +16 -0
  97. package/.claude/envoy/.venv/lib/python3.9/site-packages/cachetools-6.2.2.dist-info/WHEEL +5 -0
  98. package/.claude/envoy/.venv/lib/python3.9/site-packages/cachetools-6.2.2.dist-info/licenses/LICENSE +20 -0
  99. package/.claude/envoy/.venv/lib/python3.9/site-packages/cachetools-6.2.2.dist-info/top_level.txt +1 -0
  100. package/.claude/envoy/.venv/lib/python3.9/site-packages/certifi/__init__.py +4 -0
  101. package/.claude/envoy/.venv/lib/python3.9/site-packages/certifi/__main__.py +12 -0
  102. package/.claude/envoy/.venv/lib/python3.9/site-packages/certifi/cacert.pem +4678 -0
  103. package/.claude/envoy/.venv/lib/python3.9/site-packages/certifi/core.py +83 -0
  104. package/.claude/envoy/.venv/lib/python3.9/site-packages/certifi/py.typed +0 -0
  105. package/.claude/envoy/.venv/lib/python3.9/site-packages/certifi-2025.11.12.dist-info/INSTALLER +1 -0
  106. package/.claude/envoy/.venv/lib/python3.9/site-packages/certifi-2025.11.12.dist-info/METADATA +78 -0
  107. package/.claude/envoy/.venv/lib/python3.9/site-packages/certifi-2025.11.12.dist-info/RECORD +14 -0
  108. package/.claude/envoy/.venv/lib/python3.9/site-packages/certifi-2025.11.12.dist-info/WHEEL +5 -0
  109. package/.claude/envoy/.venv/lib/python3.9/site-packages/certifi-2025.11.12.dist-info/licenses/LICENSE +20 -0
  110. package/.claude/envoy/.venv/lib/python3.9/site-packages/certifi-2025.11.12.dist-info/top_level.txt +1 -0
  111. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer/__init__.py +48 -0
  112. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer/__main__.py +6 -0
  113. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer/api.py +669 -0
  114. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer/cd.py +395 -0
  115. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer/cli/__init__.py +8 -0
  116. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer/cli/__main__.py +381 -0
  117. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer/constant.py +2015 -0
  118. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer/legacy.py +80 -0
  119. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer/md.cpython-39-darwin.so +0 -0
  120. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer/md.py +635 -0
  121. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer/md__mypyc.cpython-39-darwin.so +0 -0
  122. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer/models.py +360 -0
  123. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer/py.typed +0 -0
  124. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer/utils.py +414 -0
  125. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer/version.py +8 -0
  126. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer-3.4.4.dist-info/INSTALLER +1 -0
  127. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer-3.4.4.dist-info/METADATA +764 -0
  128. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer-3.4.4.dist-info/RECORD +35 -0
  129. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer-3.4.4.dist-info/WHEEL +6 -0
  130. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer-3.4.4.dist-info/entry_points.txt +2 -0
  131. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer-3.4.4.dist-info/licenses/LICENSE +21 -0
  132. package/.claude/envoy/.venv/lib/python3.9/site-packages/charset_normalizer-3.4.4.dist-info/top_level.txt +1 -0
  133. package/.claude/envoy/.venv/lib/python3.9/site-packages/distutils-precedence.pth +1 -0
  134. package/.claude/envoy/.venv/lib/python3.9/site-packages/exceptiongroup/__init__.py +46 -0
  135. package/.claude/envoy/.venv/lib/python3.9/site-packages/exceptiongroup/_catch.py +138 -0
  136. package/.claude/envoy/.venv/lib/python3.9/site-packages/exceptiongroup/_exceptions.py +336 -0
  137. package/.claude/envoy/.venv/lib/python3.9/site-packages/exceptiongroup/_formatting.py +602 -0
  138. package/.claude/envoy/.venv/lib/python3.9/site-packages/exceptiongroup/_suppress.py +55 -0
  139. package/.claude/envoy/.venv/lib/python3.9/site-packages/exceptiongroup/_version.py +34 -0
  140. package/.claude/envoy/.venv/lib/python3.9/site-packages/exceptiongroup/py.typed +0 -0
  141. package/.claude/envoy/.venv/lib/python3.9/site-packages/exceptiongroup-1.3.1.dist-info/INSTALLER +1 -0
  142. package/.claude/envoy/.venv/lib/python3.9/site-packages/exceptiongroup-1.3.1.dist-info/METADATA +159 -0
  143. package/.claude/envoy/.venv/lib/python3.9/site-packages/exceptiongroup-1.3.1.dist-info/RECORD +18 -0
  144. package/.claude/envoy/.venv/lib/python3.9/site-packages/exceptiongroup-1.3.1.dist-info/WHEEL +4 -0
  145. package/.claude/envoy/.venv/lib/python3.9/site-packages/exceptiongroup-1.3.1.dist-info/licenses/LICENSE +73 -0
  146. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/__init__.py +53 -0
  147. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/_cloud_sdk.py +153 -0
  148. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/_constants.py +5 -0
  149. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/_credentials_async.py +171 -0
  150. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/_credentials_base.py +75 -0
  151. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/_default.py +739 -0
  152. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/_default_async.py +288 -0
  153. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/_exponential_backoff.py +164 -0
  154. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/_helpers.py +554 -0
  155. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/_jwt_async.py +164 -0
  156. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/_oauth2client.py +167 -0
  157. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/_refresh_worker.py +109 -0
  158. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/_service_account_info.py +80 -0
  159. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/aio/__init__.py +25 -0
  160. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/aio/_helpers.py +62 -0
  161. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/aio/credentials.py +143 -0
  162. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/aio/transport/__init__.py +144 -0
  163. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/aio/transport/aiohttp.py +190 -0
  164. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/aio/transport/sessions.py +268 -0
  165. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/api_key.py +76 -0
  166. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/app_engine.py +180 -0
  167. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/aws.py +861 -0
  168. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/compute_engine/__init__.py +22 -0
  169. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/compute_engine/_metadata.py +379 -0
  170. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/compute_engine/credentials.py +558 -0
  171. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/credentials.py +665 -0
  172. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/crypt/__init__.py +98 -0
  173. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/crypt/_cryptography_rsa.py +151 -0
  174. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/crypt/_helpers.py +0 -0
  175. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/crypt/_python_rsa.py +175 -0
  176. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/crypt/base.py +127 -0
  177. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/crypt/es256.py +175 -0
  178. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/crypt/rsa.py +30 -0
  179. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/downscoped.py +512 -0
  180. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/environment_vars.py +88 -0
  181. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/exceptions.py +108 -0
  182. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/external_account.py +708 -0
  183. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/external_account_authorized_user.py +433 -0
  184. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/iam.py +136 -0
  185. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/identity_pool.py +552 -0
  186. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/impersonated_credentials.py +705 -0
  187. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/jwt.py +878 -0
  188. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/metrics.py +154 -0
  189. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/pluggable.py +453 -0
  190. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/py.typed +2 -0
  191. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/transport/__init__.py +104 -0
  192. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/transport/_aiohttp_requests.py +398 -0
  193. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/transport/_custom_tls_signer.py +283 -0
  194. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/transport/_http_client.py +115 -0
  195. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/transport/_mtls_helper.py +446 -0
  196. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/transport/_requests_base.py +53 -0
  197. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/transport/grpc.py +337 -0
  198. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/transport/mtls.py +129 -0
  199. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/transport/requests.py +597 -0
  200. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/transport/urllib3.py +449 -0
  201. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/auth/version.py +15 -0
  202. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/__init__.py +25 -0
  203. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/_adapters.py +55 -0
  204. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/_api_client.py +1840 -0
  205. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/_api_module.py +29 -0
  206. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/_automatic_function_calling_util.py +325 -0
  207. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/_base_transformers.py +26 -0
  208. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/_base_url.py +50 -0
  209. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/_common.py +778 -0
  210. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/_extra_utils.py +618 -0
  211. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/_live_converters.py +1424 -0
  212. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/_local_tokenizer_loader.py +223 -0
  213. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/_mcp_utils.py +117 -0
  214. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/_operations_converters.py +298 -0
  215. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/_replay_api_client.py +686 -0
  216. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/_test_api_client.py +149 -0
  217. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/_tokens_converters.py +480 -0
  218. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/_transformers.py +1368 -0
  219. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/batches.py +2461 -0
  220. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/caches.py +1489 -0
  221. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/chats.py +531 -0
  222. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/client.py +403 -0
  223. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/errors.py +202 -0
  224. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/files.py +1019 -0
  225. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/live.py +1165 -0
  226. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/live_music.py +197 -0
  227. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/local_tokenizer.py +395 -0
  228. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/models.py +7335 -0
  229. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/operations.py +498 -0
  230. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/pagers.py +262 -0
  231. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/py.typed +1 -0
  232. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/tokens.py +362 -0
  233. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/tunings.py +1970 -0
  234. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/types.py +16507 -0
  235. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/genai/version.py +16 -0
  236. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/__init__.py +36 -0
  237. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/_client.py +625 -0
  238. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/_client_async.py +286 -0
  239. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/_credentials_async.py +118 -0
  240. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/_id_token_async.py +285 -0
  241. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/_reauth_async.py +328 -0
  242. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/_service_account_async.py +132 -0
  243. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/challenges.py +281 -0
  244. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/credentials.py +614 -0
  245. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/gdch_credentials.py +251 -0
  246. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/id_token.py +370 -0
  247. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/py.typed +2 -0
  248. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/reauth.py +369 -0
  249. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/service_account.py +881 -0
  250. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/sts.py +176 -0
  251. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/utils.py +168 -0
  252. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/webauthn_handler.py +82 -0
  253. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/webauthn_handler_factory.py +16 -0
  254. package/.claude/envoy/.venv/lib/python3.9/site-packages/google/oauth2/webauthn_types.py +156 -0
  255. package/.claude/envoy/.venv/lib/python3.9/site-packages/google_auth-2.43.0.dist-info/INSTALLER +1 -0
  256. package/.claude/envoy/.venv/lib/python3.9/site-packages/google_auth-2.43.0.dist-info/METADATA +181 -0
  257. package/.claude/envoy/.venv/lib/python3.9/site-packages/google_auth-2.43.0.dist-info/RECORD +154 -0
  258. package/.claude/envoy/.venv/lib/python3.9/site-packages/google_auth-2.43.0.dist-info/WHEEL +6 -0
  259. package/.claude/envoy/.venv/lib/python3.9/site-packages/google_auth-2.43.0.dist-info/licenses/LICENSE +201 -0
  260. package/.claude/envoy/.venv/lib/python3.9/site-packages/google_auth-2.43.0.dist-info/top_level.txt +1 -0
  261. package/.claude/envoy/.venv/lib/python3.9/site-packages/google_genai-1.47.0.dist-info/INSTALLER +1 -0
  262. package/.claude/envoy/.venv/lib/python3.9/site-packages/google_genai-1.47.0.dist-info/METADATA +1864 -0
  263. package/.claude/envoy/.venv/lib/python3.9/site-packages/google_genai-1.47.0.dist-info/RECORD +74 -0
  264. package/.claude/envoy/.venv/lib/python3.9/site-packages/google_genai-1.47.0.dist-info/REQUESTED +0 -0
  265. package/.claude/envoy/.venv/lib/python3.9/site-packages/google_genai-1.47.0.dist-info/WHEEL +5 -0
  266. package/.claude/envoy/.venv/lib/python3.9/site-packages/google_genai-1.47.0.dist-info/licenses/LICENSE +202 -0
  267. package/.claude/envoy/.venv/lib/python3.9/site-packages/google_genai-1.47.0.dist-info/top_level.txt +1 -0
  268. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11/__init__.py +62 -0
  269. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11/_abnf.py +132 -0
  270. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11/_connection.py +659 -0
  271. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11/_events.py +369 -0
  272. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11/_headers.py +282 -0
  273. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11/_readers.py +250 -0
  274. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11/_receivebuffer.py +153 -0
  275. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11/_state.py +365 -0
  276. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11/_util.py +135 -0
  277. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11/_version.py +16 -0
  278. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11/_writers.py +145 -0
  279. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11/py.typed +1 -0
  280. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11-0.16.0.dist-info/INSTALLER +1 -0
  281. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11-0.16.0.dist-info/METADATA +202 -0
  282. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11-0.16.0.dist-info/RECORD +29 -0
  283. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11-0.16.0.dist-info/WHEEL +5 -0
  284. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11-0.16.0.dist-info/licenses/LICENSE.txt +22 -0
  285. package/.claude/envoy/.venv/lib/python3.9/site-packages/h11-0.16.0.dist-info/top_level.txt +1 -0
  286. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/__init__.py +141 -0
  287. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_api.py +94 -0
  288. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_async/__init__.py +39 -0
  289. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_async/connection.py +222 -0
  290. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_async/connection_pool.py +420 -0
  291. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_async/http11.py +379 -0
  292. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_async/http2.py +592 -0
  293. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_async/http_proxy.py +367 -0
  294. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_async/interfaces.py +137 -0
  295. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_async/socks_proxy.py +341 -0
  296. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_backends/__init__.py +0 -0
  297. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_backends/anyio.py +146 -0
  298. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_backends/auto.py +52 -0
  299. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_backends/base.py +101 -0
  300. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_backends/mock.py +143 -0
  301. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_backends/sync.py +241 -0
  302. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_backends/trio.py +159 -0
  303. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_exceptions.py +81 -0
  304. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_models.py +516 -0
  305. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_ssl.py +9 -0
  306. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_sync/__init__.py +39 -0
  307. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_sync/connection.py +222 -0
  308. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_sync/connection_pool.py +420 -0
  309. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_sync/http11.py +379 -0
  310. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_sync/http2.py +592 -0
  311. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_sync/http_proxy.py +367 -0
  312. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_sync/interfaces.py +137 -0
  313. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_sync/socks_proxy.py +341 -0
  314. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_synchronization.py +318 -0
  315. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_trace.py +107 -0
  316. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/_utils.py +37 -0
  317. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore/py.typed +0 -0
  318. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore-1.0.9.dist-info/INSTALLER +1 -0
  319. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore-1.0.9.dist-info/METADATA +625 -0
  320. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore-1.0.9.dist-info/RECORD +68 -0
  321. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore-1.0.9.dist-info/WHEEL +4 -0
  322. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpcore-1.0.9.dist-info/licenses/LICENSE.md +27 -0
  323. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/__init__.py +105 -0
  324. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/__version__.py +3 -0
  325. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_api.py +438 -0
  326. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_auth.py +348 -0
  327. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_client.py +2019 -0
  328. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_config.py +248 -0
  329. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_content.py +240 -0
  330. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_decoders.py +393 -0
  331. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_exceptions.py +379 -0
  332. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_main.py +506 -0
  333. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_models.py +1277 -0
  334. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_multipart.py +300 -0
  335. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_status_codes.py +162 -0
  336. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_transports/__init__.py +15 -0
  337. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_transports/asgi.py +187 -0
  338. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_transports/base.py +86 -0
  339. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_transports/default.py +406 -0
  340. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_transports/mock.py +43 -0
  341. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_transports/wsgi.py +149 -0
  342. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_types.py +114 -0
  343. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_urlparse.py +527 -0
  344. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_urls.py +641 -0
  345. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/_utils.py +242 -0
  346. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx/py.typed +0 -0
  347. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx-0.28.1.dist-info/INSTALLER +1 -0
  348. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx-0.28.1.dist-info/METADATA +203 -0
  349. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx-0.28.1.dist-info/RECORD +54 -0
  350. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx-0.28.1.dist-info/WHEEL +4 -0
  351. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx-0.28.1.dist-info/entry_points.txt +2 -0
  352. package/.claude/envoy/.venv/lib/python3.9/site-packages/httpx-0.28.1.dist-info/licenses/LICENSE.md +12 -0
  353. package/.claude/envoy/.venv/lib/python3.9/site-packages/idna/__init__.py +45 -0
  354. package/.claude/envoy/.venv/lib/python3.9/site-packages/idna/codec.py +122 -0
  355. package/.claude/envoy/.venv/lib/python3.9/site-packages/idna/compat.py +15 -0
  356. package/.claude/envoy/.venv/lib/python3.9/site-packages/idna/core.py +437 -0
  357. package/.claude/envoy/.venv/lib/python3.9/site-packages/idna/idnadata.py +4309 -0
  358. package/.claude/envoy/.venv/lib/python3.9/site-packages/idna/intranges.py +57 -0
  359. package/.claude/envoy/.venv/lib/python3.9/site-packages/idna/package_data.py +1 -0
  360. package/.claude/envoy/.venv/lib/python3.9/site-packages/idna/py.typed +0 -0
  361. package/.claude/envoy/.venv/lib/python3.9/site-packages/idna/uts46data.py +8841 -0
  362. package/.claude/envoy/.venv/lib/python3.9/site-packages/idna-3.11.dist-info/INSTALLER +1 -0
  363. package/.claude/envoy/.venv/lib/python3.9/site-packages/idna-3.11.dist-info/METADATA +209 -0
  364. package/.claude/envoy/.venv/lib/python3.9/site-packages/idna-3.11.dist-info/RECORD +22 -0
  365. package/.claude/envoy/.venv/lib/python3.9/site-packages/idna-3.11.dist-info/WHEEL +4 -0
  366. package/.claude/envoy/.venv/lib/python3.9/site-packages/idna-3.11.dist-info/licenses/LICENSE.md +31 -0
  367. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/__init__.py +13 -0
  368. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/__main__.py +31 -0
  369. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/__init__.py +19 -0
  370. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/build_env.py +294 -0
  371. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/cache.py +287 -0
  372. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/cli/__init__.py +4 -0
  373. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py +163 -0
  374. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/cli/base_command.py +214 -0
  375. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.py +1009 -0
  376. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/cli/command_context.py +27 -0
  377. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/cli/main.py +70 -0
  378. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py +87 -0
  379. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/cli/parser.py +292 -0
  380. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/cli/progress_bars.py +250 -0
  381. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/cli/req_command.py +453 -0
  382. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/cli/spinners.py +157 -0
  383. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/cli/status_codes.py +6 -0
  384. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/commands/__init__.py +112 -0
  385. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/commands/cache.py +216 -0
  386. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/commands/check.py +47 -0
  387. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/commands/completion.py +91 -0
  388. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/commands/configuration.py +266 -0
  389. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/commands/debug.py +204 -0
  390. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/commands/download.py +139 -0
  391. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/commands/freeze.py +84 -0
  392. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/commands/hash.py +55 -0
  393. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/commands/help.py +41 -0
  394. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/commands/index.py +139 -0
  395. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/commands/install.py +750 -0
  396. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/commands/list.py +337 -0
  397. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/commands/search.py +164 -0
  398. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/commands/show.py +234 -0
  399. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/commands/uninstall.py +100 -0
  400. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/commands/wheel.py +176 -0
  401. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/configuration.py +403 -0
  402. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__init__.py +21 -0
  403. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/distributions/base.py +38 -0
  404. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/distributions/installed.py +22 -0
  405. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/distributions/sdist.py +95 -0
  406. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/distributions/wheel.py +34 -0
  407. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/exceptions.py +397 -0
  408. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/index/__init__.py +2 -0
  409. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/index/collector.py +534 -0
  410. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/index/package_finder.py +982 -0
  411. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/index/sources.py +224 -0
  412. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/locations/__init__.py +408 -0
  413. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/locations/_distutils.py +169 -0
  414. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/locations/_sysconfig.py +219 -0
  415. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/locations/base.py +52 -0
  416. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/main.py +13 -0
  417. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/metadata/__init__.py +48 -0
  418. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/metadata/base.py +242 -0
  419. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/metadata/pkg_resources.py +153 -0
  420. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/models/__init__.py +2 -0
  421. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/models/candidate.py +31 -0
  422. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/models/direct_url.py +220 -0
  423. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/models/format_control.py +84 -0
  424. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/models/index.py +32 -0
  425. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/models/link.py +288 -0
  426. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/models/scheme.py +31 -0
  427. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/models/search_scope.py +126 -0
  428. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/models/selection_prefs.py +46 -0
  429. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/models/target_python.py +111 -0
  430. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/models/wheel.py +92 -0
  431. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/network/__init__.py +2 -0
  432. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/network/auth.py +316 -0
  433. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/network/cache.py +69 -0
  434. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/network/download.py +184 -0
  435. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/network/lazy_wheel.py +210 -0
  436. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/network/session.py +454 -0
  437. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/network/utils.py +96 -0
  438. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/network/xmlrpc.py +60 -0
  439. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/operations/__init__.py +0 -0
  440. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__init__.py +0 -0
  441. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/metadata.py +35 -0
  442. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/metadata_legacy.py +74 -0
  443. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/wheel.py +38 -0
  444. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/wheel_legacy.py +110 -0
  445. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/operations/check.py +153 -0
  446. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/operations/freeze.py +277 -0
  447. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/__init__.py +2 -0
  448. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/editable_legacy.py +47 -0
  449. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/legacy.py +132 -0
  450. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/wheel.py +803 -0
  451. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/operations/prepare.py +655 -0
  452. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/pyproject.py +183 -0
  453. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/req/__init__.py +94 -0
  454. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/req/constructors.py +474 -0
  455. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/req/req_file.py +528 -0
  456. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/req/req_install.py +846 -0
  457. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/req/req_set.py +190 -0
  458. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/req/req_tracker.py +130 -0
  459. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/req/req_uninstall.py +629 -0
  460. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/resolution/__init__.py +0 -0
  461. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/resolution/base.py +18 -0
  462. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__init__.py +0 -0
  463. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/resolution/legacy/resolver.py +453 -0
  464. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__init__.py +0 -0
  465. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/base.py +144 -0
  466. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py +555 -0
  467. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/factory.py +700 -0
  468. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py +142 -0
  469. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/provider.py +197 -0
  470. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/reporter.py +69 -0
  471. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/requirements.py +166 -0
  472. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py +272 -0
  473. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/self_outdated_check.py +187 -0
  474. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/__init__.py +0 -0
  475. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/_log.py +38 -0
  476. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/appdirs.py +35 -0
  477. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/compat.py +63 -0
  478. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/compatibility_tags.py +168 -0
  479. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/datetime.py +11 -0
  480. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/deprecation.py +104 -0
  481. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/direct_url_helpers.py +79 -0
  482. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/distutils_args.py +42 -0
  483. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/encoding.py +36 -0
  484. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/entrypoints.py +27 -0
  485. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/filesystem.py +182 -0
  486. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/filetypes.py +28 -0
  487. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/glibc.py +92 -0
  488. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/hashes.py +165 -0
  489. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/inject_securetransport.py +36 -0
  490. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/logging.py +391 -0
  491. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/misc.py +828 -0
  492. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/models.py +47 -0
  493. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/packaging.py +89 -0
  494. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/parallel.py +101 -0
  495. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/pkg_resources.py +40 -0
  496. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/setuptools_build.py +173 -0
  497. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/subprocess.py +281 -0
  498. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/temp_dir.py +260 -0
  499. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/unpacking.py +267 -0
  500. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/urls.py +65 -0
  501. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/virtualenv.py +111 -0
  502. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/utils/wheel.py +189 -0
  503. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__init__.py +15 -0
  504. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/vcs/bazaar.py +96 -0
  505. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/vcs/git.py +506 -0
  506. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/vcs/mercurial.py +158 -0
  507. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/vcs/subversion.py +329 -0
  508. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/vcs/versioncontrol.py +722 -0
  509. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_internal/wheel_builder.py +360 -0
  510. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/__init__.py +111 -0
  511. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/appdirs.py +633 -0
  512. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__init__.py +11 -0
  513. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/_cmd.py +57 -0
  514. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/adapter.py +133 -0
  515. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/cache.py +39 -0
  516. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/caches/__init__.py +2 -0
  517. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py +146 -0
  518. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py +33 -0
  519. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/compat.py +29 -0
  520. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/controller.py +376 -0
  521. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/filewrapper.py +80 -0
  522. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/heuristics.py +135 -0
  523. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/serialize.py +188 -0
  524. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/wrapper.py +29 -0
  525. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/certifi/__init__.py +3 -0
  526. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/certifi/__main__.py +12 -0
  527. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/certifi/cacert.pem +4257 -0
  528. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/certifi/core.py +76 -0
  529. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__init__.py +83 -0
  530. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/big5freq.py +386 -0
  531. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/big5prober.py +47 -0
  532. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/chardistribution.py +233 -0
  533. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/charsetgroupprober.py +107 -0
  534. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/charsetprober.py +145 -0
  535. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/cli/__init__.py +1 -0
  536. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/cli/chardetect.py +84 -0
  537. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/codingstatemachine.py +88 -0
  538. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/compat.py +36 -0
  539. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/cp949prober.py +49 -0
  540. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/enums.py +76 -0
  541. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/escprober.py +101 -0
  542. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/escsm.py +246 -0
  543. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/eucjpprober.py +92 -0
  544. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/euckrfreq.py +195 -0
  545. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/euckrprober.py +47 -0
  546. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/euctwfreq.py +387 -0
  547. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/euctwprober.py +46 -0
  548. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/gb2312freq.py +283 -0
  549. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/gb2312prober.py +46 -0
  550. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/hebrewprober.py +292 -0
  551. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/jisfreq.py +325 -0
  552. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/jpcntx.py +233 -0
  553. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/langbulgarianmodel.py +4650 -0
  554. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/langgreekmodel.py +4398 -0
  555. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/langhebrewmodel.py +4383 -0
  556. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/langhungarianmodel.py +4650 -0
  557. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/langrussianmodel.py +5718 -0
  558. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/langthaimodel.py +4383 -0
  559. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/langturkishmodel.py +4383 -0
  560. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/latin1prober.py +145 -0
  561. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/mbcharsetprober.py +91 -0
  562. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/mbcsgroupprober.py +54 -0
  563. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/mbcssm.py +572 -0
  564. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/metadata/__init__.py +0 -0
  565. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/metadata/languages.py +310 -0
  566. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/sbcharsetprober.py +145 -0
  567. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/sbcsgroupprober.py +83 -0
  568. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/sjisprober.py +92 -0
  569. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/universaldetector.py +286 -0
  570. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/utf8prober.py +82 -0
  571. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/version.py +9 -0
  572. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__init__.py +6 -0
  573. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/ansi.py +102 -0
  574. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/ansitowin32.py +258 -0
  575. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/initialise.py +80 -0
  576. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/win32.py +152 -0
  577. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/winterm.py +169 -0
  578. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__init__.py +23 -0
  579. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__init__.py +6 -0
  580. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/misc.py +41 -0
  581. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/shutil.py +764 -0
  582. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/sysconfig.cfg +84 -0
  583. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/sysconfig.py +786 -0
  584. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/tarfile.py +2607 -0
  585. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/compat.py +1120 -0
  586. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/database.py +1339 -0
  587. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/index.py +509 -0
  588. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/locators.py +1300 -0
  589. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/manifest.py +393 -0
  590. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/markers.py +130 -0
  591. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/metadata.py +1058 -0
  592. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/resources.py +358 -0
  593. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/scripts.py +423 -0
  594. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/t32.exe +0 -0
  595. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/t64.exe +0 -0
  596. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/util.py +1965 -0
  597. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/version.py +739 -0
  598. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/w32.exe +0 -0
  599. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/w64.exe +0 -0
  600. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/wheel.py +1056 -0
  601. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/distro.py +1230 -0
  602. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__init__.py +35 -0
  603. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_ihatexml.py +289 -0
  604. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_inputstream.py +918 -0
  605. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_tokenizer.py +1735 -0
  606. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/__init__.py +5 -0
  607. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/_base.py +40 -0
  608. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/py.py +67 -0
  609. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_utils.py +159 -0
  610. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/constants.py +2946 -0
  611. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__init__.py +0 -0
  612. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/alphabeticalattributes.py +29 -0
  613. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/base.py +12 -0
  614. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/inject_meta_charset.py +73 -0
  615. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/lint.py +93 -0
  616. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/optionaltags.py +207 -0
  617. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/sanitizer.py +916 -0
  618. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/whitespace.py +38 -0
  619. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/html5parser.py +2795 -0
  620. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/serializer.py +409 -0
  621. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treeadapters/__init__.py +30 -0
  622. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treeadapters/genshi.py +54 -0
  623. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treeadapters/sax.py +50 -0
  624. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__init__.py +88 -0
  625. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/base.py +417 -0
  626. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/dom.py +239 -0
  627. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/etree.py +343 -0
  628. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.py +392 -0
  629. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__init__.py +154 -0
  630. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/base.py +252 -0
  631. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/dom.py +43 -0
  632. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/etree.py +131 -0
  633. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.py +215 -0
  634. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/genshi.py +69 -0
  635. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__init__.py +44 -0
  636. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/idna/codec.py +117 -0
  637. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/idna/compat.py +16 -0
  638. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/idna/core.py +409 -0
  639. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/idna/idnadata.py +2050 -0
  640. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/idna/intranges.py +58 -0
  641. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/idna/package_data.py +2 -0
  642. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/idna/uts46data.py +8438 -0
  643. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__init__.py +54 -0
  644. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/_version.py +1 -0
  645. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/exceptions.py +48 -0
  646. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/ext.py +193 -0
  647. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/fallback.py +1087 -0
  648. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__about__.py +26 -0
  649. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__init__.py +25 -0
  650. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/_manylinux.py +301 -0
  651. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/_musllinux.py +136 -0
  652. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/_structures.py +67 -0
  653. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/markers.py +304 -0
  654. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/requirements.py +146 -0
  655. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/specifiers.py +828 -0
  656. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/tags.py +484 -0
  657. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/utils.py +136 -0
  658. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/version.py +504 -0
  659. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__init__.py +6 -0
  660. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/build.py +127 -0
  661. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/check.py +207 -0
  662. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/colorlog.py +115 -0
  663. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/compat.py +42 -0
  664. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/dirtools.py +44 -0
  665. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/envbuild.py +171 -0
  666. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/__init__.py +17 -0
  667. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py +349 -0
  668. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/meta.py +92 -0
  669. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/wrappers.py +371 -0
  670. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/pkg_resources/__init__.py +3296 -0
  671. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/pkg_resources/py31compat.py +23 -0
  672. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/progress/__init__.py +177 -0
  673. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/progress/bar.py +91 -0
  674. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/progress/counter.py +41 -0
  675. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/progress/spinner.py +43 -0
  676. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/pyparsing.py +7107 -0
  677. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__init__.py +154 -0
  678. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__version__.py +14 -0
  679. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/_internal_utils.py +42 -0
  680. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/adapters.py +533 -0
  681. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/api.py +159 -0
  682. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/auth.py +305 -0
  683. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/certs.py +18 -0
  684. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/compat.py +76 -0
  685. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/cookies.py +549 -0
  686. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/exceptions.py +127 -0
  687. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/help.py +132 -0
  688. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/hooks.py +34 -0
  689. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/models.py +966 -0
  690. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/packages.py +16 -0
  691. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/sessions.py +781 -0
  692. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/status_codes.py +123 -0
  693. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/structures.py +105 -0
  694. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/requests/utils.py +1013 -0
  695. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__init__.py +26 -0
  696. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/compat/__init__.py +0 -0
  697. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/compat/collections_abc.py +6 -0
  698. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/providers.py +124 -0
  699. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/reporters.py +37 -0
  700. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py +473 -0
  701. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/structs.py +165 -0
  702. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/six.py +998 -0
  703. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__init__.py +517 -0
  704. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/_asyncio.py +92 -0
  705. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/_utils.py +68 -0
  706. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/after.py +46 -0
  707. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/before.py +41 -0
  708. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/before_sleep.py +58 -0
  709. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/nap.py +43 -0
  710. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/retry.py +213 -0
  711. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/stop.py +96 -0
  712. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/tornadoweb.py +59 -0
  713. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/wait.py +191 -0
  714. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/tomli/__init__.py +6 -0
  715. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/tomli/_parser.py +703 -0
  716. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/tomli/_re.py +83 -0
  717. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__init__.py +85 -0
  718. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/_collections.py +337 -0
  719. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/_version.py +2 -0
  720. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/connection.py +539 -0
  721. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/connectionpool.py +1067 -0
  722. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__init__.py +0 -0
  723. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/_appengine_environ.py +36 -0
  724. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__init__.py +0 -0
  725. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/_securetransport/bindings.py +519 -0
  726. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/_securetransport/low_level.py +396 -0
  727. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/appengine.py +314 -0
  728. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/ntlmpool.py +130 -0
  729. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py +511 -0
  730. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/securetransport.py +922 -0
  731. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/socks.py +216 -0
  732. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/exceptions.py +323 -0
  733. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/fields.py +274 -0
  734. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/filepost.py +98 -0
  735. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/__init__.py +5 -0
  736. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/backports/__init__.py +0 -0
  737. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py +51 -0
  738. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/six.py +1077 -0
  739. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/ssl_match_hostname/__init__.py +24 -0
  740. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/ssl_match_hostname/_implementation.py +160 -0
  741. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/poolmanager.py +536 -0
  742. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/request.py +170 -0
  743. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/response.py +821 -0
  744. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__init__.py +49 -0
  745. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/connection.py +150 -0
  746. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/proxy.py +56 -0
  747. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/queue.py +22 -0
  748. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/request.py +143 -0
  749. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/response.py +107 -0
  750. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/retry.py +602 -0
  751. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/ssl_.py +495 -0
  752. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/ssltransport.py +221 -0
  753. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/timeout.py +268 -0
  754. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/url.py +432 -0
  755. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/wait.py +153 -0
  756. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/vendor.txt +22 -0
  757. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__init__.py +342 -0
  758. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/labels.py +231 -0
  759. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/mklabels.py +59 -0
  760. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/tests.py +153 -0
  761. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/x_user_defined.py +325 -0
  762. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip/py.typed +4 -0
  763. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/INSTALLER +1 -0
  764. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/LICENSE.txt +20 -0
  765. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/METADATA +92 -0
  766. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/RECORD +795 -0
  767. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/REQUESTED +0 -0
  768. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/WHEEL +5 -0
  769. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/entry_points.txt +5 -0
  770. package/.claude/envoy/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/top_level.txt +1 -0
  771. package/.claude/envoy/.venv/lib/python3.9/site-packages/pkg_resources/__init__.py +3288 -0
  772. package/.claude/envoy/.venv/lib/python3.9/site-packages/pkg_resources/_vendor/__init__.py +0 -0
  773. package/.claude/envoy/.venv/lib/python3.9/site-packages/pkg_resources/_vendor/appdirs.py +608 -0
  774. package/.claude/envoy/.venv/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__about__.py +27 -0
  775. package/.claude/envoy/.venv/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__init__.py +26 -0
  776. package/.claude/envoy/.venv/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/_compat.py +38 -0
  777. package/.claude/envoy/.venv/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/_structures.py +86 -0
  778. package/.claude/envoy/.venv/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/_typing.py +48 -0
  779. package/.claude/envoy/.venv/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/markers.py +328 -0
  780. package/.claude/envoy/.venv/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/requirements.py +145 -0
  781. package/.claude/envoy/.venv/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/specifiers.py +863 -0
  782. package/.claude/envoy/.venv/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/tags.py +751 -0
  783. package/.claude/envoy/.venv/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/utils.py +65 -0
  784. package/.claude/envoy/.venv/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/version.py +535 -0
  785. package/.claude/envoy/.venv/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py +5742 -0
  786. package/.claude/envoy/.venv/lib/python3.9/site-packages/pkg_resources/extern/__init__.py +73 -0
  787. package/.claude/envoy/.venv/lib/python3.9/site-packages/pkg_resources/tests/data/my-test-package-source/setup.py +6 -0
  788. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/__init__.py +2 -0
  789. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/codec/__init__.py +1 -0
  790. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/codec/ber/__init__.py +1 -0
  791. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/codec/ber/decoder.py +2189 -0
  792. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/codec/ber/encoder.py +954 -0
  793. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/codec/ber/eoo.py +28 -0
  794. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/codec/cer/__init__.py +1 -0
  795. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/codec/cer/decoder.py +149 -0
  796. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/codec/cer/encoder.py +331 -0
  797. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/codec/der/__init__.py +1 -0
  798. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/codec/der/decoder.py +120 -0
  799. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/codec/der/encoder.py +126 -0
  800. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/codec/native/__init__.py +1 -0
  801. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/codec/native/decoder.py +244 -0
  802. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/codec/native/encoder.py +285 -0
  803. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/codec/streaming.py +234 -0
  804. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/compat/__init__.py +4 -0
  805. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/compat/integer.py +13 -0
  806. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/debug.py +146 -0
  807. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/error.py +116 -0
  808. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/type/__init__.py +1 -0
  809. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/type/base.py +699 -0
  810. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/type/char.py +288 -0
  811. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/type/constraint.py +751 -0
  812. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/type/error.py +11 -0
  813. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/type/namedtype.py +550 -0
  814. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/type/namedval.py +192 -0
  815. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/type/opentype.py +104 -0
  816. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/type/tag.py +335 -0
  817. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/type/tagmap.py +96 -0
  818. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/type/univ.py +3327 -0
  819. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1/type/useful.py +189 -0
  820. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1-0.6.1.dist-info/INSTALLER +1 -0
  821. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1-0.6.1.dist-info/LICENSE.rst +24 -0
  822. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1-0.6.1.dist-info/METADATA +228 -0
  823. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1-0.6.1.dist-info/RECORD +71 -0
  824. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1-0.6.1.dist-info/WHEEL +5 -0
  825. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1-0.6.1.dist-info/top_level.txt +1 -0
  826. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1-0.6.1.dist-info/zip-safe +1 -0
  827. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/__init__.py +2 -0
  828. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/pem.py +58 -0
  829. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc1155.py +96 -0
  830. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc1157.py +126 -0
  831. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc1901.py +22 -0
  832. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc1902.py +129 -0
  833. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc1905.py +135 -0
  834. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc2251.py +563 -0
  835. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc2314.py +48 -0
  836. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc2315.py +294 -0
  837. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc2437.py +69 -0
  838. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc2459.py +1339 -0
  839. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc2511.py +258 -0
  840. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc2560.py +225 -0
  841. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc2631.py +37 -0
  842. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc2634.py +336 -0
  843. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc2876.py +56 -0
  844. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc2985.py +588 -0
  845. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc2986.py +75 -0
  846. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3058.py +42 -0
  847. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3114.py +77 -0
  848. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3125.py +469 -0
  849. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3161.py +142 -0
  850. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3274.py +59 -0
  851. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3279.py +260 -0
  852. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3280.py +1543 -0
  853. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3281.py +331 -0
  854. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3370.py +146 -0
  855. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3412.py +53 -0
  856. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3414.py +28 -0
  857. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3447.py +45 -0
  858. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3537.py +34 -0
  859. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3560.py +74 -0
  860. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3565.py +57 -0
  861. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3657.py +66 -0
  862. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3709.py +207 -0
  863. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3739.py +203 -0
  864. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3770.py +75 -0
  865. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3779.py +137 -0
  866. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3820.py +65 -0
  867. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc3852.py +706 -0
  868. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc4010.py +58 -0
  869. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc4043.py +43 -0
  870. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc4055.py +258 -0
  871. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc4073.py +59 -0
  872. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc4108.py +350 -0
  873. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc4210.py +803 -0
  874. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc4211.py +396 -0
  875. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc4334.py +75 -0
  876. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc4357.py +477 -0
  877. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc4387.py +23 -0
  878. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc4476.py +93 -0
  879. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc4490.py +113 -0
  880. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc4491.py +44 -0
  881. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc4683.py +72 -0
  882. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc4985.py +49 -0
  883. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5035.py +199 -0
  884. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5083.py +52 -0
  885. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5084.py +97 -0
  886. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5126.py +577 -0
  887. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5208.py +56 -0
  888. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5275.py +404 -0
  889. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5280.py +1658 -0
  890. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5480.py +190 -0
  891. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5636.py +113 -0
  892. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5639.py +49 -0
  893. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5649.py +33 -0
  894. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5652.py +761 -0
  895. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5697.py +70 -0
  896. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5751.py +124 -0
  897. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5752.py +49 -0
  898. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5753.py +157 -0
  899. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5755.py +398 -0
  900. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5913.py +44 -0
  901. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5914.py +119 -0
  902. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5915.py +32 -0
  903. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5916.py +35 -0
  904. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5917.py +55 -0
  905. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5924.py +19 -0
  906. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5934.py +786 -0
  907. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5940.py +59 -0
  908. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5958.py +98 -0
  909. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc5990.py +237 -0
  910. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc6010.py +88 -0
  911. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc6019.py +45 -0
  912. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc6031.py +469 -0
  913. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc6032.py +68 -0
  914. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc6120.py +43 -0
  915. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc6170.py +17 -0
  916. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc6187.py +22 -0
  917. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc6210.py +42 -0
  918. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc6211.py +72 -0
  919. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc6402.py +628 -0
  920. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc6482.py +74 -0
  921. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc6486.py +68 -0
  922. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc6487.py +22 -0
  923. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc6664.py +147 -0
  924. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc6955.py +108 -0
  925. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc6960.py +223 -0
  926. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc7030.py +66 -0
  927. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc7191.py +261 -0
  928. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc7229.py +29 -0
  929. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc7292.py +357 -0
  930. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc7296.py +32 -0
  931. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc7508.py +90 -0
  932. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc7585.py +50 -0
  933. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc7633.py +38 -0
  934. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc7773.py +52 -0
  935. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc7894.py +92 -0
  936. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc7906.py +736 -0
  937. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc7914.py +49 -0
  938. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8017.py +153 -0
  939. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8018.py +260 -0
  940. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8103.py +36 -0
  941. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8209.py +20 -0
  942. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8226.py +149 -0
  943. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8358.py +50 -0
  944. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8360.py +44 -0
  945. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8398.py +52 -0
  946. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8410.py +43 -0
  947. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8418.py +36 -0
  948. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8419.py +68 -0
  949. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8479.py +45 -0
  950. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8494.py +80 -0
  951. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8520.py +63 -0
  952. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8619.py +45 -0
  953. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8649.py +40 -0
  954. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8692.py +79 -0
  955. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8696.py +104 -0
  956. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8702.py +105 -0
  957. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8708.py +41 -0
  958. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules/rfc8769.py +21 -0
  959. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules-0.4.2.dist-info/INSTALLER +1 -0
  960. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules-0.4.2.dist-info/METADATA +73 -0
  961. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules-0.4.2.dist-info/RECORD +271 -0
  962. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules-0.4.2.dist-info/WHEEL +5 -0
  963. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules-0.4.2.dist-info/licenses/LICENSE.txt +24 -0
  964. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules-0.4.2.dist-info/top_level.txt +1 -0
  965. package/.claude/envoy/.venv/lib/python3.9/site-packages/pyasn1_modules-0.4.2.dist-info/zip-safe +1 -0
  966. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/__init__.py +456 -0
  967. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/__init__.py +0 -0
  968. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_config.py +383 -0
  969. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_core_metadata.py +97 -0
  970. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_core_utils.py +174 -0
  971. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_dataclasses.py +315 -0
  972. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_decorators.py +858 -0
  973. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_decorators_v1.py +174 -0
  974. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_discriminated_union.py +479 -0
  975. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_docs_extraction.py +113 -0
  976. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_fields.py +635 -0
  977. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_forward_ref.py +23 -0
  978. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_generate_schema.py +2867 -0
  979. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_generics.py +543 -0
  980. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_git.py +27 -0
  981. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_import_utils.py +20 -0
  982. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_internal_dataclass.py +7 -0
  983. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_known_annotated_metadata.py +401 -0
  984. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_mock_val_ser.py +228 -0
  985. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py +848 -0
  986. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_namespace_utils.py +293 -0
  987. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_repr.py +124 -0
  988. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_schema_gather.py +209 -0
  989. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_schema_generation_shared.py +125 -0
  990. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_serializers.py +53 -0
  991. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_signature.py +188 -0
  992. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py +760 -0
  993. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_utils.py +446 -0
  994. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_validate_call.py +140 -0
  995. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_internal/_validators.py +533 -0
  996. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/_migration.py +316 -0
  997. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/alias_generators.py +62 -0
  998. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/aliases.py +135 -0
  999. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/annotated_handlers.py +122 -0
  1000. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/class_validators.py +5 -0
  1001. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/color.py +604 -0
  1002. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/config.py +1288 -0
  1003. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/dataclasses.py +413 -0
  1004. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/datetime_parse.py +5 -0
  1005. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/decorator.py +5 -0
  1006. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/deprecated/__init__.py +0 -0
  1007. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/deprecated/class_validators.py +256 -0
  1008. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/deprecated/config.py +72 -0
  1009. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/deprecated/copy_internals.py +224 -0
  1010. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/deprecated/decorator.py +284 -0
  1011. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/deprecated/json.py +141 -0
  1012. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/deprecated/parse.py +80 -0
  1013. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/deprecated/tools.py +103 -0
  1014. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/env_settings.py +5 -0
  1015. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/error_wrappers.py +5 -0
  1016. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/errors.py +189 -0
  1017. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/experimental/__init__.py +1 -0
  1018. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/experimental/arguments_schema.py +44 -0
  1019. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/experimental/missing_sentinel.py +5 -0
  1020. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/experimental/pipeline.py +654 -0
  1021. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/fields.py +1834 -0
  1022. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/functional_serializers.py +451 -0
  1023. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/functional_validators.py +893 -0
  1024. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/generics.py +5 -0
  1025. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/json.py +5 -0
  1026. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/json_schema.py +2854 -0
  1027. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/main.py +1819 -0
  1028. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/mypy.py +1374 -0
  1029. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/networks.py +1331 -0
  1030. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/parse.py +5 -0
  1031. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/plugin/__init__.py +193 -0
  1032. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/plugin/_loader.py +58 -0
  1033. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/plugin/_schema_validator.py +140 -0
  1034. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/py.typed +0 -0
  1035. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/root_model.py +155 -0
  1036. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/schema.py +5 -0
  1037. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/tools.py +5 -0
  1038. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/type_adapter.py +795 -0
  1039. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/types.py +3295 -0
  1040. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/typing.py +5 -0
  1041. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/utils.py +5 -0
  1042. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/__init__.py +142 -0
  1043. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/_hypothesis_plugin.py +391 -0
  1044. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/annotated_types.py +72 -0
  1045. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/class_validators.py +361 -0
  1046. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/color.py +494 -0
  1047. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/config.py +191 -0
  1048. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/dataclasses.py +500 -0
  1049. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/datetime_parse.py +248 -0
  1050. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/decorator.py +264 -0
  1051. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/env_settings.py +350 -0
  1052. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/error_wrappers.py +161 -0
  1053. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/errors.py +646 -0
  1054. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/fields.py +1253 -0
  1055. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/generics.py +400 -0
  1056. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/json.py +112 -0
  1057. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/main.py +1113 -0
  1058. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/mypy.py +949 -0
  1059. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/networks.py +747 -0
  1060. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/parse.py +66 -0
  1061. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/py.typed +0 -0
  1062. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/schema.py +1163 -0
  1063. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/tools.py +92 -0
  1064. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/types.py +1205 -0
  1065. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/typing.py +614 -0
  1066. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/utils.py +806 -0
  1067. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/validators.py +768 -0
  1068. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/v1/version.py +38 -0
  1069. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/validate_call_decorator.py +116 -0
  1070. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/validators.py +5 -0
  1071. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/version.py +113 -0
  1072. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic/warnings.py +122 -0
  1073. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic-2.12.5.dist-info/INSTALLER +1 -0
  1074. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic-2.12.5.dist-info/METADATA +1029 -0
  1075. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic-2.12.5.dist-info/RECORD +217 -0
  1076. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic-2.12.5.dist-info/WHEEL +4 -0
  1077. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic-2.12.5.dist-info/licenses/LICENSE +21 -0
  1078. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic_core/__init__.py +171 -0
  1079. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic_core/_pydantic_core.cpython-39-darwin.so +0 -0
  1080. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic_core/_pydantic_core.pyi +1046 -0
  1081. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic_core/core_schema.py +4435 -0
  1082. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic_core/py.typed +0 -0
  1083. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic_core-2.41.5.dist-info/INSTALLER +1 -0
  1084. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic_core-2.41.5.dist-info/METADATA +180 -0
  1085. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic_core-2.41.5.dist-info/RECORD +12 -0
  1086. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic_core-2.41.5.dist-info/WHEEL +4 -0
  1087. package/.claude/envoy/.venv/lib/python3.9/site-packages/pydantic_core-2.41.5.dist-info/licenses/LICENSE +21 -0
  1088. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/__init__.py +184 -0
  1089. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/__version__.py +14 -0
  1090. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/_internal_utils.py +50 -0
  1091. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/adapters.py +696 -0
  1092. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/api.py +157 -0
  1093. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/auth.py +314 -0
  1094. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/certs.py +17 -0
  1095. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/compat.py +106 -0
  1096. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/cookies.py +561 -0
  1097. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/exceptions.py +151 -0
  1098. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/help.py +134 -0
  1099. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/hooks.py +33 -0
  1100. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/models.py +1039 -0
  1101. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/packages.py +23 -0
  1102. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/sessions.py +831 -0
  1103. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/status_codes.py +128 -0
  1104. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/structures.py +99 -0
  1105. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests/utils.py +1086 -0
  1106. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests-2.32.5.dist-info/INSTALLER +1 -0
  1107. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests-2.32.5.dist-info/METADATA +133 -0
  1108. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests-2.32.5.dist-info/RECORD +43 -0
  1109. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests-2.32.5.dist-info/REQUESTED +0 -0
  1110. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests-2.32.5.dist-info/WHEEL +5 -0
  1111. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests-2.32.5.dist-info/licenses/LICENSE +175 -0
  1112. package/.claude/envoy/.venv/lib/python3.9/site-packages/requests-2.32.5.dist-info/top_level.txt +1 -0
  1113. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa/__init__.py +60 -0
  1114. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa/asn1.py +52 -0
  1115. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa/cli.py +321 -0
  1116. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa/common.py +184 -0
  1117. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa/core.py +53 -0
  1118. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa/key.py +858 -0
  1119. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa/parallel.py +96 -0
  1120. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa/pem.py +134 -0
  1121. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa/pkcs1.py +485 -0
  1122. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa/pkcs1_v2.py +100 -0
  1123. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa/prime.py +198 -0
  1124. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa/py.typed +1 -0
  1125. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa/randnum.py +95 -0
  1126. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa/transform.py +72 -0
  1127. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa/util.py +97 -0
  1128. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa-4.9.1.dist-info/INSTALLER +1 -0
  1129. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa-4.9.1.dist-info/LICENSE +13 -0
  1130. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa-4.9.1.dist-info/METADATA +140 -0
  1131. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa-4.9.1.dist-info/RECORD +41 -0
  1132. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa-4.9.1.dist-info/WHEEL +4 -0
  1133. package/.claude/envoy/.venv/lib/python3.9/site-packages/rsa-4.9.1.dist-info/entry_points.txt +8 -0
  1134. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/__init__.py +242 -0
  1135. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_deprecation_warning.py +7 -0
  1136. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/__init__.py +15 -0
  1137. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/_msvccompiler.py +561 -0
  1138. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/archive_util.py +256 -0
  1139. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/bcppcompiler.py +393 -0
  1140. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/ccompiler.py +1123 -0
  1141. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/cmd.py +403 -0
  1142. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/__init__.py +31 -0
  1143. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/bdist.py +143 -0
  1144. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/bdist_dumb.py +123 -0
  1145. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/bdist_msi.py +749 -0
  1146. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/bdist_rpm.py +579 -0
  1147. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/bdist_wininst.py +377 -0
  1148. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/build.py +157 -0
  1149. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/build_clib.py +209 -0
  1150. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py +757 -0
  1151. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/build_py.py +392 -0
  1152. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/build_scripts.py +152 -0
  1153. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/check.py +148 -0
  1154. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/clean.py +76 -0
  1155. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/config.py +344 -0
  1156. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/install.py +677 -0
  1157. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/install_data.py +79 -0
  1158. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/install_egg_info.py +77 -0
  1159. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/install_headers.py +47 -0
  1160. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/install_lib.py +217 -0
  1161. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/install_scripts.py +60 -0
  1162. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/py37compat.py +30 -0
  1163. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/register.py +304 -0
  1164. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/sdist.py +494 -0
  1165. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/command/upload.py +214 -0
  1166. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/config.py +130 -0
  1167. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/core.py +234 -0
  1168. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/cygwinccompiler.py +414 -0
  1169. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/debug.py +5 -0
  1170. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/dep_util.py +92 -0
  1171. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/dir_util.py +210 -0
  1172. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/dist.py +1257 -0
  1173. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/errors.py +97 -0
  1174. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/extension.py +240 -0
  1175. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/fancy_getopt.py +457 -0
  1176. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/file_util.py +238 -0
  1177. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/filelist.py +355 -0
  1178. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/log.py +77 -0
  1179. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/msvc9compiler.py +788 -0
  1180. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/msvccompiler.py +643 -0
  1181. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/py35compat.py +19 -0
  1182. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/py38compat.py +7 -0
  1183. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/spawn.py +106 -0
  1184. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/sysconfig.py +573 -0
  1185. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/text_file.py +286 -0
  1186. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/unixccompiler.py +332 -0
  1187. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/util.py +535 -0
  1188. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/version.py +347 -0
  1189. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_distutils/versionpredicate.py +166 -0
  1190. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_imp.py +82 -0
  1191. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_vendor/__init__.py +0 -0
  1192. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_vendor/more_itertools/__init__.py +4 -0
  1193. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_vendor/more_itertools/more.py +3825 -0
  1194. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_vendor/more_itertools/recipes.py +620 -0
  1195. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_vendor/ordered_set.py +488 -0
  1196. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_vendor/packaging/__about__.py +27 -0
  1197. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_vendor/packaging/__init__.py +26 -0
  1198. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_vendor/packaging/_compat.py +38 -0
  1199. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_vendor/packaging/_structures.py +86 -0
  1200. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_vendor/packaging/_typing.py +48 -0
  1201. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_vendor/packaging/markers.py +328 -0
  1202. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_vendor/packaging/requirements.py +145 -0
  1203. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_vendor/packaging/specifiers.py +863 -0
  1204. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_vendor/packaging/tags.py +751 -0
  1205. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_vendor/packaging/utils.py +65 -0
  1206. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_vendor/packaging/version.py +535 -0
  1207. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/_vendor/pyparsing.py +5742 -0
  1208. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/archive_util.py +205 -0
  1209. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/build_meta.py +281 -0
  1210. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/cli-32.exe +0 -0
  1211. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/cli-64.exe +0 -0
  1212. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/cli.exe +0 -0
  1213. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/__init__.py +8 -0
  1214. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/alias.py +78 -0
  1215. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/bdist_egg.py +456 -0
  1216. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/bdist_rpm.py +31 -0
  1217. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/build_clib.py +101 -0
  1218. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/build_ext.py +328 -0
  1219. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/build_py.py +232 -0
  1220. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/develop.py +193 -0
  1221. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/dist_info.py +36 -0
  1222. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/easy_install.py +2290 -0
  1223. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/egg_info.py +734 -0
  1224. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/install.py +125 -0
  1225. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/install_egg_info.py +62 -0
  1226. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/install_lib.py +122 -0
  1227. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/install_scripts.py +69 -0
  1228. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/launcher manifest.xml +15 -0
  1229. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/py36compat.py +134 -0
  1230. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/register.py +18 -0
  1231. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/rotate.py +64 -0
  1232. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/saveopts.py +22 -0
  1233. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/sdist.py +189 -0
  1234. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/setopt.py +149 -0
  1235. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/test.py +252 -0
  1236. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/upload.py +17 -0
  1237. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/command/upload_docs.py +202 -0
  1238. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/config.py +749 -0
  1239. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/dep_util.py +25 -0
  1240. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/depends.py +175 -0
  1241. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/dist.py +1150 -0
  1242. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/errors.py +16 -0
  1243. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/extension.py +55 -0
  1244. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/extern/__init__.py +73 -0
  1245. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/glob.py +167 -0
  1246. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/gui-32.exe +0 -0
  1247. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/gui-64.exe +0 -0
  1248. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/gui.exe +0 -0
  1249. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/installer.py +97 -0
  1250. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/launch.py +36 -0
  1251. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/monkey.py +177 -0
  1252. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/msvc.py +1805 -0
  1253. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/namespaces.py +107 -0
  1254. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/package_index.py +1119 -0
  1255. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/py34compat.py +13 -0
  1256. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/sandbox.py +530 -0
  1257. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/script (dev).tmpl +6 -0
  1258. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/script.tmpl +3 -0
  1259. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/unicode_utils.py +42 -0
  1260. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/version.py +6 -0
  1261. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/wheel.py +213 -0
  1262. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools/windows_support.py +29 -0
  1263. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools-58.0.4.dist-info/INSTALLER +1 -0
  1264. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools-58.0.4.dist-info/LICENSE +19 -0
  1265. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools-58.0.4.dist-info/METADATA +119 -0
  1266. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools-58.0.4.dist-info/RECORD +296 -0
  1267. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools-58.0.4.dist-info/REQUESTED +0 -0
  1268. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools-58.0.4.dist-info/WHEEL +5 -0
  1269. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools-58.0.4.dist-info/entry_points.txt +56 -0
  1270. package/.claude/envoy/.venv/lib/python3.9/site-packages/setuptools-58.0.4.dist-info/top_level.txt +3 -0
  1271. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity/__init__.py +722 -0
  1272. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity/_utils.py +101 -0
  1273. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity/after.py +51 -0
  1274. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity/asyncio/__init__.py +206 -0
  1275. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity/asyncio/retry.py +125 -0
  1276. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity/before.py +48 -0
  1277. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity/before_sleep.py +72 -0
  1278. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity/nap.py +43 -0
  1279. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity/py.typed +0 -0
  1280. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity/retry.py +282 -0
  1281. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity/stop.py +130 -0
  1282. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity/tornadoweb.py +63 -0
  1283. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity/wait.py +234 -0
  1284. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity-9.1.2.dist-info/INSTALLER +1 -0
  1285. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity-9.1.2.dist-info/METADATA +31 -0
  1286. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity-9.1.2.dist-info/RECORD +31 -0
  1287. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity-9.1.2.dist-info/WHEEL +5 -0
  1288. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity-9.1.2.dist-info/licenses/LICENSE +202 -0
  1289. package/.claude/envoy/.venv/lib/python3.9/site-packages/tenacity-9.1.2.dist-info/top_level.txt +1 -0
  1290. package/.claude/envoy/.venv/lib/python3.9/site-packages/typing_extensions-4.15.0.dist-info/INSTALLER +1 -0
  1291. package/.claude/envoy/.venv/lib/python3.9/site-packages/typing_extensions-4.15.0.dist-info/METADATA +72 -0
  1292. package/.claude/envoy/.venv/lib/python3.9/site-packages/typing_extensions-4.15.0.dist-info/RECORD +7 -0
  1293. package/.claude/envoy/.venv/lib/python3.9/site-packages/typing_extensions-4.15.0.dist-info/WHEEL +4 -0
  1294. package/.claude/envoy/.venv/lib/python3.9/site-packages/typing_extensions-4.15.0.dist-info/licenses/LICENSE +279 -0
  1295. package/.claude/envoy/.venv/lib/python3.9/site-packages/typing_extensions.py +4317 -0
  1296. package/.claude/envoy/.venv/lib/python3.9/site-packages/typing_inspection/__init__.py +0 -0
  1297. package/.claude/envoy/.venv/lib/python3.9/site-packages/typing_inspection/introspection.py +587 -0
  1298. package/.claude/envoy/.venv/lib/python3.9/site-packages/typing_inspection/py.typed +0 -0
  1299. package/.claude/envoy/.venv/lib/python3.9/site-packages/typing_inspection/typing_objects.py +607 -0
  1300. package/.claude/envoy/.venv/lib/python3.9/site-packages/typing_inspection/typing_objects.pyi +417 -0
  1301. package/.claude/envoy/.venv/lib/python3.9/site-packages/typing_inspection-0.4.2.dist-info/INSTALLER +1 -0
  1302. package/.claude/envoy/.venv/lib/python3.9/site-packages/typing_inspection-0.4.2.dist-info/METADATA +49 -0
  1303. package/.claude/envoy/.venv/lib/python3.9/site-packages/typing_inspection-0.4.2.dist-info/RECORD +13 -0
  1304. package/.claude/envoy/.venv/lib/python3.9/site-packages/typing_inspection-0.4.2.dist-info/WHEEL +4 -0
  1305. package/.claude/envoy/.venv/lib/python3.9/site-packages/typing_inspection-0.4.2.dist-info/licenses/LICENSE +21 -0
  1306. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/__init__.py +211 -0
  1307. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/_base_connection.py +165 -0
  1308. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/_collections.py +487 -0
  1309. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/_request_methods.py +278 -0
  1310. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/_version.py +34 -0
  1311. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/connection.py +1099 -0
  1312. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py +1178 -0
  1313. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/contrib/__init__.py +0 -0
  1314. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/contrib/emscripten/__init__.py +16 -0
  1315. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/contrib/emscripten/connection.py +259 -0
  1316. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/contrib/emscripten/emscripten_fetch_worker.js +110 -0
  1317. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/contrib/emscripten/fetch.py +726 -0
  1318. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/contrib/emscripten/request.py +22 -0
  1319. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/contrib/emscripten/response.py +277 -0
  1320. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/contrib/pyopenssl.py +564 -0
  1321. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/contrib/socks.py +228 -0
  1322. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/exceptions.py +335 -0
  1323. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/fields.py +341 -0
  1324. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/filepost.py +89 -0
  1325. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/http2/__init__.py +53 -0
  1326. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/http2/connection.py +356 -0
  1327. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/http2/probe.py +87 -0
  1328. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/poolmanager.py +651 -0
  1329. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/py.typed +2 -0
  1330. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/response.py +1465 -0
  1331. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/util/__init__.py +42 -0
  1332. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/util/connection.py +137 -0
  1333. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/util/proxy.py +43 -0
  1334. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/util/request.py +263 -0
  1335. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/util/response.py +101 -0
  1336. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/util/retry.py +533 -0
  1337. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/util/ssl_.py +527 -0
  1338. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/util/ssl_match_hostname.py +159 -0
  1339. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/util/ssltransport.py +271 -0
  1340. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/util/timeout.py +275 -0
  1341. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/util/url.py +469 -0
  1342. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/util/util.py +42 -0
  1343. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3/util/wait.py +124 -0
  1344. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3-2.6.0.dist-info/INSTALLER +1 -0
  1345. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3-2.6.0.dist-info/METADATA +156 -0
  1346. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3-2.6.0.dist-info/RECORD +79 -0
  1347. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3-2.6.0.dist-info/WHEEL +4 -0
  1348. package/.claude/envoy/.venv/lib/python3.9/site-packages/urllib3-2.6.0.dist-info/licenses/LICENSE.txt +21 -0
  1349. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/__init__.py +236 -0
  1350. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/__main__.py +5 -0
  1351. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/asyncio/__init__.py +0 -0
  1352. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/asyncio/async_timeout.py +282 -0
  1353. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/asyncio/client.py +820 -0
  1354. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/asyncio/compatibility.py +30 -0
  1355. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/asyncio/connection.py +1237 -0
  1356. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/asyncio/messages.py +314 -0
  1357. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/asyncio/router.py +198 -0
  1358. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/asyncio/server.py +981 -0
  1359. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/auth.py +18 -0
  1360. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/cli.py +178 -0
  1361. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/client.py +389 -0
  1362. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/connection.py +12 -0
  1363. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/datastructures.py +187 -0
  1364. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/exceptions.py +473 -0
  1365. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/extensions/__init__.py +4 -0
  1366. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/extensions/base.py +123 -0
  1367. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/extensions/permessage_deflate.py +697 -0
  1368. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/frames.py +430 -0
  1369. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/headers.py +586 -0
  1370. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/http.py +20 -0
  1371. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/http11.py +427 -0
  1372. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/imports.py +100 -0
  1373. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/legacy/__init__.py +11 -0
  1374. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/legacy/auth.py +190 -0
  1375. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/legacy/client.py +705 -0
  1376. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/legacy/exceptions.py +71 -0
  1377. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/legacy/framing.py +225 -0
  1378. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/legacy/handshake.py +158 -0
  1379. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/legacy/http.py +201 -0
  1380. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/legacy/protocol.py +1641 -0
  1381. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/legacy/server.py +1191 -0
  1382. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/protocol.py +758 -0
  1383. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/py.typed +0 -0
  1384. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/server.py +587 -0
  1385. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/speedups.c +222 -0
  1386. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/speedups.cpython-39-darwin.so +0 -0
  1387. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/speedups.pyi +1 -0
  1388. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/streams.py +151 -0
  1389. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/sync/__init__.py +0 -0
  1390. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/sync/client.py +648 -0
  1391. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/sync/connection.py +1072 -0
  1392. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/sync/messages.py +345 -0
  1393. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/sync/router.py +192 -0
  1394. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/sync/server.py +763 -0
  1395. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/sync/utils.py +45 -0
  1396. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/typing.py +74 -0
  1397. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/uri.py +225 -0
  1398. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/utils.py +51 -0
  1399. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets/version.py +92 -0
  1400. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets-15.0.1.dist-info/INSTALLER +1 -0
  1401. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets-15.0.1.dist-info/LICENSE +24 -0
  1402. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets-15.0.1.dist-info/METADATA +179 -0
  1403. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets-15.0.1.dist-info/RECORD +106 -0
  1404. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets-15.0.1.dist-info/WHEEL +5 -0
  1405. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets-15.0.1.dist-info/entry_points.txt +2 -0
  1406. package/.claude/envoy/.venv/lib/python3.9/site-packages/websockets-15.0.1.dist-info/top_level.txt +1 -0
  1407. package/.claude/envoy/.venv/pyvenv.cfg +3 -0
  1408. package/.claude/envoy/README.md +76 -0
  1409. package/.claude/envoy/claude-envoy.py +0 -0
  1410. package/.claude/envoy/commands/__init__.py +1 -0
  1411. package/.claude/envoy/commands/base.py +95 -0
  1412. package/.claude/envoy/commands/parallel.py +439 -0
  1413. package/.claude/envoy/commands/perplexity.py +86 -0
  1414. package/.claude/envoy/commands/plans.py +451 -0
  1415. package/.claude/envoy/commands/tavily.py +156 -0
  1416. package/.claude/envoy/commands/vertex.py +358 -0
  1417. package/.claude/envoy/commands/xai.py +124 -0
  1418. package/.claude/envoy/envoy +30 -0
  1419. package/.claude/envoy/envoy.py +122 -0
  1420. package/.claude/envoy/pyrightconfig.json +4 -0
  1421. package/.claude/envoy/requirements.txt +2 -0
  1422. package/.claude/hooks/capture-queries.sh +3 -0
  1423. package/.claude/hooks/scripts/enforce_planning.py +118 -0
  1424. package/.claude/hooks/scripts/enforce_research_fetch.py +17 -0
  1425. package/.claude/hooks/scripts/enforce_research_search.py +11 -0
  1426. package/.claude/hooks/scripts/enforce_rg.py +34 -0
  1427. package/.claude/hooks/scripts/github_url_to_gh.py +44 -0
  1428. package/.claude/hooks/scripts/scan_skills.py +89 -0
  1429. package/.claude/hooks/scripts/validate_skill.py +81 -0
  1430. package/.claude/hooks/startup.sh +57 -0
  1431. package/.claude/output-styles/systematic-bug-fixer.md +0 -0
  1432. package/.claude/plans/feat-npm-package-cli/plan.md +85 -0
  1433. package/.claude/plans/feat-specialist-builder-patterns/plan.md +298 -0
  1434. package/.claude/settings.json +145 -0
  1435. package/.claude/skills/claude-code-patterns/SKILL.md +51 -0
  1436. package/.claude/skills/claude-code-patterns/docs/context-hygiene.md +19 -0
  1437. package/.claude/skills/claude-envoy-curation/SKILL.md +99 -0
  1438. package/.claude/skills/claude-envoy-usage/SKILL.md +38 -0
  1439. package/.claude/skills/command-development/SKILL.md +216 -0
  1440. package/.claude/skills/command-development/examples/simple-commands.md +212 -0
  1441. package/.claude/skills/command-development/references/frontmatter-reference.md +221 -0
  1442. package/.claude/skills/git-ops/SKILL.md +137 -0
  1443. package/.claude/skills/hook-development/SKILL.md +103 -0
  1444. package/.claude/skills/hook-development/examples/command-hooks.md +301 -0
  1445. package/.claude/skills/hook-development/examples/prompt-hooks.md +114 -0
  1446. package/.claude/skills/hook-development/references/event-reference.md +226 -0
  1447. package/.claude/skills/orchestration-idols/SKILL.md +68 -0
  1448. package/.claude/skills/repomix-extraction/SKILL.md +89 -0
  1449. package/.claude/skills/research-tools/SKILL.md +129 -0
  1450. package/.claude/skills/skill-development/SKILL.md +236 -0
  1451. package/.claude/skills/skill-development/examples/complete-skill-examples.md +281 -0
  1452. package/.claude/skills/skill-development/references/progressive-disclosure.md +141 -0
  1453. package/.claude/skills/skill-development/references/writing-style.md +180 -0
  1454. package/.claude/skills/skill-development/scripts/validate-skill.sh +144 -0
  1455. package/.claude/skills/specialist-builder/SKILL.md +348 -0
  1456. package/.claude/skills/specialist-builder/docs/agent-catalog.md +28 -0
  1457. package/.claude/skills/specialist-builder/examples/complete-agent-examples.md +206 -0
  1458. package/.claude/skills/specialist-builder/references/system-prompt-patterns.md +281 -0
  1459. package/.claude/skills/specialist-builder/references/triggering-examples.md +162 -0
  1460. package/.claude/skills/specialist-builder/scripts/validate-agent.sh +137 -0
  1461. package/README.md +94 -0
  1462. package/bin/cli.js +7326 -0
  1463. package/package.json +45 -0
@@ -0,0 +1,4317 @@
1
+ import abc
2
+ import builtins
3
+ import collections
4
+ import collections.abc
5
+ import contextlib
6
+ import enum
7
+ import functools
8
+ import inspect
9
+ import io
10
+ import keyword
11
+ import operator
12
+ import sys
13
+ import types as _types
14
+ import typing
15
+ import warnings
16
+
17
+ # Breakpoint: https://github.com/python/cpython/pull/119891
18
+ if sys.version_info >= (3, 14):
19
+ import annotationlib
20
+
21
+ __all__ = [
22
+ # Super-special typing primitives.
23
+ 'Any',
24
+ 'ClassVar',
25
+ 'Concatenate',
26
+ 'Final',
27
+ 'LiteralString',
28
+ 'ParamSpec',
29
+ 'ParamSpecArgs',
30
+ 'ParamSpecKwargs',
31
+ 'Self',
32
+ 'Type',
33
+ 'TypeVar',
34
+ 'TypeVarTuple',
35
+ 'Unpack',
36
+
37
+ # ABCs (from collections.abc).
38
+ 'Awaitable',
39
+ 'AsyncIterator',
40
+ 'AsyncIterable',
41
+ 'Coroutine',
42
+ 'AsyncGenerator',
43
+ 'AsyncContextManager',
44
+ 'Buffer',
45
+ 'ChainMap',
46
+
47
+ # Concrete collection types.
48
+ 'ContextManager',
49
+ 'Counter',
50
+ 'Deque',
51
+ 'DefaultDict',
52
+ 'NamedTuple',
53
+ 'OrderedDict',
54
+ 'TypedDict',
55
+
56
+ # Structural checks, a.k.a. protocols.
57
+ 'SupportsAbs',
58
+ 'SupportsBytes',
59
+ 'SupportsComplex',
60
+ 'SupportsFloat',
61
+ 'SupportsIndex',
62
+ 'SupportsInt',
63
+ 'SupportsRound',
64
+ 'Reader',
65
+ 'Writer',
66
+
67
+ # One-off things.
68
+ 'Annotated',
69
+ 'assert_never',
70
+ 'assert_type',
71
+ 'clear_overloads',
72
+ 'dataclass_transform',
73
+ 'deprecated',
74
+ 'disjoint_base',
75
+ 'Doc',
76
+ 'evaluate_forward_ref',
77
+ 'get_overloads',
78
+ 'final',
79
+ 'Format',
80
+ 'get_annotations',
81
+ 'get_args',
82
+ 'get_origin',
83
+ 'get_original_bases',
84
+ 'get_protocol_members',
85
+ 'get_type_hints',
86
+ 'IntVar',
87
+ 'is_protocol',
88
+ 'is_typeddict',
89
+ 'Literal',
90
+ 'NewType',
91
+ 'overload',
92
+ 'override',
93
+ 'Protocol',
94
+ 'Sentinel',
95
+ 'reveal_type',
96
+ 'runtime',
97
+ 'runtime_checkable',
98
+ 'Text',
99
+ 'TypeAlias',
100
+ 'TypeAliasType',
101
+ 'TypeForm',
102
+ 'TypeGuard',
103
+ 'TypeIs',
104
+ 'TYPE_CHECKING',
105
+ 'type_repr',
106
+ 'Never',
107
+ 'NoReturn',
108
+ 'ReadOnly',
109
+ 'Required',
110
+ 'NotRequired',
111
+ 'NoDefault',
112
+ 'NoExtraItems',
113
+
114
+ # Pure aliases, have always been in typing
115
+ 'AbstractSet',
116
+ 'AnyStr',
117
+ 'BinaryIO',
118
+ 'Callable',
119
+ 'Collection',
120
+ 'Container',
121
+ 'Dict',
122
+ 'ForwardRef',
123
+ 'FrozenSet',
124
+ 'Generator',
125
+ 'Generic',
126
+ 'Hashable',
127
+ 'IO',
128
+ 'ItemsView',
129
+ 'Iterable',
130
+ 'Iterator',
131
+ 'KeysView',
132
+ 'List',
133
+ 'Mapping',
134
+ 'MappingView',
135
+ 'Match',
136
+ 'MutableMapping',
137
+ 'MutableSequence',
138
+ 'MutableSet',
139
+ 'Optional',
140
+ 'Pattern',
141
+ 'Reversible',
142
+ 'Sequence',
143
+ 'Set',
144
+ 'Sized',
145
+ 'TextIO',
146
+ 'Tuple',
147
+ 'Union',
148
+ 'ValuesView',
149
+ 'cast',
150
+ 'no_type_check',
151
+ 'no_type_check_decorator',
152
+ ]
153
+
154
+ # for backward compatibility
155
+ PEP_560 = True
156
+ GenericMeta = type
157
+ # Breakpoint: https://github.com/python/cpython/pull/116129
158
+ _PEP_696_IMPLEMENTED = sys.version_info >= (3, 13, 0, "beta")
159
+
160
+ # Added with bpo-45166 to 3.10.1+ and some 3.9 versions
161
+ _FORWARD_REF_HAS_CLASS = "__forward_is_class__" in typing.ForwardRef.__slots__
162
+
163
+ # The functions below are modified copies of typing internal helpers.
164
+ # They are needed by _ProtocolMeta and they provide support for PEP 646.
165
+
166
+
167
+ class _Sentinel:
168
+ def __repr__(self):
169
+ return "<sentinel>"
170
+
171
+
172
+ _marker = _Sentinel()
173
+
174
+
175
+ # Breakpoint: https://github.com/python/cpython/pull/27342
176
+ if sys.version_info >= (3, 10):
177
+ def _should_collect_from_parameters(t):
178
+ return isinstance(
179
+ t, (typing._GenericAlias, _types.GenericAlias, _types.UnionType)
180
+ )
181
+ else:
182
+ def _should_collect_from_parameters(t):
183
+ return isinstance(t, (typing._GenericAlias, _types.GenericAlias))
184
+
185
+
186
+ NoReturn = typing.NoReturn
187
+
188
+ # Some unconstrained type variables. These are used by the container types.
189
+ # (These are not for export.)
190
+ T = typing.TypeVar('T') # Any type.
191
+ KT = typing.TypeVar('KT') # Key type.
192
+ VT = typing.TypeVar('VT') # Value type.
193
+ T_co = typing.TypeVar('T_co', covariant=True) # Any type covariant containers.
194
+ T_contra = typing.TypeVar('T_contra', contravariant=True) # Ditto contravariant.
195
+
196
+
197
+ # Breakpoint: https://github.com/python/cpython/pull/31841
198
+ if sys.version_info >= (3, 11):
199
+ from typing import Any
200
+ else:
201
+
202
+ class _AnyMeta(type):
203
+ def __instancecheck__(self, obj):
204
+ if self is Any:
205
+ raise TypeError("typing_extensions.Any cannot be used with isinstance()")
206
+ return super().__instancecheck__(obj)
207
+
208
+ def __repr__(self):
209
+ if self is Any:
210
+ return "typing_extensions.Any"
211
+ return super().__repr__()
212
+
213
+ class Any(metaclass=_AnyMeta):
214
+ """Special type indicating an unconstrained type.
215
+ - Any is compatible with every type.
216
+ - Any assumed to have all methods.
217
+ - All values assumed to be instances of Any.
218
+ Note that all the above statements are true from the point of view of
219
+ static type checkers. At runtime, Any should not be used with instance
220
+ checks.
221
+ """
222
+ def __new__(cls, *args, **kwargs):
223
+ if cls is Any:
224
+ raise TypeError("Any cannot be instantiated")
225
+ return super().__new__(cls, *args, **kwargs)
226
+
227
+
228
+ ClassVar = typing.ClassVar
229
+
230
+ # Vendored from cpython typing._SpecialFrom
231
+ # Having a separate class means that instances will not be rejected by
232
+ # typing._type_check.
233
+ class _SpecialForm(typing._Final, _root=True):
234
+ __slots__ = ('_name', '__doc__', '_getitem')
235
+
236
+ def __init__(self, getitem):
237
+ self._getitem = getitem
238
+ self._name = getitem.__name__
239
+ self.__doc__ = getitem.__doc__
240
+
241
+ def __getattr__(self, item):
242
+ if item in {'__name__', '__qualname__'}:
243
+ return self._name
244
+
245
+ raise AttributeError(item)
246
+
247
+ def __mro_entries__(self, bases):
248
+ raise TypeError(f"Cannot subclass {self!r}")
249
+
250
+ def __repr__(self):
251
+ return f'typing_extensions.{self._name}'
252
+
253
+ def __reduce__(self):
254
+ return self._name
255
+
256
+ def __call__(self, *args, **kwds):
257
+ raise TypeError(f"Cannot instantiate {self!r}")
258
+
259
+ def __or__(self, other):
260
+ return typing.Union[self, other]
261
+
262
+ def __ror__(self, other):
263
+ return typing.Union[other, self]
264
+
265
+ def __instancecheck__(self, obj):
266
+ raise TypeError(f"{self} cannot be used with isinstance()")
267
+
268
+ def __subclasscheck__(self, cls):
269
+ raise TypeError(f"{self} cannot be used with issubclass()")
270
+
271
+ @typing._tp_cache
272
+ def __getitem__(self, parameters):
273
+ return self._getitem(self, parameters)
274
+
275
+
276
+ # Note that inheriting from this class means that the object will be
277
+ # rejected by typing._type_check, so do not use it if the special form
278
+ # is arguably valid as a type by itself.
279
+ class _ExtensionsSpecialForm(typing._SpecialForm, _root=True):
280
+ def __repr__(self):
281
+ return 'typing_extensions.' + self._name
282
+
283
+
284
+ Final = typing.Final
285
+
286
+ # Breakpoint: https://github.com/python/cpython/pull/30530
287
+ if sys.version_info >= (3, 11):
288
+ final = typing.final
289
+ else:
290
+ # @final exists in 3.8+, but we backport it for all versions
291
+ # before 3.11 to keep support for the __final__ attribute.
292
+ # See https://bugs.python.org/issue46342
293
+ def final(f):
294
+ """This decorator can be used to indicate to type checkers that
295
+ the decorated method cannot be overridden, and decorated class
296
+ cannot be subclassed. For example:
297
+
298
+ class Base:
299
+ @final
300
+ def done(self) -> None:
301
+ ...
302
+ class Sub(Base):
303
+ def done(self) -> None: # Error reported by type checker
304
+ ...
305
+ @final
306
+ class Leaf:
307
+ ...
308
+ class Other(Leaf): # Error reported by type checker
309
+ ...
310
+
311
+ There is no runtime checking of these properties. The decorator
312
+ sets the ``__final__`` attribute to ``True`` on the decorated object
313
+ to allow runtime introspection.
314
+ """
315
+ try:
316
+ f.__final__ = True
317
+ except (AttributeError, TypeError):
318
+ # Skip the attribute silently if it is not writable.
319
+ # AttributeError happens if the object has __slots__ or a
320
+ # read-only property, TypeError if it's a builtin class.
321
+ pass
322
+ return f
323
+
324
+
325
+ if hasattr(typing, "disjoint_base"): # 3.15
326
+ disjoint_base = typing.disjoint_base
327
+ else:
328
+ def disjoint_base(cls):
329
+ """This decorator marks a class as a disjoint base.
330
+
331
+ Child classes of a disjoint base cannot inherit from other disjoint bases that are
332
+ not parent classes of the disjoint base.
333
+
334
+ For example:
335
+
336
+ @disjoint_base
337
+ class Disjoint1: pass
338
+
339
+ @disjoint_base
340
+ class Disjoint2: pass
341
+
342
+ class Disjoint3(Disjoint1, Disjoint2): pass # Type checker error
343
+
344
+ Type checkers can use knowledge of disjoint bases to detect unreachable code
345
+ and determine when two types can overlap.
346
+
347
+ See PEP 800."""
348
+ cls.__disjoint_base__ = True
349
+ return cls
350
+
351
+
352
+ def IntVar(name):
353
+ return typing.TypeVar(name)
354
+
355
+
356
+ # A Literal bug was fixed in 3.11.0, 3.10.1 and 3.9.8
357
+ # Breakpoint: https://github.com/python/cpython/pull/29334
358
+ if sys.version_info >= (3, 10, 1):
359
+ Literal = typing.Literal
360
+ else:
361
+ def _flatten_literal_params(parameters):
362
+ """An internal helper for Literal creation: flatten Literals among parameters"""
363
+ params = []
364
+ for p in parameters:
365
+ if isinstance(p, _LiteralGenericAlias):
366
+ params.extend(p.__args__)
367
+ else:
368
+ params.append(p)
369
+ return tuple(params)
370
+
371
+ def _value_and_type_iter(params):
372
+ for p in params:
373
+ yield p, type(p)
374
+
375
+ class _LiteralGenericAlias(typing._GenericAlias, _root=True):
376
+ def __eq__(self, other):
377
+ if not isinstance(other, _LiteralGenericAlias):
378
+ return NotImplemented
379
+ these_args_deduped = set(_value_and_type_iter(self.__args__))
380
+ other_args_deduped = set(_value_and_type_iter(other.__args__))
381
+ return these_args_deduped == other_args_deduped
382
+
383
+ def __hash__(self):
384
+ return hash(frozenset(_value_and_type_iter(self.__args__)))
385
+
386
+ class _LiteralForm(_ExtensionsSpecialForm, _root=True):
387
+ def __init__(self, doc: str):
388
+ self._name = 'Literal'
389
+ self._doc = self.__doc__ = doc
390
+
391
+ def __getitem__(self, parameters):
392
+ if not isinstance(parameters, tuple):
393
+ parameters = (parameters,)
394
+
395
+ parameters = _flatten_literal_params(parameters)
396
+
397
+ val_type_pairs = list(_value_and_type_iter(parameters))
398
+ try:
399
+ deduped_pairs = set(val_type_pairs)
400
+ except TypeError:
401
+ # unhashable parameters
402
+ pass
403
+ else:
404
+ # similar logic to typing._deduplicate on Python 3.9+
405
+ if len(deduped_pairs) < len(val_type_pairs):
406
+ new_parameters = []
407
+ for pair in val_type_pairs:
408
+ if pair in deduped_pairs:
409
+ new_parameters.append(pair[0])
410
+ deduped_pairs.remove(pair)
411
+ assert not deduped_pairs, deduped_pairs
412
+ parameters = tuple(new_parameters)
413
+
414
+ return _LiteralGenericAlias(self, parameters)
415
+
416
+ Literal = _LiteralForm(doc="""\
417
+ A type that can be used to indicate to type checkers
418
+ that the corresponding value has a value literally equivalent
419
+ to the provided parameter. For example:
420
+
421
+ var: Literal[4] = 4
422
+
423
+ The type checker understands that 'var' is literally equal to
424
+ the value 4 and no other value.
425
+
426
+ Literal[...] cannot be subclassed. There is no runtime
427
+ checking verifying that the parameter is actually a value
428
+ instead of a type.""")
429
+
430
+
431
+ _overload_dummy = typing._overload_dummy
432
+
433
+
434
+ if hasattr(typing, "get_overloads"): # 3.11+
435
+ overload = typing.overload
436
+ get_overloads = typing.get_overloads
437
+ clear_overloads = typing.clear_overloads
438
+ else:
439
+ # {module: {qualname: {firstlineno: func}}}
440
+ _overload_registry = collections.defaultdict(
441
+ functools.partial(collections.defaultdict, dict)
442
+ )
443
+
444
+ def overload(func):
445
+ """Decorator for overloaded functions/methods.
446
+
447
+ In a stub file, place two or more stub definitions for the same
448
+ function in a row, each decorated with @overload. For example:
449
+
450
+ @overload
451
+ def utf8(value: None) -> None: ...
452
+ @overload
453
+ def utf8(value: bytes) -> bytes: ...
454
+ @overload
455
+ def utf8(value: str) -> bytes: ...
456
+
457
+ In a non-stub file (i.e. a regular .py file), do the same but
458
+ follow it with an implementation. The implementation should *not*
459
+ be decorated with @overload. For example:
460
+
461
+ @overload
462
+ def utf8(value: None) -> None: ...
463
+ @overload
464
+ def utf8(value: bytes) -> bytes: ...
465
+ @overload
466
+ def utf8(value: str) -> bytes: ...
467
+ def utf8(value):
468
+ # implementation goes here
469
+
470
+ The overloads for a function can be retrieved at runtime using the
471
+ get_overloads() function.
472
+ """
473
+ # classmethod and staticmethod
474
+ f = getattr(func, "__func__", func)
475
+ try:
476
+ _overload_registry[f.__module__][f.__qualname__][
477
+ f.__code__.co_firstlineno
478
+ ] = func
479
+ except AttributeError:
480
+ # Not a normal function; ignore.
481
+ pass
482
+ return _overload_dummy
483
+
484
+ def get_overloads(func):
485
+ """Return all defined overloads for *func* as a sequence."""
486
+ # classmethod and staticmethod
487
+ f = getattr(func, "__func__", func)
488
+ if f.__module__ not in _overload_registry:
489
+ return []
490
+ mod_dict = _overload_registry[f.__module__]
491
+ if f.__qualname__ not in mod_dict:
492
+ return []
493
+ return list(mod_dict[f.__qualname__].values())
494
+
495
+ def clear_overloads():
496
+ """Clear all overloads in the registry."""
497
+ _overload_registry.clear()
498
+
499
+
500
+ # This is not a real generic class. Don't use outside annotations.
501
+ Type = typing.Type
502
+
503
+ # Various ABCs mimicking those in collections.abc.
504
+ # A few are simply re-exported for completeness.
505
+ Awaitable = typing.Awaitable
506
+ Coroutine = typing.Coroutine
507
+ AsyncIterable = typing.AsyncIterable
508
+ AsyncIterator = typing.AsyncIterator
509
+ Deque = typing.Deque
510
+ DefaultDict = typing.DefaultDict
511
+ OrderedDict = typing.OrderedDict
512
+ Counter = typing.Counter
513
+ ChainMap = typing.ChainMap
514
+ Text = typing.Text
515
+ TYPE_CHECKING = typing.TYPE_CHECKING
516
+
517
+
518
+ # Breakpoint: https://github.com/python/cpython/pull/118681
519
+ if sys.version_info >= (3, 13, 0, "beta"):
520
+ from typing import AsyncContextManager, AsyncGenerator, ContextManager, Generator
521
+ else:
522
+ def _is_dunder(attr):
523
+ return attr.startswith('__') and attr.endswith('__')
524
+
525
+
526
+ class _SpecialGenericAlias(typing._SpecialGenericAlias, _root=True):
527
+ def __init__(self, origin, nparams, *, inst=True, name=None, defaults=()):
528
+ super().__init__(origin, nparams, inst=inst, name=name)
529
+ self._defaults = defaults
530
+
531
+ def __setattr__(self, attr, val):
532
+ allowed_attrs = {'_name', '_inst', '_nparams', '_defaults'}
533
+ if _is_dunder(attr) or attr in allowed_attrs:
534
+ object.__setattr__(self, attr, val)
535
+ else:
536
+ setattr(self.__origin__, attr, val)
537
+
538
+ @typing._tp_cache
539
+ def __getitem__(self, params):
540
+ if not isinstance(params, tuple):
541
+ params = (params,)
542
+ msg = "Parameters to generic types must be types."
543
+ params = tuple(typing._type_check(p, msg) for p in params)
544
+ if (
545
+ self._defaults
546
+ and len(params) < self._nparams
547
+ and len(params) + len(self._defaults) >= self._nparams
548
+ ):
549
+ params = (*params, *self._defaults[len(params) - self._nparams:])
550
+ actual_len = len(params)
551
+
552
+ if actual_len != self._nparams:
553
+ if self._defaults:
554
+ expected = f"at least {self._nparams - len(self._defaults)}"
555
+ else:
556
+ expected = str(self._nparams)
557
+ if not self._nparams:
558
+ raise TypeError(f"{self} is not a generic class")
559
+ raise TypeError(
560
+ f"Too {'many' if actual_len > self._nparams else 'few'}"
561
+ f" arguments for {self};"
562
+ f" actual {actual_len}, expected {expected}"
563
+ )
564
+ return self.copy_with(params)
565
+
566
+ _NoneType = type(None)
567
+ Generator = _SpecialGenericAlias(
568
+ collections.abc.Generator, 3, defaults=(_NoneType, _NoneType)
569
+ )
570
+ AsyncGenerator = _SpecialGenericAlias(
571
+ collections.abc.AsyncGenerator, 2, defaults=(_NoneType,)
572
+ )
573
+ ContextManager = _SpecialGenericAlias(
574
+ contextlib.AbstractContextManager,
575
+ 2,
576
+ name="ContextManager",
577
+ defaults=(typing.Optional[bool],)
578
+ )
579
+ AsyncContextManager = _SpecialGenericAlias(
580
+ contextlib.AbstractAsyncContextManager,
581
+ 2,
582
+ name="AsyncContextManager",
583
+ defaults=(typing.Optional[bool],)
584
+ )
585
+
586
+
587
+ _PROTO_ALLOWLIST = {
588
+ 'collections.abc': [
589
+ 'Callable', 'Awaitable', 'Iterable', 'Iterator', 'AsyncIterable',
590
+ 'Hashable', 'Sized', 'Container', 'Collection', 'Reversible', 'Buffer',
591
+ ],
592
+ 'contextlib': ['AbstractContextManager', 'AbstractAsyncContextManager'],
593
+ 'typing_extensions': ['Buffer'],
594
+ }
595
+
596
+
597
+ _EXCLUDED_ATTRS = frozenset(typing.EXCLUDED_ATTRIBUTES) | {
598
+ "__match_args__", "__protocol_attrs__", "__non_callable_proto_members__",
599
+ "__final__",
600
+ }
601
+
602
+
603
+ def _get_protocol_attrs(cls):
604
+ attrs = set()
605
+ for base in cls.__mro__[:-1]: # without object
606
+ if base.__name__ in {'Protocol', 'Generic'}:
607
+ continue
608
+ annotations = getattr(base, '__annotations__', {})
609
+ for attr in (*base.__dict__, *annotations):
610
+ if (not attr.startswith('_abc_') and attr not in _EXCLUDED_ATTRS):
611
+ attrs.add(attr)
612
+ return attrs
613
+
614
+
615
+ def _caller(depth=1, default='__main__'):
616
+ try:
617
+ return sys._getframemodulename(depth + 1) or default
618
+ except AttributeError: # For platforms without _getframemodulename()
619
+ pass
620
+ try:
621
+ return sys._getframe(depth + 1).f_globals.get('__name__', default)
622
+ except (AttributeError, ValueError): # For platforms without _getframe()
623
+ pass
624
+ return None
625
+
626
+
627
+ # `__match_args__` attribute was removed from protocol members in 3.13,
628
+ # we want to backport this change to older Python versions.
629
+ # Breakpoint: https://github.com/python/cpython/pull/110683
630
+ if sys.version_info >= (3, 13):
631
+ Protocol = typing.Protocol
632
+ else:
633
+ def _allow_reckless_class_checks(depth=2):
634
+ """Allow instance and class checks for special stdlib modules.
635
+ The abc and functools modules indiscriminately call isinstance() and
636
+ issubclass() on the whole MRO of a user class, which may contain protocols.
637
+ """
638
+ return _caller(depth) in {'abc', 'functools', None}
639
+
640
+ def _no_init(self, *args, **kwargs):
641
+ if type(self)._is_protocol:
642
+ raise TypeError('Protocols cannot be instantiated')
643
+
644
+ def _type_check_issubclass_arg_1(arg):
645
+ """Raise TypeError if `arg` is not an instance of `type`
646
+ in `issubclass(arg, <protocol>)`.
647
+
648
+ In most cases, this is verified by type.__subclasscheck__.
649
+ Checking it again unnecessarily would slow down issubclass() checks,
650
+ so, we don't perform this check unless we absolutely have to.
651
+
652
+ For various error paths, however,
653
+ we want to ensure that *this* error message is shown to the user
654
+ where relevant, rather than a typing.py-specific error message.
655
+ """
656
+ if not isinstance(arg, type):
657
+ # Same error message as for issubclass(1, int).
658
+ raise TypeError('issubclass() arg 1 must be a class')
659
+
660
+ # Inheriting from typing._ProtocolMeta isn't actually desirable,
661
+ # but is necessary to allow typing.Protocol and typing_extensions.Protocol
662
+ # to mix without getting TypeErrors about "metaclass conflict"
663
+ class _ProtocolMeta(type(typing.Protocol)):
664
+ # This metaclass is somewhat unfortunate,
665
+ # but is necessary for several reasons...
666
+ #
667
+ # NOTE: DO NOT call super() in any methods in this class
668
+ # That would call the methods on typing._ProtocolMeta on Python <=3.11
669
+ # and those are slow
670
+ def __new__(mcls, name, bases, namespace, **kwargs):
671
+ if name == "Protocol" and len(bases) < 2:
672
+ pass
673
+ elif {Protocol, typing.Protocol} & set(bases):
674
+ for base in bases:
675
+ if not (
676
+ base in {object, typing.Generic, Protocol, typing.Protocol}
677
+ or base.__name__ in _PROTO_ALLOWLIST.get(base.__module__, [])
678
+ or is_protocol(base)
679
+ ):
680
+ raise TypeError(
681
+ f"Protocols can only inherit from other protocols, "
682
+ f"got {base!r}"
683
+ )
684
+ return abc.ABCMeta.__new__(mcls, name, bases, namespace, **kwargs)
685
+
686
+ def __init__(cls, *args, **kwargs):
687
+ abc.ABCMeta.__init__(cls, *args, **kwargs)
688
+ if getattr(cls, "_is_protocol", False):
689
+ cls.__protocol_attrs__ = _get_protocol_attrs(cls)
690
+
691
+ def __subclasscheck__(cls, other):
692
+ if cls is Protocol:
693
+ return type.__subclasscheck__(cls, other)
694
+ if (
695
+ getattr(cls, '_is_protocol', False)
696
+ and not _allow_reckless_class_checks()
697
+ ):
698
+ if not getattr(cls, '_is_runtime_protocol', False):
699
+ _type_check_issubclass_arg_1(other)
700
+ raise TypeError(
701
+ "Instance and class checks can only be used with "
702
+ "@runtime_checkable protocols"
703
+ )
704
+ if (
705
+ # this attribute is set by @runtime_checkable:
706
+ cls.__non_callable_proto_members__
707
+ and cls.__dict__.get("__subclasshook__") is _proto_hook
708
+ ):
709
+ _type_check_issubclass_arg_1(other)
710
+ non_method_attrs = sorted(cls.__non_callable_proto_members__)
711
+ raise TypeError(
712
+ "Protocols with non-method members don't support issubclass()."
713
+ f" Non-method members: {str(non_method_attrs)[1:-1]}."
714
+ )
715
+ return abc.ABCMeta.__subclasscheck__(cls, other)
716
+
717
+ def __instancecheck__(cls, instance):
718
+ # We need this method for situations where attributes are
719
+ # assigned in __init__.
720
+ if cls is Protocol:
721
+ return type.__instancecheck__(cls, instance)
722
+ if not getattr(cls, "_is_protocol", False):
723
+ # i.e., it's a concrete subclass of a protocol
724
+ return abc.ABCMeta.__instancecheck__(cls, instance)
725
+
726
+ if (
727
+ not getattr(cls, '_is_runtime_protocol', False) and
728
+ not _allow_reckless_class_checks()
729
+ ):
730
+ raise TypeError("Instance and class checks can only be used with"
731
+ " @runtime_checkable protocols")
732
+
733
+ if abc.ABCMeta.__instancecheck__(cls, instance):
734
+ return True
735
+
736
+ for attr in cls.__protocol_attrs__:
737
+ try:
738
+ val = inspect.getattr_static(instance, attr)
739
+ except AttributeError:
740
+ break
741
+ # this attribute is set by @runtime_checkable:
742
+ if val is None and attr not in cls.__non_callable_proto_members__:
743
+ break
744
+ else:
745
+ return True
746
+
747
+ return False
748
+
749
+ def __eq__(cls, other):
750
+ # Hack so that typing.Generic.__class_getitem__
751
+ # treats typing_extensions.Protocol
752
+ # as equivalent to typing.Protocol
753
+ if abc.ABCMeta.__eq__(cls, other) is True:
754
+ return True
755
+ return cls is Protocol and other is typing.Protocol
756
+
757
+ # This has to be defined, or the abc-module cache
758
+ # complains about classes with this metaclass being unhashable,
759
+ # if we define only __eq__!
760
+ def __hash__(cls) -> int:
761
+ return type.__hash__(cls)
762
+
763
+ @classmethod
764
+ def _proto_hook(cls, other):
765
+ if not cls.__dict__.get('_is_protocol', False):
766
+ return NotImplemented
767
+
768
+ for attr in cls.__protocol_attrs__:
769
+ for base in other.__mro__:
770
+ # Check if the members appears in the class dictionary...
771
+ if attr in base.__dict__:
772
+ if base.__dict__[attr] is None:
773
+ return NotImplemented
774
+ break
775
+
776
+ # ...or in annotations, if it is a sub-protocol.
777
+ annotations = getattr(base, '__annotations__', {})
778
+ if (
779
+ isinstance(annotations, collections.abc.Mapping)
780
+ and attr in annotations
781
+ and is_protocol(other)
782
+ ):
783
+ break
784
+ else:
785
+ return NotImplemented
786
+ return True
787
+
788
+ class Protocol(typing.Generic, metaclass=_ProtocolMeta):
789
+ __doc__ = typing.Protocol.__doc__
790
+ __slots__ = ()
791
+ _is_protocol = True
792
+ _is_runtime_protocol = False
793
+
794
+ def __init_subclass__(cls, *args, **kwargs):
795
+ super().__init_subclass__(*args, **kwargs)
796
+
797
+ # Determine if this is a protocol or a concrete subclass.
798
+ if not cls.__dict__.get('_is_protocol', False):
799
+ cls._is_protocol = any(b is Protocol for b in cls.__bases__)
800
+
801
+ # Set (or override) the protocol subclass hook.
802
+ if '__subclasshook__' not in cls.__dict__:
803
+ cls.__subclasshook__ = _proto_hook
804
+
805
+ # Prohibit instantiation for protocol classes
806
+ if cls._is_protocol and cls.__init__ is Protocol.__init__:
807
+ cls.__init__ = _no_init
808
+
809
+
810
+ # Breakpoint: https://github.com/python/cpython/pull/113401
811
+ if sys.version_info >= (3, 13):
812
+ runtime_checkable = typing.runtime_checkable
813
+ else:
814
+ def runtime_checkable(cls):
815
+ """Mark a protocol class as a runtime protocol.
816
+
817
+ Such protocol can be used with isinstance() and issubclass().
818
+ Raise TypeError if applied to a non-protocol class.
819
+ This allows a simple-minded structural check very similar to
820
+ one trick ponies in collections.abc such as Iterable.
821
+
822
+ For example::
823
+
824
+ @runtime_checkable
825
+ class Closable(Protocol):
826
+ def close(self): ...
827
+
828
+ assert isinstance(open('/some/file'), Closable)
829
+
830
+ Warning: this will check only the presence of the required methods,
831
+ not their type signatures!
832
+ """
833
+ if not issubclass(cls, typing.Generic) or not getattr(cls, '_is_protocol', False):
834
+ raise TypeError(f'@runtime_checkable can be only applied to protocol classes,'
835
+ f' got {cls!r}')
836
+ cls._is_runtime_protocol = True
837
+
838
+ # typing.Protocol classes on <=3.11 break if we execute this block,
839
+ # because typing.Protocol classes on <=3.11 don't have a
840
+ # `__protocol_attrs__` attribute, and this block relies on the
841
+ # `__protocol_attrs__` attribute. Meanwhile, typing.Protocol classes on 3.12.2+
842
+ # break if we *don't* execute this block, because *they* assume that all
843
+ # protocol classes have a `__non_callable_proto_members__` attribute
844
+ # (which this block sets)
845
+ if isinstance(cls, _ProtocolMeta) or sys.version_info >= (3, 12, 2):
846
+ # PEP 544 prohibits using issubclass()
847
+ # with protocols that have non-method members.
848
+ # See gh-113320 for why we compute this attribute here,
849
+ # rather than in `_ProtocolMeta.__init__`
850
+ cls.__non_callable_proto_members__ = set()
851
+ for attr in cls.__protocol_attrs__:
852
+ try:
853
+ is_callable = callable(getattr(cls, attr, None))
854
+ except Exception as e:
855
+ raise TypeError(
856
+ f"Failed to determine whether protocol member {attr!r} "
857
+ "is a method member"
858
+ ) from e
859
+ else:
860
+ if not is_callable:
861
+ cls.__non_callable_proto_members__.add(attr)
862
+
863
+ return cls
864
+
865
+
866
+ # The "runtime" alias exists for backwards compatibility.
867
+ runtime = runtime_checkable
868
+
869
+
870
+ # Our version of runtime-checkable protocols is faster on Python <=3.11
871
+ # Breakpoint: https://github.com/python/cpython/pull/112717
872
+ if sys.version_info >= (3, 12):
873
+ SupportsInt = typing.SupportsInt
874
+ SupportsFloat = typing.SupportsFloat
875
+ SupportsComplex = typing.SupportsComplex
876
+ SupportsBytes = typing.SupportsBytes
877
+ SupportsIndex = typing.SupportsIndex
878
+ SupportsAbs = typing.SupportsAbs
879
+ SupportsRound = typing.SupportsRound
880
+ else:
881
+ @runtime_checkable
882
+ class SupportsInt(Protocol):
883
+ """An ABC with one abstract method __int__."""
884
+ __slots__ = ()
885
+
886
+ @abc.abstractmethod
887
+ def __int__(self) -> int:
888
+ pass
889
+
890
+ @runtime_checkable
891
+ class SupportsFloat(Protocol):
892
+ """An ABC with one abstract method __float__."""
893
+ __slots__ = ()
894
+
895
+ @abc.abstractmethod
896
+ def __float__(self) -> float:
897
+ pass
898
+
899
+ @runtime_checkable
900
+ class SupportsComplex(Protocol):
901
+ """An ABC with one abstract method __complex__."""
902
+ __slots__ = ()
903
+
904
+ @abc.abstractmethod
905
+ def __complex__(self) -> complex:
906
+ pass
907
+
908
+ @runtime_checkable
909
+ class SupportsBytes(Protocol):
910
+ """An ABC with one abstract method __bytes__."""
911
+ __slots__ = ()
912
+
913
+ @abc.abstractmethod
914
+ def __bytes__(self) -> bytes:
915
+ pass
916
+
917
+ @runtime_checkable
918
+ class SupportsIndex(Protocol):
919
+ __slots__ = ()
920
+
921
+ @abc.abstractmethod
922
+ def __index__(self) -> int:
923
+ pass
924
+
925
+ @runtime_checkable
926
+ class SupportsAbs(Protocol[T_co]):
927
+ """
928
+ An ABC with one abstract method __abs__ that is covariant in its return type.
929
+ """
930
+ __slots__ = ()
931
+
932
+ @abc.abstractmethod
933
+ def __abs__(self) -> T_co:
934
+ pass
935
+
936
+ @runtime_checkable
937
+ class SupportsRound(Protocol[T_co]):
938
+ """
939
+ An ABC with one abstract method __round__ that is covariant in its return type.
940
+ """
941
+ __slots__ = ()
942
+
943
+ @abc.abstractmethod
944
+ def __round__(self, ndigits: int = 0) -> T_co:
945
+ pass
946
+
947
+
948
+ if hasattr(io, "Reader") and hasattr(io, "Writer"):
949
+ Reader = io.Reader
950
+ Writer = io.Writer
951
+ else:
952
+ @runtime_checkable
953
+ class Reader(Protocol[T_co]):
954
+ """Protocol for simple I/O reader instances.
955
+
956
+ This protocol only supports blocking I/O.
957
+ """
958
+
959
+ __slots__ = ()
960
+
961
+ @abc.abstractmethod
962
+ def read(self, size: int = ..., /) -> T_co:
963
+ """Read data from the input stream and return it.
964
+
965
+ If *size* is specified, at most *size* items (bytes/characters) will be
966
+ read.
967
+ """
968
+
969
+ @runtime_checkable
970
+ class Writer(Protocol[T_contra]):
971
+ """Protocol for simple I/O writer instances.
972
+
973
+ This protocol only supports blocking I/O.
974
+ """
975
+
976
+ __slots__ = ()
977
+
978
+ @abc.abstractmethod
979
+ def write(self, data: T_contra, /) -> int:
980
+ """Write *data* to the output stream and return the number of items written.""" # noqa: E501
981
+
982
+
983
+ _NEEDS_SINGLETONMETA = (
984
+ not hasattr(typing, "NoDefault") or not hasattr(typing, "NoExtraItems")
985
+ )
986
+
987
+ if _NEEDS_SINGLETONMETA:
988
+ class SingletonMeta(type):
989
+ def __setattr__(cls, attr, value):
990
+ # TypeError is consistent with the behavior of NoneType
991
+ raise TypeError(
992
+ f"cannot set {attr!r} attribute of immutable type {cls.__name__!r}"
993
+ )
994
+
995
+
996
+ if hasattr(typing, "NoDefault"):
997
+ NoDefault = typing.NoDefault
998
+ else:
999
+ class NoDefaultType(metaclass=SingletonMeta):
1000
+ """The type of the NoDefault singleton."""
1001
+
1002
+ __slots__ = ()
1003
+
1004
+ def __new__(cls):
1005
+ return globals().get("NoDefault") or object.__new__(cls)
1006
+
1007
+ def __repr__(self):
1008
+ return "typing_extensions.NoDefault"
1009
+
1010
+ def __reduce__(self):
1011
+ return "NoDefault"
1012
+
1013
+ NoDefault = NoDefaultType()
1014
+ del NoDefaultType
1015
+
1016
+ if hasattr(typing, "NoExtraItems"):
1017
+ NoExtraItems = typing.NoExtraItems
1018
+ else:
1019
+ class NoExtraItemsType(metaclass=SingletonMeta):
1020
+ """The type of the NoExtraItems singleton."""
1021
+
1022
+ __slots__ = ()
1023
+
1024
+ def __new__(cls):
1025
+ return globals().get("NoExtraItems") or object.__new__(cls)
1026
+
1027
+ def __repr__(self):
1028
+ return "typing_extensions.NoExtraItems"
1029
+
1030
+ def __reduce__(self):
1031
+ return "NoExtraItems"
1032
+
1033
+ NoExtraItems = NoExtraItemsType()
1034
+ del NoExtraItemsType
1035
+
1036
+ if _NEEDS_SINGLETONMETA:
1037
+ del SingletonMeta
1038
+
1039
+
1040
+ # Update this to something like >=3.13.0b1 if and when
1041
+ # PEP 728 is implemented in CPython
1042
+ _PEP_728_IMPLEMENTED = False
1043
+
1044
+ if _PEP_728_IMPLEMENTED:
1045
+ # The standard library TypedDict in Python 3.9.0/1 does not honour the "total"
1046
+ # keyword with old-style TypedDict(). See https://bugs.python.org/issue42059
1047
+ # The standard library TypedDict below Python 3.11 does not store runtime
1048
+ # information about optional and required keys when using Required or NotRequired.
1049
+ # Generic TypedDicts are also impossible using typing.TypedDict on Python <3.11.
1050
+ # Aaaand on 3.12 we add __orig_bases__ to TypedDict
1051
+ # to enable better runtime introspection.
1052
+ # On 3.13 we deprecate some odd ways of creating TypedDicts.
1053
+ # Also on 3.13, PEP 705 adds the ReadOnly[] qualifier.
1054
+ # PEP 728 (still pending) makes more changes.
1055
+ TypedDict = typing.TypedDict
1056
+ _TypedDictMeta = typing._TypedDictMeta
1057
+ is_typeddict = typing.is_typeddict
1058
+ else:
1059
+ # 3.10.0 and later
1060
+ _TAKES_MODULE = "module" in inspect.signature(typing._type_check).parameters
1061
+
1062
+ def _get_typeddict_qualifiers(annotation_type):
1063
+ while True:
1064
+ annotation_origin = get_origin(annotation_type)
1065
+ if annotation_origin is Annotated:
1066
+ annotation_args = get_args(annotation_type)
1067
+ if annotation_args:
1068
+ annotation_type = annotation_args[0]
1069
+ else:
1070
+ break
1071
+ elif annotation_origin is Required:
1072
+ yield Required
1073
+ annotation_type, = get_args(annotation_type)
1074
+ elif annotation_origin is NotRequired:
1075
+ yield NotRequired
1076
+ annotation_type, = get_args(annotation_type)
1077
+ elif annotation_origin is ReadOnly:
1078
+ yield ReadOnly
1079
+ annotation_type, = get_args(annotation_type)
1080
+ else:
1081
+ break
1082
+
1083
+ class _TypedDictMeta(type):
1084
+
1085
+ def __new__(cls, name, bases, ns, *, total=True, closed=None,
1086
+ extra_items=NoExtraItems):
1087
+ """Create new typed dict class object.
1088
+
1089
+ This method is called when TypedDict is subclassed,
1090
+ or when TypedDict is instantiated. This way
1091
+ TypedDict supports all three syntax forms described in its docstring.
1092
+ Subclasses and instances of TypedDict return actual dictionaries.
1093
+ """
1094
+ for base in bases:
1095
+ if type(base) is not _TypedDictMeta and base is not typing.Generic:
1096
+ raise TypeError('cannot inherit from both a TypedDict type '
1097
+ 'and a non-TypedDict base class')
1098
+ if closed is not None and extra_items is not NoExtraItems:
1099
+ raise TypeError(f"Cannot combine closed={closed!r} and extra_items")
1100
+
1101
+ if any(issubclass(b, typing.Generic) for b in bases):
1102
+ generic_base = (typing.Generic,)
1103
+ else:
1104
+ generic_base = ()
1105
+
1106
+ ns_annotations = ns.pop('__annotations__', None)
1107
+
1108
+ # typing.py generally doesn't let you inherit from plain Generic, unless
1109
+ # the name of the class happens to be "Protocol"
1110
+ tp_dict = type.__new__(_TypedDictMeta, "Protocol", (*generic_base, dict), ns)
1111
+ tp_dict.__name__ = name
1112
+ if tp_dict.__qualname__ == "Protocol":
1113
+ tp_dict.__qualname__ = name
1114
+
1115
+ if not hasattr(tp_dict, '__orig_bases__'):
1116
+ tp_dict.__orig_bases__ = bases
1117
+
1118
+ annotations = {}
1119
+ own_annotate = None
1120
+ if ns_annotations is not None:
1121
+ own_annotations = ns_annotations
1122
+ elif sys.version_info >= (3, 14):
1123
+ if hasattr(annotationlib, "get_annotate_from_class_namespace"):
1124
+ own_annotate = annotationlib.get_annotate_from_class_namespace(ns)
1125
+ else:
1126
+ # 3.14.0a7 and earlier
1127
+ own_annotate = ns.get("__annotate__")
1128
+ if own_annotate is not None:
1129
+ own_annotations = annotationlib.call_annotate_function(
1130
+ own_annotate, Format.FORWARDREF, owner=tp_dict
1131
+ )
1132
+ else:
1133
+ own_annotations = {}
1134
+ else:
1135
+ own_annotations = {}
1136
+ msg = "TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a type"
1137
+ if _TAKES_MODULE:
1138
+ own_checked_annotations = {
1139
+ n: typing._type_check(tp, msg, module=tp_dict.__module__)
1140
+ for n, tp in own_annotations.items()
1141
+ }
1142
+ else:
1143
+ own_checked_annotations = {
1144
+ n: typing._type_check(tp, msg)
1145
+ for n, tp in own_annotations.items()
1146
+ }
1147
+ required_keys = set()
1148
+ optional_keys = set()
1149
+ readonly_keys = set()
1150
+ mutable_keys = set()
1151
+ extra_items_type = extra_items
1152
+
1153
+ for base in bases:
1154
+ base_dict = base.__dict__
1155
+
1156
+ if sys.version_info <= (3, 14):
1157
+ annotations.update(base_dict.get('__annotations__', {}))
1158
+ required_keys.update(base_dict.get('__required_keys__', ()))
1159
+ optional_keys.update(base_dict.get('__optional_keys__', ()))
1160
+ readonly_keys.update(base_dict.get('__readonly_keys__', ()))
1161
+ mutable_keys.update(base_dict.get('__mutable_keys__', ()))
1162
+
1163
+ # This was specified in an earlier version of PEP 728. Support
1164
+ # is retained for backwards compatibility, but only for Python
1165
+ # 3.13 and lower.
1166
+ if (closed and sys.version_info < (3, 14)
1167
+ and "__extra_items__" in own_checked_annotations):
1168
+ annotation_type = own_checked_annotations.pop("__extra_items__")
1169
+ qualifiers = set(_get_typeddict_qualifiers(annotation_type))
1170
+ if Required in qualifiers:
1171
+ raise TypeError(
1172
+ "Special key __extra_items__ does not support "
1173
+ "Required"
1174
+ )
1175
+ if NotRequired in qualifiers:
1176
+ raise TypeError(
1177
+ "Special key __extra_items__ does not support "
1178
+ "NotRequired"
1179
+ )
1180
+ extra_items_type = annotation_type
1181
+
1182
+ annotations.update(own_checked_annotations)
1183
+ for annotation_key, annotation_type in own_checked_annotations.items():
1184
+ qualifiers = set(_get_typeddict_qualifiers(annotation_type))
1185
+
1186
+ if Required in qualifiers:
1187
+ required_keys.add(annotation_key)
1188
+ elif NotRequired in qualifiers:
1189
+ optional_keys.add(annotation_key)
1190
+ elif total:
1191
+ required_keys.add(annotation_key)
1192
+ else:
1193
+ optional_keys.add(annotation_key)
1194
+ if ReadOnly in qualifiers:
1195
+ mutable_keys.discard(annotation_key)
1196
+ readonly_keys.add(annotation_key)
1197
+ else:
1198
+ mutable_keys.add(annotation_key)
1199
+ readonly_keys.discard(annotation_key)
1200
+
1201
+ # Breakpoint: https://github.com/python/cpython/pull/119891
1202
+ if sys.version_info >= (3, 14):
1203
+ def __annotate__(format):
1204
+ annos = {}
1205
+ for base in bases:
1206
+ if base is Generic:
1207
+ continue
1208
+ base_annotate = base.__annotate__
1209
+ if base_annotate is None:
1210
+ continue
1211
+ base_annos = annotationlib.call_annotate_function(
1212
+ base_annotate, format, owner=base)
1213
+ annos.update(base_annos)
1214
+ if own_annotate is not None:
1215
+ own = annotationlib.call_annotate_function(
1216
+ own_annotate, format, owner=tp_dict)
1217
+ if format != Format.STRING:
1218
+ own = {
1219
+ n: typing._type_check(tp, msg, module=tp_dict.__module__)
1220
+ for n, tp in own.items()
1221
+ }
1222
+ elif format == Format.STRING:
1223
+ own = annotationlib.annotations_to_string(own_annotations)
1224
+ elif format in (Format.FORWARDREF, Format.VALUE):
1225
+ own = own_checked_annotations
1226
+ else:
1227
+ raise NotImplementedError(format)
1228
+ annos.update(own)
1229
+ return annos
1230
+
1231
+ tp_dict.__annotate__ = __annotate__
1232
+ else:
1233
+ tp_dict.__annotations__ = annotations
1234
+ tp_dict.__required_keys__ = frozenset(required_keys)
1235
+ tp_dict.__optional_keys__ = frozenset(optional_keys)
1236
+ tp_dict.__readonly_keys__ = frozenset(readonly_keys)
1237
+ tp_dict.__mutable_keys__ = frozenset(mutable_keys)
1238
+ tp_dict.__total__ = total
1239
+ tp_dict.__closed__ = closed
1240
+ tp_dict.__extra_items__ = extra_items_type
1241
+ return tp_dict
1242
+
1243
+ __call__ = dict # static method
1244
+
1245
+ def __subclasscheck__(cls, other):
1246
+ # Typed dicts are only for static structural subtyping.
1247
+ raise TypeError('TypedDict does not support instance and class checks')
1248
+
1249
+ __instancecheck__ = __subclasscheck__
1250
+
1251
+ _TypedDict = type.__new__(_TypedDictMeta, 'TypedDict', (), {})
1252
+
1253
+ def _create_typeddict(
1254
+ typename,
1255
+ fields,
1256
+ /,
1257
+ *,
1258
+ typing_is_inline,
1259
+ total,
1260
+ closed,
1261
+ extra_items,
1262
+ **kwargs,
1263
+ ):
1264
+ if fields is _marker or fields is None:
1265
+ if fields is _marker:
1266
+ deprecated_thing = (
1267
+ "Failing to pass a value for the 'fields' parameter"
1268
+ )
1269
+ else:
1270
+ deprecated_thing = "Passing `None` as the 'fields' parameter"
1271
+
1272
+ example = f"`{typename} = TypedDict({typename!r}, {{}})`"
1273
+ deprecation_msg = (
1274
+ f"{deprecated_thing} is deprecated and will be disallowed in "
1275
+ "Python 3.15. To create a TypedDict class with 0 fields "
1276
+ "using the functional syntax, pass an empty dictionary, e.g. "
1277
+ ) + example + "."
1278
+ warnings.warn(deprecation_msg, DeprecationWarning, stacklevel=2)
1279
+ # Support a field called "closed"
1280
+ if closed is not False and closed is not True and closed is not None:
1281
+ kwargs["closed"] = closed
1282
+ closed = None
1283
+ # Or "extra_items"
1284
+ if extra_items is not NoExtraItems:
1285
+ kwargs["extra_items"] = extra_items
1286
+ extra_items = NoExtraItems
1287
+ fields = kwargs
1288
+ elif kwargs:
1289
+ raise TypeError("TypedDict takes either a dict or keyword arguments,"
1290
+ " but not both")
1291
+ if kwargs:
1292
+ # Breakpoint: https://github.com/python/cpython/pull/104891
1293
+ if sys.version_info >= (3, 13):
1294
+ raise TypeError("TypedDict takes no keyword arguments")
1295
+ warnings.warn(
1296
+ "The kwargs-based syntax for TypedDict definitions is deprecated "
1297
+ "in Python 3.11, will be removed in Python 3.13, and may not be "
1298
+ "understood by third-party type checkers.",
1299
+ DeprecationWarning,
1300
+ stacklevel=2,
1301
+ )
1302
+
1303
+ ns = {'__annotations__': dict(fields)}
1304
+ module = _caller(depth=4 if typing_is_inline else 2)
1305
+ if module is not None:
1306
+ # Setting correct module is necessary to make typed dict classes
1307
+ # pickleable.
1308
+ ns['__module__'] = module
1309
+
1310
+ td = _TypedDictMeta(typename, (), ns, total=total, closed=closed,
1311
+ extra_items=extra_items)
1312
+ td.__orig_bases__ = (TypedDict,)
1313
+ return td
1314
+
1315
+ class _TypedDictSpecialForm(_SpecialForm, _root=True):
1316
+ def __call__(
1317
+ self,
1318
+ typename,
1319
+ fields=_marker,
1320
+ /,
1321
+ *,
1322
+ total=True,
1323
+ closed=None,
1324
+ extra_items=NoExtraItems,
1325
+ **kwargs
1326
+ ):
1327
+ return _create_typeddict(
1328
+ typename,
1329
+ fields,
1330
+ typing_is_inline=False,
1331
+ total=total,
1332
+ closed=closed,
1333
+ extra_items=extra_items,
1334
+ **kwargs,
1335
+ )
1336
+
1337
+ def __mro_entries__(self, bases):
1338
+ return (_TypedDict,)
1339
+
1340
+ @_TypedDictSpecialForm
1341
+ def TypedDict(self, args):
1342
+ """A simple typed namespace. At runtime it is equivalent to a plain dict.
1343
+
1344
+ TypedDict creates a dictionary type such that a type checker will expect all
1345
+ instances to have a certain set of keys, where each key is
1346
+ associated with a value of a consistent type. This expectation
1347
+ is not checked at runtime.
1348
+
1349
+ Usage::
1350
+
1351
+ class Point2D(TypedDict):
1352
+ x: int
1353
+ y: int
1354
+ label: str
1355
+
1356
+ a: Point2D = {'x': 1, 'y': 2, 'label': 'good'} # OK
1357
+ b: Point2D = {'z': 3, 'label': 'bad'} # Fails type check
1358
+
1359
+ assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')
1360
+
1361
+ The type info can be accessed via the Point2D.__annotations__ dict, and
1362
+ the Point2D.__required_keys__ and Point2D.__optional_keys__ frozensets.
1363
+ TypedDict supports an additional equivalent form::
1364
+
1365
+ Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})
1366
+
1367
+ By default, all keys must be present in a TypedDict. It is possible
1368
+ to override this by specifying totality::
1369
+
1370
+ class Point2D(TypedDict, total=False):
1371
+ x: int
1372
+ y: int
1373
+
1374
+ This means that a Point2D TypedDict can have any of the keys omitted. A type
1375
+ checker is only expected to support a literal False or True as the value of
1376
+ the total argument. True is the default, and makes all items defined in the
1377
+ class body be required.
1378
+
1379
+ The Required and NotRequired special forms can also be used to mark
1380
+ individual keys as being required or not required::
1381
+
1382
+ class Point2D(TypedDict):
1383
+ x: int # the "x" key must always be present (Required is the default)
1384
+ y: NotRequired[int] # the "y" key can be omitted
1385
+
1386
+ See PEP 655 for more details on Required and NotRequired.
1387
+ """
1388
+ # This runs when creating inline TypedDicts:
1389
+ if not isinstance(args, dict):
1390
+ raise TypeError(
1391
+ "TypedDict[...] should be used with a single dict argument"
1392
+ )
1393
+
1394
+ return _create_typeddict(
1395
+ "<inline TypedDict>",
1396
+ args,
1397
+ typing_is_inline=True,
1398
+ total=True,
1399
+ closed=True,
1400
+ extra_items=NoExtraItems,
1401
+ )
1402
+
1403
+ _TYPEDDICT_TYPES = (typing._TypedDictMeta, _TypedDictMeta)
1404
+
1405
+ def is_typeddict(tp):
1406
+ """Check if an annotation is a TypedDict class
1407
+
1408
+ For example::
1409
+ class Film(TypedDict):
1410
+ title: str
1411
+ year: int
1412
+
1413
+ is_typeddict(Film) # => True
1414
+ is_typeddict(Union[list, str]) # => False
1415
+ """
1416
+ return isinstance(tp, _TYPEDDICT_TYPES)
1417
+
1418
+
1419
+ if hasattr(typing, "assert_type"):
1420
+ assert_type = typing.assert_type
1421
+
1422
+ else:
1423
+ def assert_type(val, typ, /):
1424
+ """Assert (to the type checker) that the value is of the given type.
1425
+
1426
+ When the type checker encounters a call to assert_type(), it
1427
+ emits an error if the value is not of the specified type::
1428
+
1429
+ def greet(name: str) -> None:
1430
+ assert_type(name, str) # ok
1431
+ assert_type(name, int) # type checker error
1432
+
1433
+ At runtime this returns the first argument unchanged and otherwise
1434
+ does nothing.
1435
+ """
1436
+ return val
1437
+
1438
+
1439
+ if hasattr(typing, "ReadOnly"): # 3.13+
1440
+ get_type_hints = typing.get_type_hints
1441
+ else: # <=3.13
1442
+ # replaces _strip_annotations()
1443
+ def _strip_extras(t):
1444
+ """Strips Annotated, Required and NotRequired from a given type."""
1445
+ if isinstance(t, typing._AnnotatedAlias):
1446
+ return _strip_extras(t.__origin__)
1447
+ if hasattr(t, "__origin__") and t.__origin__ in (Required, NotRequired, ReadOnly):
1448
+ return _strip_extras(t.__args__[0])
1449
+ if isinstance(t, typing._GenericAlias):
1450
+ stripped_args = tuple(_strip_extras(a) for a in t.__args__)
1451
+ if stripped_args == t.__args__:
1452
+ return t
1453
+ return t.copy_with(stripped_args)
1454
+ if hasattr(_types, "GenericAlias") and isinstance(t, _types.GenericAlias):
1455
+ stripped_args = tuple(_strip_extras(a) for a in t.__args__)
1456
+ if stripped_args == t.__args__:
1457
+ return t
1458
+ return _types.GenericAlias(t.__origin__, stripped_args)
1459
+ if hasattr(_types, "UnionType") and isinstance(t, _types.UnionType):
1460
+ stripped_args = tuple(_strip_extras(a) for a in t.__args__)
1461
+ if stripped_args == t.__args__:
1462
+ return t
1463
+ return functools.reduce(operator.or_, stripped_args)
1464
+
1465
+ return t
1466
+
1467
+ def get_type_hints(obj, globalns=None, localns=None, include_extras=False):
1468
+ """Return type hints for an object.
1469
+
1470
+ This is often the same as obj.__annotations__, but it handles
1471
+ forward references encoded as string literals, adds Optional[t] if a
1472
+ default value equal to None is set and recursively replaces all
1473
+ 'Annotated[T, ...]', 'Required[T]' or 'NotRequired[T]' with 'T'
1474
+ (unless 'include_extras=True').
1475
+
1476
+ The argument may be a module, class, method, or function. The annotations
1477
+ are returned as a dictionary. For classes, annotations include also
1478
+ inherited members.
1479
+
1480
+ TypeError is raised if the argument is not of a type that can contain
1481
+ annotations, and an empty dictionary is returned if no annotations are
1482
+ present.
1483
+
1484
+ BEWARE -- the behavior of globalns and localns is counterintuitive
1485
+ (unless you are familiar with how eval() and exec() work). The
1486
+ search order is locals first, then globals.
1487
+
1488
+ - If no dict arguments are passed, an attempt is made to use the
1489
+ globals from obj (or the respective module's globals for classes),
1490
+ and these are also used as the locals. If the object does not appear
1491
+ to have globals, an empty dictionary is used.
1492
+
1493
+ - If one dict argument is passed, it is used for both globals and
1494
+ locals.
1495
+
1496
+ - If two dict arguments are passed, they specify globals and
1497
+ locals, respectively.
1498
+ """
1499
+ hint = typing.get_type_hints(
1500
+ obj, globalns=globalns, localns=localns, include_extras=True
1501
+ )
1502
+ # Breakpoint: https://github.com/python/cpython/pull/30304
1503
+ if sys.version_info < (3, 11):
1504
+ _clean_optional(obj, hint, globalns, localns)
1505
+ if include_extras:
1506
+ return hint
1507
+ return {k: _strip_extras(t) for k, t in hint.items()}
1508
+
1509
+ _NoneType = type(None)
1510
+
1511
+ def _could_be_inserted_optional(t):
1512
+ """detects Union[..., None] pattern"""
1513
+ if not isinstance(t, typing._UnionGenericAlias):
1514
+ return False
1515
+ # Assume if last argument is not None they are user defined
1516
+ if t.__args__[-1] is not _NoneType:
1517
+ return False
1518
+ return True
1519
+
1520
+ # < 3.11
1521
+ def _clean_optional(obj, hints, globalns=None, localns=None):
1522
+ # reverts injected Union[..., None] cases from typing.get_type_hints
1523
+ # when a None default value is used.
1524
+ # see https://github.com/python/typing_extensions/issues/310
1525
+ if not hints or isinstance(obj, type):
1526
+ return
1527
+ defaults = typing._get_defaults(obj) # avoid accessing __annotations___
1528
+ if not defaults:
1529
+ return
1530
+ original_hints = obj.__annotations__
1531
+ for name, value in hints.items():
1532
+ # Not a Union[..., None] or replacement conditions not fullfilled
1533
+ if (not _could_be_inserted_optional(value)
1534
+ or name not in defaults
1535
+ or defaults[name] is not None
1536
+ ):
1537
+ continue
1538
+ original_value = original_hints[name]
1539
+ # value=NoneType should have caused a skip above but check for safety
1540
+ if original_value is None:
1541
+ original_value = _NoneType
1542
+ # Forward reference
1543
+ if isinstance(original_value, str):
1544
+ if globalns is None:
1545
+ if isinstance(obj, _types.ModuleType):
1546
+ globalns = obj.__dict__
1547
+ else:
1548
+ nsobj = obj
1549
+ # Find globalns for the unwrapped object.
1550
+ while hasattr(nsobj, '__wrapped__'):
1551
+ nsobj = nsobj.__wrapped__
1552
+ globalns = getattr(nsobj, '__globals__', {})
1553
+ if localns is None:
1554
+ localns = globalns
1555
+ elif localns is None:
1556
+ localns = globalns
1557
+
1558
+ original_value = ForwardRef(
1559
+ original_value,
1560
+ is_argument=not isinstance(obj, _types.ModuleType)
1561
+ )
1562
+ original_evaluated = typing._eval_type(original_value, globalns, localns)
1563
+ # Compare if values differ. Note that even if equal
1564
+ # value might be cached by typing._tp_cache contrary to original_evaluated
1565
+ if original_evaluated != value or (
1566
+ # 3.10: ForwardRefs of UnionType might be turned into _UnionGenericAlias
1567
+ hasattr(_types, "UnionType")
1568
+ and isinstance(original_evaluated, _types.UnionType)
1569
+ and not isinstance(value, _types.UnionType)
1570
+ ):
1571
+ hints[name] = original_evaluated
1572
+
1573
+ # Python 3.9 has get_origin() and get_args() but those implementations don't support
1574
+ # ParamSpecArgs and ParamSpecKwargs, so only Python 3.10's versions will do.
1575
+ # Breakpoint: https://github.com/python/cpython/pull/25298
1576
+ if sys.version_info >= (3, 10):
1577
+ get_origin = typing.get_origin
1578
+ get_args = typing.get_args
1579
+ # 3.9
1580
+ else:
1581
+ def get_origin(tp):
1582
+ """Get the unsubscripted version of a type.
1583
+
1584
+ This supports generic types, Callable, Tuple, Union, Literal, Final, ClassVar
1585
+ and Annotated. Return None for unsupported types. Examples::
1586
+
1587
+ get_origin(Literal[42]) is Literal
1588
+ get_origin(int) is None
1589
+ get_origin(ClassVar[int]) is ClassVar
1590
+ get_origin(Generic) is Generic
1591
+ get_origin(Generic[T]) is Generic
1592
+ get_origin(Union[T, int]) is Union
1593
+ get_origin(List[Tuple[T, T]][int]) == list
1594
+ get_origin(P.args) is P
1595
+ """
1596
+ if isinstance(tp, typing._AnnotatedAlias):
1597
+ return Annotated
1598
+ if isinstance(tp, (typing._BaseGenericAlias, _types.GenericAlias,
1599
+ ParamSpecArgs, ParamSpecKwargs)):
1600
+ return tp.__origin__
1601
+ if tp is typing.Generic:
1602
+ return typing.Generic
1603
+ return None
1604
+
1605
+ def get_args(tp):
1606
+ """Get type arguments with all substitutions performed.
1607
+
1608
+ For unions, basic simplifications used by Union constructor are performed.
1609
+ Examples::
1610
+ get_args(Dict[str, int]) == (str, int)
1611
+ get_args(int) == ()
1612
+ get_args(Union[int, Union[T, int], str][int]) == (int, str)
1613
+ get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, int])
1614
+ get_args(Callable[[], T][int]) == ([], int)
1615
+ """
1616
+ if isinstance(tp, typing._AnnotatedAlias):
1617
+ return (tp.__origin__, *tp.__metadata__)
1618
+ if isinstance(tp, (typing._GenericAlias, _types.GenericAlias)):
1619
+ res = tp.__args__
1620
+ if get_origin(tp) is collections.abc.Callable and res[0] is not Ellipsis:
1621
+ res = (list(res[:-1]), res[-1])
1622
+ return res
1623
+ return ()
1624
+
1625
+
1626
+ # 3.10+
1627
+ if hasattr(typing, 'TypeAlias'):
1628
+ TypeAlias = typing.TypeAlias
1629
+ # 3.9
1630
+ else:
1631
+ @_ExtensionsSpecialForm
1632
+ def TypeAlias(self, parameters):
1633
+ """Special marker indicating that an assignment should
1634
+ be recognized as a proper type alias definition by type
1635
+ checkers.
1636
+
1637
+ For example::
1638
+
1639
+ Predicate: TypeAlias = Callable[..., bool]
1640
+
1641
+ It's invalid when used anywhere except as in the example above.
1642
+ """
1643
+ raise TypeError(f"{self} is not subscriptable")
1644
+
1645
+
1646
+ def _set_default(type_param, default):
1647
+ type_param.has_default = lambda: default is not NoDefault
1648
+ type_param.__default__ = default
1649
+
1650
+
1651
+ def _set_module(typevarlike):
1652
+ # for pickling:
1653
+ def_mod = _caller(depth=2)
1654
+ if def_mod != 'typing_extensions':
1655
+ typevarlike.__module__ = def_mod
1656
+
1657
+
1658
+ class _DefaultMixin:
1659
+ """Mixin for TypeVarLike defaults."""
1660
+
1661
+ __slots__ = ()
1662
+ __init__ = _set_default
1663
+
1664
+
1665
+ # Classes using this metaclass must provide a _backported_typevarlike ClassVar
1666
+ class _TypeVarLikeMeta(type):
1667
+ def __instancecheck__(cls, __instance: Any) -> bool:
1668
+ return isinstance(__instance, cls._backported_typevarlike)
1669
+
1670
+
1671
+ if _PEP_696_IMPLEMENTED:
1672
+ from typing import TypeVar
1673
+ else:
1674
+ # Add default and infer_variance parameters from PEP 696 and 695
1675
+ class TypeVar(metaclass=_TypeVarLikeMeta):
1676
+ """Type variable."""
1677
+
1678
+ _backported_typevarlike = typing.TypeVar
1679
+
1680
+ def __new__(cls, name, *constraints, bound=None,
1681
+ covariant=False, contravariant=False,
1682
+ default=NoDefault, infer_variance=False):
1683
+ if hasattr(typing, "TypeAliasType"):
1684
+ # PEP 695 implemented (3.12+), can pass infer_variance to typing.TypeVar
1685
+ typevar = typing.TypeVar(name, *constraints, bound=bound,
1686
+ covariant=covariant, contravariant=contravariant,
1687
+ infer_variance=infer_variance)
1688
+ else:
1689
+ typevar = typing.TypeVar(name, *constraints, bound=bound,
1690
+ covariant=covariant, contravariant=contravariant)
1691
+ if infer_variance and (covariant or contravariant):
1692
+ raise ValueError("Variance cannot be specified with infer_variance.")
1693
+ typevar.__infer_variance__ = infer_variance
1694
+
1695
+ _set_default(typevar, default)
1696
+ _set_module(typevar)
1697
+
1698
+ def _tvar_prepare_subst(alias, args):
1699
+ if (
1700
+ typevar.has_default()
1701
+ and alias.__parameters__.index(typevar) == len(args)
1702
+ ):
1703
+ args += (typevar.__default__,)
1704
+ return args
1705
+
1706
+ typevar.__typing_prepare_subst__ = _tvar_prepare_subst
1707
+ return typevar
1708
+
1709
+ def __init_subclass__(cls) -> None:
1710
+ raise TypeError(f"type '{__name__}.TypeVar' is not an acceptable base type")
1711
+
1712
+
1713
+ # Python 3.10+ has PEP 612
1714
+ if hasattr(typing, 'ParamSpecArgs'):
1715
+ ParamSpecArgs = typing.ParamSpecArgs
1716
+ ParamSpecKwargs = typing.ParamSpecKwargs
1717
+ # 3.9
1718
+ else:
1719
+ class _Immutable:
1720
+ """Mixin to indicate that object should not be copied."""
1721
+ __slots__ = ()
1722
+
1723
+ def __copy__(self):
1724
+ return self
1725
+
1726
+ def __deepcopy__(self, memo):
1727
+ return self
1728
+
1729
+ class ParamSpecArgs(_Immutable):
1730
+ """The args for a ParamSpec object.
1731
+
1732
+ Given a ParamSpec object P, P.args is an instance of ParamSpecArgs.
1733
+
1734
+ ParamSpecArgs objects have a reference back to their ParamSpec:
1735
+
1736
+ P.args.__origin__ is P
1737
+
1738
+ This type is meant for runtime introspection and has no special meaning to
1739
+ static type checkers.
1740
+ """
1741
+ def __init__(self, origin):
1742
+ self.__origin__ = origin
1743
+
1744
+ def __repr__(self):
1745
+ return f"{self.__origin__.__name__}.args"
1746
+
1747
+ def __eq__(self, other):
1748
+ if not isinstance(other, ParamSpecArgs):
1749
+ return NotImplemented
1750
+ return self.__origin__ == other.__origin__
1751
+
1752
+ class ParamSpecKwargs(_Immutable):
1753
+ """The kwargs for a ParamSpec object.
1754
+
1755
+ Given a ParamSpec object P, P.kwargs is an instance of ParamSpecKwargs.
1756
+
1757
+ ParamSpecKwargs objects have a reference back to their ParamSpec:
1758
+
1759
+ P.kwargs.__origin__ is P
1760
+
1761
+ This type is meant for runtime introspection and has no special meaning to
1762
+ static type checkers.
1763
+ """
1764
+ def __init__(self, origin):
1765
+ self.__origin__ = origin
1766
+
1767
+ def __repr__(self):
1768
+ return f"{self.__origin__.__name__}.kwargs"
1769
+
1770
+ def __eq__(self, other):
1771
+ if not isinstance(other, ParamSpecKwargs):
1772
+ return NotImplemented
1773
+ return self.__origin__ == other.__origin__
1774
+
1775
+
1776
+ if _PEP_696_IMPLEMENTED:
1777
+ from typing import ParamSpec
1778
+
1779
+ # 3.10+
1780
+ elif hasattr(typing, 'ParamSpec'):
1781
+
1782
+ # Add default parameter - PEP 696
1783
+ class ParamSpec(metaclass=_TypeVarLikeMeta):
1784
+ """Parameter specification."""
1785
+
1786
+ _backported_typevarlike = typing.ParamSpec
1787
+
1788
+ def __new__(cls, name, *, bound=None,
1789
+ covariant=False, contravariant=False,
1790
+ infer_variance=False, default=NoDefault):
1791
+ if hasattr(typing, "TypeAliasType"):
1792
+ # PEP 695 implemented, can pass infer_variance to typing.TypeVar
1793
+ paramspec = typing.ParamSpec(name, bound=bound,
1794
+ covariant=covariant,
1795
+ contravariant=contravariant,
1796
+ infer_variance=infer_variance)
1797
+ else:
1798
+ paramspec = typing.ParamSpec(name, bound=bound,
1799
+ covariant=covariant,
1800
+ contravariant=contravariant)
1801
+ paramspec.__infer_variance__ = infer_variance
1802
+
1803
+ _set_default(paramspec, default)
1804
+ _set_module(paramspec)
1805
+
1806
+ def _paramspec_prepare_subst(alias, args):
1807
+ params = alias.__parameters__
1808
+ i = params.index(paramspec)
1809
+ if i == len(args) and paramspec.has_default():
1810
+ args = [*args, paramspec.__default__]
1811
+ if i >= len(args):
1812
+ raise TypeError(f"Too few arguments for {alias}")
1813
+ # Special case where Z[[int, str, bool]] == Z[int, str, bool] in PEP 612.
1814
+ if len(params) == 1 and not typing._is_param_expr(args[0]):
1815
+ assert i == 0
1816
+ args = (args,)
1817
+ # Convert lists to tuples to help other libraries cache the results.
1818
+ elif isinstance(args[i], list):
1819
+ args = (*args[:i], tuple(args[i]), *args[i + 1:])
1820
+ return args
1821
+
1822
+ paramspec.__typing_prepare_subst__ = _paramspec_prepare_subst
1823
+ return paramspec
1824
+
1825
+ def __init_subclass__(cls) -> None:
1826
+ raise TypeError(f"type '{__name__}.ParamSpec' is not an acceptable base type")
1827
+
1828
+ # 3.9
1829
+ else:
1830
+
1831
+ # Inherits from list as a workaround for Callable checks in Python < 3.9.2.
1832
+ class ParamSpec(list, _DefaultMixin):
1833
+ """Parameter specification variable.
1834
+
1835
+ Usage::
1836
+
1837
+ P = ParamSpec('P')
1838
+
1839
+ Parameter specification variables exist primarily for the benefit of static
1840
+ type checkers. They are used to forward the parameter types of one
1841
+ callable to another callable, a pattern commonly found in higher order
1842
+ functions and decorators. They are only valid when used in ``Concatenate``,
1843
+ or s the first argument to ``Callable``. In Python 3.10 and higher,
1844
+ they are also supported in user-defined Generics at runtime.
1845
+ See class Generic for more information on generic types. An
1846
+ example for annotating a decorator::
1847
+
1848
+ T = TypeVar('T')
1849
+ P = ParamSpec('P')
1850
+
1851
+ def add_logging(f: Callable[P, T]) -> Callable[P, T]:
1852
+ '''A type-safe decorator to add logging to a function.'''
1853
+ def inner(*args: P.args, **kwargs: P.kwargs) -> T:
1854
+ logging.info(f'{f.__name__} was called')
1855
+ return f(*args, **kwargs)
1856
+ return inner
1857
+
1858
+ @add_logging
1859
+ def add_two(x: float, y: float) -> float:
1860
+ '''Add two numbers together.'''
1861
+ return x + y
1862
+
1863
+ Parameter specification variables defined with covariant=True or
1864
+ contravariant=True can be used to declare covariant or contravariant
1865
+ generic types. These keyword arguments are valid, but their actual semantics
1866
+ are yet to be decided. See PEP 612 for details.
1867
+
1868
+ Parameter specification variables can be introspected. e.g.:
1869
+
1870
+ P.__name__ == 'T'
1871
+ P.__bound__ == None
1872
+ P.__covariant__ == False
1873
+ P.__contravariant__ == False
1874
+
1875
+ Note that only parameter specification variables defined in global scope can
1876
+ be pickled.
1877
+ """
1878
+
1879
+ # Trick Generic __parameters__.
1880
+ __class__ = typing.TypeVar
1881
+
1882
+ @property
1883
+ def args(self):
1884
+ return ParamSpecArgs(self)
1885
+
1886
+ @property
1887
+ def kwargs(self):
1888
+ return ParamSpecKwargs(self)
1889
+
1890
+ def __init__(self, name, *, bound=None, covariant=False, contravariant=False,
1891
+ infer_variance=False, default=NoDefault):
1892
+ list.__init__(self, [self])
1893
+ self.__name__ = name
1894
+ self.__covariant__ = bool(covariant)
1895
+ self.__contravariant__ = bool(contravariant)
1896
+ self.__infer_variance__ = bool(infer_variance)
1897
+ if bound:
1898
+ self.__bound__ = typing._type_check(bound, 'Bound must be a type.')
1899
+ else:
1900
+ self.__bound__ = None
1901
+ _DefaultMixin.__init__(self, default)
1902
+
1903
+ # for pickling:
1904
+ def_mod = _caller()
1905
+ if def_mod != 'typing_extensions':
1906
+ self.__module__ = def_mod
1907
+
1908
+ def __repr__(self):
1909
+ if self.__infer_variance__:
1910
+ prefix = ''
1911
+ elif self.__covariant__:
1912
+ prefix = '+'
1913
+ elif self.__contravariant__:
1914
+ prefix = '-'
1915
+ else:
1916
+ prefix = '~'
1917
+ return prefix + self.__name__
1918
+
1919
+ def __hash__(self):
1920
+ return object.__hash__(self)
1921
+
1922
+ def __eq__(self, other):
1923
+ return self is other
1924
+
1925
+ def __reduce__(self):
1926
+ return self.__name__
1927
+
1928
+ # Hack to get typing._type_check to pass.
1929
+ def __call__(self, *args, **kwargs):
1930
+ pass
1931
+
1932
+
1933
+ # 3.9
1934
+ if not hasattr(typing, 'Concatenate'):
1935
+ # Inherits from list as a workaround for Callable checks in Python < 3.9.2.
1936
+
1937
+ # 3.9.0-1
1938
+ if not hasattr(typing, '_type_convert'):
1939
+ def _type_convert(arg, module=None, *, allow_special_forms=False):
1940
+ """For converting None to type(None), and strings to ForwardRef."""
1941
+ if arg is None:
1942
+ return type(None)
1943
+ if isinstance(arg, str):
1944
+ if sys.version_info <= (3, 9, 6):
1945
+ return ForwardRef(arg)
1946
+ if sys.version_info <= (3, 9, 7):
1947
+ return ForwardRef(arg, module=module)
1948
+ return ForwardRef(arg, module=module, is_class=allow_special_forms)
1949
+ return arg
1950
+ else:
1951
+ _type_convert = typing._type_convert
1952
+
1953
+ class _ConcatenateGenericAlias(list):
1954
+
1955
+ # Trick Generic into looking into this for __parameters__.
1956
+ __class__ = typing._GenericAlias
1957
+
1958
+ def __init__(self, origin, args):
1959
+ super().__init__(args)
1960
+ self.__origin__ = origin
1961
+ self.__args__ = args
1962
+
1963
+ def __repr__(self):
1964
+ _type_repr = typing._type_repr
1965
+ return (f'{_type_repr(self.__origin__)}'
1966
+ f'[{", ".join(_type_repr(arg) for arg in self.__args__)}]')
1967
+
1968
+ def __hash__(self):
1969
+ return hash((self.__origin__, self.__args__))
1970
+
1971
+ # Hack to get typing._type_check to pass in Generic.
1972
+ def __call__(self, *args, **kwargs):
1973
+ pass
1974
+
1975
+ @property
1976
+ def __parameters__(self):
1977
+ return tuple(
1978
+ tp for tp in self.__args__ if isinstance(tp, (typing.TypeVar, ParamSpec))
1979
+ )
1980
+
1981
+ # 3.9 used by __getitem__ below
1982
+ def copy_with(self, params):
1983
+ if isinstance(params[-1], _ConcatenateGenericAlias):
1984
+ params = (*params[:-1], *params[-1].__args__)
1985
+ elif isinstance(params[-1], (list, tuple)):
1986
+ return (*params[:-1], *params[-1])
1987
+ elif (not (params[-1] is ... or isinstance(params[-1], ParamSpec))):
1988
+ raise TypeError("The last parameter to Concatenate should be a "
1989
+ "ParamSpec variable or ellipsis.")
1990
+ return self.__class__(self.__origin__, params)
1991
+
1992
+ # 3.9; accessed during GenericAlias.__getitem__ when substituting
1993
+ def __getitem__(self, args):
1994
+ if self.__origin__ in (Generic, Protocol):
1995
+ # Can't subscript Generic[...] or Protocol[...].
1996
+ raise TypeError(f"Cannot subscript already-subscripted {self}")
1997
+ if not self.__parameters__:
1998
+ raise TypeError(f"{self} is not a generic class")
1999
+
2000
+ if not isinstance(args, tuple):
2001
+ args = (args,)
2002
+ args = _unpack_args(*(_type_convert(p) for p in args))
2003
+ params = self.__parameters__
2004
+ for param in params:
2005
+ prepare = getattr(param, "__typing_prepare_subst__", None)
2006
+ if prepare is not None:
2007
+ args = prepare(self, args)
2008
+ # 3.9 & typing.ParamSpec
2009
+ elif isinstance(param, ParamSpec):
2010
+ i = params.index(param)
2011
+ if (
2012
+ i == len(args)
2013
+ and getattr(param, '__default__', NoDefault) is not NoDefault
2014
+ ):
2015
+ args = [*args, param.__default__]
2016
+ if i >= len(args):
2017
+ raise TypeError(f"Too few arguments for {self}")
2018
+ # Special case for Z[[int, str, bool]] == Z[int, str, bool]
2019
+ if len(params) == 1 and not _is_param_expr(args[0]):
2020
+ assert i == 0
2021
+ args = (args,)
2022
+ elif (
2023
+ isinstance(args[i], list)
2024
+ # 3.9
2025
+ # This class inherits from list do not convert
2026
+ and not isinstance(args[i], _ConcatenateGenericAlias)
2027
+ ):
2028
+ args = (*args[:i], tuple(args[i]), *args[i + 1:])
2029
+
2030
+ alen = len(args)
2031
+ plen = len(params)
2032
+ if alen != plen:
2033
+ raise TypeError(
2034
+ f"Too {'many' if alen > plen else 'few'} arguments for {self};"
2035
+ f" actual {alen}, expected {plen}"
2036
+ )
2037
+
2038
+ subst = dict(zip(self.__parameters__, args))
2039
+ # determine new args
2040
+ new_args = []
2041
+ for arg in self.__args__:
2042
+ if isinstance(arg, type):
2043
+ new_args.append(arg)
2044
+ continue
2045
+ if isinstance(arg, TypeVar):
2046
+ arg = subst[arg]
2047
+ if (
2048
+ (isinstance(arg, typing._GenericAlias) and _is_unpack(arg))
2049
+ or (
2050
+ hasattr(_types, "GenericAlias")
2051
+ and isinstance(arg, _types.GenericAlias)
2052
+ and getattr(arg, "__unpacked__", False)
2053
+ )
2054
+ ):
2055
+ raise TypeError(f"{arg} is not valid as type argument")
2056
+
2057
+ elif isinstance(arg,
2058
+ typing._GenericAlias
2059
+ if not hasattr(_types, "GenericAlias") else
2060
+ (typing._GenericAlias, _types.GenericAlias)
2061
+ ):
2062
+ subparams = arg.__parameters__
2063
+ if subparams:
2064
+ subargs = tuple(subst[x] for x in subparams)
2065
+ arg = arg[subargs]
2066
+ new_args.append(arg)
2067
+ return self.copy_with(tuple(new_args))
2068
+
2069
+ # 3.10+
2070
+ else:
2071
+ _ConcatenateGenericAlias = typing._ConcatenateGenericAlias
2072
+
2073
+ # 3.10
2074
+ if sys.version_info < (3, 11):
2075
+
2076
+ class _ConcatenateGenericAlias(typing._ConcatenateGenericAlias, _root=True):
2077
+ # needed for checks in collections.abc.Callable to accept this class
2078
+ __module__ = "typing"
2079
+
2080
+ def copy_with(self, params):
2081
+ if isinstance(params[-1], (list, tuple)):
2082
+ return (*params[:-1], *params[-1])
2083
+ if isinstance(params[-1], typing._ConcatenateGenericAlias):
2084
+ params = (*params[:-1], *params[-1].__args__)
2085
+ elif not (params[-1] is ... or isinstance(params[-1], ParamSpec)):
2086
+ raise TypeError("The last parameter to Concatenate should be a "
2087
+ "ParamSpec variable or ellipsis.")
2088
+ return super(typing._ConcatenateGenericAlias, self).copy_with(params)
2089
+
2090
+ def __getitem__(self, args):
2091
+ value = super().__getitem__(args)
2092
+ if isinstance(value, tuple) and any(_is_unpack(t) for t in value):
2093
+ return tuple(_unpack_args(*(n for n in value)))
2094
+ return value
2095
+
2096
+
2097
+ # 3.9.2
2098
+ class _EllipsisDummy: ...
2099
+
2100
+
2101
+ # <=3.10
2102
+ def _create_concatenate_alias(origin, parameters):
2103
+ if parameters[-1] is ... and sys.version_info < (3, 9, 2):
2104
+ # Hack: Arguments must be types, replace it with one.
2105
+ parameters = (*parameters[:-1], _EllipsisDummy)
2106
+ if sys.version_info >= (3, 10, 3):
2107
+ concatenate = _ConcatenateGenericAlias(origin, parameters,
2108
+ _typevar_types=(TypeVar, ParamSpec),
2109
+ _paramspec_tvars=True)
2110
+ else:
2111
+ concatenate = _ConcatenateGenericAlias(origin, parameters)
2112
+ if parameters[-1] is not _EllipsisDummy:
2113
+ return concatenate
2114
+ # Remove dummy again
2115
+ concatenate.__args__ = tuple(p if p is not _EllipsisDummy else ...
2116
+ for p in concatenate.__args__)
2117
+ if sys.version_info < (3, 10):
2118
+ # backport needs __args__ adjustment only
2119
+ return concatenate
2120
+ concatenate.__parameters__ = tuple(p for p in concatenate.__parameters__
2121
+ if p is not _EllipsisDummy)
2122
+ return concatenate
2123
+
2124
+
2125
+ # <=3.10
2126
+ @typing._tp_cache
2127
+ def _concatenate_getitem(self, parameters):
2128
+ if parameters == ():
2129
+ raise TypeError("Cannot take a Concatenate of no types.")
2130
+ if not isinstance(parameters, tuple):
2131
+ parameters = (parameters,)
2132
+ if not (parameters[-1] is ... or isinstance(parameters[-1], ParamSpec)):
2133
+ raise TypeError("The last parameter to Concatenate should be a "
2134
+ "ParamSpec variable or ellipsis.")
2135
+ msg = "Concatenate[arg, ...]: each arg must be a type."
2136
+ parameters = (*(typing._type_check(p, msg) for p in parameters[:-1]),
2137
+ parameters[-1])
2138
+ return _create_concatenate_alias(self, parameters)
2139
+
2140
+
2141
+ # 3.11+; Concatenate does not accept ellipsis in 3.10
2142
+ # Breakpoint: https://github.com/python/cpython/pull/30969
2143
+ if sys.version_info >= (3, 11):
2144
+ Concatenate = typing.Concatenate
2145
+ # <=3.10
2146
+ else:
2147
+ @_ExtensionsSpecialForm
2148
+ def Concatenate(self, parameters):
2149
+ """Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a
2150
+ higher order function which adds, removes or transforms parameters of a
2151
+ callable.
2152
+
2153
+ For example::
2154
+
2155
+ Callable[Concatenate[int, P], int]
2156
+
2157
+ See PEP 612 for detailed information.
2158
+ """
2159
+ return _concatenate_getitem(self, parameters)
2160
+
2161
+
2162
+ # 3.10+
2163
+ if hasattr(typing, 'TypeGuard'):
2164
+ TypeGuard = typing.TypeGuard
2165
+ # 3.9
2166
+ else:
2167
+ @_ExtensionsSpecialForm
2168
+ def TypeGuard(self, parameters):
2169
+ """Special typing form used to annotate the return type of a user-defined
2170
+ type guard function. ``TypeGuard`` only accepts a single type argument.
2171
+ At runtime, functions marked this way should return a boolean.
2172
+
2173
+ ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static
2174
+ type checkers to determine a more precise type of an expression within a
2175
+ program's code flow. Usually type narrowing is done by analyzing
2176
+ conditional code flow and applying the narrowing to a block of code. The
2177
+ conditional expression here is sometimes referred to as a "type guard".
2178
+
2179
+ Sometimes it would be convenient to use a user-defined boolean function
2180
+ as a type guard. Such a function should use ``TypeGuard[...]`` as its
2181
+ return type to alert static type checkers to this intention.
2182
+
2183
+ Using ``-> TypeGuard`` tells the static type checker that for a given
2184
+ function:
2185
+
2186
+ 1. The return value is a boolean.
2187
+ 2. If the return value is ``True``, the type of its argument
2188
+ is the type inside ``TypeGuard``.
2189
+
2190
+ For example::
2191
+
2192
+ def is_str(val: Union[str, float]):
2193
+ # "isinstance" type guard
2194
+ if isinstance(val, str):
2195
+ # Type of ``val`` is narrowed to ``str``
2196
+ ...
2197
+ else:
2198
+ # Else, type of ``val`` is narrowed to ``float``.
2199
+ ...
2200
+
2201
+ Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower
2202
+ form of ``TypeA`` (it can even be a wider form) and this may lead to
2203
+ type-unsafe results. The main reason is to allow for things like
2204
+ narrowing ``List[object]`` to ``List[str]`` even though the latter is not
2205
+ a subtype of the former, since ``List`` is invariant. The responsibility of
2206
+ writing type-safe type guards is left to the user.
2207
+
2208
+ ``TypeGuard`` also works with type variables. For more information, see
2209
+ PEP 647 (User-Defined Type Guards).
2210
+ """
2211
+ item = typing._type_check(parameters, f'{self} accepts only a single type.')
2212
+ return typing._GenericAlias(self, (item,))
2213
+
2214
+
2215
+ # 3.13+
2216
+ if hasattr(typing, 'TypeIs'):
2217
+ TypeIs = typing.TypeIs
2218
+ # <=3.12
2219
+ else:
2220
+ @_ExtensionsSpecialForm
2221
+ def TypeIs(self, parameters):
2222
+ """Special typing form used to annotate the return type of a user-defined
2223
+ type narrower function. ``TypeIs`` only accepts a single type argument.
2224
+ At runtime, functions marked this way should return a boolean.
2225
+
2226
+ ``TypeIs`` aims to benefit *type narrowing* -- a technique used by static
2227
+ type checkers to determine a more precise type of an expression within a
2228
+ program's code flow. Usually type narrowing is done by analyzing
2229
+ conditional code flow and applying the narrowing to a block of code. The
2230
+ conditional expression here is sometimes referred to as a "type guard".
2231
+
2232
+ Sometimes it would be convenient to use a user-defined boolean function
2233
+ as a type guard. Such a function should use ``TypeIs[...]`` as its
2234
+ return type to alert static type checkers to this intention.
2235
+
2236
+ Using ``-> TypeIs`` tells the static type checker that for a given
2237
+ function:
2238
+
2239
+ 1. The return value is a boolean.
2240
+ 2. If the return value is ``True``, the type of its argument
2241
+ is the intersection of the type inside ``TypeIs`` and the argument's
2242
+ previously known type.
2243
+
2244
+ For example::
2245
+
2246
+ def is_awaitable(val: object) -> TypeIs[Awaitable[Any]]:
2247
+ return hasattr(val, '__await__')
2248
+
2249
+ def f(val: Union[int, Awaitable[int]]) -> int:
2250
+ if is_awaitable(val):
2251
+ assert_type(val, Awaitable[int])
2252
+ else:
2253
+ assert_type(val, int)
2254
+
2255
+ ``TypeIs`` also works with type variables. For more information, see
2256
+ PEP 742 (Narrowing types with TypeIs).
2257
+ """
2258
+ item = typing._type_check(parameters, f'{self} accepts only a single type.')
2259
+ return typing._GenericAlias(self, (item,))
2260
+
2261
+
2262
+ # 3.14+?
2263
+ if hasattr(typing, 'TypeForm'):
2264
+ TypeForm = typing.TypeForm
2265
+ # <=3.13
2266
+ else:
2267
+ class _TypeFormForm(_ExtensionsSpecialForm, _root=True):
2268
+ # TypeForm(X) is equivalent to X but indicates to the type checker
2269
+ # that the object is a TypeForm.
2270
+ def __call__(self, obj, /):
2271
+ return obj
2272
+
2273
+ @_TypeFormForm
2274
+ def TypeForm(self, parameters):
2275
+ """A special form representing the value that results from the evaluation
2276
+ of a type expression. This value encodes the information supplied in the
2277
+ type expression, and it represents the type described by that type expression.
2278
+
2279
+ When used in a type expression, TypeForm describes a set of type form objects.
2280
+ It accepts a single type argument, which must be a valid type expression.
2281
+ ``TypeForm[T]`` describes the set of all type form objects that represent
2282
+ the type T or types that are assignable to T.
2283
+
2284
+ Usage:
2285
+
2286
+ def cast[T](typ: TypeForm[T], value: Any) -> T: ...
2287
+
2288
+ reveal_type(cast(int, "x")) # int
2289
+
2290
+ See PEP 747 for more information.
2291
+ """
2292
+ item = typing._type_check(parameters, f'{self} accepts only a single type.')
2293
+ return typing._GenericAlias(self, (item,))
2294
+
2295
+
2296
+
2297
+
2298
+ if hasattr(typing, "LiteralString"): # 3.11+
2299
+ LiteralString = typing.LiteralString
2300
+ else:
2301
+ @_SpecialForm
2302
+ def LiteralString(self, params):
2303
+ """Represents an arbitrary literal string.
2304
+
2305
+ Example::
2306
+
2307
+ from typing_extensions import LiteralString
2308
+
2309
+ def query(sql: LiteralString) -> ...:
2310
+ ...
2311
+
2312
+ query("SELECT * FROM table") # ok
2313
+ query(f"SELECT * FROM {input()}") # not ok
2314
+
2315
+ See PEP 675 for details.
2316
+
2317
+ """
2318
+ raise TypeError(f"{self} is not subscriptable")
2319
+
2320
+
2321
+ if hasattr(typing, "Self"): # 3.11+
2322
+ Self = typing.Self
2323
+ else:
2324
+ @_SpecialForm
2325
+ def Self(self, params):
2326
+ """Used to spell the type of "self" in classes.
2327
+
2328
+ Example::
2329
+
2330
+ from typing import Self
2331
+
2332
+ class ReturnsSelf:
2333
+ def parse(self, data: bytes) -> Self:
2334
+ ...
2335
+ return self
2336
+
2337
+ """
2338
+
2339
+ raise TypeError(f"{self} is not subscriptable")
2340
+
2341
+
2342
+ if hasattr(typing, "Never"): # 3.11+
2343
+ Never = typing.Never
2344
+ else:
2345
+ @_SpecialForm
2346
+ def Never(self, params):
2347
+ """The bottom type, a type that has no members.
2348
+
2349
+ This can be used to define a function that should never be
2350
+ called, or a function that never returns::
2351
+
2352
+ from typing_extensions import Never
2353
+
2354
+ def never_call_me(arg: Never) -> None:
2355
+ pass
2356
+
2357
+ def int_or_str(arg: int | str) -> None:
2358
+ never_call_me(arg) # type checker error
2359
+ match arg:
2360
+ case int():
2361
+ print("It's an int")
2362
+ case str():
2363
+ print("It's a str")
2364
+ case _:
2365
+ never_call_me(arg) # ok, arg is of type Never
2366
+
2367
+ """
2368
+
2369
+ raise TypeError(f"{self} is not subscriptable")
2370
+
2371
+
2372
+ if hasattr(typing, 'Required'): # 3.11+
2373
+ Required = typing.Required
2374
+ NotRequired = typing.NotRequired
2375
+ else: # <=3.10
2376
+ @_ExtensionsSpecialForm
2377
+ def Required(self, parameters):
2378
+ """A special typing construct to mark a key of a total=False TypedDict
2379
+ as required. For example:
2380
+
2381
+ class Movie(TypedDict, total=False):
2382
+ title: Required[str]
2383
+ year: int
2384
+
2385
+ m = Movie(
2386
+ title='The Matrix', # typechecker error if key is omitted
2387
+ year=1999,
2388
+ )
2389
+
2390
+ There is no runtime checking that a required key is actually provided
2391
+ when instantiating a related TypedDict.
2392
+ """
2393
+ item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
2394
+ return typing._GenericAlias(self, (item,))
2395
+
2396
+ @_ExtensionsSpecialForm
2397
+ def NotRequired(self, parameters):
2398
+ """A special typing construct to mark a key of a TypedDict as
2399
+ potentially missing. For example:
2400
+
2401
+ class Movie(TypedDict):
2402
+ title: str
2403
+ year: NotRequired[int]
2404
+
2405
+ m = Movie(
2406
+ title='The Matrix', # typechecker error if key is omitted
2407
+ year=1999,
2408
+ )
2409
+ """
2410
+ item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
2411
+ return typing._GenericAlias(self, (item,))
2412
+
2413
+
2414
+ if hasattr(typing, 'ReadOnly'):
2415
+ ReadOnly = typing.ReadOnly
2416
+ else: # <=3.12
2417
+ @_ExtensionsSpecialForm
2418
+ def ReadOnly(self, parameters):
2419
+ """A special typing construct to mark an item of a TypedDict as read-only.
2420
+
2421
+ For example:
2422
+
2423
+ class Movie(TypedDict):
2424
+ title: ReadOnly[str]
2425
+ year: int
2426
+
2427
+ def mutate_movie(m: Movie) -> None:
2428
+ m["year"] = 1992 # allowed
2429
+ m["title"] = "The Matrix" # typechecker error
2430
+
2431
+ There is no runtime checking for this property.
2432
+ """
2433
+ item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
2434
+ return typing._GenericAlias(self, (item,))
2435
+
2436
+
2437
+ _UNPACK_DOC = """\
2438
+ Type unpack operator.
2439
+
2440
+ The type unpack operator takes the child types from some container type,
2441
+ such as `tuple[int, str]` or a `TypeVarTuple`, and 'pulls them out'. For
2442
+ example:
2443
+
2444
+ # For some generic class `Foo`:
2445
+ Foo[Unpack[tuple[int, str]]] # Equivalent to Foo[int, str]
2446
+
2447
+ Ts = TypeVarTuple('Ts')
2448
+ # Specifies that `Bar` is generic in an arbitrary number of types.
2449
+ # (Think of `Ts` as a tuple of an arbitrary number of individual
2450
+ # `TypeVar`s, which the `Unpack` is 'pulling out' directly into the
2451
+ # `Generic[]`.)
2452
+ class Bar(Generic[Unpack[Ts]]): ...
2453
+ Bar[int] # Valid
2454
+ Bar[int, str] # Also valid
2455
+
2456
+ From Python 3.11, this can also be done using the `*` operator:
2457
+
2458
+ Foo[*tuple[int, str]]
2459
+ class Bar(Generic[*Ts]): ...
2460
+
2461
+ The operator can also be used along with a `TypedDict` to annotate
2462
+ `**kwargs` in a function signature. For instance:
2463
+
2464
+ class Movie(TypedDict):
2465
+ name: str
2466
+ year: int
2467
+
2468
+ # This function expects two keyword arguments - *name* of type `str` and
2469
+ # *year* of type `int`.
2470
+ def foo(**kwargs: Unpack[Movie]): ...
2471
+
2472
+ Note that there is only some runtime checking of this operator. Not
2473
+ everything the runtime allows may be accepted by static type checkers.
2474
+
2475
+ For more information, see PEP 646 and PEP 692.
2476
+ """
2477
+
2478
+
2479
+ # PEP 692 changed the repr of Unpack[]
2480
+ # Breakpoint: https://github.com/python/cpython/pull/104048
2481
+ if sys.version_info >= (3, 12):
2482
+ Unpack = typing.Unpack
2483
+
2484
+ def _is_unpack(obj):
2485
+ return get_origin(obj) is Unpack
2486
+
2487
+ else: # <=3.11
2488
+ class _UnpackSpecialForm(_ExtensionsSpecialForm, _root=True):
2489
+ def __init__(self, getitem):
2490
+ super().__init__(getitem)
2491
+ self.__doc__ = _UNPACK_DOC
2492
+
2493
+ class _UnpackAlias(typing._GenericAlias, _root=True):
2494
+ if sys.version_info < (3, 11):
2495
+ # needed for compatibility with Generic[Unpack[Ts]]
2496
+ __class__ = typing.TypeVar
2497
+
2498
+ @property
2499
+ def __typing_unpacked_tuple_args__(self):
2500
+ assert self.__origin__ is Unpack
2501
+ assert len(self.__args__) == 1
2502
+ arg, = self.__args__
2503
+ if isinstance(arg, (typing._GenericAlias, _types.GenericAlias)):
2504
+ if arg.__origin__ is not tuple:
2505
+ raise TypeError("Unpack[...] must be used with a tuple type")
2506
+ return arg.__args__
2507
+ return None
2508
+
2509
+ @property
2510
+ def __typing_is_unpacked_typevartuple__(self):
2511
+ assert self.__origin__ is Unpack
2512
+ assert len(self.__args__) == 1
2513
+ return isinstance(self.__args__[0], TypeVarTuple)
2514
+
2515
+ def __getitem__(self, args):
2516
+ if self.__typing_is_unpacked_typevartuple__:
2517
+ return args
2518
+ return super().__getitem__(args)
2519
+
2520
+ @_UnpackSpecialForm
2521
+ def Unpack(self, parameters):
2522
+ item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
2523
+ return _UnpackAlias(self, (item,))
2524
+
2525
+ def _is_unpack(obj):
2526
+ return isinstance(obj, _UnpackAlias)
2527
+
2528
+
2529
+ def _unpack_args(*args):
2530
+ newargs = []
2531
+ for arg in args:
2532
+ subargs = getattr(arg, '__typing_unpacked_tuple_args__', None)
2533
+ if subargs is not None and (not (subargs and subargs[-1] is ...)):
2534
+ newargs.extend(subargs)
2535
+ else:
2536
+ newargs.append(arg)
2537
+ return newargs
2538
+
2539
+
2540
+ if _PEP_696_IMPLEMENTED:
2541
+ from typing import TypeVarTuple
2542
+
2543
+ elif hasattr(typing, "TypeVarTuple"): # 3.11+
2544
+
2545
+ # Add default parameter - PEP 696
2546
+ class TypeVarTuple(metaclass=_TypeVarLikeMeta):
2547
+ """Type variable tuple."""
2548
+
2549
+ _backported_typevarlike = typing.TypeVarTuple
2550
+
2551
+ def __new__(cls, name, *, default=NoDefault):
2552
+ tvt = typing.TypeVarTuple(name)
2553
+ _set_default(tvt, default)
2554
+ _set_module(tvt)
2555
+
2556
+ def _typevartuple_prepare_subst(alias, args):
2557
+ params = alias.__parameters__
2558
+ typevartuple_index = params.index(tvt)
2559
+ for param in params[typevartuple_index + 1:]:
2560
+ if isinstance(param, TypeVarTuple):
2561
+ raise TypeError(
2562
+ f"More than one TypeVarTuple parameter in {alias}"
2563
+ )
2564
+
2565
+ alen = len(args)
2566
+ plen = len(params)
2567
+ left = typevartuple_index
2568
+ right = plen - typevartuple_index - 1
2569
+ var_tuple_index = None
2570
+ fillarg = None
2571
+ for k, arg in enumerate(args):
2572
+ if not isinstance(arg, type):
2573
+ subargs = getattr(arg, '__typing_unpacked_tuple_args__', None)
2574
+ if subargs and len(subargs) == 2 and subargs[-1] is ...:
2575
+ if var_tuple_index is not None:
2576
+ raise TypeError(
2577
+ "More than one unpacked "
2578
+ "arbitrary-length tuple argument"
2579
+ )
2580
+ var_tuple_index = k
2581
+ fillarg = subargs[0]
2582
+ if var_tuple_index is not None:
2583
+ left = min(left, var_tuple_index)
2584
+ right = min(right, alen - var_tuple_index - 1)
2585
+ elif left + right > alen:
2586
+ raise TypeError(f"Too few arguments for {alias};"
2587
+ f" actual {alen}, expected at least {plen - 1}")
2588
+ if left == alen - right and tvt.has_default():
2589
+ replacement = _unpack_args(tvt.__default__)
2590
+ else:
2591
+ replacement = args[left: alen - right]
2592
+
2593
+ return (
2594
+ *args[:left],
2595
+ *([fillarg] * (typevartuple_index - left)),
2596
+ replacement,
2597
+ *([fillarg] * (plen - right - left - typevartuple_index - 1)),
2598
+ *args[alen - right:],
2599
+ )
2600
+
2601
+ tvt.__typing_prepare_subst__ = _typevartuple_prepare_subst
2602
+ return tvt
2603
+
2604
+ def __init_subclass__(self, *args, **kwds):
2605
+ raise TypeError("Cannot subclass special typing classes")
2606
+
2607
+ else: # <=3.10
2608
+ class TypeVarTuple(_DefaultMixin):
2609
+ """Type variable tuple.
2610
+
2611
+ Usage::
2612
+
2613
+ Ts = TypeVarTuple('Ts')
2614
+
2615
+ In the same way that a normal type variable is a stand-in for a single
2616
+ type such as ``int``, a type variable *tuple* is a stand-in for a *tuple*
2617
+ type such as ``Tuple[int, str]``.
2618
+
2619
+ Type variable tuples can be used in ``Generic`` declarations.
2620
+ Consider the following example::
2621
+
2622
+ class Array(Generic[*Ts]): ...
2623
+
2624
+ The ``Ts`` type variable tuple here behaves like ``tuple[T1, T2]``,
2625
+ where ``T1`` and ``T2`` are type variables. To use these type variables
2626
+ as type parameters of ``Array``, we must *unpack* the type variable tuple using
2627
+ the star operator: ``*Ts``. The signature of ``Array`` then behaves
2628
+ as if we had simply written ``class Array(Generic[T1, T2]): ...``.
2629
+ In contrast to ``Generic[T1, T2]``, however, ``Generic[*Shape]`` allows
2630
+ us to parameterise the class with an *arbitrary* number of type parameters.
2631
+
2632
+ Type variable tuples can be used anywhere a normal ``TypeVar`` can.
2633
+ This includes class definitions, as shown above, as well as function
2634
+ signatures and variable annotations::
2635
+
2636
+ class Array(Generic[*Ts]):
2637
+
2638
+ def __init__(self, shape: Tuple[*Ts]):
2639
+ self._shape: Tuple[*Ts] = shape
2640
+
2641
+ def get_shape(self) -> Tuple[*Ts]:
2642
+ return self._shape
2643
+
2644
+ shape = (Height(480), Width(640))
2645
+ x: Array[Height, Width] = Array(shape)
2646
+ y = abs(x) # Inferred type is Array[Height, Width]
2647
+ z = x + x # ... is Array[Height, Width]
2648
+ x.get_shape() # ... is tuple[Height, Width]
2649
+
2650
+ """
2651
+
2652
+ # Trick Generic __parameters__.
2653
+ __class__ = typing.TypeVar
2654
+
2655
+ def __iter__(self):
2656
+ yield self.__unpacked__
2657
+
2658
+ def __init__(self, name, *, default=NoDefault):
2659
+ self.__name__ = name
2660
+ _DefaultMixin.__init__(self, default)
2661
+
2662
+ # for pickling:
2663
+ def_mod = _caller()
2664
+ if def_mod != 'typing_extensions':
2665
+ self.__module__ = def_mod
2666
+
2667
+ self.__unpacked__ = Unpack[self]
2668
+
2669
+ def __repr__(self):
2670
+ return self.__name__
2671
+
2672
+ def __hash__(self):
2673
+ return object.__hash__(self)
2674
+
2675
+ def __eq__(self, other):
2676
+ return self is other
2677
+
2678
+ def __reduce__(self):
2679
+ return self.__name__
2680
+
2681
+ def __init_subclass__(self, *args, **kwds):
2682
+ if '_root' not in kwds:
2683
+ raise TypeError("Cannot subclass special typing classes")
2684
+
2685
+
2686
+ if hasattr(typing, "reveal_type"): # 3.11+
2687
+ reveal_type = typing.reveal_type
2688
+ else: # <=3.10
2689
+ def reveal_type(obj: T, /) -> T:
2690
+ """Reveal the inferred type of a variable.
2691
+
2692
+ When a static type checker encounters a call to ``reveal_type()``,
2693
+ it will emit the inferred type of the argument::
2694
+
2695
+ x: int = 1
2696
+ reveal_type(x)
2697
+
2698
+ Running a static type checker (e.g., ``mypy``) on this example
2699
+ will produce output similar to 'Revealed type is "builtins.int"'.
2700
+
2701
+ At runtime, the function prints the runtime type of the
2702
+ argument and returns it unchanged.
2703
+
2704
+ """
2705
+ print(f"Runtime type is {type(obj).__name__!r}", file=sys.stderr)
2706
+ return obj
2707
+
2708
+
2709
+ if hasattr(typing, "_ASSERT_NEVER_REPR_MAX_LENGTH"): # 3.11+
2710
+ _ASSERT_NEVER_REPR_MAX_LENGTH = typing._ASSERT_NEVER_REPR_MAX_LENGTH
2711
+ else: # <=3.10
2712
+ _ASSERT_NEVER_REPR_MAX_LENGTH = 100
2713
+
2714
+
2715
+ if hasattr(typing, "assert_never"): # 3.11+
2716
+ assert_never = typing.assert_never
2717
+ else: # <=3.10
2718
+ def assert_never(arg: Never, /) -> Never:
2719
+ """Assert to the type checker that a line of code is unreachable.
2720
+
2721
+ Example::
2722
+
2723
+ def int_or_str(arg: int | str) -> None:
2724
+ match arg:
2725
+ case int():
2726
+ print("It's an int")
2727
+ case str():
2728
+ print("It's a str")
2729
+ case _:
2730
+ assert_never(arg)
2731
+
2732
+ If a type checker finds that a call to assert_never() is
2733
+ reachable, it will emit an error.
2734
+
2735
+ At runtime, this throws an exception when called.
2736
+
2737
+ """
2738
+ value = repr(arg)
2739
+ if len(value) > _ASSERT_NEVER_REPR_MAX_LENGTH:
2740
+ value = value[:_ASSERT_NEVER_REPR_MAX_LENGTH] + '...'
2741
+ raise AssertionError(f"Expected code to be unreachable, but got: {value}")
2742
+
2743
+
2744
+ # dataclass_transform exists in 3.11 but lacks the frozen_default parameter
2745
+ # Breakpoint: https://github.com/python/cpython/pull/99958
2746
+ if sys.version_info >= (3, 12): # 3.12+
2747
+ dataclass_transform = typing.dataclass_transform
2748
+ else: # <=3.11
2749
+ def dataclass_transform(
2750
+ *,
2751
+ eq_default: bool = True,
2752
+ order_default: bool = False,
2753
+ kw_only_default: bool = False,
2754
+ frozen_default: bool = False,
2755
+ field_specifiers: typing.Tuple[
2756
+ typing.Union[typing.Type[typing.Any], typing.Callable[..., typing.Any]],
2757
+ ...
2758
+ ] = (),
2759
+ **kwargs: typing.Any,
2760
+ ) -> typing.Callable[[T], T]:
2761
+ """Decorator that marks a function, class, or metaclass as providing
2762
+ dataclass-like behavior.
2763
+
2764
+ Example:
2765
+
2766
+ from typing_extensions import dataclass_transform
2767
+
2768
+ _T = TypeVar("_T")
2769
+
2770
+ # Used on a decorator function
2771
+ @dataclass_transform()
2772
+ def create_model(cls: type[_T]) -> type[_T]:
2773
+ ...
2774
+ return cls
2775
+
2776
+ @create_model
2777
+ class CustomerModel:
2778
+ id: int
2779
+ name: str
2780
+
2781
+ # Used on a base class
2782
+ @dataclass_transform()
2783
+ class ModelBase: ...
2784
+
2785
+ class CustomerModel(ModelBase):
2786
+ id: int
2787
+ name: str
2788
+
2789
+ # Used on a metaclass
2790
+ @dataclass_transform()
2791
+ class ModelMeta(type): ...
2792
+
2793
+ class ModelBase(metaclass=ModelMeta): ...
2794
+
2795
+ class CustomerModel(ModelBase):
2796
+ id: int
2797
+ name: str
2798
+
2799
+ Each of the ``CustomerModel`` classes defined in this example will now
2800
+ behave similarly to a dataclass created with the ``@dataclasses.dataclass``
2801
+ decorator. For example, the type checker will synthesize an ``__init__``
2802
+ method.
2803
+
2804
+ The arguments to this decorator can be used to customize this behavior:
2805
+ - ``eq_default`` indicates whether the ``eq`` parameter is assumed to be
2806
+ True or False if it is omitted by the caller.
2807
+ - ``order_default`` indicates whether the ``order`` parameter is
2808
+ assumed to be True or False if it is omitted by the caller.
2809
+ - ``kw_only_default`` indicates whether the ``kw_only`` parameter is
2810
+ assumed to be True or False if it is omitted by the caller.
2811
+ - ``frozen_default`` indicates whether the ``frozen`` parameter is
2812
+ assumed to be True or False if it is omitted by the caller.
2813
+ - ``field_specifiers`` specifies a static list of supported classes
2814
+ or functions that describe fields, similar to ``dataclasses.field()``.
2815
+
2816
+ At runtime, this decorator records its arguments in the
2817
+ ``__dataclass_transform__`` attribute on the decorated object.
2818
+
2819
+ See PEP 681 for details.
2820
+
2821
+ """
2822
+ def decorator(cls_or_fn):
2823
+ cls_or_fn.__dataclass_transform__ = {
2824
+ "eq_default": eq_default,
2825
+ "order_default": order_default,
2826
+ "kw_only_default": kw_only_default,
2827
+ "frozen_default": frozen_default,
2828
+ "field_specifiers": field_specifiers,
2829
+ "kwargs": kwargs,
2830
+ }
2831
+ return cls_or_fn
2832
+ return decorator
2833
+
2834
+
2835
+ if hasattr(typing, "override"): # 3.12+
2836
+ override = typing.override
2837
+ else: # <=3.11
2838
+ _F = typing.TypeVar("_F", bound=typing.Callable[..., typing.Any])
2839
+
2840
+ def override(arg: _F, /) -> _F:
2841
+ """Indicate that a method is intended to override a method in a base class.
2842
+
2843
+ Usage:
2844
+
2845
+ class Base:
2846
+ def method(self) -> None:
2847
+ pass
2848
+
2849
+ class Child(Base):
2850
+ @override
2851
+ def method(self) -> None:
2852
+ super().method()
2853
+
2854
+ When this decorator is applied to a method, the type checker will
2855
+ validate that it overrides a method with the same name on a base class.
2856
+ This helps prevent bugs that may occur when a base class is changed
2857
+ without an equivalent change to a child class.
2858
+
2859
+ There is no runtime checking of these properties. The decorator
2860
+ sets the ``__override__`` attribute to ``True`` on the decorated object
2861
+ to allow runtime introspection.
2862
+
2863
+ See PEP 698 for details.
2864
+
2865
+ """
2866
+ try:
2867
+ arg.__override__ = True
2868
+ except (AttributeError, TypeError):
2869
+ # Skip the attribute silently if it is not writable.
2870
+ # AttributeError happens if the object has __slots__ or a
2871
+ # read-only property, TypeError if it's a builtin class.
2872
+ pass
2873
+ return arg
2874
+
2875
+
2876
+ # Python 3.13.3+ contains a fix for the wrapped __new__
2877
+ # Breakpoint: https://github.com/python/cpython/pull/132160
2878
+ if sys.version_info >= (3, 13, 3):
2879
+ deprecated = warnings.deprecated
2880
+ else:
2881
+ _T = typing.TypeVar("_T")
2882
+
2883
+ class deprecated:
2884
+ """Indicate that a class, function or overload is deprecated.
2885
+
2886
+ When this decorator is applied to an object, the type checker
2887
+ will generate a diagnostic on usage of the deprecated object.
2888
+
2889
+ Usage:
2890
+
2891
+ @deprecated("Use B instead")
2892
+ class A:
2893
+ pass
2894
+
2895
+ @deprecated("Use g instead")
2896
+ def f():
2897
+ pass
2898
+
2899
+ @overload
2900
+ @deprecated("int support is deprecated")
2901
+ def g(x: int) -> int: ...
2902
+ @overload
2903
+ def g(x: str) -> int: ...
2904
+
2905
+ The warning specified by *category* will be emitted at runtime
2906
+ on use of deprecated objects. For functions, that happens on calls;
2907
+ for classes, on instantiation and on creation of subclasses.
2908
+ If the *category* is ``None``, no warning is emitted at runtime.
2909
+ The *stacklevel* determines where the
2910
+ warning is emitted. If it is ``1`` (the default), the warning
2911
+ is emitted at the direct caller of the deprecated object; if it
2912
+ is higher, it is emitted further up the stack.
2913
+ Static type checker behavior is not affected by the *category*
2914
+ and *stacklevel* arguments.
2915
+
2916
+ The deprecation message passed to the decorator is saved in the
2917
+ ``__deprecated__`` attribute on the decorated object.
2918
+ If applied to an overload, the decorator
2919
+ must be after the ``@overload`` decorator for the attribute to
2920
+ exist on the overload as returned by ``get_overloads()``.
2921
+
2922
+ See PEP 702 for details.
2923
+
2924
+ """
2925
+ def __init__(
2926
+ self,
2927
+ message: str,
2928
+ /,
2929
+ *,
2930
+ category: typing.Optional[typing.Type[Warning]] = DeprecationWarning,
2931
+ stacklevel: int = 1,
2932
+ ) -> None:
2933
+ if not isinstance(message, str):
2934
+ raise TypeError(
2935
+ "Expected an object of type str for 'message', not "
2936
+ f"{type(message).__name__!r}"
2937
+ )
2938
+ self.message = message
2939
+ self.category = category
2940
+ self.stacklevel = stacklevel
2941
+
2942
+ def __call__(self, arg: _T, /) -> _T:
2943
+ # Make sure the inner functions created below don't
2944
+ # retain a reference to self.
2945
+ msg = self.message
2946
+ category = self.category
2947
+ stacklevel = self.stacklevel
2948
+ if category is None:
2949
+ arg.__deprecated__ = msg
2950
+ return arg
2951
+ elif isinstance(arg, type):
2952
+ import functools
2953
+ from types import MethodType
2954
+
2955
+ original_new = arg.__new__
2956
+
2957
+ @functools.wraps(original_new)
2958
+ def __new__(cls, /, *args, **kwargs):
2959
+ if cls is arg:
2960
+ warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
2961
+ if original_new is not object.__new__:
2962
+ return original_new(cls, *args, **kwargs)
2963
+ # Mirrors a similar check in object.__new__.
2964
+ elif cls.__init__ is object.__init__ and (args or kwargs):
2965
+ raise TypeError(f"{cls.__name__}() takes no arguments")
2966
+ else:
2967
+ return original_new(cls)
2968
+
2969
+ arg.__new__ = staticmethod(__new__)
2970
+
2971
+ original_init_subclass = arg.__init_subclass__
2972
+ # We need slightly different behavior if __init_subclass__
2973
+ # is a bound method (likely if it was implemented in Python)
2974
+ if isinstance(original_init_subclass, MethodType):
2975
+ original_init_subclass = original_init_subclass.__func__
2976
+
2977
+ @functools.wraps(original_init_subclass)
2978
+ def __init_subclass__(*args, **kwargs):
2979
+ warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
2980
+ return original_init_subclass(*args, **kwargs)
2981
+
2982
+ arg.__init_subclass__ = classmethod(__init_subclass__)
2983
+ # Or otherwise, which likely means it's a builtin such as
2984
+ # object's implementation of __init_subclass__.
2985
+ else:
2986
+ @functools.wraps(original_init_subclass)
2987
+ def __init_subclass__(*args, **kwargs):
2988
+ warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
2989
+ return original_init_subclass(*args, **kwargs)
2990
+
2991
+ arg.__init_subclass__ = __init_subclass__
2992
+
2993
+ arg.__deprecated__ = __new__.__deprecated__ = msg
2994
+ __init_subclass__.__deprecated__ = msg
2995
+ return arg
2996
+ elif callable(arg):
2997
+ import asyncio.coroutines
2998
+ import functools
2999
+ import inspect
3000
+
3001
+ @functools.wraps(arg)
3002
+ def wrapper(*args, **kwargs):
3003
+ warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
3004
+ return arg(*args, **kwargs)
3005
+
3006
+ if asyncio.coroutines.iscoroutinefunction(arg):
3007
+ # Breakpoint: https://github.com/python/cpython/pull/99247
3008
+ if sys.version_info >= (3, 12):
3009
+ wrapper = inspect.markcoroutinefunction(wrapper)
3010
+ else:
3011
+ wrapper._is_coroutine = asyncio.coroutines._is_coroutine
3012
+
3013
+ arg.__deprecated__ = wrapper.__deprecated__ = msg
3014
+ return wrapper
3015
+ else:
3016
+ raise TypeError(
3017
+ "@deprecated decorator with non-None category must be applied to "
3018
+ f"a class or callable, not {arg!r}"
3019
+ )
3020
+
3021
+ # Breakpoint: https://github.com/python/cpython/pull/23702
3022
+ if sys.version_info < (3, 10):
3023
+ def _is_param_expr(arg):
3024
+ return arg is ... or isinstance(
3025
+ arg, (tuple, list, ParamSpec, _ConcatenateGenericAlias)
3026
+ )
3027
+ else:
3028
+ def _is_param_expr(arg):
3029
+ return arg is ... or isinstance(
3030
+ arg,
3031
+ (
3032
+ tuple,
3033
+ list,
3034
+ ParamSpec,
3035
+ _ConcatenateGenericAlias,
3036
+ typing._ConcatenateGenericAlias,
3037
+ ),
3038
+ )
3039
+
3040
+
3041
+ # We have to do some monkey patching to deal with the dual nature of
3042
+ # Unpack/TypeVarTuple:
3043
+ # - We want Unpack to be a kind of TypeVar so it gets accepted in
3044
+ # Generic[Unpack[Ts]]
3045
+ # - We want it to *not* be treated as a TypeVar for the purposes of
3046
+ # counting generic parameters, so that when we subscript a generic,
3047
+ # the runtime doesn't try to substitute the Unpack with the subscripted type.
3048
+ if not hasattr(typing, "TypeVarTuple"):
3049
+ def _check_generic(cls, parameters, elen=_marker):
3050
+ """Check correct count for parameters of a generic cls (internal helper).
3051
+
3052
+ This gives a nice error message in case of count mismatch.
3053
+ """
3054
+ # If substituting a single ParamSpec with multiple arguments
3055
+ # we do not check the count
3056
+ if (inspect.isclass(cls) and issubclass(cls, typing.Generic)
3057
+ and len(cls.__parameters__) == 1
3058
+ and isinstance(cls.__parameters__[0], ParamSpec)
3059
+ and parameters
3060
+ and not _is_param_expr(parameters[0])
3061
+ ):
3062
+ # Generic modifies parameters variable, but here we cannot do this
3063
+ return
3064
+
3065
+ if not elen:
3066
+ raise TypeError(f"{cls} is not a generic class")
3067
+ if elen is _marker:
3068
+ if not hasattr(cls, "__parameters__") or not cls.__parameters__:
3069
+ raise TypeError(f"{cls} is not a generic class")
3070
+ elen = len(cls.__parameters__)
3071
+ alen = len(parameters)
3072
+ if alen != elen:
3073
+ expect_val = elen
3074
+ if hasattr(cls, "__parameters__"):
3075
+ parameters = [p for p in cls.__parameters__ if not _is_unpack(p)]
3076
+ num_tv_tuples = sum(isinstance(p, TypeVarTuple) for p in parameters)
3077
+ if (num_tv_tuples > 0) and (alen >= elen - num_tv_tuples):
3078
+ return
3079
+
3080
+ # deal with TypeVarLike defaults
3081
+ # required TypeVarLikes cannot appear after a defaulted one.
3082
+ if alen < elen:
3083
+ # since we validate TypeVarLike default in _collect_type_vars
3084
+ # or _collect_parameters we can safely check parameters[alen]
3085
+ if (
3086
+ getattr(parameters[alen], '__default__', NoDefault)
3087
+ is not NoDefault
3088
+ ):
3089
+ return
3090
+
3091
+ num_default_tv = sum(getattr(p, '__default__', NoDefault)
3092
+ is not NoDefault for p in parameters)
3093
+
3094
+ elen -= num_default_tv
3095
+
3096
+ expect_val = f"at least {elen}"
3097
+
3098
+ # Breakpoint: https://github.com/python/cpython/pull/27515
3099
+ things = "arguments" if sys.version_info >= (3, 10) else "parameters"
3100
+ raise TypeError(f"Too {'many' if alen > elen else 'few'} {things}"
3101
+ f" for {cls}; actual {alen}, expected {expect_val}")
3102
+ else:
3103
+ # Python 3.11+
3104
+
3105
+ def _check_generic(cls, parameters, elen):
3106
+ """Check correct count for parameters of a generic cls (internal helper).
3107
+
3108
+ This gives a nice error message in case of count mismatch.
3109
+ """
3110
+ if not elen:
3111
+ raise TypeError(f"{cls} is not a generic class")
3112
+ alen = len(parameters)
3113
+ if alen != elen:
3114
+ expect_val = elen
3115
+ if hasattr(cls, "__parameters__"):
3116
+ parameters = [p for p in cls.__parameters__ if not _is_unpack(p)]
3117
+
3118
+ # deal with TypeVarLike defaults
3119
+ # required TypeVarLikes cannot appear after a defaulted one.
3120
+ if alen < elen:
3121
+ # since we validate TypeVarLike default in _collect_type_vars
3122
+ # or _collect_parameters we can safely check parameters[alen]
3123
+ if (
3124
+ getattr(parameters[alen], '__default__', NoDefault)
3125
+ is not NoDefault
3126
+ ):
3127
+ return
3128
+
3129
+ num_default_tv = sum(getattr(p, '__default__', NoDefault)
3130
+ is not NoDefault for p in parameters)
3131
+
3132
+ elen -= num_default_tv
3133
+
3134
+ expect_val = f"at least {elen}"
3135
+
3136
+ raise TypeError(f"Too {'many' if alen > elen else 'few'} arguments"
3137
+ f" for {cls}; actual {alen}, expected {expect_val}")
3138
+
3139
+ if not _PEP_696_IMPLEMENTED:
3140
+ typing._check_generic = _check_generic
3141
+
3142
+
3143
+ def _has_generic_or_protocol_as_origin() -> bool:
3144
+ try:
3145
+ frame = sys._getframe(2)
3146
+ # - Catch AttributeError: not all Python implementations have sys._getframe()
3147
+ # - Catch ValueError: maybe we're called from an unexpected module
3148
+ # and the call stack isn't deep enough
3149
+ except (AttributeError, ValueError):
3150
+ return False # err on the side of leniency
3151
+ else:
3152
+ # If we somehow get invoked from outside typing.py,
3153
+ # also err on the side of leniency
3154
+ if frame.f_globals.get("__name__") != "typing":
3155
+ return False
3156
+ origin = frame.f_locals.get("origin")
3157
+ # Cannot use "in" because origin may be an object with a buggy __eq__ that
3158
+ # throws an error.
3159
+ return origin is typing.Generic or origin is Protocol or origin is typing.Protocol
3160
+
3161
+
3162
+ _TYPEVARTUPLE_TYPES = {TypeVarTuple, getattr(typing, "TypeVarTuple", None)}
3163
+
3164
+
3165
+ def _is_unpacked_typevartuple(x) -> bool:
3166
+ if get_origin(x) is not Unpack:
3167
+ return False
3168
+ args = get_args(x)
3169
+ return (
3170
+ bool(args)
3171
+ and len(args) == 1
3172
+ and type(args[0]) in _TYPEVARTUPLE_TYPES
3173
+ )
3174
+
3175
+
3176
+ # Python 3.11+ _collect_type_vars was renamed to _collect_parameters
3177
+ if hasattr(typing, '_collect_type_vars'):
3178
+ def _collect_type_vars(types, typevar_types=None):
3179
+ """Collect all type variable contained in types in order of
3180
+ first appearance (lexicographic order). For example::
3181
+
3182
+ _collect_type_vars((T, List[S, T])) == (T, S)
3183
+ """
3184
+ if typevar_types is None:
3185
+ typevar_types = typing.TypeVar
3186
+ tvars = []
3187
+
3188
+ # A required TypeVarLike cannot appear after a TypeVarLike with a default
3189
+ # if it was a direct call to `Generic[]` or `Protocol[]`
3190
+ enforce_default_ordering = _has_generic_or_protocol_as_origin()
3191
+ default_encountered = False
3192
+
3193
+ # Also, a TypeVarLike with a default cannot appear after a TypeVarTuple
3194
+ type_var_tuple_encountered = False
3195
+
3196
+ for t in types:
3197
+ if _is_unpacked_typevartuple(t):
3198
+ type_var_tuple_encountered = True
3199
+ elif (
3200
+ isinstance(t, typevar_types) and not isinstance(t, _UnpackAlias)
3201
+ and t not in tvars
3202
+ ):
3203
+ if enforce_default_ordering:
3204
+ has_default = getattr(t, '__default__', NoDefault) is not NoDefault
3205
+ if has_default:
3206
+ if type_var_tuple_encountered:
3207
+ raise TypeError('Type parameter with a default'
3208
+ ' follows TypeVarTuple')
3209
+ default_encountered = True
3210
+ elif default_encountered:
3211
+ raise TypeError(f'Type parameter {t!r} without a default'
3212
+ ' follows type parameter with a default')
3213
+
3214
+ tvars.append(t)
3215
+ if _should_collect_from_parameters(t):
3216
+ tvars.extend([t for t in t.__parameters__ if t not in tvars])
3217
+ elif isinstance(t, tuple):
3218
+ # Collect nested type_vars
3219
+ # tuple wrapped by _prepare_paramspec_params(cls, params)
3220
+ for x in t:
3221
+ for collected in _collect_type_vars([x]):
3222
+ if collected not in tvars:
3223
+ tvars.append(collected)
3224
+ return tuple(tvars)
3225
+
3226
+ typing._collect_type_vars = _collect_type_vars
3227
+ else:
3228
+ def _collect_parameters(args):
3229
+ """Collect all type variables and parameter specifications in args
3230
+ in order of first appearance (lexicographic order).
3231
+
3232
+ For example::
3233
+
3234
+ assert _collect_parameters((T, Callable[P, T])) == (T, P)
3235
+ """
3236
+ parameters = []
3237
+
3238
+ # A required TypeVarLike cannot appear after a TypeVarLike with default
3239
+ # if it was a direct call to `Generic[]` or `Protocol[]`
3240
+ enforce_default_ordering = _has_generic_or_protocol_as_origin()
3241
+ default_encountered = False
3242
+
3243
+ # Also, a TypeVarLike with a default cannot appear after a TypeVarTuple
3244
+ type_var_tuple_encountered = False
3245
+
3246
+ for t in args:
3247
+ if isinstance(t, type):
3248
+ # We don't want __parameters__ descriptor of a bare Python class.
3249
+ pass
3250
+ elif isinstance(t, tuple):
3251
+ # `t` might be a tuple, when `ParamSpec` is substituted with
3252
+ # `[T, int]`, or `[int, *Ts]`, etc.
3253
+ for x in t:
3254
+ for collected in _collect_parameters([x]):
3255
+ if collected not in parameters:
3256
+ parameters.append(collected)
3257
+ elif hasattr(t, '__typing_subst__'):
3258
+ if t not in parameters:
3259
+ if enforce_default_ordering:
3260
+ has_default = (
3261
+ getattr(t, '__default__', NoDefault) is not NoDefault
3262
+ )
3263
+
3264
+ if type_var_tuple_encountered and has_default:
3265
+ raise TypeError('Type parameter with a default'
3266
+ ' follows TypeVarTuple')
3267
+
3268
+ if has_default:
3269
+ default_encountered = True
3270
+ elif default_encountered:
3271
+ raise TypeError(f'Type parameter {t!r} without a default'
3272
+ ' follows type parameter with a default')
3273
+
3274
+ parameters.append(t)
3275
+ else:
3276
+ if _is_unpacked_typevartuple(t):
3277
+ type_var_tuple_encountered = True
3278
+ for x in getattr(t, '__parameters__', ()):
3279
+ if x not in parameters:
3280
+ parameters.append(x)
3281
+
3282
+ return tuple(parameters)
3283
+
3284
+ if not _PEP_696_IMPLEMENTED:
3285
+ typing._collect_parameters = _collect_parameters
3286
+
3287
+ # Backport typing.NamedTuple as it exists in Python 3.13.
3288
+ # In 3.11, the ability to define generic `NamedTuple`s was supported.
3289
+ # This was explicitly disallowed in 3.9-3.10, and only half-worked in <=3.8.
3290
+ # On 3.12, we added __orig_bases__ to call-based NamedTuples
3291
+ # On 3.13, we deprecated kwargs-based NamedTuples
3292
+ # Breakpoint: https://github.com/python/cpython/pull/105609
3293
+ if sys.version_info >= (3, 13):
3294
+ NamedTuple = typing.NamedTuple
3295
+ else:
3296
+ def _make_nmtuple(name, types, module, defaults=()):
3297
+ fields = [n for n, t in types]
3298
+ annotations = {n: typing._type_check(t, f"field {n} annotation must be a type")
3299
+ for n, t in types}
3300
+ nm_tpl = collections.namedtuple(name, fields,
3301
+ defaults=defaults, module=module)
3302
+ nm_tpl.__annotations__ = nm_tpl.__new__.__annotations__ = annotations
3303
+ return nm_tpl
3304
+
3305
+ _prohibited_namedtuple_fields = typing._prohibited
3306
+ _special_namedtuple_fields = frozenset({'__module__', '__name__', '__annotations__'})
3307
+
3308
+ class _NamedTupleMeta(type):
3309
+ def __new__(cls, typename, bases, ns):
3310
+ assert _NamedTuple in bases
3311
+ for base in bases:
3312
+ if base is not _NamedTuple and base is not typing.Generic:
3313
+ raise TypeError(
3314
+ 'can only inherit from a NamedTuple type and Generic')
3315
+ bases = tuple(tuple if base is _NamedTuple else base for base in bases)
3316
+ if "__annotations__" in ns:
3317
+ types = ns["__annotations__"]
3318
+ elif "__annotate__" in ns:
3319
+ # TODO: Use inspect.VALUE here, and make the annotations lazily evaluated
3320
+ types = ns["__annotate__"](1)
3321
+ else:
3322
+ types = {}
3323
+ default_names = []
3324
+ for field_name in types:
3325
+ if field_name in ns:
3326
+ default_names.append(field_name)
3327
+ elif default_names:
3328
+ raise TypeError(f"Non-default namedtuple field {field_name} "
3329
+ f"cannot follow default field"
3330
+ f"{'s' if len(default_names) > 1 else ''} "
3331
+ f"{', '.join(default_names)}")
3332
+ nm_tpl = _make_nmtuple(
3333
+ typename, types.items(),
3334
+ defaults=[ns[n] for n in default_names],
3335
+ module=ns['__module__']
3336
+ )
3337
+ nm_tpl.__bases__ = bases
3338
+ if typing.Generic in bases:
3339
+ if hasattr(typing, '_generic_class_getitem'): # 3.12+
3340
+ nm_tpl.__class_getitem__ = classmethod(typing._generic_class_getitem)
3341
+ else:
3342
+ class_getitem = typing.Generic.__class_getitem__.__func__
3343
+ nm_tpl.__class_getitem__ = classmethod(class_getitem)
3344
+ # update from user namespace without overriding special namedtuple attributes
3345
+ for key, val in ns.items():
3346
+ if key in _prohibited_namedtuple_fields:
3347
+ raise AttributeError("Cannot overwrite NamedTuple attribute " + key)
3348
+ elif key not in _special_namedtuple_fields:
3349
+ if key not in nm_tpl._fields:
3350
+ setattr(nm_tpl, key, ns[key])
3351
+ try:
3352
+ set_name = type(val).__set_name__
3353
+ except AttributeError:
3354
+ pass
3355
+ else:
3356
+ try:
3357
+ set_name(val, nm_tpl, key)
3358
+ except BaseException as e:
3359
+ msg = (
3360
+ f"Error calling __set_name__ on {type(val).__name__!r} "
3361
+ f"instance {key!r} in {typename!r}"
3362
+ )
3363
+ # BaseException.add_note() existed on py311,
3364
+ # but the __set_name__ machinery didn't start
3365
+ # using add_note() until py312.
3366
+ # Making sure exceptions are raised in the same way
3367
+ # as in "normal" classes seems most important here.
3368
+ # Breakpoint: https://github.com/python/cpython/pull/95915
3369
+ if sys.version_info >= (3, 12):
3370
+ e.add_note(msg)
3371
+ raise
3372
+ else:
3373
+ raise RuntimeError(msg) from e
3374
+
3375
+ if typing.Generic in bases:
3376
+ nm_tpl.__init_subclass__()
3377
+ return nm_tpl
3378
+
3379
+ _NamedTuple = type.__new__(_NamedTupleMeta, 'NamedTuple', (), {})
3380
+
3381
+ def _namedtuple_mro_entries(bases):
3382
+ assert NamedTuple in bases
3383
+ return (_NamedTuple,)
3384
+
3385
+ def NamedTuple(typename, fields=_marker, /, **kwargs):
3386
+ """Typed version of namedtuple.
3387
+
3388
+ Usage::
3389
+
3390
+ class Employee(NamedTuple):
3391
+ name: str
3392
+ id: int
3393
+
3394
+ This is equivalent to::
3395
+
3396
+ Employee = collections.namedtuple('Employee', ['name', 'id'])
3397
+
3398
+ The resulting class has an extra __annotations__ attribute, giving a
3399
+ dict that maps field names to types. (The field names are also in
3400
+ the _fields attribute, which is part of the namedtuple API.)
3401
+ An alternative equivalent functional syntax is also accepted::
3402
+
3403
+ Employee = NamedTuple('Employee', [('name', str), ('id', int)])
3404
+ """
3405
+ if fields is _marker:
3406
+ if kwargs:
3407
+ deprecated_thing = "Creating NamedTuple classes using keyword arguments"
3408
+ deprecation_msg = (
3409
+ "{name} is deprecated and will be disallowed in Python {remove}. "
3410
+ "Use the class-based or functional syntax instead."
3411
+ )
3412
+ else:
3413
+ deprecated_thing = "Failing to pass a value for the 'fields' parameter"
3414
+ example = f"`{typename} = NamedTuple({typename!r}, [])`"
3415
+ deprecation_msg = (
3416
+ "{name} is deprecated and will be disallowed in Python {remove}. "
3417
+ "To create a NamedTuple class with 0 fields "
3418
+ "using the functional syntax, "
3419
+ "pass an empty list, e.g. "
3420
+ ) + example + "."
3421
+ elif fields is None:
3422
+ if kwargs:
3423
+ raise TypeError(
3424
+ "Cannot pass `None` as the 'fields' parameter "
3425
+ "and also specify fields using keyword arguments"
3426
+ )
3427
+ else:
3428
+ deprecated_thing = "Passing `None` as the 'fields' parameter"
3429
+ example = f"`{typename} = NamedTuple({typename!r}, [])`"
3430
+ deprecation_msg = (
3431
+ "{name} is deprecated and will be disallowed in Python {remove}. "
3432
+ "To create a NamedTuple class with 0 fields "
3433
+ "using the functional syntax, "
3434
+ "pass an empty list, e.g. "
3435
+ ) + example + "."
3436
+ elif kwargs:
3437
+ raise TypeError("Either list of fields or keywords"
3438
+ " can be provided to NamedTuple, not both")
3439
+ if fields is _marker or fields is None:
3440
+ warnings.warn(
3441
+ deprecation_msg.format(name=deprecated_thing, remove="3.15"),
3442
+ DeprecationWarning,
3443
+ stacklevel=2,
3444
+ )
3445
+ fields = kwargs.items()
3446
+ nt = _make_nmtuple(typename, fields, module=_caller())
3447
+ nt.__orig_bases__ = (NamedTuple,)
3448
+ return nt
3449
+
3450
+ NamedTuple.__mro_entries__ = _namedtuple_mro_entries
3451
+
3452
+
3453
+ if hasattr(collections.abc, "Buffer"):
3454
+ Buffer = collections.abc.Buffer
3455
+ else:
3456
+ class Buffer(abc.ABC): # noqa: B024
3457
+ """Base class for classes that implement the buffer protocol.
3458
+
3459
+ The buffer protocol allows Python objects to expose a low-level
3460
+ memory buffer interface. Before Python 3.12, it is not possible
3461
+ to implement the buffer protocol in pure Python code, or even
3462
+ to check whether a class implements the buffer protocol. In
3463
+ Python 3.12 and higher, the ``__buffer__`` method allows access
3464
+ to the buffer protocol from Python code, and the
3465
+ ``collections.abc.Buffer`` ABC allows checking whether a class
3466
+ implements the buffer protocol.
3467
+
3468
+ To indicate support for the buffer protocol in earlier versions,
3469
+ inherit from this ABC, either in a stub file or at runtime,
3470
+ or use ABC registration. This ABC provides no methods, because
3471
+ there is no Python-accessible methods shared by pre-3.12 buffer
3472
+ classes. It is useful primarily for static checks.
3473
+
3474
+ """
3475
+
3476
+ # As a courtesy, register the most common stdlib buffer classes.
3477
+ Buffer.register(memoryview)
3478
+ Buffer.register(bytearray)
3479
+ Buffer.register(bytes)
3480
+
3481
+
3482
+ # Backport of types.get_original_bases, available on 3.12+ in CPython
3483
+ if hasattr(_types, "get_original_bases"):
3484
+ get_original_bases = _types.get_original_bases
3485
+ else:
3486
+ def get_original_bases(cls, /):
3487
+ """Return the class's "original" bases prior to modification by `__mro_entries__`.
3488
+
3489
+ Examples::
3490
+
3491
+ from typing import TypeVar, Generic
3492
+ from typing_extensions import NamedTuple, TypedDict
3493
+
3494
+ T = TypeVar("T")
3495
+ class Foo(Generic[T]): ...
3496
+ class Bar(Foo[int], float): ...
3497
+ class Baz(list[str]): ...
3498
+ Eggs = NamedTuple("Eggs", [("a", int), ("b", str)])
3499
+ Spam = TypedDict("Spam", {"a": int, "b": str})
3500
+
3501
+ assert get_original_bases(Bar) == (Foo[int], float)
3502
+ assert get_original_bases(Baz) == (list[str],)
3503
+ assert get_original_bases(Eggs) == (NamedTuple,)
3504
+ assert get_original_bases(Spam) == (TypedDict,)
3505
+ assert get_original_bases(int) == (object,)
3506
+ """
3507
+ try:
3508
+ return cls.__dict__.get("__orig_bases__", cls.__bases__)
3509
+ except AttributeError:
3510
+ raise TypeError(
3511
+ f'Expected an instance of type, not {type(cls).__name__!r}'
3512
+ ) from None
3513
+
3514
+
3515
+ # NewType is a class on Python 3.10+, making it pickleable
3516
+ # The error message for subclassing instances of NewType was improved on 3.11+
3517
+ # Breakpoint: https://github.com/python/cpython/pull/30268
3518
+ if sys.version_info >= (3, 11):
3519
+ NewType = typing.NewType
3520
+ else:
3521
+ class NewType:
3522
+ """NewType creates simple unique types with almost zero
3523
+ runtime overhead. NewType(name, tp) is considered a subtype of tp
3524
+ by static type checkers. At runtime, NewType(name, tp) returns
3525
+ a dummy callable that simply returns its argument. Usage::
3526
+ UserId = NewType('UserId', int)
3527
+ def name_by_id(user_id: UserId) -> str:
3528
+ ...
3529
+ UserId('user') # Fails type check
3530
+ name_by_id(42) # Fails type check
3531
+ name_by_id(UserId(42)) # OK
3532
+ num = UserId(5) + 1 # type: int
3533
+ """
3534
+
3535
+ def __call__(self, obj, /):
3536
+ return obj
3537
+
3538
+ def __init__(self, name, tp):
3539
+ self.__qualname__ = name
3540
+ if '.' in name:
3541
+ name = name.rpartition('.')[-1]
3542
+ self.__name__ = name
3543
+ self.__supertype__ = tp
3544
+ def_mod = _caller()
3545
+ if def_mod != 'typing_extensions':
3546
+ self.__module__ = def_mod
3547
+
3548
+ def __mro_entries__(self, bases):
3549
+ # We defined __mro_entries__ to get a better error message
3550
+ # if a user attempts to subclass a NewType instance. bpo-46170
3551
+ supercls_name = self.__name__
3552
+
3553
+ class Dummy:
3554
+ def __init_subclass__(cls):
3555
+ subcls_name = cls.__name__
3556
+ raise TypeError(
3557
+ f"Cannot subclass an instance of NewType. "
3558
+ f"Perhaps you were looking for: "
3559
+ f"`{subcls_name} = NewType({subcls_name!r}, {supercls_name})`"
3560
+ )
3561
+
3562
+ return (Dummy,)
3563
+
3564
+ def __repr__(self):
3565
+ return f'{self.__module__}.{self.__qualname__}'
3566
+
3567
+ def __reduce__(self):
3568
+ return self.__qualname__
3569
+
3570
+ # Breakpoint: https://github.com/python/cpython/pull/21515
3571
+ if sys.version_info >= (3, 10):
3572
+ # PEP 604 methods
3573
+ # It doesn't make sense to have these methods on Python <3.10
3574
+
3575
+ def __or__(self, other):
3576
+ return typing.Union[self, other]
3577
+
3578
+ def __ror__(self, other):
3579
+ return typing.Union[other, self]
3580
+
3581
+
3582
+ # Breakpoint: https://github.com/python/cpython/pull/124795
3583
+ if sys.version_info >= (3, 14):
3584
+ TypeAliasType = typing.TypeAliasType
3585
+ # <=3.13
3586
+ else:
3587
+ # Breakpoint: https://github.com/python/cpython/pull/103764
3588
+ if sys.version_info >= (3, 12):
3589
+ # 3.12-3.13
3590
+ def _is_unionable(obj):
3591
+ """Corresponds to is_unionable() in unionobject.c in CPython."""
3592
+ return obj is None or isinstance(obj, (
3593
+ type,
3594
+ _types.GenericAlias,
3595
+ _types.UnionType,
3596
+ typing.TypeAliasType,
3597
+ TypeAliasType,
3598
+ ))
3599
+ else:
3600
+ # <=3.11
3601
+ def _is_unionable(obj):
3602
+ """Corresponds to is_unionable() in unionobject.c in CPython."""
3603
+ return obj is None or isinstance(obj, (
3604
+ type,
3605
+ _types.GenericAlias,
3606
+ _types.UnionType,
3607
+ TypeAliasType,
3608
+ ))
3609
+
3610
+ if sys.version_info < (3, 10):
3611
+ # Copied and pasted from https://github.com/python/cpython/blob/986a4e1b6fcae7fe7a1d0a26aea446107dd58dd2/Objects/genericaliasobject.c#L568-L582,
3612
+ # so that we emulate the behaviour of `types.GenericAlias`
3613
+ # on the latest versions of CPython
3614
+ _ATTRIBUTE_DELEGATION_EXCLUSIONS = frozenset({
3615
+ "__class__",
3616
+ "__bases__",
3617
+ "__origin__",
3618
+ "__args__",
3619
+ "__unpacked__",
3620
+ "__parameters__",
3621
+ "__typing_unpacked_tuple_args__",
3622
+ "__mro_entries__",
3623
+ "__reduce_ex__",
3624
+ "__reduce__",
3625
+ "__copy__",
3626
+ "__deepcopy__",
3627
+ })
3628
+
3629
+ class _TypeAliasGenericAlias(typing._GenericAlias, _root=True):
3630
+ def __getattr__(self, attr):
3631
+ if attr in _ATTRIBUTE_DELEGATION_EXCLUSIONS:
3632
+ return object.__getattr__(self, attr)
3633
+ return getattr(self.__origin__, attr)
3634
+
3635
+
3636
+ class TypeAliasType:
3637
+ """Create named, parameterized type aliases.
3638
+
3639
+ This provides a backport of the new `type` statement in Python 3.12:
3640
+
3641
+ type ListOrSet[T] = list[T] | set[T]
3642
+
3643
+ is equivalent to:
3644
+
3645
+ T = TypeVar("T")
3646
+ ListOrSet = TypeAliasType("ListOrSet", list[T] | set[T], type_params=(T,))
3647
+
3648
+ The name ListOrSet can then be used as an alias for the type it refers to.
3649
+
3650
+ The type_params argument should contain all the type parameters used
3651
+ in the value of the type alias. If the alias is not generic, this
3652
+ argument is omitted.
3653
+
3654
+ Static type checkers should only support type aliases declared using
3655
+ TypeAliasType that follow these rules:
3656
+
3657
+ - The first argument (the name) must be a string literal.
3658
+ - The TypeAliasType instance must be immediately assigned to a variable
3659
+ of the same name. (For example, 'X = TypeAliasType("Y", int)' is invalid,
3660
+ as is 'X, Y = TypeAliasType("X", int), TypeAliasType("Y", int)').
3661
+
3662
+ """
3663
+
3664
+ def __init__(self, name: str, value, *, type_params=()):
3665
+ if not isinstance(name, str):
3666
+ raise TypeError("TypeAliasType name must be a string")
3667
+ if not isinstance(type_params, tuple):
3668
+ raise TypeError("type_params must be a tuple")
3669
+ self.__value__ = value
3670
+ self.__type_params__ = type_params
3671
+
3672
+ default_value_encountered = False
3673
+ parameters = []
3674
+ for type_param in type_params:
3675
+ if (
3676
+ not isinstance(type_param, (TypeVar, TypeVarTuple, ParamSpec))
3677
+ # <=3.11
3678
+ # Unpack Backport passes isinstance(type_param, TypeVar)
3679
+ or _is_unpack(type_param)
3680
+ ):
3681
+ raise TypeError(f"Expected a type param, got {type_param!r}")
3682
+ has_default = (
3683
+ getattr(type_param, '__default__', NoDefault) is not NoDefault
3684
+ )
3685
+ if default_value_encountered and not has_default:
3686
+ raise TypeError(f"non-default type parameter '{type_param!r}'"
3687
+ " follows default type parameter")
3688
+ if has_default:
3689
+ default_value_encountered = True
3690
+ if isinstance(type_param, TypeVarTuple):
3691
+ parameters.extend(type_param)
3692
+ else:
3693
+ parameters.append(type_param)
3694
+ self.__parameters__ = tuple(parameters)
3695
+ def_mod = _caller()
3696
+ if def_mod != 'typing_extensions':
3697
+ self.__module__ = def_mod
3698
+ # Setting this attribute closes the TypeAliasType from further modification
3699
+ self.__name__ = name
3700
+
3701
+ def __setattr__(self, name: str, value: object, /) -> None:
3702
+ if hasattr(self, "__name__"):
3703
+ self._raise_attribute_error(name)
3704
+ super().__setattr__(name, value)
3705
+
3706
+ def __delattr__(self, name: str, /) -> Never:
3707
+ self._raise_attribute_error(name)
3708
+
3709
+ def _raise_attribute_error(self, name: str) -> Never:
3710
+ # Match the Python 3.12 error messages exactly
3711
+ if name == "__name__":
3712
+ raise AttributeError("readonly attribute")
3713
+ elif name in {"__value__", "__type_params__", "__parameters__", "__module__"}:
3714
+ raise AttributeError(
3715
+ f"attribute '{name}' of 'typing.TypeAliasType' objects "
3716
+ "is not writable"
3717
+ )
3718
+ else:
3719
+ raise AttributeError(
3720
+ f"'typing.TypeAliasType' object has no attribute '{name}'"
3721
+ )
3722
+
3723
+ def __repr__(self) -> str:
3724
+ return self.__name__
3725
+
3726
+ if sys.version_info < (3, 11):
3727
+ def _check_single_param(self, param, recursion=0):
3728
+ # Allow [], [int], [int, str], [int, ...], [int, T]
3729
+ if param is ...:
3730
+ return ...
3731
+ if param is None:
3732
+ return None
3733
+ # Note in <= 3.9 _ConcatenateGenericAlias inherits from list
3734
+ if isinstance(param, list) and recursion == 0:
3735
+ return [self._check_single_param(arg, recursion+1)
3736
+ for arg in param]
3737
+ return typing._type_check(
3738
+ param, f'Subscripting {self.__name__} requires a type.'
3739
+ )
3740
+
3741
+ def _check_parameters(self, parameters):
3742
+ if sys.version_info < (3, 11):
3743
+ return tuple(
3744
+ self._check_single_param(item)
3745
+ for item in parameters
3746
+ )
3747
+ return tuple(typing._type_check(
3748
+ item, f'Subscripting {self.__name__} requires a type.'
3749
+ )
3750
+ for item in parameters
3751
+ )
3752
+
3753
+ def __getitem__(self, parameters):
3754
+ if not self.__type_params__:
3755
+ raise TypeError("Only generic type aliases are subscriptable")
3756
+ if not isinstance(parameters, tuple):
3757
+ parameters = (parameters,)
3758
+ # Using 3.9 here will create problems with Concatenate
3759
+ if sys.version_info >= (3, 10):
3760
+ return _types.GenericAlias(self, parameters)
3761
+ type_vars = _collect_type_vars(parameters)
3762
+ parameters = self._check_parameters(parameters)
3763
+ alias = _TypeAliasGenericAlias(self, parameters)
3764
+ # alias.__parameters__ is not complete if Concatenate is present
3765
+ # as it is converted to a list from which no parameters are extracted.
3766
+ if alias.__parameters__ != type_vars:
3767
+ alias.__parameters__ = type_vars
3768
+ return alias
3769
+
3770
+ def __reduce__(self):
3771
+ return self.__name__
3772
+
3773
+ def __init_subclass__(cls, *args, **kwargs):
3774
+ raise TypeError(
3775
+ "type 'typing_extensions.TypeAliasType' is not an acceptable base type"
3776
+ )
3777
+
3778
+ # The presence of this method convinces typing._type_check
3779
+ # that TypeAliasTypes are types.
3780
+ def __call__(self):
3781
+ raise TypeError("Type alias is not callable")
3782
+
3783
+ # Breakpoint: https://github.com/python/cpython/pull/21515
3784
+ if sys.version_info >= (3, 10):
3785
+ def __or__(self, right):
3786
+ # For forward compatibility with 3.12, reject Unions
3787
+ # that are not accepted by the built-in Union.
3788
+ if not _is_unionable(right):
3789
+ return NotImplemented
3790
+ return typing.Union[self, right]
3791
+
3792
+ def __ror__(self, left):
3793
+ if not _is_unionable(left):
3794
+ return NotImplemented
3795
+ return typing.Union[left, self]
3796
+
3797
+
3798
+ if hasattr(typing, "is_protocol"):
3799
+ is_protocol = typing.is_protocol
3800
+ get_protocol_members = typing.get_protocol_members
3801
+ else:
3802
+ def is_protocol(tp: type, /) -> bool:
3803
+ """Return True if the given type is a Protocol.
3804
+
3805
+ Example::
3806
+
3807
+ >>> from typing_extensions import Protocol, is_protocol
3808
+ >>> class P(Protocol):
3809
+ ... def a(self) -> str: ...
3810
+ ... b: int
3811
+ >>> is_protocol(P)
3812
+ True
3813
+ >>> is_protocol(int)
3814
+ False
3815
+ """
3816
+ return (
3817
+ isinstance(tp, type)
3818
+ and getattr(tp, '_is_protocol', False)
3819
+ and tp is not Protocol
3820
+ and tp is not typing.Protocol
3821
+ )
3822
+
3823
+ def get_protocol_members(tp: type, /) -> typing.FrozenSet[str]:
3824
+ """Return the set of members defined in a Protocol.
3825
+
3826
+ Example::
3827
+
3828
+ >>> from typing_extensions import Protocol, get_protocol_members
3829
+ >>> class P(Protocol):
3830
+ ... def a(self) -> str: ...
3831
+ ... b: int
3832
+ >>> get_protocol_members(P)
3833
+ frozenset({'a', 'b'})
3834
+
3835
+ Raise a TypeError for arguments that are not Protocols.
3836
+ """
3837
+ if not is_protocol(tp):
3838
+ raise TypeError(f'{tp!r} is not a Protocol')
3839
+ if hasattr(tp, '__protocol_attrs__'):
3840
+ return frozenset(tp.__protocol_attrs__)
3841
+ return frozenset(_get_protocol_attrs(tp))
3842
+
3843
+
3844
+ if hasattr(typing, "Doc"):
3845
+ Doc = typing.Doc
3846
+ else:
3847
+ class Doc:
3848
+ """Define the documentation of a type annotation using ``Annotated``, to be
3849
+ used in class attributes, function and method parameters, return values,
3850
+ and variables.
3851
+
3852
+ The value should be a positional-only string literal to allow static tools
3853
+ like editors and documentation generators to use it.
3854
+
3855
+ This complements docstrings.
3856
+
3857
+ The string value passed is available in the attribute ``documentation``.
3858
+
3859
+ Example::
3860
+
3861
+ >>> from typing_extensions import Annotated, Doc
3862
+ >>> def hi(to: Annotated[str, Doc("Who to say hi to")]) -> None: ...
3863
+ """
3864
+ def __init__(self, documentation: str, /) -> None:
3865
+ self.documentation = documentation
3866
+
3867
+ def __repr__(self) -> str:
3868
+ return f"Doc({self.documentation!r})"
3869
+
3870
+ def __hash__(self) -> int:
3871
+ return hash(self.documentation)
3872
+
3873
+ def __eq__(self, other: object) -> bool:
3874
+ if not isinstance(other, Doc):
3875
+ return NotImplemented
3876
+ return self.documentation == other.documentation
3877
+
3878
+
3879
+ _CapsuleType = getattr(_types, "CapsuleType", None)
3880
+
3881
+ if _CapsuleType is None:
3882
+ try:
3883
+ import _socket
3884
+ except ImportError:
3885
+ pass
3886
+ else:
3887
+ _CAPI = getattr(_socket, "CAPI", None)
3888
+ if _CAPI is not None:
3889
+ _CapsuleType = type(_CAPI)
3890
+
3891
+ if _CapsuleType is not None:
3892
+ CapsuleType = _CapsuleType
3893
+ __all__.append("CapsuleType")
3894
+
3895
+
3896
+ if sys.version_info >= (3, 14):
3897
+ from annotationlib import Format, get_annotations
3898
+ else:
3899
+ # Available since Python 3.14.0a3
3900
+ # PR: https://github.com/python/cpython/pull/124415
3901
+ class Format(enum.IntEnum):
3902
+ VALUE = 1
3903
+ VALUE_WITH_FAKE_GLOBALS = 2
3904
+ FORWARDREF = 3
3905
+ STRING = 4
3906
+
3907
+ # Available since Python 3.14.0a1
3908
+ # PR: https://github.com/python/cpython/pull/119891
3909
+ def get_annotations(obj, *, globals=None, locals=None, eval_str=False,
3910
+ format=Format.VALUE):
3911
+ """Compute the annotations dict for an object.
3912
+
3913
+ obj may be a callable, class, or module.
3914
+ Passing in an object of any other type raises TypeError.
3915
+
3916
+ Returns a dict. get_annotations() returns a new dict every time
3917
+ it's called; calling it twice on the same object will return two
3918
+ different but equivalent dicts.
3919
+
3920
+ This is a backport of `inspect.get_annotations`, which has been
3921
+ in the standard library since Python 3.10. See the standard library
3922
+ documentation for more:
3923
+
3924
+ https://docs.python.org/3/library/inspect.html#inspect.get_annotations
3925
+
3926
+ This backport adds the *format* argument introduced by PEP 649. The
3927
+ three formats supported are:
3928
+ * VALUE: the annotations are returned as-is. This is the default and
3929
+ it is compatible with the behavior on previous Python versions.
3930
+ * FORWARDREF: return annotations as-is if possible, but replace any
3931
+ undefined names with ForwardRef objects. The implementation proposed by
3932
+ PEP 649 relies on language changes that cannot be backported; the
3933
+ typing-extensions implementation simply returns the same result as VALUE.
3934
+ * STRING: return annotations as strings, in a format close to the original
3935
+ source. Again, this behavior cannot be replicated directly in a backport.
3936
+ As an approximation, typing-extensions retrieves the annotations under
3937
+ VALUE semantics and then stringifies them.
3938
+
3939
+ The purpose of this backport is to allow users who would like to use
3940
+ FORWARDREF or STRING semantics once PEP 649 is implemented, but who also
3941
+ want to support earlier Python versions, to simply write:
3942
+
3943
+ typing_extensions.get_annotations(obj, format=Format.FORWARDREF)
3944
+
3945
+ """
3946
+ format = Format(format)
3947
+ if format is Format.VALUE_WITH_FAKE_GLOBALS:
3948
+ raise ValueError(
3949
+ "The VALUE_WITH_FAKE_GLOBALS format is for internal use only"
3950
+ )
3951
+
3952
+ if eval_str and format is not Format.VALUE:
3953
+ raise ValueError("eval_str=True is only supported with format=Format.VALUE")
3954
+
3955
+ if isinstance(obj, type):
3956
+ # class
3957
+ obj_dict = getattr(obj, '__dict__', None)
3958
+ if obj_dict and hasattr(obj_dict, 'get'):
3959
+ ann = obj_dict.get('__annotations__', None)
3960
+ if isinstance(ann, _types.GetSetDescriptorType):
3961
+ ann = None
3962
+ else:
3963
+ ann = None
3964
+
3965
+ obj_globals = None
3966
+ module_name = getattr(obj, '__module__', None)
3967
+ if module_name:
3968
+ module = sys.modules.get(module_name, None)
3969
+ if module:
3970
+ obj_globals = getattr(module, '__dict__', None)
3971
+ obj_locals = dict(vars(obj))
3972
+ unwrap = obj
3973
+ elif isinstance(obj, _types.ModuleType):
3974
+ # module
3975
+ ann = getattr(obj, '__annotations__', None)
3976
+ obj_globals = obj.__dict__
3977
+ obj_locals = None
3978
+ unwrap = None
3979
+ elif callable(obj):
3980
+ # this includes types.Function, types.BuiltinFunctionType,
3981
+ # types.BuiltinMethodType, functools.partial, functools.singledispatch,
3982
+ # "class funclike" from Lib/test/test_inspect... on and on it goes.
3983
+ ann = getattr(obj, '__annotations__', None)
3984
+ obj_globals = getattr(obj, '__globals__', None)
3985
+ obj_locals = None
3986
+ unwrap = obj
3987
+ elif hasattr(obj, '__annotations__'):
3988
+ ann = obj.__annotations__
3989
+ obj_globals = obj_locals = unwrap = None
3990
+ else:
3991
+ raise TypeError(f"{obj!r} is not a module, class, or callable.")
3992
+
3993
+ if ann is None:
3994
+ return {}
3995
+
3996
+ if not isinstance(ann, dict):
3997
+ raise ValueError(f"{obj!r}.__annotations__ is neither a dict nor None")
3998
+
3999
+ if not ann:
4000
+ return {}
4001
+
4002
+ if not eval_str:
4003
+ if format is Format.STRING:
4004
+ return {
4005
+ key: value if isinstance(value, str) else typing._type_repr(value)
4006
+ for key, value in ann.items()
4007
+ }
4008
+ return dict(ann)
4009
+
4010
+ if unwrap is not None:
4011
+ while True:
4012
+ if hasattr(unwrap, '__wrapped__'):
4013
+ unwrap = unwrap.__wrapped__
4014
+ continue
4015
+ if isinstance(unwrap, functools.partial):
4016
+ unwrap = unwrap.func
4017
+ continue
4018
+ break
4019
+ if hasattr(unwrap, "__globals__"):
4020
+ obj_globals = unwrap.__globals__
4021
+
4022
+ if globals is None:
4023
+ globals = obj_globals
4024
+ if locals is None:
4025
+ locals = obj_locals or {}
4026
+
4027
+ # "Inject" type parameters into the local namespace
4028
+ # (unless they are shadowed by assignments *in* the local namespace),
4029
+ # as a way of emulating annotation scopes when calling `eval()`
4030
+ if type_params := getattr(obj, "__type_params__", ()):
4031
+ locals = {param.__name__: param for param in type_params} | locals
4032
+
4033
+ return_value = {key:
4034
+ value if not isinstance(value, str) else eval(value, globals, locals)
4035
+ for key, value in ann.items() }
4036
+ return return_value
4037
+
4038
+
4039
+ if hasattr(typing, "evaluate_forward_ref"):
4040
+ evaluate_forward_ref = typing.evaluate_forward_ref
4041
+ else:
4042
+ # Implements annotationlib.ForwardRef.evaluate
4043
+ def _eval_with_owner(
4044
+ forward_ref, *, owner=None, globals=None, locals=None, type_params=None
4045
+ ):
4046
+ if forward_ref.__forward_evaluated__:
4047
+ return forward_ref.__forward_value__
4048
+ if getattr(forward_ref, "__cell__", None) is not None:
4049
+ try:
4050
+ value = forward_ref.__cell__.cell_contents
4051
+ except ValueError:
4052
+ pass
4053
+ else:
4054
+ forward_ref.__forward_evaluated__ = True
4055
+ forward_ref.__forward_value__ = value
4056
+ return value
4057
+ if owner is None:
4058
+ owner = getattr(forward_ref, "__owner__", None)
4059
+
4060
+ if (
4061
+ globals is None
4062
+ and getattr(forward_ref, "__forward_module__", None) is not None
4063
+ ):
4064
+ globals = getattr(
4065
+ sys.modules.get(forward_ref.__forward_module__, None), "__dict__", None
4066
+ )
4067
+ if globals is None:
4068
+ globals = getattr(forward_ref, "__globals__", None)
4069
+ if globals is None:
4070
+ if isinstance(owner, type):
4071
+ module_name = getattr(owner, "__module__", None)
4072
+ if module_name:
4073
+ module = sys.modules.get(module_name, None)
4074
+ if module:
4075
+ globals = getattr(module, "__dict__", None)
4076
+ elif isinstance(owner, _types.ModuleType):
4077
+ globals = getattr(owner, "__dict__", None)
4078
+ elif callable(owner):
4079
+ globals = getattr(owner, "__globals__", None)
4080
+
4081
+ # If we pass None to eval() below, the globals of this module are used.
4082
+ if globals is None:
4083
+ globals = {}
4084
+
4085
+ if locals is None:
4086
+ locals = {}
4087
+ if isinstance(owner, type):
4088
+ locals.update(vars(owner))
4089
+
4090
+ if type_params is None and owner is not None:
4091
+ # "Inject" type parameters into the local namespace
4092
+ # (unless they are shadowed by assignments *in* the local namespace),
4093
+ # as a way of emulating annotation scopes when calling `eval()`
4094
+ type_params = getattr(owner, "__type_params__", None)
4095
+
4096
+ # Type parameters exist in their own scope, which is logically
4097
+ # between the locals and the globals. We simulate this by adding
4098
+ # them to the globals.
4099
+ if type_params is not None:
4100
+ globals = dict(globals)
4101
+ for param in type_params:
4102
+ globals[param.__name__] = param
4103
+
4104
+ arg = forward_ref.__forward_arg__
4105
+ if arg.isidentifier() and not keyword.iskeyword(arg):
4106
+ if arg in locals:
4107
+ value = locals[arg]
4108
+ elif arg in globals:
4109
+ value = globals[arg]
4110
+ elif hasattr(builtins, arg):
4111
+ return getattr(builtins, arg)
4112
+ else:
4113
+ raise NameError(arg)
4114
+ else:
4115
+ code = forward_ref.__forward_code__
4116
+ value = eval(code, globals, locals)
4117
+ forward_ref.__forward_evaluated__ = True
4118
+ forward_ref.__forward_value__ = value
4119
+ return value
4120
+
4121
+ def evaluate_forward_ref(
4122
+ forward_ref,
4123
+ *,
4124
+ owner=None,
4125
+ globals=None,
4126
+ locals=None,
4127
+ type_params=None,
4128
+ format=None,
4129
+ _recursive_guard=frozenset(),
4130
+ ):
4131
+ """Evaluate a forward reference as a type hint.
4132
+
4133
+ This is similar to calling the ForwardRef.evaluate() method,
4134
+ but unlike that method, evaluate_forward_ref() also:
4135
+
4136
+ * Recursively evaluates forward references nested within the type hint.
4137
+ * Rejects certain objects that are not valid type hints.
4138
+ * Replaces type hints that evaluate to None with types.NoneType.
4139
+ * Supports the *FORWARDREF* and *STRING* formats.
4140
+
4141
+ *forward_ref* must be an instance of ForwardRef. *owner*, if given,
4142
+ should be the object that holds the annotations that the forward reference
4143
+ derived from, such as a module, class object, or function. It is used to
4144
+ infer the namespaces to use for looking up names. *globals* and *locals*
4145
+ can also be explicitly given to provide the global and local namespaces.
4146
+ *type_params* is a tuple of type parameters that are in scope when
4147
+ evaluating the forward reference. This parameter must be provided (though
4148
+ it may be an empty tuple) if *owner* is not given and the forward reference
4149
+ does not already have an owner set. *format* specifies the format of the
4150
+ annotation and is a member of the annotationlib.Format enum.
4151
+
4152
+ """
4153
+ if format == Format.STRING:
4154
+ return forward_ref.__forward_arg__
4155
+ if forward_ref.__forward_arg__ in _recursive_guard:
4156
+ return forward_ref
4157
+
4158
+ # Evaluate the forward reference
4159
+ try:
4160
+ value = _eval_with_owner(
4161
+ forward_ref,
4162
+ owner=owner,
4163
+ globals=globals,
4164
+ locals=locals,
4165
+ type_params=type_params,
4166
+ )
4167
+ except NameError:
4168
+ if format == Format.FORWARDREF:
4169
+ return forward_ref
4170
+ else:
4171
+ raise
4172
+
4173
+ if isinstance(value, str):
4174
+ value = ForwardRef(value)
4175
+
4176
+ # Recursively evaluate the type
4177
+ if isinstance(value, ForwardRef):
4178
+ if getattr(value, "__forward_module__", True) is not None:
4179
+ globals = None
4180
+ return evaluate_forward_ref(
4181
+ value,
4182
+ globals=globals,
4183
+ locals=locals,
4184
+ type_params=type_params, owner=owner,
4185
+ _recursive_guard=_recursive_guard, format=format
4186
+ )
4187
+ if sys.version_info < (3, 12, 5) and type_params:
4188
+ # Make use of type_params
4189
+ locals = dict(locals) if locals else {}
4190
+ for tvar in type_params:
4191
+ if tvar.__name__ not in locals: # lets not overwrite something present
4192
+ locals[tvar.__name__] = tvar
4193
+ if sys.version_info < (3, 12, 5):
4194
+ return typing._eval_type(
4195
+ value,
4196
+ globals,
4197
+ locals,
4198
+ recursive_guard=_recursive_guard | {forward_ref.__forward_arg__},
4199
+ )
4200
+ else:
4201
+ return typing._eval_type(
4202
+ value,
4203
+ globals,
4204
+ locals,
4205
+ type_params,
4206
+ recursive_guard=_recursive_guard | {forward_ref.__forward_arg__},
4207
+ )
4208
+
4209
+
4210
+ class Sentinel:
4211
+ """Create a unique sentinel object.
4212
+
4213
+ *name* should be the name of the variable to which the return value shall be assigned.
4214
+
4215
+ *repr*, if supplied, will be used for the repr of the sentinel object.
4216
+ If not provided, "<name>" will be used.
4217
+ """
4218
+
4219
+ def __init__(
4220
+ self,
4221
+ name: str,
4222
+ repr: typing.Optional[str] = None,
4223
+ ):
4224
+ self._name = name
4225
+ self._repr = repr if repr is not None else f'<{name}>'
4226
+
4227
+ def __repr__(self):
4228
+ return self._repr
4229
+
4230
+ if sys.version_info < (3, 11):
4231
+ # The presence of this method convinces typing._type_check
4232
+ # that Sentinels are types.
4233
+ def __call__(self, *args, **kwargs):
4234
+ raise TypeError(f"{type(self).__name__!r} object is not callable")
4235
+
4236
+ # Breakpoint: https://github.com/python/cpython/pull/21515
4237
+ if sys.version_info >= (3, 10):
4238
+ def __or__(self, other):
4239
+ return typing.Union[self, other]
4240
+
4241
+ def __ror__(self, other):
4242
+ return typing.Union[other, self]
4243
+
4244
+ def __getstate__(self):
4245
+ raise TypeError(f"Cannot pickle {type(self).__name__!r} object")
4246
+
4247
+
4248
+ if sys.version_info >= (3, 14, 0, "beta"):
4249
+ type_repr = annotationlib.type_repr
4250
+ else:
4251
+ def type_repr(value):
4252
+ """Convert a Python value to a format suitable for use with the STRING format.
4253
+
4254
+ This is intended as a helper for tools that support the STRING format but do
4255
+ not have access to the code that originally produced the annotations. It uses
4256
+ repr() for most objects.
4257
+
4258
+ """
4259
+ if isinstance(value, (type, _types.FunctionType, _types.BuiltinFunctionType)):
4260
+ if value.__module__ == "builtins":
4261
+ return value.__qualname__
4262
+ return f"{value.__module__}.{value.__qualname__}"
4263
+ if value is ...:
4264
+ return "..."
4265
+ return repr(value)
4266
+
4267
+
4268
+ # Aliases for items that are in typing in all supported versions.
4269
+ # We use hasattr() checks so this library will continue to import on
4270
+ # future versions of Python that may remove these names.
4271
+ _typing_names = [
4272
+ "AbstractSet",
4273
+ "AnyStr",
4274
+ "BinaryIO",
4275
+ "Callable",
4276
+ "Collection",
4277
+ "Container",
4278
+ "Dict",
4279
+ "FrozenSet",
4280
+ "Hashable",
4281
+ "IO",
4282
+ "ItemsView",
4283
+ "Iterable",
4284
+ "Iterator",
4285
+ "KeysView",
4286
+ "List",
4287
+ "Mapping",
4288
+ "MappingView",
4289
+ "Match",
4290
+ "MutableMapping",
4291
+ "MutableSequence",
4292
+ "MutableSet",
4293
+ "Optional",
4294
+ "Pattern",
4295
+ "Reversible",
4296
+ "Sequence",
4297
+ "Set",
4298
+ "Sized",
4299
+ "TextIO",
4300
+ "Tuple",
4301
+ "Union",
4302
+ "ValuesView",
4303
+ "cast",
4304
+ "no_type_check",
4305
+ "no_type_check_decorator",
4306
+ # This is private, but it was defined by typing_extensions for a long time
4307
+ # and some users rely on it.
4308
+ "_AnnotatedAlias",
4309
+ ]
4310
+ globals().update(
4311
+ {name: getattr(typing, name) for name in _typing_names if hasattr(typing, name)}
4312
+ )
4313
+ # These are defined unconditionally because they are used in
4314
+ # typing-extensions itself.
4315
+ Generic = typing.Generic
4316
+ ForwardRef = typing.ForwardRef
4317
+ Annotated = typing.Annotated