@gnost-cli/darwin-arm64 0.0.0-stage → 0.5.1-rc.1

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 (1407) hide show
  1. package/README.md +2 -2
  2. package/bundle/_internal/6ec57f84c680d3a3778b__mypyc.cpython-312-darwin.so +4 -0
  3. package/bundle/_internal/Python +0 -0
  4. package/bundle/_internal/Python.framework/Python +0 -0
  5. package/bundle/_internal/Python.framework/Resources/Info.plist +30 -0
  6. package/bundle/_internal/Python.framework/Versions/3.12/Python +0 -0
  7. package/bundle/_internal/Python.framework/Versions/3.12/Resources/Info.plist +30 -0
  8. package/bundle/_internal/Python.framework/Versions/Current/Python +0 -0
  9. package/bundle/_internal/Python.framework/Versions/Current/Resources/Info.plist +30 -0
  10. package/bundle/_internal/ast_serialize/ast_serialize.abi3.so +0 -0
  11. package/bundle/_internal/bandit/__init__.py +20 -0
  12. package/bundle/_internal/bandit/__main__.py +17 -0
  13. package/bundle/_internal/bandit/blacklists/__init__.py +0 -0
  14. package/bundle/_internal/bandit/blacklists/calls.py +670 -0
  15. package/bundle/_internal/bandit/blacklists/imports.py +425 -0
  16. package/bundle/_internal/bandit/blacklists/utils.py +17 -0
  17. package/bundle/_internal/bandit/cli/__init__.py +0 -0
  18. package/bundle/_internal/bandit/cli/baseline.py +252 -0
  19. package/bundle/_internal/bandit/cli/config_generator.py +207 -0
  20. package/bundle/_internal/bandit/cli/main.py +701 -0
  21. package/bundle/_internal/bandit/core/__init__.py +15 -0
  22. package/bundle/_internal/bandit/core/blacklisting.py +72 -0
  23. package/bundle/_internal/bandit/core/config.py +271 -0
  24. package/bundle/_internal/bandit/core/constants.py +40 -0
  25. package/bundle/_internal/bandit/core/context.py +316 -0
  26. package/bundle/_internal/bandit/core/docs_utils.py +54 -0
  27. package/bundle/_internal/bandit/core/extension_loader.py +114 -0
  28. package/bundle/_internal/bandit/core/issue.py +245 -0
  29. package/bundle/_internal/bandit/core/manager.py +499 -0
  30. package/bundle/_internal/bandit/core/meta_ast.py +44 -0
  31. package/bundle/_internal/bandit/core/metrics.py +106 -0
  32. package/bundle/_internal/bandit/core/node_visitor.py +297 -0
  33. package/bundle/_internal/bandit/core/test_properties.py +83 -0
  34. package/bundle/_internal/bandit/core/test_set.py +114 -0
  35. package/bundle/_internal/bandit/core/tester.py +168 -0
  36. package/bundle/_internal/bandit/core/utils.py +398 -0
  37. package/bundle/_internal/bandit/formatters/__init__.py +0 -0
  38. package/bundle/_internal/bandit/formatters/csv.py +82 -0
  39. package/bundle/_internal/bandit/formatters/custom.py +161 -0
  40. package/bundle/_internal/bandit/formatters/html.py +394 -0
  41. package/bundle/_internal/bandit/formatters/json.py +155 -0
  42. package/bundle/_internal/bandit/formatters/sarif.py +374 -0
  43. package/bundle/_internal/bandit/formatters/screen.py +244 -0
  44. package/bundle/_internal/bandit/formatters/text.py +200 -0
  45. package/bundle/_internal/bandit/formatters/utils.py +14 -0
  46. package/bundle/_internal/bandit/formatters/xml.py +97 -0
  47. package/bundle/_internal/bandit/formatters/yaml.py +126 -0
  48. package/bundle/_internal/bandit/plugins/__init__.py +0 -0
  49. package/bundle/_internal/bandit/plugins/app_debug.py +63 -0
  50. package/bundle/_internal/bandit/plugins/asserts.py +83 -0
  51. package/bundle/_internal/bandit/plugins/crypto_request_no_cert_validation.py +75 -0
  52. package/bundle/_internal/bandit/plugins/django_sql_injection.py +155 -0
  53. package/bundle/_internal/bandit/plugins/django_xss.py +287 -0
  54. package/bundle/_internal/bandit/plugins/exec.py +55 -0
  55. package/bundle/_internal/bandit/plugins/general_bad_file_permissions.py +99 -0
  56. package/bundle/_internal/bandit/plugins/general_bind_all_interfaces.py +52 -0
  57. package/bundle/_internal/bandit/plugins/general_hardcoded_password.py +282 -0
  58. package/bundle/_internal/bandit/plugins/general_hardcoded_tmp.py +79 -0
  59. package/bundle/_internal/bandit/plugins/hashlib_insecure_functions.py +121 -0
  60. package/bundle/_internal/bandit/plugins/huggingface_unsafe_download.py +166 -0
  61. package/bundle/_internal/bandit/plugins/injection_paramiko.py +63 -0
  62. package/bundle/_internal/bandit/plugins/injection_shell.py +706 -0
  63. package/bundle/_internal/bandit/plugins/injection_sql.py +143 -0
  64. package/bundle/_internal/bandit/plugins/injection_wildcard.py +144 -0
  65. package/bundle/_internal/bandit/plugins/insecure_ssl_tls.py +285 -0
  66. package/bundle/_internal/bandit/plugins/jinja2_templates.py +134 -0
  67. package/bundle/_internal/bandit/plugins/logging_config_insecure_listen.py +58 -0
  68. package/bundle/_internal/bandit/plugins/mako_templates.py +69 -0
  69. package/bundle/_internal/bandit/plugins/markupsafe_markup_xss.py +118 -0
  70. package/bundle/_internal/bandit/plugins/pytorch_load.py +77 -0
  71. package/bundle/_internal/bandit/plugins/request_without_timeout.py +84 -0
  72. package/bundle/_internal/bandit/plugins/snmp_security_check.py +110 -0
  73. package/bundle/_internal/bandit/plugins/ssh_no_host_key_verification.py +76 -0
  74. package/bundle/_internal/bandit/plugins/tarfile_unsafe_members.py +121 -0
  75. package/bundle/_internal/bandit/plugins/trojansource.py +82 -0
  76. package/bundle/_internal/bandit/plugins/try_except_continue.py +108 -0
  77. package/bundle/_internal/bandit/plugins/try_except_pass.py +106 -0
  78. package/bundle/_internal/bandit/plugins/weak_cryptographic_key.py +165 -0
  79. package/bundle/_internal/bandit/plugins/yaml_load.py +76 -0
  80. package/bundle/_internal/bandit-1.9.4.dist-info/INSTALLER +1 -0
  81. package/bundle/_internal/bandit-1.9.4.dist-info/METADATA +212 -0
  82. package/bundle/_internal/bandit-1.9.4.dist-info/RECORD +150 -0
  83. package/bundle/_internal/bandit-1.9.4.dist-info/WHEEL +5 -0
  84. package/bundle/_internal/bandit-1.9.4.dist-info/entry_points.txt +63 -0
  85. package/bundle/_internal/bandit-1.9.4.dist-info/licenses/LICENSE +175 -0
  86. package/bundle/_internal/bandit-1.9.4.dist-info/pbr.json +1 -0
  87. package/bundle/_internal/bandit-1.9.4.dist-info/top_level.txt +1 -0
  88. package/bundle/_internal/base_library.zip +0 -0
  89. package/bundle/_internal/bin/ruff +0 -0
  90. package/bundle/_internal/gnost/__init__.py +1 -0
  91. package/bundle/_internal/gnost/analysis/__init__.py +0 -0
  92. package/bundle/_internal/gnost/analysis/analyzers/__init__.py +11 -0
  93. package/bundle/_internal/gnost/analysis/analyzers/maintainability_analyzer.py +901 -0
  94. package/bundle/_internal/gnost/analysis/analyzers/observability_analyzer.py +592 -0
  95. package/bundle/_internal/gnost/analysis/analyzers/readability_analyzer.py +968 -0
  96. package/bundle/_internal/gnost/analysis/analyzers/robustness_analyzer.py +944 -0
  97. package/bundle/_internal/gnost/analysis/config/mypy.ini +4 -0
  98. package/bundle/_internal/gnost/analysis/core/__init__.py +0 -0
  99. package/bundle/_internal/gnost/analysis/core/aggregator.py +584 -0
  100. package/bundle/_internal/gnost/analysis/core/engine.py +430 -0
  101. package/bundle/_internal/gnost/analysis/core/file_utils.py +209 -0
  102. package/bundle/_internal/gnost/analysis/core/interfaces.py +304 -0
  103. package/bundle/_internal/gnost/analysis/core/models.py +479 -0
  104. package/bundle/_internal/gnost/analysis/core/tool_runner.py +153 -0
  105. package/bundle/_internal/gnost/analysis/core/transformers.py +779 -0
  106. package/bundle/_internal/gnost/analysis/utils/__init__.py +0 -0
  107. package/bundle/_internal/gnost/analysis/utils/analyze.py +132 -0
  108. package/bundle/_internal/gnost/analysis/utils/df_handling.py +215 -0
  109. package/bundle/_internal/gnost/analysis/utils/duplicate_code.py +42 -0
  110. package/bundle/_internal/gnost/analysis/utils/extract.py +172 -0
  111. package/bundle/_internal/gnost/analysis/utils/mi.py +130 -0
  112. package/bundle/_internal/gnost/analysis/utils/tool_command.py +63 -0
  113. package/bundle/_internal/gnost/cli/__init__.py +3 -0
  114. package/bundle/_internal/gnost/cli/app.py +696 -0
  115. package/bundle/_internal/gnost/cli/commands/__init__.py +3 -0
  116. package/bundle/_internal/gnost/cli/commands/analysis.py +190 -0
  117. package/bundle/_internal/gnost/cli/commands/onboard.py +507 -0
  118. package/bundle/_internal/gnost/cli/commands/show.py +70 -0
  119. package/bundle/_internal/gnost/config/__init__.py +0 -0
  120. package/bundle/_internal/gnost/config/languages.py +10 -0
  121. package/bundle/_internal/gnost/config/settings.py +240 -0
  122. package/bundle/_internal/gnost/core/__init__.py +0 -0
  123. package/bundle/_internal/gnost/core/callgraph.py +399 -0
  124. package/bundle/_internal/gnost/core/caution.py +315 -0
  125. package/bundle/_internal/gnost/core/cycles.py +148 -0
  126. package/bundle/_internal/gnost/core/flow.py +204 -0
  127. package/bundle/_internal/gnost/core/graph.py +108 -0
  128. package/bundle/_internal/gnost/core/insight_builder.py +164 -0
  129. package/bundle/_internal/gnost/core/ranker.py +119 -0
  130. package/bundle/_internal/gnost/core/resolver.py +304 -0
  131. package/bundle/_internal/gnost/languages/base.py +108 -0
  132. package/bundle/_internal/gnost/languages/java.py +104 -0
  133. package/bundle/_internal/gnost/languages/javascript.py +153 -0
  134. package/bundle/_internal/gnost/languages/manifests.py +45 -0
  135. package/bundle/_internal/gnost/languages/python.py +318 -0
  136. package/bundle/_internal/gnost/languages/typescript.py +6 -0
  137. package/bundle/_internal/gnost/models/__init__.py +0 -0
  138. package/bundle/_internal/gnost/models/insights.py +68 -0
  139. package/bundle/_internal/gnost/reporters/__init__.py +3 -0
  140. package/bundle/_internal/gnost/reporters/analysis_html.py +1292 -0
  141. package/bundle/_internal/gnost/reporters/diagram_viewer.py +153 -0
  142. package/bundle/_internal/gnost/reporters/files.py +18 -0
  143. package/bundle/_internal/gnost/reporters/folders.py +18 -0
  144. package/bundle/_internal/gnost/reporters/insights_json.py +189 -0
  145. package/bundle/_internal/gnost/reporters/loc_summary.py +19 -0
  146. package/bundle/_internal/gnost/reporters/markdown.py +372 -0
  147. package/bundle/_internal/gnost/reporters/mermaid.py +543 -0
  148. package/bundle/_internal/gnost/reporters/mermaid_graph.py +309 -0
  149. package/bundle/_internal/gnost/reporters/readme.py +81 -0
  150. package/bundle/_internal/gnost/reporters/stats.py +13 -0
  151. package/bundle/_internal/gnost/reporters/summary.py +223 -0
  152. package/bundle/_internal/gnost/reporters/templates/analyzer_guides.json +247 -0
  153. package/bundle/_internal/gnost/reporters/templates/analyzer_guides_layout.html +9 -0
  154. package/bundle/_internal/gnost/reporters/templates/graph_viewer.html +427 -0
  155. package/bundle/_internal/gnost/reporters/vendor/THIRD_PARTY_NOTICES.md +205 -0
  156. package/bundle/_internal/gnost/reporters/vendor/cose-base.js +3214 -0
  157. package/bundle/_internal/gnost/reporters/vendor/cytoscape-fcose.js +1549 -0
  158. package/bundle/_internal/gnost/reporters/vendor/cytoscape.min.js +32 -0
  159. package/bundle/_internal/gnost/reporters/vendor/layout-base.js +5230 -0
  160. package/bundle/_internal/gnost/reporters/vendor/marked.min.js +6 -0
  161. package/bundle/_internal/gnost/reporters/vendor/mermaid.min.js +2314 -0
  162. package/bundle/_internal/gnost/reporters/vendor/svg-pan-zoom.min.js +3 -0
  163. package/bundle/_internal/gnost/reporters/vendor/vendor.json +44 -0
  164. package/bundle/_internal/gnost/routes/__init__.py +45 -0
  165. package/bundle/_internal/gnost/routes/java.py +72 -0
  166. package/bundle/_internal/gnost/routes/javascript.py +275 -0
  167. package/bundle/_internal/gnost/routes/models.py +58 -0
  168. package/bundle/_internal/gnost/routes/python.py +429 -0
  169. package/bundle/_internal/gnost/scanner/__init__.py +4 -0
  170. package/bundle/_internal/gnost/scanner/classify.py +13 -0
  171. package/bundle/_internal/gnost/scanner/engine.py +169 -0
  172. package/bundle/_internal/gnost/scanner/filters.py +196 -0
  173. package/bundle/_internal/gnost/scanner/loc.py +93 -0
  174. package/bundle/_internal/gnost/scanner/models.py +27 -0
  175. package/bundle/_internal/gnost/schemas/insights.schema.json +517 -0
  176. package/bundle/_internal/gnost/utils/__init__.py +0 -0
  177. package/bundle/_internal/gnost/utils/logger.py +85 -0
  178. package/bundle/_internal/gnost/utils/paths.py +29 -0
  179. package/bundle/_internal/gnost/utils/printer.py +46 -0
  180. package/bundle/_internal/gnost/utils/progress.py +20 -0
  181. package/bundle/_internal/gnost-0.5.1rc1.dist-info/INSTALLER +1 -0
  182. package/bundle/_internal/gnost-0.5.1rc1.dist-info/METADATA +130 -0
  183. package/bundle/_internal/gnost-0.5.1rc1.dist-info/RECORD +178 -0
  184. package/bundle/_internal/gnost-0.5.1rc1.dist-info/REQUESTED +0 -0
  185. package/bundle/_internal/gnost-0.5.1rc1.dist-info/WHEEL +5 -0
  186. package/bundle/_internal/gnost-0.5.1rc1.dist-info/direct_url.json +1 -0
  187. package/bundle/_internal/gnost-0.5.1rc1.dist-info/entry_points.txt +2 -0
  188. package/bundle/_internal/gnost-0.5.1rc1.dist-info/licenses/LICENSE +21 -0
  189. package/bundle/_internal/gnost-0.5.1rc1.dist-info/top_level.txt +1 -0
  190. package/bundle/_internal/libcrypto.3.dylib +0 -0
  191. package/bundle/_internal/libncurses.6.dylib +0 -0
  192. package/bundle/_internal/librt/base64.cpython-312-darwin.so +0 -0
  193. package/bundle/_internal/librt/internal.cpython-312-darwin.so +0 -0
  194. package/bundle/_internal/libssl.3.dylib +0 -0
  195. package/bundle/_internal/mypy/__init__.cpython-312-darwin.so +0 -0
  196. package/bundle/_internal/mypy/__init__.py +1 -0
  197. package/bundle/_internal/mypy/__main__.py +52 -0
  198. package/bundle/_internal/mypy/api.cpython-312-darwin.so +0 -0
  199. package/bundle/_internal/mypy/api.py +95 -0
  200. package/bundle/_internal/mypy/applytype.cpython-312-darwin.so +0 -0
  201. package/bundle/_internal/mypy/applytype.py +317 -0
  202. package/bundle/_internal/mypy/argmap.cpython-312-darwin.so +0 -0
  203. package/bundle/_internal/mypy/argmap.py +269 -0
  204. package/bundle/_internal/mypy/binder.cpython-312-darwin.so +0 -0
  205. package/bundle/_internal/mypy/binder.py +710 -0
  206. package/bundle/_internal/mypy/bogus_type.py +27 -0
  207. package/bundle/_internal/mypy/build.cpython-312-darwin.so +0 -0
  208. package/bundle/_internal/mypy/build.py +5533 -0
  209. package/bundle/_internal/mypy/build_worker/__init__.cpython-312-darwin.so +0 -0
  210. package/bundle/_internal/mypy/build_worker/__init__.py +0 -0
  211. package/bundle/_internal/mypy/build_worker/__main__.py +6 -0
  212. package/bundle/_internal/mypy/build_worker/worker.cpython-312-darwin.so +0 -0
  213. package/bundle/_internal/mypy/build_worker/worker.py +379 -0
  214. package/bundle/_internal/mypy/cache.cpython-312-darwin.so +0 -0
  215. package/bundle/_internal/mypy/cache.py +626 -0
  216. package/bundle/_internal/mypy/checker.cpython-312-darwin.so +0 -0
  217. package/bundle/_internal/mypy/checker.py +10110 -0
  218. package/bundle/_internal/mypy/checker_shared.cpython-312-darwin.so +0 -0
  219. package/bundle/_internal/mypy/checker_shared.py +377 -0
  220. package/bundle/_internal/mypy/checker_state.cpython-312-darwin.so +0 -0
  221. package/bundle/_internal/mypy/checker_state.py +30 -0
  222. package/bundle/_internal/mypy/checkexpr.cpython-312-darwin.so +0 -0
  223. package/bundle/_internal/mypy/checkexpr.py +7018 -0
  224. package/bundle/_internal/mypy/checkmember.cpython-312-darwin.so +0 -0
  225. package/bundle/_internal/mypy/checkmember.py +1593 -0
  226. package/bundle/_internal/mypy/checkpattern.cpython-312-darwin.so +0 -0
  227. package/bundle/_internal/mypy/checkpattern.py +883 -0
  228. package/bundle/_internal/mypy/checkstrformat.cpython-312-darwin.so +0 -0
  229. package/bundle/_internal/mypy/checkstrformat.py +1103 -0
  230. package/bundle/_internal/mypy/config_parser.cpython-312-darwin.so +0 -0
  231. package/bundle/_internal/mypy/config_parser.py +749 -0
  232. package/bundle/_internal/mypy/constant_fold.cpython-312-darwin.so +0 -0
  233. package/bundle/_internal/mypy/constant_fold.py +187 -0
  234. package/bundle/_internal/mypy/constraints.cpython-312-darwin.so +0 -0
  235. package/bundle/_internal/mypy/constraints.py +1748 -0
  236. package/bundle/_internal/mypy/copytype.cpython-312-darwin.so +0 -0
  237. package/bundle/_internal/mypy/copytype.py +137 -0
  238. package/bundle/_internal/mypy/defaults.cpython-312-darwin.so +0 -0
  239. package/bundle/_internal/mypy/defaults.py +67 -0
  240. package/bundle/_internal/mypy/dmypy/__init__.cpython-312-darwin.so +0 -0
  241. package/bundle/_internal/mypy/dmypy/__init__.py +0 -0
  242. package/bundle/_internal/mypy/dmypy/__main__.py +6 -0
  243. package/bundle/_internal/mypy/dmypy/client.cpython-312-darwin.so +0 -0
  244. package/bundle/_internal/mypy/dmypy/client.py +732 -0
  245. package/bundle/_internal/mypy/dmypy_os.cpython-312-darwin.so +0 -0
  246. package/bundle/_internal/mypy/dmypy_os.py +43 -0
  247. package/bundle/_internal/mypy/dmypy_server.cpython-312-darwin.so +0 -0
  248. package/bundle/_internal/mypy/dmypy_server.py +1132 -0
  249. package/bundle/_internal/mypy/dmypy_util.cpython-312-darwin.so +0 -0
  250. package/bundle/_internal/mypy/dmypy_util.py +117 -0
  251. package/bundle/_internal/mypy/erasetype.cpython-312-darwin.so +0 -0
  252. package/bundle/_internal/mypy/erasetype.py +301 -0
  253. package/bundle/_internal/mypy/error_formatter.cpython-312-darwin.so +0 -0
  254. package/bundle/_internal/mypy/error_formatter.py +39 -0
  255. package/bundle/_internal/mypy/errorcodes.cpython-312-darwin.so +0 -0
  256. package/bundle/_internal/mypy/errorcodes.py +340 -0
  257. package/bundle/_internal/mypy/errors.cpython-312-darwin.so +0 -0
  258. package/bundle/_internal/mypy/errors.py +1468 -0
  259. package/bundle/_internal/mypy/evalexpr.cpython-312-darwin.so +0 -0
  260. package/bundle/_internal/mypy/evalexpr.py +211 -0
  261. package/bundle/_internal/mypy/expandtype.cpython-312-darwin.so +0 -0
  262. package/bundle/_internal/mypy/expandtype.py +662 -0
  263. package/bundle/_internal/mypy/exportjson.py +616 -0
  264. package/bundle/_internal/mypy/exprtotype.cpython-312-darwin.so +0 -0
  265. package/bundle/_internal/mypy/exprtotype.py +285 -0
  266. package/bundle/_internal/mypy/fastparse.cpython-312-darwin.so +0 -0
  267. package/bundle/_internal/mypy/fastparse.py +2267 -0
  268. package/bundle/_internal/mypy/find_sources.cpython-312-darwin.so +0 -0
  269. package/bundle/_internal/mypy/find_sources.py +257 -0
  270. package/bundle/_internal/mypy/fixup.cpython-312-darwin.so +0 -0
  271. package/bundle/_internal/mypy/fixup.py +438 -0
  272. package/bundle/_internal/mypy/freetree.cpython-312-darwin.so +0 -0
  273. package/bundle/_internal/mypy/freetree.py +23 -0
  274. package/bundle/_internal/mypy/fscache.cpython-312-darwin.so +0 -0
  275. package/bundle/_internal/mypy/fscache.py +312 -0
  276. package/bundle/_internal/mypy/fswatcher.cpython-312-darwin.so +0 -0
  277. package/bundle/_internal/mypy/fswatcher.py +106 -0
  278. package/bundle/_internal/mypy/gclogger.cpython-312-darwin.so +0 -0
  279. package/bundle/_internal/mypy/gclogger.py +48 -0
  280. package/bundle/_internal/mypy/git.cpython-312-darwin.so +0 -0
  281. package/bundle/_internal/mypy/git.py +69 -0
  282. package/bundle/_internal/mypy/graph_utils.cpython-312-darwin.so +0 -0
  283. package/bundle/_internal/mypy/graph_utils.py +161 -0
  284. package/bundle/_internal/mypy/indirection.cpython-312-darwin.so +0 -0
  285. package/bundle/_internal/mypy/indirection.py +176 -0
  286. package/bundle/_internal/mypy/infer.cpython-312-darwin.so +0 -0
  287. package/bundle/_internal/mypy/infer.py +80 -0
  288. package/bundle/_internal/mypy/inspections.cpython-312-darwin.so +0 -0
  289. package/bundle/_internal/mypy/inspections.py +626 -0
  290. package/bundle/_internal/mypy/ipc.cpython-312-darwin.so +0 -0
  291. package/bundle/_internal/mypy/ipc.py +508 -0
  292. package/bundle/_internal/mypy/join.cpython-312-darwin.so +0 -0
  293. package/bundle/_internal/mypy/join.py +962 -0
  294. package/bundle/_internal/mypy/known_modules.cpython-312-darwin.so +0 -0
  295. package/bundle/_internal/mypy/known_modules.py +174 -0
  296. package/bundle/_internal/mypy/literals.cpython-312-darwin.so +0 -0
  297. package/bundle/_internal/mypy/literals.py +327 -0
  298. package/bundle/_internal/mypy/lookup.cpython-312-darwin.so +0 -0
  299. package/bundle/_internal/mypy/lookup.py +80 -0
  300. package/bundle/_internal/mypy/main.cpython-312-darwin.so +0 -0
  301. package/bundle/_internal/mypy/main.py +1793 -0
  302. package/bundle/_internal/mypy/maptype.cpython-312-darwin.so +0 -0
  303. package/bundle/_internal/mypy/maptype.py +109 -0
  304. package/bundle/_internal/mypy/meet.cpython-312-darwin.so +0 -0
  305. package/bundle/_internal/mypy/meet.py +1371 -0
  306. package/bundle/_internal/mypy/memprofile.cpython-312-darwin.so +0 -0
  307. package/bundle/_internal/mypy/memprofile.py +122 -0
  308. package/bundle/_internal/mypy/message_registry.cpython-312-darwin.so +0 -0
  309. package/bundle/_internal/mypy/message_registry.py +378 -0
  310. package/bundle/_internal/mypy/messages.cpython-312-darwin.so +0 -0
  311. package/bundle/_internal/mypy/messages.py +3535 -0
  312. package/bundle/_internal/mypy/metastore.cpython-312-darwin.so +0 -0
  313. package/bundle/_internal/mypy/metastore.py +278 -0
  314. package/bundle/_internal/mypy/mixedtraverser.cpython-312-darwin.so +0 -0
  315. package/bundle/_internal/mypy/mixedtraverser.py +147 -0
  316. package/bundle/_internal/mypy/modulefinder.cpython-312-darwin.so +0 -0
  317. package/bundle/_internal/mypy/modulefinder.py +1008 -0
  318. package/bundle/_internal/mypy/moduleinspect.cpython-312-darwin.so +0 -0
  319. package/bundle/_internal/mypy/moduleinspect.py +184 -0
  320. package/bundle/_internal/mypy/modules_state.cpython-312-darwin.so +0 -0
  321. package/bundle/_internal/mypy/modules_state.py +20 -0
  322. package/bundle/_internal/mypy/mro.cpython-312-darwin.so +0 -0
  323. package/bundle/_internal/mypy/mro.py +62 -0
  324. package/bundle/_internal/mypy/nativeparse.cpython-312-darwin.so +0 -0
  325. package/bundle/_internal/mypy/nativeparse.py +2199 -0
  326. package/bundle/_internal/mypy/nodes.cpython-312-darwin.so +0 -0
  327. package/bundle/_internal/mypy/nodes.py +5608 -0
  328. package/bundle/_internal/mypy/operators.cpython-312-darwin.so +0 -0
  329. package/bundle/_internal/mypy/operators.py +126 -0
  330. package/bundle/_internal/mypy/options.cpython-312-darwin.so +0 -0
  331. package/bundle/_internal/mypy/options.py +678 -0
  332. package/bundle/_internal/mypy/parse.cpython-312-darwin.so +0 -0
  333. package/bundle/_internal/mypy/parse.py +135 -0
  334. package/bundle/_internal/mypy/partially_defined.cpython-312-darwin.so +0 -0
  335. package/bundle/_internal/mypy/partially_defined.py +703 -0
  336. package/bundle/_internal/mypy/patterns.cpython-312-darwin.so +0 -0
  337. package/bundle/_internal/mypy/patterns.py +162 -0
  338. package/bundle/_internal/mypy/plugin.cpython-312-darwin.so +0 -0
  339. package/bundle/_internal/mypy/plugin.py +945 -0
  340. package/bundle/_internal/mypy/plugins/__init__.py +0 -0
  341. package/bundle/_internal/mypy/plugins/attrs.cpython-312-darwin.so +0 -0
  342. package/bundle/_internal/mypy/plugins/attrs.py +1179 -0
  343. package/bundle/_internal/mypy/plugins/common.cpython-312-darwin.so +0 -0
  344. package/bundle/_internal/mypy/plugins/common.py +441 -0
  345. package/bundle/_internal/mypy/plugins/constants.cpython-312-darwin.so +0 -0
  346. package/bundle/_internal/mypy/plugins/constants.py +20 -0
  347. package/bundle/_internal/mypy/plugins/ctypes.cpython-312-darwin.so +0 -0
  348. package/bundle/_internal/mypy/plugins/ctypes.py +245 -0
  349. package/bundle/_internal/mypy/plugins/dataclasses.cpython-312-darwin.so +0 -0
  350. package/bundle/_internal/mypy/plugins/dataclasses.py +1135 -0
  351. package/bundle/_internal/mypy/plugins/default.cpython-312-darwin.so +0 -0
  352. package/bundle/_internal/mypy/plugins/default.py +612 -0
  353. package/bundle/_internal/mypy/plugins/enums.cpython-312-darwin.so +0 -0
  354. package/bundle/_internal/mypy/plugins/enums.py +299 -0
  355. package/bundle/_internal/mypy/plugins/functools.cpython-312-darwin.so +0 -0
  356. package/bundle/_internal/mypy/plugins/functools.py +399 -0
  357. package/bundle/_internal/mypy/plugins/proper_plugin.cpython-312-darwin.so +0 -0
  358. package/bundle/_internal/mypy/plugins/proper_plugin.py +178 -0
  359. package/bundle/_internal/mypy/plugins/singledispatch.cpython-312-darwin.so +0 -0
  360. package/bundle/_internal/mypy/plugins/singledispatch.py +212 -0
  361. package/bundle/_internal/mypy/py.typed +1 -0
  362. package/bundle/_internal/mypy/pyinfo.py +79 -0
  363. package/bundle/_internal/mypy/reachability.cpython-312-darwin.so +0 -0
  364. package/bundle/_internal/mypy/reachability.py +388 -0
  365. package/bundle/_internal/mypy/refinfo.cpython-312-darwin.so +0 -0
  366. package/bundle/_internal/mypy/refinfo.py +92 -0
  367. package/bundle/_internal/mypy/renaming.cpython-312-darwin.so +0 -0
  368. package/bundle/_internal/mypy/renaming.py +583 -0
  369. package/bundle/_internal/mypy/report.cpython-312-darwin.so +0 -0
  370. package/bundle/_internal/mypy/report.py +930 -0
  371. package/bundle/_internal/mypy/scope.cpython-312-darwin.so +0 -0
  372. package/bundle/_internal/mypy/scope.py +125 -0
  373. package/bundle/_internal/mypy/semanal.cpython-312-darwin.so +0 -0
  374. package/bundle/_internal/mypy/semanal.py +8674 -0
  375. package/bundle/_internal/mypy/semanal_classprop.cpython-312-darwin.so +0 -0
  376. package/bundle/_internal/mypy/semanal_classprop.py +188 -0
  377. package/bundle/_internal/mypy/semanal_enum.cpython-312-darwin.so +0 -0
  378. package/bundle/_internal/mypy/semanal_enum.py +259 -0
  379. package/bundle/_internal/mypy/semanal_infer.cpython-312-darwin.so +0 -0
  380. package/bundle/_internal/mypy/semanal_infer.py +135 -0
  381. package/bundle/_internal/mypy/semanal_main.cpython-312-darwin.so +0 -0
  382. package/bundle/_internal/mypy/semanal_main.py +542 -0
  383. package/bundle/_internal/mypy/semanal_namedtuple.cpython-312-darwin.so +0 -0
  384. package/bundle/_internal/mypy/semanal_namedtuple.py +679 -0
  385. package/bundle/_internal/mypy/semanal_newtype.cpython-312-darwin.so +0 -0
  386. package/bundle/_internal/mypy/semanal_newtype.py +272 -0
  387. package/bundle/_internal/mypy/semanal_pass1.cpython-312-darwin.so +0 -0
  388. package/bundle/_internal/mypy/semanal_pass1.py +159 -0
  389. package/bundle/_internal/mypy/semanal_shared.cpython-312-darwin.so +0 -0
  390. package/bundle/_internal/mypy/semanal_shared.py +499 -0
  391. package/bundle/_internal/mypy/semanal_typeargs.cpython-312-darwin.so +0 -0
  392. package/bundle/_internal/mypy/semanal_typeargs.py +309 -0
  393. package/bundle/_internal/mypy/semanal_typeddict.cpython-312-darwin.so +0 -0
  394. package/bundle/_internal/mypy/semanal_typeddict.py +826 -0
  395. package/bundle/_internal/mypy/server/__init__.py +0 -0
  396. package/bundle/_internal/mypy/server/astdiff.cpython-312-darwin.so +0 -0
  397. package/bundle/_internal/mypy/server/astdiff.py +552 -0
  398. package/bundle/_internal/mypy/server/astmerge.cpython-312-darwin.so +0 -0
  399. package/bundle/_internal/mypy/server/astmerge.py +583 -0
  400. package/bundle/_internal/mypy/server/aststrip.cpython-312-darwin.so +0 -0
  401. package/bundle/_internal/mypy/server/aststrip.py +255 -0
  402. package/bundle/_internal/mypy/server/deps.cpython-312-darwin.so +0 -0
  403. package/bundle/_internal/mypy/server/deps.py +1153 -0
  404. package/bundle/_internal/mypy/server/mergecheck.cpython-312-darwin.so +0 -0
  405. package/bundle/_internal/mypy/server/mergecheck.py +84 -0
  406. package/bundle/_internal/mypy/server/objgraph.cpython-312-darwin.so +0 -0
  407. package/bundle/_internal/mypy/server/objgraph.py +101 -0
  408. package/bundle/_internal/mypy/server/subexpr.cpython-312-darwin.so +0 -0
  409. package/bundle/_internal/mypy/server/subexpr.py +208 -0
  410. package/bundle/_internal/mypy/server/target.cpython-312-darwin.so +0 -0
  411. package/bundle/_internal/mypy/server/target.py +11 -0
  412. package/bundle/_internal/mypy/server/trigger.cpython-312-darwin.so +0 -0
  413. package/bundle/_internal/mypy/server/trigger.py +26 -0
  414. package/bundle/_internal/mypy/server/update.cpython-312-darwin.so +0 -0
  415. package/bundle/_internal/mypy/server/update.py +1372 -0
  416. package/bundle/_internal/mypy/sharedparse.cpython-312-darwin.so +0 -0
  417. package/bundle/_internal/mypy/sharedparse.py +114 -0
  418. package/bundle/_internal/mypy/solve.cpython-312-darwin.so +0 -0
  419. package/bundle/_internal/mypy/solve.py +602 -0
  420. package/bundle/_internal/mypy/split_namespace.py +35 -0
  421. package/bundle/_internal/mypy/state.cpython-312-darwin.so +0 -0
  422. package/bundle/_internal/mypy/state.py +29 -0
  423. package/bundle/_internal/mypy/stats.cpython-312-darwin.so +0 -0
  424. package/bundle/_internal/mypy/stats.py +494 -0
  425. package/bundle/_internal/mypy/strconv.cpython-312-darwin.so +0 -0
  426. package/bundle/_internal/mypy/strconv.py +707 -0
  427. package/bundle/_internal/mypy/stubdoc.py +545 -0
  428. package/bundle/_internal/mypy/stubgen.cpython-312-darwin.so +0 -0
  429. package/bundle/_internal/mypy/stubgen.py +2064 -0
  430. package/bundle/_internal/mypy/stubgenc.py +1046 -0
  431. package/bundle/_internal/mypy/stubinfo.cpython-312-darwin.so +0 -0
  432. package/bundle/_internal/mypy/stubinfo.py +321 -0
  433. package/bundle/_internal/mypy/stubtest.py +2676 -0
  434. package/bundle/_internal/mypy/stubutil.cpython-312-darwin.so +0 -0
  435. package/bundle/_internal/mypy/stubutil.py +895 -0
  436. package/bundle/_internal/mypy/subtypes.cpython-312-darwin.so +0 -0
  437. package/bundle/_internal/mypy/subtypes.py +2572 -0
  438. package/bundle/_internal/mypy/suggestions.cpython-312-darwin.so +0 -0
  439. package/bundle/_internal/mypy/suggestions.py +1068 -0
  440. package/bundle/_internal/mypy/test/__init__.py +0 -0
  441. package/bundle/_internal/mypy/test/config.py +31 -0
  442. package/bundle/_internal/mypy/test/data.py +864 -0
  443. package/bundle/_internal/mypy/test/helpers.py +546 -0
  444. package/bundle/_internal/mypy/test/meta/__init__.py +0 -0
  445. package/bundle/_internal/mypy/test/meta/_pytest.py +72 -0
  446. package/bundle/_internal/mypy/test/meta/test_diff_helper.py +47 -0
  447. package/bundle/_internal/mypy/test/meta/test_parse_data.py +69 -0
  448. package/bundle/_internal/mypy/test/meta/test_update_data.py +131 -0
  449. package/bundle/_internal/mypy/test/test_config_parser.py +130 -0
  450. package/bundle/_internal/mypy/test/test_diff_cache.py +209 -0
  451. package/bundle/_internal/mypy/test/test_find_sources.py +376 -0
  452. package/bundle/_internal/mypy/test/test_nativeparse.py +306 -0
  453. package/bundle/_internal/mypy/test/test_ref_info.py +46 -0
  454. package/bundle/_internal/mypy/test/testapi.py +45 -0
  455. package/bundle/_internal/mypy/test/testargs.py +202 -0
  456. package/bundle/_internal/mypy/test/testcheck.py +360 -0
  457. package/bundle/_internal/mypy/test/testcmdline.py +162 -0
  458. package/bundle/_internal/mypy/test/testconstraints.py +134 -0
  459. package/bundle/_internal/mypy/test/testdaemon.py +132 -0
  460. package/bundle/_internal/mypy/test/testdeps.py +85 -0
  461. package/bundle/_internal/mypy/test/testdiff.py +70 -0
  462. package/bundle/_internal/mypy/test/testerrorstream.py +46 -0
  463. package/bundle/_internal/mypy/test/testexportjson.py +104 -0
  464. package/bundle/_internal/mypy/test/testfinegrained.py +453 -0
  465. package/bundle/_internal/mypy/test/testfinegrainedcache.py +18 -0
  466. package/bundle/_internal/mypy/test/testformatter.py +85 -0
  467. package/bundle/_internal/mypy/test/testfscache.py +100 -0
  468. package/bundle/_internal/mypy/test/testgraph.py +138 -0
  469. package/bundle/_internal/mypy/test/testinfer.py +373 -0
  470. package/bundle/_internal/mypy/test/testipc.py +154 -0
  471. package/bundle/_internal/mypy/test/testmerge.py +235 -0
  472. package/bundle/_internal/mypy/test/testmodulefinder.py +284 -0
  473. package/bundle/_internal/mypy/test/testmypyc.py +26 -0
  474. package/bundle/_internal/mypy/test/testoutput.py +64 -0
  475. package/bundle/_internal/mypy/test/testparse.py +131 -0
  476. package/bundle/_internal/mypy/test/testpep561.py +174 -0
  477. package/bundle/_internal/mypy/test/testpythoneval.py +116 -0
  478. package/bundle/_internal/mypy/test/testreports.py +59 -0
  479. package/bundle/_internal/mypy/test/testsemanal.py +219 -0
  480. package/bundle/_internal/mypy/test/testsolve.py +287 -0
  481. package/bundle/_internal/mypy/test/teststubgen.py +1650 -0
  482. package/bundle/_internal/mypy/test/teststubinfo.py +24 -0
  483. package/bundle/_internal/mypy/test/teststubtest.py +3417 -0
  484. package/bundle/_internal/mypy/test/testsubtypes.py +306 -0
  485. package/bundle/_internal/mypy/test/testtransform.py +64 -0
  486. package/bundle/_internal/mypy/test/testtypegen.py +83 -0
  487. package/bundle/_internal/mypy/test/testtypes.py +1666 -0
  488. package/bundle/_internal/mypy/test/testutil.py +111 -0
  489. package/bundle/_internal/mypy/test/typefixture.py +419 -0
  490. package/bundle/_internal/mypy/test/update_data.py +87 -0
  491. package/bundle/_internal/mypy/test/visitors.cpython-312-darwin.so +0 -0
  492. package/bundle/_internal/mypy/test/visitors.py +77 -0
  493. package/bundle/_internal/mypy/traverser.cpython-312-darwin.so +0 -0
  494. package/bundle/_internal/mypy/traverser.py +1106 -0
  495. package/bundle/_internal/mypy/treetransform.cpython-312-darwin.so +0 -0
  496. package/bundle/_internal/mypy/treetransform.py +820 -0
  497. package/bundle/_internal/mypy/tvar_scope.cpython-312-darwin.so +0 -0
  498. package/bundle/_internal/mypy/tvar_scope.py +154 -0
  499. package/bundle/_internal/mypy/type_visitor.cpython-312-darwin.so +0 -0
  500. package/bundle/_internal/mypy/type_visitor.py +630 -0
  501. package/bundle/_internal/mypy/typeanal.cpython-312-darwin.so +0 -0
  502. package/bundle/_internal/mypy/typeanal.py +2961 -0
  503. package/bundle/_internal/mypy/typeops.cpython-312-darwin.so +0 -0
  504. package/bundle/_internal/mypy/typeops.py +1355 -0
  505. package/bundle/_internal/mypy/types.cpython-312-darwin.so +0 -0
  506. package/bundle/_internal/mypy/types.py +4639 -0
  507. package/bundle/_internal/mypy/types_utils.cpython-312-darwin.so +0 -0
  508. package/bundle/_internal/mypy/types_utils.py +183 -0
  509. package/bundle/_internal/mypy/typeshed/LICENSE +237 -0
  510. package/bundle/_internal/mypy/typeshed/stdlib/VERSIONS +349 -0
  511. package/bundle/_internal/mypy/typeshed/stdlib/__future__.pyi +36 -0
  512. package/bundle/_internal/mypy/typeshed/stdlib/__main__.pyi +1 -0
  513. package/bundle/_internal/mypy/typeshed/stdlib/_ast.pyi +141 -0
  514. package/bundle/_internal/mypy/typeshed/stdlib/_asyncio.pyi +114 -0
  515. package/bundle/_internal/mypy/typeshed/stdlib/_bisect.pyi +103 -0
  516. package/bundle/_internal/mypy/typeshed/stdlib/_blake2.pyi +119 -0
  517. package/bundle/_internal/mypy/typeshed/stdlib/_bz2.pyi +24 -0
  518. package/bundle/_internal/mypy/typeshed/stdlib/_codecs.pyi +125 -0
  519. package/bundle/_internal/mypy/typeshed/stdlib/_collections_abc.pyi +105 -0
  520. package/bundle/_internal/mypy/typeshed/stdlib/_compat_pickle.pyi +10 -0
  521. package/bundle/_internal/mypy/typeshed/stdlib/_compression.pyi +39 -0
  522. package/bundle/_internal/mypy/typeshed/stdlib/_contextvars.pyi +69 -0
  523. package/bundle/_internal/mypy/typeshed/stdlib/_csv.pyi +116 -0
  524. package/bundle/_internal/mypy/typeshed/stdlib/_ctypes.pyi +375 -0
  525. package/bundle/_internal/mypy/typeshed/stdlib/_curses.pyi +583 -0
  526. package/bundle/_internal/mypy/typeshed/stdlib/_curses_panel.pyi +27 -0
  527. package/bundle/_internal/mypy/typeshed/stdlib/_dbm.pyi +46 -0
  528. package/bundle/_internal/mypy/typeshed/stdlib/_decimal.pyi +73 -0
  529. package/bundle/_internal/mypy/typeshed/stdlib/_frozen_importlib.pyi +121 -0
  530. package/bundle/_internal/mypy/typeshed/stdlib/_frozen_importlib_external.pyi +218 -0
  531. package/bundle/_internal/mypy/typeshed/stdlib/_gdbm.pyi +50 -0
  532. package/bundle/_internal/mypy/typeshed/stdlib/_hashlib.pyi +127 -0
  533. package/bundle/_internal/mypy/typeshed/stdlib/_heapq.pyi +18 -0
  534. package/bundle/_internal/mypy/typeshed/stdlib/_imp.pyi +30 -0
  535. package/bundle/_internal/mypy/typeshed/stdlib/_interpchannels.pyi +86 -0
  536. package/bundle/_internal/mypy/typeshed/stdlib/_interpqueues.pyi +31 -0
  537. package/bundle/_internal/mypy/typeshed/stdlib/_interpreters.pyi +68 -0
  538. package/bundle/_internal/mypy/typeshed/stdlib/_io.pyi +330 -0
  539. package/bundle/_internal/mypy/typeshed/stdlib/_json.pyi +59 -0
  540. package/bundle/_internal/mypy/typeshed/stdlib/_locale.pyi +121 -0
  541. package/bundle/_internal/mypy/typeshed/stdlib/_lsprof.pyi +34 -0
  542. package/bundle/_internal/mypy/typeshed/stdlib/_lzma.pyi +71 -0
  543. package/bundle/_internal/mypy/typeshed/stdlib/_markupbase.pyi +10 -0
  544. package/bundle/_internal/mypy/typeshed/stdlib/_msi.pyi +97 -0
  545. package/bundle/_internal/mypy/typeshed/stdlib/_multibytecodec.pyi +49 -0
  546. package/bundle/_internal/mypy/typeshed/stdlib/_operator.pyi +130 -0
  547. package/bundle/_internal/mypy/typeshed/stdlib/_osx_support.pyi +34 -0
  548. package/bundle/_internal/mypy/typeshed/stdlib/_pickle.pyi +114 -0
  549. package/bundle/_internal/mypy/typeshed/stdlib/_posixsubprocess.pyi +59 -0
  550. package/bundle/_internal/mypy/typeshed/stdlib/_py_abc.pyi +14 -0
  551. package/bundle/_internal/mypy/typeshed/stdlib/_pydecimal.pyi +50 -0
  552. package/bundle/_internal/mypy/typeshed/stdlib/_queue.pyi +18 -0
  553. package/bundle/_internal/mypy/typeshed/stdlib/_random.pyi +14 -0
  554. package/bundle/_internal/mypy/typeshed/stdlib/_remote_debugging.pyi +186 -0
  555. package/bundle/_internal/mypy/typeshed/stdlib/_sitebuiltins.pyi +18 -0
  556. package/bundle/_internal/mypy/typeshed/stdlib/_socket.pyi +966 -0
  557. package/bundle/_internal/mypy/typeshed/stdlib/_sqlite3.pyi +311 -0
  558. package/bundle/_internal/mypy/typeshed/stdlib/_ssl.pyi +303 -0
  559. package/bundle/_internal/mypy/typeshed/stdlib/_stat.pyi +119 -0
  560. package/bundle/_internal/mypy/typeshed/stdlib/_struct.pyi +24 -0
  561. package/bundle/_internal/mypy/typeshed/stdlib/_thread.pyi +125 -0
  562. package/bundle/_internal/mypy/typeshed/stdlib/_threading_local.pyi +24 -0
  563. package/bundle/_internal/mypy/typeshed/stdlib/_tkinter.pyi +156 -0
  564. package/bundle/_internal/mypy/typeshed/stdlib/_tracemalloc.pyi +13 -0
  565. package/bundle/_internal/mypy/typeshed/stdlib/_typeshed/README.md +34 -0
  566. package/bundle/_internal/mypy/typeshed/stdlib/_typeshed/__init__.pyi +415 -0
  567. package/bundle/_internal/mypy/typeshed/stdlib/_typeshed/_type_checker_internals.pyi +102 -0
  568. package/bundle/_internal/mypy/typeshed/stdlib/_typeshed/dbapi.pyi +36 -0
  569. package/bundle/_internal/mypy/typeshed/stdlib/_typeshed/importlib.pyi +18 -0
  570. package/bundle/_internal/mypy/typeshed/stdlib/_typeshed/wsgi.pyi +43 -0
  571. package/bundle/_internal/mypy/typeshed/stdlib/_typeshed/xml.pyi +9 -0
  572. package/bundle/_internal/mypy/typeshed/stdlib/_warnings.pyi +54 -0
  573. package/bundle/_internal/mypy/typeshed/stdlib/_weakref.pyi +15 -0
  574. package/bundle/_internal/mypy/typeshed/stdlib/_weakrefset.pyi +49 -0
  575. package/bundle/_internal/mypy/typeshed/stdlib/_winapi.pyi +319 -0
  576. package/bundle/_internal/mypy/typeshed/stdlib/_zstd.pyi +102 -0
  577. package/bundle/_internal/mypy/typeshed/stdlib/abc.pyi +50 -0
  578. package/bundle/_internal/mypy/typeshed/stdlib/aifc.pyi +79 -0
  579. package/bundle/_internal/mypy/typeshed/stdlib/annotationlib.pyi +156 -0
  580. package/bundle/_internal/mypy/typeshed/stdlib/antigravity.pyi +3 -0
  581. package/bundle/_internal/mypy/typeshed/stdlib/argparse.pyi +866 -0
  582. package/bundle/_internal/mypy/typeshed/stdlib/array.pyi +113 -0
  583. package/bundle/_internal/mypy/typeshed/stdlib/ast.pyi +2199 -0
  584. package/bundle/_internal/mypy/typeshed/stdlib/asynchat.pyi +21 -0
  585. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/__init__.pyi +1022 -0
  586. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/base_events.pyi +607 -0
  587. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/base_futures.pyi +17 -0
  588. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/base_subprocess.pyi +62 -0
  589. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/base_tasks.pyi +17 -0
  590. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/constants.pyi +20 -0
  591. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/coroutines.pyi +45 -0
  592. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/events.pyi +803 -0
  593. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/exceptions.pyi +44 -0
  594. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/format_helpers.pyi +31 -0
  595. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/futures.pyi +19 -0
  596. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/graph.pyi +29 -0
  597. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/locks.pyi +83 -0
  598. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/log.pyi +3 -0
  599. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/mixins.pyi +9 -0
  600. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/proactor_events.pyi +53 -0
  601. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/protocols.pyi +39 -0
  602. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/queues.pyi +45 -0
  603. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/runners.pyi +41 -0
  604. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/selector_events.pyi +10 -0
  605. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/sslproto.pyi +164 -0
  606. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/staggered.pyi +10 -0
  607. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/streams.pyi +124 -0
  608. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/subprocess.pyi +166 -0
  609. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/taskgroups.pyi +41 -0
  610. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/tasks.pyi +315 -0
  611. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/threads.pyi +9 -0
  612. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/timeouts.pyi +20 -0
  613. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/tools.pyi +51 -0
  614. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/transports.pyi +57 -0
  615. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/trsock.pyi +137 -0
  616. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/unix_events.pyi +277 -0
  617. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/windows_events.pyi +122 -0
  618. package/bundle/_internal/mypy/typeshed/stdlib/asyncio/windows_utils.pyi +49 -0
  619. package/bundle/_internal/mypy/typeshed/stdlib/asyncore.pyi +91 -0
  620. package/bundle/_internal/mypy/typeshed/stdlib/atexit.pyi +11 -0
  621. package/bundle/_internal/mypy/typeshed/stdlib/audioop.pyi +44 -0
  622. package/bundle/_internal/mypy/typeshed/stdlib/base64.pyi +124 -0
  623. package/bundle/_internal/mypy/typeshed/stdlib/bdb.pyi +139 -0
  624. package/bundle/_internal/mypy/typeshed/stdlib/binascii.pyi +102 -0
  625. package/bundle/_internal/mypy/typeshed/stdlib/binhex.pyi +44 -0
  626. package/bundle/_internal/mypy/typeshed/stdlib/bisect.pyi +4 -0
  627. package/bundle/_internal/mypy/typeshed/stdlib/builtins.pyi +2470 -0
  628. package/bundle/_internal/mypy/typeshed/stdlib/bz2.pyi +121 -0
  629. package/bundle/_internal/mypy/typeshed/stdlib/cProfile.pyi +33 -0
  630. package/bundle/_internal/mypy/typeshed/stdlib/calendar.pyi +249 -0
  631. package/bundle/_internal/mypy/typeshed/stdlib/cgi.pyi +120 -0
  632. package/bundle/_internal/mypy/typeshed/stdlib/cgitb.pyi +32 -0
  633. package/bundle/_internal/mypy/typeshed/stdlib/chunk.pyi +20 -0
  634. package/bundle/_internal/mypy/typeshed/stdlib/cmath.pyi +36 -0
  635. package/bundle/_internal/mypy/typeshed/stdlib/cmd.pyi +46 -0
  636. package/bundle/_internal/mypy/typeshed/stdlib/code.pyi +55 -0
  637. package/bundle/_internal/mypy/typeshed/stdlib/codecs.pyi +357 -0
  638. package/bundle/_internal/mypy/typeshed/stdlib/codeop.pyi +21 -0
  639. package/bundle/_internal/mypy/typeshed/stdlib/collections/__init__.pyi +565 -0
  640. package/bundle/_internal/mypy/typeshed/stdlib/collections/abc.pyi +2 -0
  641. package/bundle/_internal/mypy/typeshed/stdlib/colorsys.pyi +15 -0
  642. package/bundle/_internal/mypy/typeshed/stdlib/compileall.pyi +51 -0
  643. package/bundle/_internal/mypy/typeshed/stdlib/compression/__init__.pyi +0 -0
  644. package/bundle/_internal/mypy/typeshed/stdlib/compression/_common/__init__.pyi +0 -0
  645. package/bundle/_internal/mypy/typeshed/stdlib/compression/_common/_streams.pyi +37 -0
  646. package/bundle/_internal/mypy/typeshed/stdlib/compression/bz2.pyi +1 -0
  647. package/bundle/_internal/mypy/typeshed/stdlib/compression/gzip.pyi +1 -0
  648. package/bundle/_internal/mypy/typeshed/stdlib/compression/lzma.pyi +1 -0
  649. package/bundle/_internal/mypy/typeshed/stdlib/compression/zlib.pyi +1 -0
  650. package/bundle/_internal/mypy/typeshed/stdlib/compression/zstd/__init__.pyi +94 -0
  651. package/bundle/_internal/mypy/typeshed/stdlib/compression/zstd/_zstdfile.pyi +117 -0
  652. package/bundle/_internal/mypy/typeshed/stdlib/concurrent/__init__.pyi +0 -0
  653. package/bundle/_internal/mypy/typeshed/stdlib/concurrent/futures/__init__.pyi +71 -0
  654. package/bundle/_internal/mypy/typeshed/stdlib/concurrent/futures/_base.pyi +119 -0
  655. package/bundle/_internal/mypy/typeshed/stdlib/concurrent/futures/interpreter.pyi +82 -0
  656. package/bundle/_internal/mypy/typeshed/stdlib/concurrent/futures/process.pyi +248 -0
  657. package/bundle/_internal/mypy/typeshed/stdlib/concurrent/futures/thread.pyi +143 -0
  658. package/bundle/_internal/mypy/typeshed/stdlib/concurrent/interpreters/__init__.pyi +68 -0
  659. package/bundle/_internal/mypy/typeshed/stdlib/concurrent/interpreters/_crossinterp.pyi +30 -0
  660. package/bundle/_internal/mypy/typeshed/stdlib/concurrent/interpreters/_queues.pyi +74 -0
  661. package/bundle/_internal/mypy/typeshed/stdlib/configparser.pyi +509 -0
  662. package/bundle/_internal/mypy/typeshed/stdlib/contextlib.pyi +211 -0
  663. package/bundle/_internal/mypy/typeshed/stdlib/contextvars.pyi +3 -0
  664. package/bundle/_internal/mypy/typeshed/stdlib/copy.pyi +37 -0
  665. package/bundle/_internal/mypy/typeshed/stdlib/copyreg.pyi +20 -0
  666. package/bundle/_internal/mypy/typeshed/stdlib/crypt.pyi +26 -0
  667. package/bundle/_internal/mypy/typeshed/stdlib/csv.pyi +153 -0
  668. package/bundle/_internal/mypy/typeshed/stdlib/ctypes/__init__.pyi +394 -0
  669. package/bundle/_internal/mypy/typeshed/stdlib/ctypes/_endian.pyi +16 -0
  670. package/bundle/_internal/mypy/typeshed/stdlib/ctypes/macholib/__init__.pyi +3 -0
  671. package/bundle/_internal/mypy/typeshed/stdlib/ctypes/macholib/dyld.pyi +8 -0
  672. package/bundle/_internal/mypy/typeshed/stdlib/ctypes/macholib/dylib.pyi +14 -0
  673. package/bundle/_internal/mypy/typeshed/stdlib/ctypes/macholib/framework.pyi +14 -0
  674. package/bundle/_internal/mypy/typeshed/stdlib/ctypes/util.pyi +11 -0
  675. package/bundle/_internal/mypy/typeshed/stdlib/ctypes/wintypes.pyi +321 -0
  676. package/bundle/_internal/mypy/typeshed/stdlib/curses/__init__.pyi +38 -0
  677. package/bundle/_internal/mypy/typeshed/stdlib/curses/ascii.pyi +62 -0
  678. package/bundle/_internal/mypy/typeshed/stdlib/curses/has_key.pyi +1 -0
  679. package/bundle/_internal/mypy/typeshed/stdlib/curses/panel.pyi +1 -0
  680. package/bundle/_internal/mypy/typeshed/stdlib/curses/textpad.pyi +11 -0
  681. package/bundle/_internal/mypy/typeshed/stdlib/dataclasses.pyi +401 -0
  682. package/bundle/_internal/mypy/typeshed/stdlib/datetime.pyi +381 -0
  683. package/bundle/_internal/mypy/typeshed/stdlib/dbm/__init__.pyi +105 -0
  684. package/bundle/_internal/mypy/typeshed/stdlib/dbm/dumb.pyi +41 -0
  685. package/bundle/_internal/mypy/typeshed/stdlib/dbm/gnu.pyi +1 -0
  686. package/bundle/_internal/mypy/typeshed/stdlib/dbm/ndbm.pyi +1 -0
  687. package/bundle/_internal/mypy/typeshed/stdlib/dbm/sqlite3.pyi +34 -0
  688. package/bundle/_internal/mypy/typeshed/stdlib/decimal.pyi +278 -0
  689. package/bundle/_internal/mypy/typeshed/stdlib/difflib.pyi +157 -0
  690. package/bundle/_internal/mypy/typeshed/stdlib/dis.pyi +302 -0
  691. package/bundle/_internal/mypy/typeshed/stdlib/distutils/__init__.pyi +5 -0
  692. package/bundle/_internal/mypy/typeshed/stdlib/distutils/_msvccompiler.pyi +13 -0
  693. package/bundle/_internal/mypy/typeshed/stdlib/distutils/archive_util.pyi +36 -0
  694. package/bundle/_internal/mypy/typeshed/stdlib/distutils/bcppcompiler.pyi +3 -0
  695. package/bundle/_internal/mypy/typeshed/stdlib/distutils/ccompiler.pyi +182 -0
  696. package/bundle/_internal/mypy/typeshed/stdlib/distutils/cmd.pyi +238 -0
  697. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/__init__.pyi +41 -0
  698. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/bdist.pyi +27 -0
  699. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/bdist_dumb.pyi +22 -0
  700. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/bdist_msi.pyi +45 -0
  701. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/bdist_packager.pyi +0 -0
  702. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/bdist_rpm.pyi +53 -0
  703. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/build.pyi +34 -0
  704. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/build_clib.pyi +29 -0
  705. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/build_ext.pyi +52 -0
  706. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/build_py.pyi +45 -0
  707. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/build_scripts.pyi +25 -0
  708. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/check.pyi +39 -0
  709. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/clean.pyi +18 -0
  710. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/config.pyi +84 -0
  711. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/install.pyi +67 -0
  712. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/install_data.pyi +20 -0
  713. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/install_egg_info.pyi +19 -0
  714. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/install_headers.pyi +17 -0
  715. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/install_lib.pyi +26 -0
  716. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/install_scripts.pyi +19 -0
  717. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/register.pyi +20 -0
  718. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/sdist.pyi +45 -0
  719. package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/upload.pyi +18 -0
  720. package/bundle/_internal/mypy/typeshed/stdlib/distutils/config.pyi +17 -0
  721. package/bundle/_internal/mypy/typeshed/stdlib/distutils/core.pyi +58 -0
  722. package/bundle/_internal/mypy/typeshed/stdlib/distutils/cygwinccompiler.pyi +20 -0
  723. package/bundle/_internal/mypy/typeshed/stdlib/distutils/debug.pyi +3 -0
  724. package/bundle/_internal/mypy/typeshed/stdlib/distutils/dep_util.pyi +14 -0
  725. package/bundle/_internal/mypy/typeshed/stdlib/distutils/dir_util.pyi +23 -0
  726. package/bundle/_internal/mypy/typeshed/stdlib/distutils/dist.pyi +318 -0
  727. package/bundle/_internal/mypy/typeshed/stdlib/distutils/errors.pyi +19 -0
  728. package/bundle/_internal/mypy/typeshed/stdlib/distutils/extension.pyi +36 -0
  729. package/bundle/_internal/mypy/typeshed/stdlib/distutils/fancy_getopt.pyi +45 -0
  730. package/bundle/_internal/mypy/typeshed/stdlib/distutils/file_util.pyi +40 -0
  731. package/bundle/_internal/mypy/typeshed/stdlib/distutils/filelist.pyi +61 -0
  732. package/bundle/_internal/mypy/typeshed/stdlib/distutils/log.pyi +26 -0
  733. package/bundle/_internal/mypy/typeshed/stdlib/distutils/msvccompiler.pyi +3 -0
  734. package/bundle/_internal/mypy/typeshed/stdlib/distutils/spawn.pyi +10 -0
  735. package/bundle/_internal/mypy/typeshed/stdlib/distutils/sysconfig.pyi +32 -0
  736. package/bundle/_internal/mypy/typeshed/stdlib/distutils/text_file.pyi +21 -0
  737. package/bundle/_internal/mypy/typeshed/stdlib/distutils/unixccompiler.pyi +3 -0
  738. package/bundle/_internal/mypy/typeshed/stdlib/distutils/util.pyi +53 -0
  739. package/bundle/_internal/mypy/typeshed/stdlib/distutils/version.pyi +36 -0
  740. package/bundle/_internal/mypy/typeshed/stdlib/doctest.pyi +265 -0
  741. package/bundle/_internal/mypy/typeshed/stdlib/email/__init__.pyi +68 -0
  742. package/bundle/_internal/mypy/typeshed/stdlib/email/_header_value_parser.pyi +415 -0
  743. package/bundle/_internal/mypy/typeshed/stdlib/email/_policybase.pyi +80 -0
  744. package/bundle/_internal/mypy/typeshed/stdlib/email/base64mime.pyi +13 -0
  745. package/bundle/_internal/mypy/typeshed/stdlib/email/charset.pyi +44 -0
  746. package/bundle/_internal/mypy/typeshed/stdlib/email/contentmanager.pyi +11 -0
  747. package/bundle/_internal/mypy/typeshed/stdlib/email/encoders.pyi +8 -0
  748. package/bundle/_internal/mypy/typeshed/stdlib/email/errors.pyi +38 -0
  749. package/bundle/_internal/mypy/typeshed/stdlib/email/feedparser.pyi +24 -0
  750. package/bundle/_internal/mypy/typeshed/stdlib/email/generator.pyi +79 -0
  751. package/bundle/_internal/mypy/typeshed/stdlib/email/header.pyi +32 -0
  752. package/bundle/_internal/mypy/typeshed/stdlib/email/headerregistry.pyi +196 -0
  753. package/bundle/_internal/mypy/typeshed/stdlib/email/iterators.pyi +15 -0
  754. package/bundle/_internal/mypy/typeshed/stdlib/email/message.pyi +191 -0
  755. package/bundle/_internal/mypy/typeshed/stdlib/email/mime/__init__.pyi +0 -0
  756. package/bundle/_internal/mypy/typeshed/stdlib/email/mime/application.pyi +17 -0
  757. package/bundle/_internal/mypy/typeshed/stdlib/email/mime/audio.pyi +17 -0
  758. package/bundle/_internal/mypy/typeshed/stdlib/email/mime/base.pyi +8 -0
  759. package/bundle/_internal/mypy/typeshed/stdlib/email/mime/image.pyi +17 -0
  760. package/bundle/_internal/mypy/typeshed/stdlib/email/mime/message.pyi +8 -0
  761. package/bundle/_internal/mypy/typeshed/stdlib/email/mime/multipart.pyi +18 -0
  762. package/bundle/_internal/mypy/typeshed/stdlib/email/mime/nonmultipart.pyi +5 -0
  763. package/bundle/_internal/mypy/typeshed/stdlib/email/mime/text.pyi +9 -0
  764. package/bundle/_internal/mypy/typeshed/stdlib/email/parser.pyi +42 -0
  765. package/bundle/_internal/mypy/typeshed/stdlib/email/policy.pyi +78 -0
  766. package/bundle/_internal/mypy/typeshed/stdlib/email/quoprimime.pyi +28 -0
  767. package/bundle/_internal/mypy/typeshed/stdlib/email/utils.pyi +72 -0
  768. package/bundle/_internal/mypy/typeshed/stdlib/encodings/__init__.pyi +15 -0
  769. package/bundle/_internal/mypy/typeshed/stdlib/encodings/aliases.pyi +1 -0
  770. package/bundle/_internal/mypy/typeshed/stdlib/encodings/ascii.pyi +30 -0
  771. package/bundle/_internal/mypy/typeshed/stdlib/encodings/base64_codec.pyi +26 -0
  772. package/bundle/_internal/mypy/typeshed/stdlib/encodings/big5.pyi +23 -0
  773. package/bundle/_internal/mypy/typeshed/stdlib/encodings/big5hkscs.pyi +23 -0
  774. package/bundle/_internal/mypy/typeshed/stdlib/encodings/bz2_codec.pyi +26 -0
  775. package/bundle/_internal/mypy/typeshed/stdlib/encodings/charmap.pyi +33 -0
  776. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp037.pyi +21 -0
  777. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1006.pyi +21 -0
  778. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1026.pyi +21 -0
  779. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1125.pyi +21 -0
  780. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1140.pyi +21 -0
  781. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1250.pyi +21 -0
  782. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1251.pyi +21 -0
  783. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1252.pyi +21 -0
  784. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1253.pyi +21 -0
  785. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1254.pyi +21 -0
  786. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1255.pyi +21 -0
  787. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1256.pyi +21 -0
  788. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1257.pyi +21 -0
  789. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1258.pyi +21 -0
  790. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp273.pyi +21 -0
  791. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp424.pyi +21 -0
  792. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp437.pyi +21 -0
  793. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp500.pyi +21 -0
  794. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp720.pyi +21 -0
  795. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp737.pyi +21 -0
  796. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp775.pyi +21 -0
  797. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp850.pyi +21 -0
  798. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp852.pyi +21 -0
  799. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp855.pyi +21 -0
  800. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp856.pyi +21 -0
  801. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp857.pyi +21 -0
  802. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp858.pyi +21 -0
  803. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp860.pyi +21 -0
  804. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp861.pyi +21 -0
  805. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp862.pyi +21 -0
  806. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp863.pyi +21 -0
  807. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp864.pyi +21 -0
  808. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp865.pyi +21 -0
  809. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp866.pyi +21 -0
  810. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp869.pyi +21 -0
  811. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp874.pyi +21 -0
  812. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp875.pyi +21 -0
  813. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp932.pyi +23 -0
  814. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp949.pyi +23 -0
  815. package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp950.pyi +23 -0
  816. package/bundle/_internal/mypy/typeshed/stdlib/encodings/euc_jis_2004.pyi +23 -0
  817. package/bundle/_internal/mypy/typeshed/stdlib/encodings/euc_jisx0213.pyi +23 -0
  818. package/bundle/_internal/mypy/typeshed/stdlib/encodings/euc_jp.pyi +23 -0
  819. package/bundle/_internal/mypy/typeshed/stdlib/encodings/euc_kr.pyi +23 -0
  820. package/bundle/_internal/mypy/typeshed/stdlib/encodings/gb18030.pyi +23 -0
  821. package/bundle/_internal/mypy/typeshed/stdlib/encodings/gb2312.pyi +23 -0
  822. package/bundle/_internal/mypy/typeshed/stdlib/encodings/gbk.pyi +23 -0
  823. package/bundle/_internal/mypy/typeshed/stdlib/encodings/hex_codec.pyi +26 -0
  824. package/bundle/_internal/mypy/typeshed/stdlib/encodings/hp_roman8.pyi +21 -0
  825. package/bundle/_internal/mypy/typeshed/stdlib/encodings/hz.pyi +23 -0
  826. package/bundle/_internal/mypy/typeshed/stdlib/encodings/idna.pyi +26 -0
  827. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso2022_jp.pyi +23 -0
  828. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso2022_jp_1.pyi +23 -0
  829. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso2022_jp_2.pyi +23 -0
  830. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso2022_jp_2004.pyi +23 -0
  831. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso2022_jp_3.pyi +23 -0
  832. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso2022_jp_ext.pyi +23 -0
  833. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso2022_kr.pyi +23 -0
  834. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_1.pyi +21 -0
  835. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_10.pyi +21 -0
  836. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_11.pyi +21 -0
  837. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_13.pyi +21 -0
  838. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_14.pyi +21 -0
  839. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_15.pyi +21 -0
  840. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_16.pyi +21 -0
  841. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_2.pyi +21 -0
  842. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_3.pyi +21 -0
  843. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_4.pyi +21 -0
  844. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_5.pyi +21 -0
  845. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_6.pyi +21 -0
  846. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_7.pyi +21 -0
  847. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_8.pyi +21 -0
  848. package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_9.pyi +21 -0
  849. package/bundle/_internal/mypy/typeshed/stdlib/encodings/johab.pyi +23 -0
  850. package/bundle/_internal/mypy/typeshed/stdlib/encodings/koi8_r.pyi +21 -0
  851. package/bundle/_internal/mypy/typeshed/stdlib/encodings/koi8_t.pyi +21 -0
  852. package/bundle/_internal/mypy/typeshed/stdlib/encodings/koi8_u.pyi +21 -0
  853. package/bundle/_internal/mypy/typeshed/stdlib/encodings/kz1048.pyi +21 -0
  854. package/bundle/_internal/mypy/typeshed/stdlib/encodings/latin_1.pyi +30 -0
  855. package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_arabic.pyi +21 -0
  856. package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_croatian.pyi +21 -0
  857. package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_cyrillic.pyi +21 -0
  858. package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_farsi.pyi +21 -0
  859. package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_greek.pyi +21 -0
  860. package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_iceland.pyi +21 -0
  861. package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_latin2.pyi +21 -0
  862. package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_roman.pyi +21 -0
  863. package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_romanian.pyi +21 -0
  864. package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_turkish.pyi +21 -0
  865. package/bundle/_internal/mypy/typeshed/stdlib/encodings/mbcs.pyi +28 -0
  866. package/bundle/_internal/mypy/typeshed/stdlib/encodings/oem.pyi +28 -0
  867. package/bundle/_internal/mypy/typeshed/stdlib/encodings/palmos.pyi +21 -0
  868. package/bundle/_internal/mypy/typeshed/stdlib/encodings/ptcp154.pyi +21 -0
  869. package/bundle/_internal/mypy/typeshed/stdlib/encodings/punycode.pyi +33 -0
  870. package/bundle/_internal/mypy/typeshed/stdlib/encodings/quopri_codec.pyi +26 -0
  871. package/bundle/_internal/mypy/typeshed/stdlib/encodings/raw_unicode_escape.pyi +23 -0
  872. package/bundle/_internal/mypy/typeshed/stdlib/encodings/rot_13.pyi +23 -0
  873. package/bundle/_internal/mypy/typeshed/stdlib/encodings/shift_jis.pyi +23 -0
  874. package/bundle/_internal/mypy/typeshed/stdlib/encodings/shift_jis_2004.pyi +23 -0
  875. package/bundle/_internal/mypy/typeshed/stdlib/encodings/shift_jisx0213.pyi +23 -0
  876. package/bundle/_internal/mypy/typeshed/stdlib/encodings/tis_620.pyi +21 -0
  877. package/bundle/_internal/mypy/typeshed/stdlib/encodings/undefined.pyi +20 -0
  878. package/bundle/_internal/mypy/typeshed/stdlib/encodings/unicode_escape.pyi +23 -0
  879. package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_16.pyi +20 -0
  880. package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_16_be.pyi +26 -0
  881. package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_16_le.pyi +26 -0
  882. package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_32.pyi +20 -0
  883. package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_32_be.pyi +26 -0
  884. package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_32_le.pyi +26 -0
  885. package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_7.pyi +26 -0
  886. package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_8.pyi +26 -0
  887. package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_8_sig.pyi +22 -0
  888. package/bundle/_internal/mypy/typeshed/stdlib/encodings/uu_codec.pyi +28 -0
  889. package/bundle/_internal/mypy/typeshed/stdlib/encodings/zlib_codec.pyi +26 -0
  890. package/bundle/_internal/mypy/typeshed/stdlib/ensurepip/__init__.pyi +12 -0
  891. package/bundle/_internal/mypy/typeshed/stdlib/enum.pyi +374 -0
  892. package/bundle/_internal/mypy/typeshed/stdlib/errno.pyi +227 -0
  893. package/bundle/_internal/mypy/typeshed/stdlib/faulthandler.pyi +61 -0
  894. package/bundle/_internal/mypy/typeshed/stdlib/fcntl.pyi +157 -0
  895. package/bundle/_internal/mypy/typeshed/stdlib/filecmp.pyi +65 -0
  896. package/bundle/_internal/mypy/typeshed/stdlib/fileinput.pyi +141 -0
  897. package/bundle/_internal/mypy/typeshed/stdlib/fnmatch.pyi +16 -0
  898. package/bundle/_internal/mypy/typeshed/stdlib/fractions.pyi +185 -0
  899. package/bundle/_internal/mypy/typeshed/stdlib/ftplib.pyi +174 -0
  900. package/bundle/_internal/mypy/typeshed/stdlib/functools.pyi +287 -0
  901. package/bundle/_internal/mypy/typeshed/stdlib/gc.pyi +32 -0
  902. package/bundle/_internal/mypy/typeshed/stdlib/genericpath.pyi +98 -0
  903. package/bundle/_internal/mypy/typeshed/stdlib/getopt.pyi +27 -0
  904. package/bundle/_internal/mypy/typeshed/stdlib/getpass.pyi +14 -0
  905. package/bundle/_internal/mypy/typeshed/stdlib/gettext.pyi +190 -0
  906. package/bundle/_internal/mypy/typeshed/stdlib/glob.pyi +50 -0
  907. package/bundle/_internal/mypy/typeshed/stdlib/graphlib.pyi +29 -0
  908. package/bundle/_internal/mypy/typeshed/stdlib/grp.pyi +21 -0
  909. package/bundle/_internal/mypy/typeshed/stdlib/gzip.pyi +181 -0
  910. package/bundle/_internal/mypy/typeshed/stdlib/hashlib.pyi +112 -0
  911. package/bundle/_internal/mypy/typeshed/stdlib/heapq.pyi +32 -0
  912. package/bundle/_internal/mypy/typeshed/stdlib/hmac.pyi +33 -0
  913. package/bundle/_internal/mypy/typeshed/stdlib/html/__init__.pyi +7 -0
  914. package/bundle/_internal/mypy/typeshed/stdlib/html/entities.pyi +8 -0
  915. package/bundle/_internal/mypy/typeshed/stdlib/html/parser.pyi +40 -0
  916. package/bundle/_internal/mypy/typeshed/stdlib/http/__init__.pyi +118 -0
  917. package/bundle/_internal/mypy/typeshed/stdlib/http/client.pyi +318 -0
  918. package/bundle/_internal/mypy/typeshed/stdlib/http/cookiejar.pyi +158 -0
  919. package/bundle/_internal/mypy/typeshed/stdlib/http/cookies.pyi +57 -0
  920. package/bundle/_internal/mypy/typeshed/stdlib/http/server.pyi +139 -0
  921. package/bundle/_internal/mypy/typeshed/stdlib/imaplib.pyi +212 -0
  922. package/bundle/_internal/mypy/typeshed/stdlib/imghdr.pyi +18 -0
  923. package/bundle/_internal/mypy/typeshed/stdlib/imp.pyi +63 -0
  924. package/bundle/_internal/mypy/typeshed/stdlib/importlib/__init__.pyi +17 -0
  925. package/bundle/_internal/mypy/typeshed/stdlib/importlib/_abc.pyi +21 -0
  926. package/bundle/_internal/mypy/typeshed/stdlib/importlib/_bootstrap.pyi +2 -0
  927. package/bundle/_internal/mypy/typeshed/stdlib/importlib/_bootstrap_external.pyi +2 -0
  928. package/bundle/_internal/mypy/typeshed/stdlib/importlib/abc.pyi +165 -0
  929. package/bundle/_internal/mypy/typeshed/stdlib/importlib/machinery.pyi +43 -0
  930. package/bundle/_internal/mypy/typeshed/stdlib/importlib/metadata/__init__.pyi +310 -0
  931. package/bundle/_internal/mypy/typeshed/stdlib/importlib/metadata/_meta.pyi +65 -0
  932. package/bundle/_internal/mypy/typeshed/stdlib/importlib/metadata/diagnose.pyi +2 -0
  933. package/bundle/_internal/mypy/typeshed/stdlib/importlib/readers.pyi +69 -0
  934. package/bundle/_internal/mypy/typeshed/stdlib/importlib/resources/__init__.pyi +81 -0
  935. package/bundle/_internal/mypy/typeshed/stdlib/importlib/resources/_common.pyi +48 -0
  936. package/bundle/_internal/mypy/typeshed/stdlib/importlib/resources/_functional.pyi +35 -0
  937. package/bundle/_internal/mypy/typeshed/stdlib/importlib/resources/abc.pyi +64 -0
  938. package/bundle/_internal/mypy/typeshed/stdlib/importlib/resources/readers.pyi +14 -0
  939. package/bundle/_internal/mypy/typeshed/stdlib/importlib/resources/simple.pyi +59 -0
  940. package/bundle/_internal/mypy/typeshed/stdlib/importlib/simple.pyi +11 -0
  941. package/bundle/_internal/mypy/typeshed/stdlib/importlib/util.pyi +75 -0
  942. package/bundle/_internal/mypy/typeshed/stdlib/inspect.pyi +749 -0
  943. package/bundle/_internal/mypy/typeshed/stdlib/io.pyi +75 -0
  944. package/bundle/_internal/mypy/typeshed/stdlib/ipaddress.pyi +249 -0
  945. package/bundle/_internal/mypy/typeshed/stdlib/itertools.pyi +376 -0
  946. package/bundle/_internal/mypy/typeshed/stdlib/json/__init__.pyi +93 -0
  947. package/bundle/_internal/mypy/typeshed/stdlib/json/decoder.pyi +50 -0
  948. package/bundle/_internal/mypy/typeshed/stdlib/json/encoder.pyi +40 -0
  949. package/bundle/_internal/mypy/typeshed/stdlib/json/scanner.pyi +7 -0
  950. package/bundle/_internal/mypy/typeshed/stdlib/json/tool.pyi +1 -0
  951. package/bundle/_internal/mypy/typeshed/stdlib/keyword.pyi +16 -0
  952. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/__init__.pyi +0 -0
  953. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/btm_matcher.pyi +28 -0
  954. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixer_base.pyi +42 -0
  955. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/__init__.pyi +0 -0
  956. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_apply.pyi +8 -0
  957. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_asserts.pyi +10 -0
  958. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_basestring.pyi +8 -0
  959. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_buffer.pyi +8 -0
  960. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_dict.pyi +16 -0
  961. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_except.pyi +14 -0
  962. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_exec.pyi +8 -0
  963. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_execfile.pyi +8 -0
  964. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_exitfunc.pyi +13 -0
  965. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_filter.pyi +9 -0
  966. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_funcattrs.pyi +8 -0
  967. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_future.pyi +8 -0
  968. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_getcwdu.pyi +8 -0
  969. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_has_key.pyi +8 -0
  970. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_idioms.pyi +15 -0
  971. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_import.pyi +16 -0
  972. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_imports.pyi +21 -0
  973. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_imports2.pyi +8 -0
  974. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_input.pyi +11 -0
  975. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_intern.pyi +9 -0
  976. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_isinstance.pyi +8 -0
  977. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_itertools.pyi +9 -0
  978. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_itertools_imports.pyi +7 -0
  979. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_long.pyi +7 -0
  980. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_map.pyi +9 -0
  981. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_metaclass.pyi +17 -0
  982. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_methodattrs.pyi +10 -0
  983. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_ne.pyi +8 -0
  984. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_next.pyi +19 -0
  985. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_nonzero.pyi +8 -0
  986. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_numliterals.pyi +8 -0
  987. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_operator.pyi +12 -0
  988. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_paren.pyi +8 -0
  989. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_print.pyi +12 -0
  990. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_raise.pyi +8 -0
  991. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_raw_input.pyi +8 -0
  992. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_reduce.pyi +8 -0
  993. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_reload.pyi +9 -0
  994. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_renames.pyi +17 -0
  995. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_repr.pyi +8 -0
  996. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_set_literal.pyi +7 -0
  997. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_standarderror.pyi +8 -0
  998. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_sys_exc.pyi +9 -0
  999. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_throw.pyi +8 -0
  1000. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_tuple_params.pyi +16 -0
  1001. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_types.pyi +8 -0
  1002. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_unicode.pyi +12 -0
  1003. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_urllib.pyi +15 -0
  1004. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_ws_comma.pyi +12 -0
  1005. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_xrange.pyi +20 -0
  1006. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_xreadlines.pyi +8 -0
  1007. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_zip.pyi +9 -0
  1008. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/main.pyi +42 -0
  1009. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pgen2/__init__.pyi +8 -0
  1010. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pgen2/driver.pyi +27 -0
  1011. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pgen2/grammar.pyi +25 -0
  1012. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pgen2/literals.pyi +7 -0
  1013. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pgen2/parse.pyi +30 -0
  1014. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pgen2/pgen.pyi +53 -0
  1015. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pgen2/token.pyi +69 -0
  1016. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pgen2/tokenize.pyi +96 -0
  1017. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pygram.pyi +114 -0
  1018. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pytree.pyi +118 -0
  1019. package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/refactor.pyi +86 -0
  1020. package/bundle/_internal/mypy/typeshed/stdlib/linecache.pyi +18 -0
  1021. package/bundle/_internal/mypy/typeshed/stdlib/locale.pyi +160 -0
  1022. package/bundle/_internal/mypy/typeshed/stdlib/logging/__init__.pyi +674 -0
  1023. package/bundle/_internal/mypy/typeshed/stdlib/logging/config.pyi +141 -0
  1024. package/bundle/_internal/mypy/typeshed/stdlib/logging/handlers.pyi +258 -0
  1025. package/bundle/_internal/mypy/typeshed/stdlib/lzma.pyi +181 -0
  1026. package/bundle/_internal/mypy/typeshed/stdlib/mailbox.pyi +307 -0
  1027. package/bundle/_internal/mypy/typeshed/stdlib/mailcap.pyi +11 -0
  1028. package/bundle/_internal/mypy/typeshed/stdlib/marshal.pyi +51 -0
  1029. package/bundle/_internal/mypy/typeshed/stdlib/math/__init__.pyi +157 -0
  1030. package/bundle/_internal/mypy/typeshed/stdlib/math/integer.pyi +8 -0
  1031. package/bundle/_internal/mypy/typeshed/stdlib/mimetypes.pyi +56 -0
  1032. package/bundle/_internal/mypy/typeshed/stdlib/mmap.pyi +191 -0
  1033. package/bundle/_internal/mypy/typeshed/stdlib/modulefinder.pyi +68 -0
  1034. package/bundle/_internal/mypy/typeshed/stdlib/msilib/__init__.pyi +177 -0
  1035. package/bundle/_internal/mypy/typeshed/stdlib/msilib/schema.pyi +95 -0
  1036. package/bundle/_internal/mypy/typeshed/stdlib/msilib/sequence.pyi +13 -0
  1037. package/bundle/_internal/mypy/typeshed/stdlib/msilib/text.pyi +8 -0
  1038. package/bundle/_internal/mypy/typeshed/stdlib/msvcrt.pyi +31 -0
  1039. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/__init__.pyi +90 -0
  1040. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/connection.pyi +97 -0
  1041. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/context.pyi +220 -0
  1042. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/dummy/__init__.pyi +89 -0
  1043. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/dummy/connection.pyi +39 -0
  1044. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/forkserver.pyi +78 -0
  1045. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/heap.pyi +41 -0
  1046. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/managers.pyi +390 -0
  1047. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/pool.pyi +101 -0
  1048. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/popen_fork.pyi +26 -0
  1049. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/popen_forkserver.pyi +16 -0
  1050. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/popen_spawn_posix.pyi +20 -0
  1051. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/popen_spawn_win32.pyi +30 -0
  1052. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/process.pyi +57 -0
  1053. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/queues.pyi +46 -0
  1054. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/reduction.pyi +95 -0
  1055. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/resource_sharer.pyi +20 -0
  1056. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/resource_tracker.pyi +21 -0
  1057. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/shared_memory.pyi +43 -0
  1058. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/sharedctypes.pyi +140 -0
  1059. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/spawn.pyi +32 -0
  1060. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/synchronize.pyi +63 -0
  1061. package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/util.pyi +109 -0
  1062. package/bundle/_internal/mypy/typeshed/stdlib/netrc.pyi +23 -0
  1063. package/bundle/_internal/mypy/typeshed/stdlib/nis.pyi +9 -0
  1064. package/bundle/_internal/mypy/typeshed/stdlib/nntplib.pyi +120 -0
  1065. package/bundle/_internal/mypy/typeshed/stdlib/nt.pyi +116 -0
  1066. package/bundle/_internal/mypy/typeshed/stdlib/ntpath.pyi +134 -0
  1067. package/bundle/_internal/mypy/typeshed/stdlib/nturl2path.pyi +6 -0
  1068. package/bundle/_internal/mypy/typeshed/stdlib/numbers.pyi +220 -0
  1069. package/bundle/_internal/mypy/typeshed/stdlib/opcode.pyi +53 -0
  1070. package/bundle/_internal/mypy/typeshed/stdlib/operator.pyi +219 -0
  1071. package/bundle/_internal/mypy/typeshed/stdlib/optparse.pyi +312 -0
  1072. package/bundle/_internal/mypy/typeshed/stdlib/os/__init__.pyi +1878 -0
  1073. package/bundle/_internal/mypy/typeshed/stdlib/os/path.pyi +8 -0
  1074. package/bundle/_internal/mypy/typeshed/stdlib/ossaudiodev.pyi +132 -0
  1075. package/bundle/_internal/mypy/typeshed/stdlib/pathlib/__init__.pyi +358 -0
  1076. package/bundle/_internal/mypy/typeshed/stdlib/pathlib/types.pyi +8 -0
  1077. package/bundle/_internal/mypy/typeshed/stdlib/pdb.pyi +275 -0
  1078. package/bundle/_internal/mypy/typeshed/stdlib/pickle.pyi +240 -0
  1079. package/bundle/_internal/mypy/typeshed/stdlib/pickletools.pyi +176 -0
  1080. package/bundle/_internal/mypy/typeshed/stdlib/pipes.pyi +16 -0
  1081. package/bundle/_internal/mypy/typeshed/stdlib/pkgutil.pyi +60 -0
  1082. package/bundle/_internal/mypy/typeshed/stdlib/platform.pyi +100 -0
  1083. package/bundle/_internal/mypy/typeshed/stdlib/plistlib.pyi +84 -0
  1084. package/bundle/_internal/mypy/typeshed/stdlib/poplib.pyi +93 -0
  1085. package/bundle/_internal/mypy/typeshed/stdlib/posix.pyi +427 -0
  1086. package/bundle/_internal/mypy/typeshed/stdlib/posixpath.pyi +230 -0
  1087. package/bundle/_internal/mypy/typeshed/stdlib/pprint.pyi +170 -0
  1088. package/bundle/_internal/mypy/typeshed/stdlib/profile.pyi +31 -0
  1089. package/bundle/_internal/mypy/typeshed/stdlib/profiling/__init__.pyi +3 -0
  1090. package/bundle/_internal/mypy/typeshed/stdlib/profiling/sampling/__init__.pyi +17 -0
  1091. package/bundle/_internal/mypy/typeshed/stdlib/profiling/sampling/collector.pyi +25 -0
  1092. package/bundle/_internal/mypy/typeshed/stdlib/profiling/sampling/gecko_collector.pyi +111 -0
  1093. package/bundle/_internal/mypy/typeshed/stdlib/profiling/sampling/heatmap_collector.pyi +24 -0
  1094. package/bundle/_internal/mypy/typeshed/stdlib/profiling/sampling/jsonl_collector.pyi +15 -0
  1095. package/bundle/_internal/mypy/typeshed/stdlib/profiling/sampling/pstats_collector.pyi +17 -0
  1096. package/bundle/_internal/mypy/typeshed/stdlib/profiling/sampling/stack_collector.pyi +40 -0
  1097. package/bundle/_internal/mypy/typeshed/stdlib/profiling/sampling/string_table.pyi +5 -0
  1098. package/bundle/_internal/mypy/typeshed/stdlib/profiling/tracing.pyi +9 -0
  1099. package/bundle/_internal/mypy/typeshed/stdlib/pstats.pyi +96 -0
  1100. package/bundle/_internal/mypy/typeshed/stdlib/pty.pyi +24 -0
  1101. package/bundle/_internal/mypy/typeshed/stdlib/pwd.pyi +27 -0
  1102. package/bundle/_internal/mypy/typeshed/stdlib/py_compile.pyi +28 -0
  1103. package/bundle/_internal/mypy/typeshed/stdlib/pyclbr.pyi +57 -0
  1104. package/bundle/_internal/mypy/typeshed/stdlib/pydoc.pyi +348 -0
  1105. package/bundle/_internal/mypy/typeshed/stdlib/pydoc_data/__init__.pyi +0 -0
  1106. package/bundle/_internal/mypy/typeshed/stdlib/pydoc_data/module_docs.pyi +3 -0
  1107. package/bundle/_internal/mypy/typeshed/stdlib/pydoc_data/topics.pyi +3 -0
  1108. package/bundle/_internal/mypy/typeshed/stdlib/pyexpat/__init__.pyi +88 -0
  1109. package/bundle/_internal/mypy/typeshed/stdlib/pyexpat/errors.pyi +53 -0
  1110. package/bundle/_internal/mypy/typeshed/stdlib/pyexpat/model.pyi +13 -0
  1111. package/bundle/_internal/mypy/typeshed/stdlib/queue.pyi +55 -0
  1112. package/bundle/_internal/mypy/typeshed/stdlib/quopri.pyi +12 -0
  1113. package/bundle/_internal/mypy/typeshed/stdlib/random.pyi +135 -0
  1114. package/bundle/_internal/mypy/typeshed/stdlib/re.pyi +347 -0
  1115. package/bundle/_internal/mypy/typeshed/stdlib/readline.pyi +39 -0
  1116. package/bundle/_internal/mypy/typeshed/stdlib/reprlib.pyi +64 -0
  1117. package/bundle/_internal/mypy/typeshed/stdlib/resource.pyi +102 -0
  1118. package/bundle/_internal/mypy/typeshed/stdlib/rlcompleter.pyi +9 -0
  1119. package/bundle/_internal/mypy/typeshed/stdlib/runpy.pyi +24 -0
  1120. package/bundle/_internal/mypy/typeshed/stdlib/sched.pyi +34 -0
  1121. package/bundle/_internal/mypy/typeshed/stdlib/secrets.pyi +17 -0
  1122. package/bundle/_internal/mypy/typeshed/stdlib/select.pyi +171 -0
  1123. package/bundle/_internal/mypy/typeshed/stdlib/selectors.pyi +67 -0
  1124. package/bundle/_internal/mypy/typeshed/stdlib/shelve.pyi +110 -0
  1125. package/bundle/_internal/mypy/typeshed/stdlib/shlex.pyi +63 -0
  1126. package/bundle/_internal/mypy/typeshed/stdlib/shutil.pyi +243 -0
  1127. package/bundle/_internal/mypy/typeshed/stdlib/signal.pyi +174 -0
  1128. package/bundle/_internal/mypy/typeshed/stdlib/site.pyi +46 -0
  1129. package/bundle/_internal/mypy/typeshed/stdlib/smtpd.pyi +92 -0
  1130. package/bundle/_internal/mypy/typeshed/stdlib/smtplib.pyi +223 -0
  1131. package/bundle/_internal/mypy/typeshed/stdlib/sndhdr.pyi +14 -0
  1132. package/bundle/_internal/mypy/typeshed/stdlib/socket.pyi +1587 -0
  1133. package/bundle/_internal/mypy/typeshed/stdlib/socketserver.pyi +170 -0
  1134. package/bundle/_internal/mypy/typeshed/stdlib/spwd.pyi +45 -0
  1135. package/bundle/_internal/mypy/typeshed/stdlib/sqlite3/__init__.pyi +510 -0
  1136. package/bundle/_internal/mypy/typeshed/stdlib/sqlite3/dbapi2.pyi +244 -0
  1137. package/bundle/_internal/mypy/typeshed/stdlib/sqlite3/dump.pyi +2 -0
  1138. package/bundle/_internal/mypy/typeshed/stdlib/sre_compile.pyi +12 -0
  1139. package/bundle/_internal/mypy/typeshed/stdlib/sre_constants.pyi +135 -0
  1140. package/bundle/_internal/mypy/typeshed/stdlib/sre_parse.pyi +102 -0
  1141. package/bundle/_internal/mypy/typeshed/stdlib/ssl.pyi +540 -0
  1142. package/bundle/_internal/mypy/typeshed/stdlib/stat.pyi +126 -0
  1143. package/bundle/_internal/mypy/typeshed/stdlib/statistics.pyi +161 -0
  1144. package/bundle/_internal/mypy/typeshed/stdlib/string/__init__.pyi +81 -0
  1145. package/bundle/_internal/mypy/typeshed/stdlib/string/templatelib.pyi +36 -0
  1146. package/bundle/_internal/mypy/typeshed/stdlib/stringprep.pyi +29 -0
  1147. package/bundle/_internal/mypy/typeshed/stdlib/struct.pyi +5 -0
  1148. package/bundle/_internal/mypy/typeshed/stdlib/subprocess.pyi +1484 -0
  1149. package/bundle/_internal/mypy/typeshed/stdlib/sunau.pyi +82 -0
  1150. package/bundle/_internal/mypy/typeshed/stdlib/symtable.pyi +95 -0
  1151. package/bundle/_internal/mypy/typeshed/stdlib/sys/__init__.pyi +538 -0
  1152. package/bundle/_internal/mypy/typeshed/stdlib/sys/__jit.pyi +11 -0
  1153. package/bundle/_internal/mypy/typeshed/stdlib/sys/_monitoring.pyi +69 -0
  1154. package/bundle/_internal/mypy/typeshed/stdlib/sysconfig.pyi +59 -0
  1155. package/bundle/_internal/mypy/typeshed/stdlib/syslog.pyi +58 -0
  1156. package/bundle/_internal/mypy/typeshed/stdlib/tabnanny.pyi +16 -0
  1157. package/bundle/_internal/mypy/typeshed/stdlib/tarfile.pyi +868 -0
  1158. package/bundle/_internal/mypy/typeshed/stdlib/telnetlib.pyi +123 -0
  1159. package/bundle/_internal/mypy/typeshed/stdlib/tempfile.pyi +474 -0
  1160. package/bundle/_internal/mypy/typeshed/stdlib/termios.pyi +303 -0
  1161. package/bundle/_internal/mypy/typeshed/stdlib/textwrap.pyi +103 -0
  1162. package/bundle/_internal/mypy/typeshed/stdlib/this.pyi +2 -0
  1163. package/bundle/_internal/mypy/typeshed/stdlib/threading.pyi +221 -0
  1164. package/bundle/_internal/mypy/typeshed/stdlib/time.pyi +117 -0
  1165. package/bundle/_internal/mypy/typeshed/stdlib/timeit.pyi +46 -0
  1166. package/bundle/_internal/mypy/typeshed/stdlib/tkinter/__init__.pyi +4376 -0
  1167. package/bundle/_internal/mypy/typeshed/stdlib/tkinter/colorchooser.pyi +12 -0
  1168. package/bundle/_internal/mypy/typeshed/stdlib/tkinter/commondialog.pyi +14 -0
  1169. package/bundle/_internal/mypy/typeshed/stdlib/tkinter/constants.pyi +80 -0
  1170. package/bundle/_internal/mypy/typeshed/stdlib/tkinter/dialog.pyi +13 -0
  1171. package/bundle/_internal/mypy/typeshed/stdlib/tkinter/dnd.pyi +19 -0
  1172. package/bundle/_internal/mypy/typeshed/stdlib/tkinter/filedialog.pyi +149 -0
  1173. package/bundle/_internal/mypy/typeshed/stdlib/tkinter/font.pyi +123 -0
  1174. package/bundle/_internal/mypy/typeshed/stdlib/tkinter/messagebox.pyi +98 -0
  1175. package/bundle/_internal/mypy/typeshed/stdlib/tkinter/scrolledtext.pyi +9 -0
  1176. package/bundle/_internal/mypy/typeshed/stdlib/tkinter/simpledialog.pyi +58 -0
  1177. package/bundle/_internal/mypy/typeshed/stdlib/tkinter/tix.pyi +299 -0
  1178. package/bundle/_internal/mypy/typeshed/stdlib/tkinter/ttk.pyi +1434 -0
  1179. package/bundle/_internal/mypy/typeshed/stdlib/token.pyi +166 -0
  1180. package/bundle/_internal/mypy/typeshed/stdlib/tokenize.pyi +201 -0
  1181. package/bundle/_internal/mypy/typeshed/stdlib/tomllib.pyi +27 -0
  1182. package/bundle/_internal/mypy/typeshed/stdlib/trace.pyi +85 -0
  1183. package/bundle/_internal/mypy/typeshed/stdlib/traceback.pyi +293 -0
  1184. package/bundle/_internal/mypy/typeshed/stdlib/tracemalloc.pyi +123 -0
  1185. package/bundle/_internal/mypy/typeshed/stdlib/tty.pyi +29 -0
  1186. package/bundle/_internal/mypy/typeshed/stdlib/turtle.pyi +856 -0
  1187. package/bundle/_internal/mypy/typeshed/stdlib/types.pyi +744 -0
  1188. package/bundle/_internal/mypy/typeshed/stdlib/typing.pyi +1250 -0
  1189. package/bundle/_internal/mypy/typeshed/stdlib/typing_extensions.pyi +749 -0
  1190. package/bundle/_internal/mypy/typeshed/stdlib/unicodedata.pyi +94 -0
  1191. package/bundle/_internal/mypy/typeshed/stdlib/unittest/__init__.pyi +63 -0
  1192. package/bundle/_internal/mypy/typeshed/stdlib/unittest/_log.pyi +29 -0
  1193. package/bundle/_internal/mypy/typeshed/stdlib/unittest/async_case.pyi +24 -0
  1194. package/bundle/_internal/mypy/typeshed/stdlib/unittest/case.pyi +352 -0
  1195. package/bundle/_internal/mypy/typeshed/stdlib/unittest/loader.pyi +55 -0
  1196. package/bundle/_internal/mypy/typeshed/stdlib/unittest/main.pyi +74 -0
  1197. package/bundle/_internal/mypy/typeshed/stdlib/unittest/mock.pyi +555 -0
  1198. package/bundle/_internal/mypy/typeshed/stdlib/unittest/result.pyi +46 -0
  1199. package/bundle/_internal/mypy/typeshed/stdlib/unittest/runner.pyi +93 -0
  1200. package/bundle/_internal/mypy/typeshed/stdlib/unittest/signals.pyi +15 -0
  1201. package/bundle/_internal/mypy/typeshed/stdlib/unittest/suite.pyi +23 -0
  1202. package/bundle/_internal/mypy/typeshed/stdlib/unittest/util.pyi +39 -0
  1203. package/bundle/_internal/mypy/typeshed/stdlib/urllib/__init__.pyi +0 -0
  1204. package/bundle/_internal/mypy/typeshed/stdlib/urllib/error.pyi +29 -0
  1205. package/bundle/_internal/mypy/typeshed/stdlib/urllib/parse.pyi +354 -0
  1206. package/bundle/_internal/mypy/typeshed/stdlib/urllib/request.pyi +447 -0
  1207. package/bundle/_internal/mypy/typeshed/stdlib/urllib/response.pyi +45 -0
  1208. package/bundle/_internal/mypy/typeshed/stdlib/urllib/robotparser.pyi +20 -0
  1209. package/bundle/_internal/mypy/typeshed/stdlib/uu.pyi +12 -0
  1210. package/bundle/_internal/mypy/typeshed/stdlib/uuid.pyi +106 -0
  1211. package/bundle/_internal/mypy/typeshed/stdlib/venv/__init__.pyi +86 -0
  1212. package/bundle/_internal/mypy/typeshed/stdlib/warnings.pyi +146 -0
  1213. package/bundle/_internal/mypy/typeshed/stdlib/wave.pyi +105 -0
  1214. package/bundle/_internal/mypy/typeshed/stdlib/weakref.pyi +217 -0
  1215. package/bundle/_internal/mypy/typeshed/stdlib/webbrowser.pyi +93 -0
  1216. package/bundle/_internal/mypy/typeshed/stdlib/winreg.pyi +137 -0
  1217. package/bundle/_internal/mypy/typeshed/stdlib/winsound.pyi +40 -0
  1218. package/bundle/_internal/mypy/typeshed/stdlib/wsgiref/__init__.pyi +0 -0
  1219. package/bundle/_internal/mypy/typeshed/stdlib/wsgiref/handlers.pyi +91 -0
  1220. package/bundle/_internal/mypy/typeshed/stdlib/wsgiref/headers.pyi +27 -0
  1221. package/bundle/_internal/mypy/typeshed/stdlib/wsgiref/simple_server.pyi +37 -0
  1222. package/bundle/_internal/mypy/typeshed/stdlib/wsgiref/types.pyi +31 -0
  1223. package/bundle/_internal/mypy/typeshed/stdlib/wsgiref/util.pyi +26 -0
  1224. package/bundle/_internal/mypy/typeshed/stdlib/wsgiref/validate.pyi +50 -0
  1225. package/bundle/_internal/mypy/typeshed/stdlib/xdrlib.pyi +57 -0
  1226. package/bundle/_internal/mypy/typeshed/stdlib/xml/__init__.pyi +9 -0
  1227. package/bundle/_internal/mypy/typeshed/stdlib/xml/dom/NodeFilter.pyi +22 -0
  1228. package/bundle/_internal/mypy/typeshed/stdlib/xml/dom/__init__.pyi +101 -0
  1229. package/bundle/_internal/mypy/typeshed/stdlib/xml/dom/domreg.pyi +8 -0
  1230. package/bundle/_internal/mypy/typeshed/stdlib/xml/dom/expatbuilder.pyi +126 -0
  1231. package/bundle/_internal/mypy/typeshed/stdlib/xml/dom/minicompat.pyi +24 -0
  1232. package/bundle/_internal/mypy/typeshed/stdlib/xml/dom/minidom.pyi +693 -0
  1233. package/bundle/_internal/mypy/typeshed/stdlib/xml/dom/pulldom.pyi +109 -0
  1234. package/bundle/_internal/mypy/typeshed/stdlib/xml/dom/xmlbuilder.pyi +82 -0
  1235. package/bundle/_internal/mypy/typeshed/stdlib/xml/etree/ElementInclude.pyi +28 -0
  1236. package/bundle/_internal/mypy/typeshed/stdlib/xml/etree/ElementPath.pyi +42 -0
  1237. package/bundle/_internal/mypy/typeshed/stdlib/xml/etree/ElementTree.pyi +402 -0
  1238. package/bundle/_internal/mypy/typeshed/stdlib/xml/etree/__init__.pyi +0 -0
  1239. package/bundle/_internal/mypy/typeshed/stdlib/xml/etree/cElementTree.pyi +1 -0
  1240. package/bundle/_internal/mypy/typeshed/stdlib/xml/parsers/__init__.pyi +1 -0
  1241. package/bundle/_internal/mypy/typeshed/stdlib/xml/parsers/expat/__init__.pyi +7 -0
  1242. package/bundle/_internal/mypy/typeshed/stdlib/xml/parsers/expat/errors.pyi +1 -0
  1243. package/bundle/_internal/mypy/typeshed/stdlib/xml/parsers/expat/model.pyi +1 -0
  1244. package/bundle/_internal/mypy/typeshed/stdlib/xml/sax/__init__.pyi +42 -0
  1245. package/bundle/_internal/mypy/typeshed/stdlib/xml/sax/_exceptions.pyi +19 -0
  1246. package/bundle/_internal/mypy/typeshed/stdlib/xml/sax/expatreader.pyi +72 -0
  1247. package/bundle/_internal/mypy/typeshed/stdlib/xml/sax/handler.pyi +85 -0
  1248. package/bundle/_internal/mypy/typeshed/stdlib/xml/sax/saxutils.pyi +69 -0
  1249. package/bundle/_internal/mypy/typeshed/stdlib/xml/sax/xmlreader.pyi +94 -0
  1250. package/bundle/_internal/mypy/typeshed/stdlib/xml/utils.pyi +2 -0
  1251. package/bundle/_internal/mypy/typeshed/stdlib/xmlrpc/__init__.pyi +0 -0
  1252. package/bundle/_internal/mypy/typeshed/stdlib/xmlrpc/client.pyi +300 -0
  1253. package/bundle/_internal/mypy/typeshed/stdlib/xmlrpc/server.pyi +149 -0
  1254. package/bundle/_internal/mypy/typeshed/stdlib/xxlimited.pyi +15 -0
  1255. package/bundle/_internal/mypy/typeshed/stdlib/zipapp.pyi +19 -0
  1256. package/bundle/_internal/mypy/typeshed/stdlib/zipfile/__init__.pyi +411 -0
  1257. package/bundle/_internal/mypy/typeshed/stdlib/zipfile/_path/__init__.pyi +87 -0
  1258. package/bundle/_internal/mypy/typeshed/stdlib/zipfile/_path/glob.pyi +26 -0
  1259. package/bundle/_internal/mypy/typeshed/stdlib/zipimport.pyi +44 -0
  1260. package/bundle/_internal/mypy/typeshed/stdlib/zlib.pyi +81 -0
  1261. package/bundle/_internal/mypy/typeshed/stdlib/zoneinfo/__init__.pyi +36 -0
  1262. package/bundle/_internal/mypy/typeshed/stdlib/zoneinfo/_common.pyi +14 -0
  1263. package/bundle/_internal/mypy/typeshed/stdlib/zoneinfo/_tzpath.pyi +13 -0
  1264. package/bundle/_internal/mypy/typeshed/stubs/librt/librt/__init__.pyi +0 -0
  1265. package/bundle/_internal/mypy/typeshed/stubs/librt/librt/base64.pyi +4 -0
  1266. package/bundle/_internal/mypy/typeshed/stubs/librt/librt/internal.pyi +22 -0
  1267. package/bundle/_internal/mypy/typeshed/stubs/librt/librt/random.pyi +22 -0
  1268. package/bundle/_internal/mypy/typeshed/stubs/librt/librt/strings.pyi +61 -0
  1269. package/bundle/_internal/mypy/typeshed/stubs/librt/librt/threading.pyi +16 -0
  1270. package/bundle/_internal/mypy/typeshed/stubs/librt/librt/time.pyi +1 -0
  1271. package/bundle/_internal/mypy/typeshed/stubs/librt/librt/vecs.pyi +24 -0
  1272. package/bundle/_internal/mypy/typeshed/stubs/mypy-extensions/mypy_extensions.pyi +226 -0
  1273. package/bundle/_internal/mypy/typestate.cpython-312-darwin.so +0 -0
  1274. package/bundle/_internal/mypy/typestate.py +334 -0
  1275. package/bundle/_internal/mypy/typetraverser.cpython-312-darwin.so +0 -0
  1276. package/bundle/_internal/mypy/typetraverser.py +166 -0
  1277. package/bundle/_internal/mypy/typevars.cpython-312-darwin.so +0 -0
  1278. package/bundle/_internal/mypy/typevars.py +84 -0
  1279. package/bundle/_internal/mypy/typevartuples.cpython-312-darwin.so +0 -0
  1280. package/bundle/_internal/mypy/typevartuples.py +36 -0
  1281. package/bundle/_internal/mypy/util.cpython-312-darwin.so +0 -0
  1282. package/bundle/_internal/mypy/util.py +1055 -0
  1283. package/bundle/_internal/mypy/version.py +1 -0
  1284. package/bundle/_internal/mypy/visitor.cpython-312-darwin.so +0 -0
  1285. package/bundle/_internal/mypy/visitor.py +639 -0
  1286. package/bundle/_internal/mypy/xml/mypy-html.css +104 -0
  1287. package/bundle/_internal/mypy/xml/mypy-html.xslt +81 -0
  1288. package/bundle/_internal/mypy/xml/mypy-txt.xslt +100 -0
  1289. package/bundle/_internal/mypy/xml/mypy.xsd +50 -0
  1290. package/bundle/_internal/mypy-2.4.1.dist-info/INSTALLER +1 -0
  1291. package/bundle/_internal/mypy-2.4.1.dist-info/METADATA +56 -0
  1292. package/bundle/_internal/mypy-2.4.1.dist-info/RECORD +1814 -0
  1293. package/bundle/_internal/mypy-2.4.1.dist-info/WHEEL +6 -0
  1294. package/bundle/_internal/mypy-2.4.1.dist-info/entry_points.txt +6 -0
  1295. package/bundle/_internal/mypy-2.4.1.dist-info/licenses/LICENSE +264 -0
  1296. package/bundle/_internal/mypy-2.4.1.dist-info/licenses/mypy/typeshed/LICENSE +237 -0
  1297. package/bundle/_internal/mypy-2.4.1.dist-info/top_level.txt +3 -0
  1298. package/bundle/_internal/mypyc/__init__.cpython-312-darwin.so +0 -0
  1299. package/bundle/_internal/python3.12/lib-dynload/_asyncio.cpython-312-darwin.so +0 -0
  1300. package/bundle/_internal/python3.12/lib-dynload/_bisect.cpython-312-darwin.so +0 -0
  1301. package/bundle/_internal/python3.12/lib-dynload/_blake2.cpython-312-darwin.so +0 -0
  1302. package/bundle/_internal/python3.12/lib-dynload/_bz2.cpython-312-darwin.so +0 -0
  1303. package/bundle/_internal/python3.12/lib-dynload/_codecs_cn.cpython-312-darwin.so +0 -0
  1304. package/bundle/_internal/python3.12/lib-dynload/_codecs_hk.cpython-312-darwin.so +0 -0
  1305. package/bundle/_internal/python3.12/lib-dynload/_codecs_iso2022.cpython-312-darwin.so +0 -0
  1306. package/bundle/_internal/python3.12/lib-dynload/_codecs_jp.cpython-312-darwin.so +0 -0
  1307. package/bundle/_internal/python3.12/lib-dynload/_codecs_kr.cpython-312-darwin.so +0 -0
  1308. package/bundle/_internal/python3.12/lib-dynload/_codecs_tw.cpython-312-darwin.so +0 -0
  1309. package/bundle/_internal/python3.12/lib-dynload/_contextvars.cpython-312-darwin.so +0 -0
  1310. package/bundle/_internal/python3.12/lib-dynload/_csv.cpython-312-darwin.so +0 -0
  1311. package/bundle/_internal/python3.12/lib-dynload/_ctypes.cpython-312-darwin.so +0 -0
  1312. package/bundle/_internal/python3.12/lib-dynload/_curses.cpython-312-darwin.so +0 -0
  1313. package/bundle/_internal/python3.12/lib-dynload/_datetime.cpython-312-darwin.so +0 -0
  1314. package/bundle/_internal/python3.12/lib-dynload/_decimal.cpython-312-darwin.so +0 -0
  1315. package/bundle/_internal/python3.12/lib-dynload/_elementtree.cpython-312-darwin.so +0 -0
  1316. package/bundle/_internal/python3.12/lib-dynload/_hashlib.cpython-312-darwin.so +0 -0
  1317. package/bundle/_internal/python3.12/lib-dynload/_heapq.cpython-312-darwin.so +0 -0
  1318. package/bundle/_internal/python3.12/lib-dynload/_json.cpython-312-darwin.so +0 -0
  1319. package/bundle/_internal/python3.12/lib-dynload/_lzma.cpython-312-darwin.so +0 -0
  1320. package/bundle/_internal/python3.12/lib-dynload/_md5.cpython-312-darwin.so +0 -0
  1321. package/bundle/_internal/python3.12/lib-dynload/_multibytecodec.cpython-312-darwin.so +0 -0
  1322. package/bundle/_internal/python3.12/lib-dynload/_multiprocessing.cpython-312-darwin.so +0 -0
  1323. package/bundle/_internal/python3.12/lib-dynload/_opcode.cpython-312-darwin.so +0 -0
  1324. package/bundle/_internal/python3.12/lib-dynload/_pickle.cpython-312-darwin.so +0 -0
  1325. package/bundle/_internal/python3.12/lib-dynload/_posixshmem.cpython-312-darwin.so +0 -0
  1326. package/bundle/_internal/python3.12/lib-dynload/_posixsubprocess.cpython-312-darwin.so +0 -0
  1327. package/bundle/_internal/python3.12/lib-dynload/_queue.cpython-312-darwin.so +0 -0
  1328. package/bundle/_internal/python3.12/lib-dynload/_random.cpython-312-darwin.so +0 -0
  1329. package/bundle/_internal/python3.12/lib-dynload/_scproxy.cpython-312-darwin.so +0 -0
  1330. package/bundle/_internal/python3.12/lib-dynload/_sha1.cpython-312-darwin.so +0 -0
  1331. package/bundle/_internal/python3.12/lib-dynload/_sha2.cpython-312-darwin.so +0 -0
  1332. package/bundle/_internal/python3.12/lib-dynload/_sha3.cpython-312-darwin.so +0 -0
  1333. package/bundle/_internal/python3.12/lib-dynload/_socket.cpython-312-darwin.so +0 -0
  1334. package/bundle/_internal/python3.12/lib-dynload/_sqlite3.cpython-312-darwin.so +0 -0
  1335. package/bundle/_internal/python3.12/lib-dynload/_ssl.cpython-312-darwin.so +0 -0
  1336. package/bundle/_internal/python3.12/lib-dynload/_statistics.cpython-312-darwin.so +0 -0
  1337. package/bundle/_internal/python3.12/lib-dynload/_struct.cpython-312-darwin.so +0 -0
  1338. package/bundle/_internal/python3.12/lib-dynload/_uuid.cpython-312-darwin.so +0 -0
  1339. package/bundle/_internal/python3.12/lib-dynload/array.cpython-312-darwin.so +0 -0
  1340. package/bundle/_internal/python3.12/lib-dynload/binascii.cpython-312-darwin.so +0 -0
  1341. package/bundle/_internal/python3.12/lib-dynload/fcntl.cpython-312-darwin.so +0 -0
  1342. package/bundle/_internal/python3.12/lib-dynload/grp.cpython-312-darwin.so +0 -0
  1343. package/bundle/_internal/python3.12/lib-dynload/math.cpython-312-darwin.so +0 -0
  1344. package/bundle/_internal/python3.12/lib-dynload/mmap.cpython-312-darwin.so +0 -0
  1345. package/bundle/_internal/python3.12/lib-dynload/pyexpat.cpython-312-darwin.so +0 -0
  1346. package/bundle/_internal/python3.12/lib-dynload/readline.cpython-312-darwin.so +0 -0
  1347. package/bundle/_internal/python3.12/lib-dynload/resource.cpython-312-darwin.so +0 -0
  1348. package/bundle/_internal/python3.12/lib-dynload/select.cpython-312-darwin.so +0 -0
  1349. package/bundle/_internal/python3.12/lib-dynload/syslog.cpython-312-darwin.so +0 -0
  1350. package/bundle/_internal/python3.12/lib-dynload/termios.cpython-312-darwin.so +0 -0
  1351. package/bundle/_internal/python3.12/lib-dynload/unicodedata.cpython-312-darwin.so +0 -0
  1352. package/bundle/_internal/python3.12/lib-dynload/zlib.cpython-312-darwin.so +0 -0
  1353. package/bundle/_internal/radon/__init__.py +21 -0
  1354. package/bundle/_internal/radon/__main__.py +4 -0
  1355. package/bundle/_internal/radon/cli/__init__.py +433 -0
  1356. package/bundle/_internal/radon/cli/colors.py +49 -0
  1357. package/bundle/_internal/radon/cli/harvest.py +449 -0
  1358. package/bundle/_internal/radon/cli/tools.py +597 -0
  1359. package/bundle/_internal/radon/complexity.py +108 -0
  1360. package/bundle/_internal/radon/contrib/__init__.py +0 -0
  1361. package/bundle/_internal/radon/contrib/flake8.py +72 -0
  1362. package/bundle/_internal/radon/metrics.py +157 -0
  1363. package/bundle/_internal/radon/raw.py +245 -0
  1364. package/bundle/_internal/radon/tests/__init__.py +0 -0
  1365. package/bundle/_internal/radon/tests/conftest.py +31 -0
  1366. package/bundle/_internal/radon/tests/data/__init__.py +5 -0
  1367. package/bundle/_internal/radon/tests/data/no_encoding.py +2 -0
  1368. package/bundle/_internal/radon/tests/data/py3unicode.py +5 -0
  1369. package/bundle/_internal/radon/tests/run.py +14 -0
  1370. package/bundle/_internal/radon/tests/test_cli.py +282 -0
  1371. package/bundle/_internal/radon/tests/test_cli_colors.py +22 -0
  1372. package/bundle/_internal/radon/tests/test_cli_harvest.py +392 -0
  1373. package/bundle/_internal/radon/tests/test_cli_tools.py +616 -0
  1374. package/bundle/_internal/radon/tests/test_complexity_utils.py +118 -0
  1375. package/bundle/_internal/radon/tests/test_complexity_visitor.py +754 -0
  1376. package/bundle/_internal/radon/tests/test_halstead.py +113 -0
  1377. package/bundle/_internal/radon/tests/test_ipynb.py +141 -0
  1378. package/bundle/_internal/radon/tests/test_other_metrics.py +169 -0
  1379. package/bundle/_internal/radon/tests/test_raw.py +467 -0
  1380. package/bundle/_internal/radon/visitors.py +460 -0
  1381. package/bundle/_internal/radon-6.0.1.dist-info/INSTALLER +1 -0
  1382. package/bundle/_internal/radon-6.0.1.dist-info/LICENSE +22 -0
  1383. package/bundle/_internal/radon-6.0.1.dist-info/METADATA +263 -0
  1384. package/bundle/_internal/radon-6.0.1.dist-info/RECORD +64 -0
  1385. package/bundle/_internal/radon-6.0.1.dist-info/WHEEL +6 -0
  1386. package/bundle/_internal/radon-6.0.1.dist-info/entry_points.txt +8 -0
  1387. package/bundle/_internal/radon-6.0.1.dist-info/top_level.txt +1 -0
  1388. package/bundle/_internal/setuptools/_vendor/jaraco/text/Lorem ipsum.txt +2 -0
  1389. package/bundle/_internal/stevedore-5.10.0.dist-info/INSTALLER +1 -0
  1390. package/bundle/_internal/stevedore-5.10.0.dist-info/METADATA +56 -0
  1391. package/bundle/_internal/stevedore-5.10.0.dist-info/RECORD +84 -0
  1392. package/bundle/_internal/stevedore-5.10.0.dist-info/WHEEL +5 -0
  1393. package/bundle/_internal/stevedore-5.10.0.dist-info/entry_points.txt +10 -0
  1394. package/bundle/_internal/stevedore-5.10.0.dist-info/licenses/AUTHORS +76 -0
  1395. package/bundle/_internal/stevedore-5.10.0.dist-info/licenses/LICENSE +202 -0
  1396. package/bundle/_internal/stevedore-5.10.0.dist-info/pbr.json +1 -0
  1397. package/bundle/_internal/stevedore-5.10.0.dist-info/top_level.txt +1 -0
  1398. package/bundle/_internal/tqdm-4.70.1.dist-info/INSTALLER +1 -0
  1399. package/bundle/_internal/tqdm-4.70.1.dist-info/METADATA +1600 -0
  1400. package/bundle/_internal/tqdm-4.70.1.dist-info/RECORD +72 -0
  1401. package/bundle/_internal/tqdm-4.70.1.dist-info/WHEEL +5 -0
  1402. package/bundle/_internal/tqdm-4.70.1.dist-info/entry_points.txt +2 -0
  1403. package/bundle/_internal/tqdm-4.70.1.dist-info/licenses/LICENCE +49 -0
  1404. package/bundle/_internal/tqdm-4.70.1.dist-info/top_level.txt +1 -0
  1405. package/bundle/_internal/yaml/_yaml.cpython-312-darwin.so +0 -0
  1406. package/bundle/gnost +0 -0
  1407. package/package.json +21 -4
@@ -0,0 +1,2572 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Callable, Iterable, Iterator, Sequence
4
+ from contextlib import contextmanager
5
+ from typing import Any, Final, TypeAlias as _TypeAlias, TypeVar, cast
6
+
7
+ import mypy.applytype
8
+ import mypy.constraints
9
+ import mypy.typeops
10
+ from mypy.checker_state import checker_state
11
+ from mypy.erasetype import erase_type
12
+ from mypy.expandtype import (
13
+ expand_self_type,
14
+ expand_type,
15
+ expand_type_by_instance,
16
+ freshen_function_type_vars,
17
+ )
18
+ from mypy.maptype import map_instance_to_supertype
19
+
20
+ # Circular import; done in the function instead.
21
+ # import mypy.solve
22
+ from mypy.nodes import (
23
+ ARG_POS,
24
+ ARG_STAR,
25
+ ARG_STAR2,
26
+ CONTRAVARIANT,
27
+ COVARIANT,
28
+ INVARIANT,
29
+ VARIANCE_NOT_READY,
30
+ Context,
31
+ Decorator,
32
+ FuncBase,
33
+ OverloadedFuncDef,
34
+ TypeInfo,
35
+ Var,
36
+ )
37
+ from mypy.options import Options
38
+ from mypy.state import state
39
+ from mypy.types import (
40
+ MAX_PROTOCOL_DEPTH,
41
+ MYPYC_NATIVE_INT_NAMES,
42
+ TUPLE_LIKE_INSTANCE_NAMES,
43
+ TYPED_NAMEDTUPLE_NAMES,
44
+ AnyType,
45
+ CallableType,
46
+ DeletedType,
47
+ ErasedType,
48
+ FormalArgument,
49
+ FunctionLike,
50
+ Instance,
51
+ LiteralType,
52
+ NoneType,
53
+ NormalizedCallableType,
54
+ Overloaded,
55
+ Parameters,
56
+ ParamSpecType,
57
+ PartialType,
58
+ ProperType,
59
+ TupleType,
60
+ Type,
61
+ TypeAliasType,
62
+ TypedDictType,
63
+ TypeOfAny,
64
+ TypeType,
65
+ TypeVarLikeType,
66
+ TypeVarTupleType,
67
+ TypeVarType,
68
+ TypeVisitor,
69
+ UnboundType,
70
+ UninhabitedType,
71
+ UnionType,
72
+ UnpackType,
73
+ extend_args_for_prefix_and_suffix,
74
+ find_unpack_in_list,
75
+ flatten_nested_unions,
76
+ get_proper_type,
77
+ get_variadic_item,
78
+ is_named_instance,
79
+ split_with_prefix_and_suffix,
80
+ )
81
+ from mypy.types_utils import flatten_types
82
+ from mypy.typestate import SubtypeKind, type_state
83
+ from mypy.typevars import fill_typevars, fill_typevars_with_any
84
+
85
+ # Flags for detected protocol members
86
+ IS_SETTABLE: Final = 1
87
+ IS_CLASSVAR: Final = 2
88
+ IS_CLASS_OR_STATIC: Final = 3
89
+ IS_VAR: Final = 4
90
+ IS_EXPLICIT_SETTER: Final = 5
91
+
92
+ TypeParameterChecker: _TypeAlias = Callable[[Type, Type, int, bool, "SubtypeContext"], bool]
93
+
94
+
95
+ class SubtypeContext:
96
+ def __init__(
97
+ self,
98
+ *,
99
+ # Non-proper subtype flags
100
+ ignore_type_params: bool = False,
101
+ ignore_pos_arg_names: bool = False,
102
+ ignore_declared_variance: bool = False,
103
+ # Supported for both proper and non-proper
104
+ always_covariant: bool = False,
105
+ ignore_promotions: bool = False,
106
+ # Proper subtype flags
107
+ erase_instances: bool = False,
108
+ keep_erased_types: bool = False,
109
+ options: Options | None = None,
110
+ ) -> None:
111
+ self.ignore_type_params = ignore_type_params
112
+ self.ignore_pos_arg_names = ignore_pos_arg_names
113
+ self.ignore_declared_variance = ignore_declared_variance
114
+ self.always_covariant = always_covariant
115
+ self.ignore_promotions = ignore_promotions
116
+ self.erase_instances = erase_instances
117
+ self.keep_erased_types = keep_erased_types
118
+ self.options = options
119
+
120
+ def check_context(self, proper_subtype: bool) -> None:
121
+ # Historically proper and non-proper subtypes were defined using different helpers
122
+ # and different visitors. Check if flag values are such that we definitely support.
123
+ if proper_subtype:
124
+ assert not self.ignore_pos_arg_names and not self.ignore_declared_variance
125
+ else:
126
+ assert not self.erase_instances and not self.keep_erased_types
127
+
128
+
129
+ def is_subtype(
130
+ left: Type,
131
+ right: Type,
132
+ *,
133
+ subtype_context: SubtypeContext | None = None,
134
+ ignore_type_params: bool = False,
135
+ ignore_pos_arg_names: bool = False,
136
+ ignore_declared_variance: bool = False,
137
+ always_covariant: bool = False,
138
+ ignore_promotions: bool = False,
139
+ options: Options | None = None,
140
+ ) -> bool:
141
+ """Is 'left' subtype of 'right'?
142
+
143
+ Also consider Any to be a subtype of any type, and vice versa. This
144
+ recursively applies to components of composite types (List[int] is subtype
145
+ of List[Any], for example).
146
+
147
+ type_parameter_checker is used to check the type parameters (for example,
148
+ A with B in is_subtype(C[A], C[B]). The default checks for subtype relation
149
+ between the type arguments (e.g., A and B), taking the variance of the
150
+ type var into account.
151
+ """
152
+ if left == right:
153
+ return True
154
+ if subtype_context is None:
155
+ subtype_context = SubtypeContext(
156
+ ignore_type_params=ignore_type_params,
157
+ ignore_pos_arg_names=ignore_pos_arg_names,
158
+ ignore_declared_variance=ignore_declared_variance,
159
+ always_covariant=always_covariant,
160
+ ignore_promotions=ignore_promotions,
161
+ options=options,
162
+ )
163
+ else:
164
+ assert (
165
+ not ignore_type_params
166
+ and not ignore_pos_arg_names
167
+ and not ignore_declared_variance
168
+ and not always_covariant
169
+ and not ignore_promotions
170
+ and options is None
171
+ ), "Don't pass both context and individual flags"
172
+ if type_state.is_assumed_subtype(left, right):
173
+ return True
174
+ if mypy.typeops.is_recursive_pair(left, right):
175
+ # This case requires special care because it may cause infinite recursion.
176
+ # Our view on recursive types is known under a fancy name of iso-recursive mu-types.
177
+ # Roughly this means that a recursive type is defined as an alias where right hand side
178
+ # can refer to the type as a whole, for example:
179
+ # A = Union[int, Tuple[A, ...]]
180
+ # and an alias unrolled once represents the *same type*, in our case all these represent
181
+ # the same type:
182
+ # A
183
+ # Union[int, Tuple[A, ...]]
184
+ # Union[int, Tuple[Union[int, Tuple[A, ...]], ...]]
185
+ # The algorithm for subtyping is then essentially under the assumption that left <: right,
186
+ # check that get_proper_type(left) <: get_proper_type(right). On the example above,
187
+ # If we start with:
188
+ # A = Union[int, Tuple[A, ...]]
189
+ # B = Union[int, Tuple[B, ...]]
190
+ # When checking if A <: B we push pair (A, B) onto 'assuming' stack, then when after few
191
+ # steps we come back to initial call is_subtype(A, B) and immediately return True.
192
+ with pop_on_exit(type_state.get_assumptions(is_proper=False), left, right):
193
+ return _is_subtype(left, right, subtype_context, proper_subtype=False)
194
+ return _is_subtype(left, right, subtype_context, proper_subtype=False)
195
+
196
+
197
+ def is_proper_subtype(
198
+ left: Type,
199
+ right: Type,
200
+ *,
201
+ subtype_context: SubtypeContext | None = None,
202
+ ignore_promotions: bool = False,
203
+ erase_instances: bool = False,
204
+ keep_erased_types: bool = False,
205
+ ) -> bool:
206
+ """Is left a proper subtype of right?
207
+
208
+ For proper subtypes, there's no need to rely on compatibility due to
209
+ Any types. Every usable type is a proper subtype of itself.
210
+
211
+ If erase_instances is True, erase left instance *after* mapping it to supertype
212
+ (this is useful for runtime isinstance() checks). If keep_erased_types is True,
213
+ do not consider ErasedType a subtype of all types (used by type inference against unions).
214
+ """
215
+ if left == right:
216
+ return True
217
+ if subtype_context is None:
218
+ subtype_context = SubtypeContext(
219
+ ignore_promotions=ignore_promotions,
220
+ erase_instances=erase_instances,
221
+ keep_erased_types=keep_erased_types,
222
+ )
223
+ else:
224
+ assert (
225
+ not ignore_promotions and not erase_instances and not keep_erased_types
226
+ ), "Don't pass both context and individual flags"
227
+ if type_state.is_assumed_proper_subtype(left, right):
228
+ return True
229
+ if mypy.typeops.is_recursive_pair(left, right):
230
+ # Same as for non-proper subtype, see detailed comment there for explanation.
231
+ with pop_on_exit(type_state.get_assumptions(is_proper=True), left, right):
232
+ return _is_subtype(left, right, subtype_context, proper_subtype=True)
233
+ return _is_subtype(left, right, subtype_context, proper_subtype=True)
234
+
235
+
236
+ def is_equivalent(
237
+ a: Type,
238
+ b: Type,
239
+ *,
240
+ ignore_type_params: bool = False,
241
+ ignore_pos_arg_names: bool = False,
242
+ options: Options | None = None,
243
+ subtype_context: SubtypeContext | None = None,
244
+ ) -> bool:
245
+ return is_subtype(
246
+ a,
247
+ b,
248
+ ignore_type_params=ignore_type_params,
249
+ ignore_pos_arg_names=ignore_pos_arg_names,
250
+ options=options,
251
+ subtype_context=subtype_context,
252
+ ) and is_subtype(
253
+ b,
254
+ a,
255
+ ignore_type_params=ignore_type_params,
256
+ ignore_pos_arg_names=ignore_pos_arg_names,
257
+ options=options,
258
+ subtype_context=subtype_context,
259
+ )
260
+
261
+
262
+ def is_same_type(
263
+ a: Type, b: Type, ignore_promotions: bool = True, subtype_context: SubtypeContext | None = None
264
+ ) -> bool:
265
+ """Are these types proper subtypes of each other?
266
+
267
+ This means types may have different representation (e.g. an alias, or
268
+ a non-simplified union) but are semantically exchangeable in all contexts.
269
+ """
270
+ # First, use fast path for some common types. This is performance-critical.
271
+ if (
272
+ type(a) is Instance
273
+ and type(b) is Instance
274
+ and a.type == b.type
275
+ and len(a.args) == len(b.args)
276
+ and a.last_known_value is b.last_known_value
277
+ ):
278
+ return all(is_same_type(x, y) for x, y in zip(a.args, b.args))
279
+ elif (
280
+ isinstance(a, TypeVarType)
281
+ and isinstance(b, TypeVarType)
282
+ and a.id == b.id
283
+ and a.upper_bound == b.upper_bound
284
+ ):
285
+ return True
286
+
287
+ # Note that using ignore_promotions=True (default) makes types like int and int64
288
+ # considered not the same type (which is the case at runtime).
289
+ # Also Union[bool, int] (if it wasn't simplified before) will be different
290
+ # from plain int, etc.
291
+ return is_proper_subtype(
292
+ a, b, ignore_promotions=ignore_promotions, subtype_context=subtype_context
293
+ ) and is_proper_subtype(
294
+ b, a, ignore_promotions=ignore_promotions, subtype_context=subtype_context
295
+ )
296
+
297
+
298
+ # This is a common entry point for subtyping checks (both proper and non-proper).
299
+ # Never call this private function directly, use the public versions.
300
+ def _is_subtype(
301
+ left: Type, right: Type, subtype_context: SubtypeContext, proper_subtype: bool
302
+ ) -> bool:
303
+ subtype_context.check_context(proper_subtype)
304
+ orig_right = right
305
+ orig_left = left
306
+ left = get_proper_type(left)
307
+ right = get_proper_type(right)
308
+
309
+ # Note: Unpack type should not be a subtype of Any, since it may represent
310
+ # multiple types. This should always go through the visitor, to check arity.
311
+ if (
312
+ not proper_subtype
313
+ and isinstance(right, (AnyType, UnboundType, ErasedType))
314
+ and not isinstance(left, UnpackType)
315
+ ):
316
+ # TODO: should we consider all types proper subtypes of UnboundType and/or
317
+ # ErasedType as we do for non-proper subtyping.
318
+ return True
319
+
320
+ # Cases specific w.r.t. right type are easier to handle before entering the SubtypeVisitor.
321
+ # Currently, these include Union types and TypeVarType with values.
322
+ if isinstance(right, UnionType) and not isinstance(left, UnionType):
323
+ # Normally, when 'left' is not itself a union, the only way
324
+ # 'left' can be a subtype of the union 'right' is if it is a
325
+ # subtype of one of the items making up the union.
326
+ if proper_subtype:
327
+ is_subtype_of_item = any(
328
+ is_proper_subtype(orig_left, item, subtype_context=subtype_context)
329
+ for item in right.items
330
+ )
331
+ else:
332
+ is_subtype_of_item = any(
333
+ is_subtype(orig_left, item, subtype_context=subtype_context)
334
+ for item in right.items
335
+ )
336
+ # Recombine rhs literal types, to make an enum type a subtype
337
+ # of a union of all enum items as literal types. Only do it if
338
+ # the previous check didn't succeed, since recombining can be
339
+ # expensive.
340
+ # `bool` is a special case, because `bool` is `Literal[True, False]`.
341
+ if (
342
+ not is_subtype_of_item
343
+ and isinstance(left, Instance)
344
+ and (left.type.is_enum or left.type.fullname == "builtins.bool")
345
+ ):
346
+ right = UnionType(
347
+ mypy.typeops.try_contracting_literals_in_union(flatten_nested_unions(right.items))
348
+ )
349
+ if proper_subtype:
350
+ is_subtype_of_item = any(
351
+ is_proper_subtype(orig_left, item, subtype_context=subtype_context)
352
+ for item in right.items
353
+ )
354
+ else:
355
+ is_subtype_of_item = any(
356
+ is_subtype(orig_left, item, subtype_context=subtype_context)
357
+ for item in right.items
358
+ )
359
+ # However, if 'left' is a type variable T, T might also have
360
+ # an upper bound which is itself a union. This case will be
361
+ # handled below by the SubtypeVisitor. We have to check both
362
+ # possibilities, to handle both cases like T <: Union[T, U]
363
+ # and cases like T <: B where B is the upper bound of T and is
364
+ # a union. (See #2314.)
365
+ if not isinstance(left, TypeVarType):
366
+ return is_subtype_of_item
367
+ elif is_subtype_of_item:
368
+ return True
369
+ # otherwise, fall through
370
+
371
+ if isinstance(right, TypeVarType) and right.values and not isinstance(left, TypeVarType):
372
+ if proper_subtype:
373
+ if all(
374
+ is_proper_subtype(orig_left, v, subtype_context=subtype_context)
375
+ for v in right.values
376
+ ):
377
+ return True
378
+ elif all(is_subtype(orig_left, v, subtype_context=subtype_context) for v in right.values):
379
+ return True
380
+
381
+ return left.accept(SubtypeVisitor(orig_right, subtype_context, proper_subtype))
382
+
383
+
384
+ def check_type_parameter(
385
+ left: Type, right: Type, variance: int, proper_subtype: bool, subtype_context: SubtypeContext
386
+ ) -> bool:
387
+ # It is safe to consider empty collection literals and similar as covariant, since
388
+ # such type can't be stored in a variable, see checker.is_valid_inferred_type().
389
+ if variance == INVARIANT:
390
+ p_left = get_proper_type(left)
391
+ if isinstance(p_left, UninhabitedType) and p_left.ambiguous:
392
+ variance = COVARIANT
393
+ # If variance hasn't been inferred yet, we are lenient and default to
394
+ # covariance. This shouldn't happen often, but it's very difficult to
395
+ # avoid these cases altogether.
396
+ if variance == COVARIANT or variance == VARIANCE_NOT_READY:
397
+ if proper_subtype:
398
+ return is_proper_subtype(left, right, subtype_context=subtype_context)
399
+ else:
400
+ return is_subtype(left, right, subtype_context=subtype_context)
401
+ elif variance == CONTRAVARIANT:
402
+ if proper_subtype:
403
+ return is_proper_subtype(right, left, subtype_context=subtype_context)
404
+ else:
405
+ return is_subtype(right, left, subtype_context=subtype_context)
406
+ else:
407
+ if proper_subtype:
408
+ # We pass ignore_promotions=False because it is a default for subtype checks.
409
+ # The actual value will be taken from the subtype_context, and it is whatever
410
+ # the original caller passed.
411
+ return is_same_type(
412
+ left, right, ignore_promotions=False, subtype_context=subtype_context
413
+ )
414
+ else:
415
+ return is_equivalent(left, right, subtype_context=subtype_context)
416
+
417
+
418
+ class SubtypeVisitor(TypeVisitor[bool]):
419
+ __slots__ = (
420
+ "right",
421
+ "orig_right",
422
+ "proper_subtype",
423
+ "subtype_context",
424
+ "options",
425
+ "_subtype_kind",
426
+ )
427
+
428
+ def __init__(self, right: Type, subtype_context: SubtypeContext, proper_subtype: bool) -> None:
429
+ self.right = get_proper_type(right)
430
+ self.orig_right = right
431
+ self.proper_subtype = proper_subtype
432
+ self.subtype_context = subtype_context
433
+ self.options = subtype_context.options
434
+ self._subtype_kind = SubtypeVisitor.build_subtype_kind(subtype_context, proper_subtype)
435
+
436
+ @staticmethod
437
+ def build_subtype_kind(subtype_context: SubtypeContext, proper_subtype: bool) -> SubtypeKind:
438
+ return (
439
+ state.strict_optional,
440
+ proper_subtype,
441
+ subtype_context.ignore_type_params,
442
+ subtype_context.ignore_pos_arg_names,
443
+ subtype_context.ignore_declared_variance,
444
+ subtype_context.always_covariant,
445
+ subtype_context.ignore_promotions,
446
+ subtype_context.erase_instances,
447
+ subtype_context.keep_erased_types,
448
+ )
449
+
450
+ def _is_subtype(self, left: Type, right: Type) -> bool:
451
+ if self.proper_subtype:
452
+ return is_proper_subtype(left, right, subtype_context=self.subtype_context)
453
+ return is_subtype(left, right, subtype_context=self.subtype_context)
454
+
455
+ def _all_subtypes(self, lefts: Iterable[Type], rights: Iterable[Type]) -> bool:
456
+ return all(self._is_subtype(li, ri) for (li, ri) in zip(lefts, rights))
457
+
458
+ # visit_x(left) means: is left (which is an instance of X) a subtype of right?
459
+
460
+ def visit_unbound_type(self, left: UnboundType) -> bool:
461
+ # This can be called if there is a bad type annotation. The result probably
462
+ # doesn't matter much but by returning True we simplify these bad types away
463
+ # from unions, which could filter out some bogus messages.
464
+ return True
465
+
466
+ def visit_any(self, left: AnyType) -> bool:
467
+ return isinstance(self.right, AnyType) if self.proper_subtype else True
468
+
469
+ def visit_none_type(self, left: NoneType) -> bool:
470
+ if state.strict_optional:
471
+ if isinstance(self.right, NoneType) or is_named_instance(
472
+ self.right, "builtins.object"
473
+ ):
474
+ return True
475
+ if isinstance(self.right, Instance) and self.right.type.is_protocol:
476
+ members = self.right.type.protocol_members
477
+ # None is compatible with Hashable (and other similar protocols). This is
478
+ # slightly sloppy since we don't check the signature of "__hash__".
479
+ # None is also compatible with `SupportsStr` protocol.
480
+ return not members or all(member in ("__hash__", "__str__") for member in members)
481
+ return False
482
+ else:
483
+ return True
484
+
485
+ def visit_uninhabited_type(self, left: UninhabitedType) -> bool:
486
+ return True
487
+
488
+ def visit_erased_type(self, left: ErasedType) -> bool:
489
+ # This may be encountered during type inference. The result probably doesn't
490
+ # matter much.
491
+ # TODO: it actually does matter, figure out more principled logic about this.
492
+ return not self.subtype_context.keep_erased_types
493
+
494
+ def visit_deleted_type(self, left: DeletedType) -> bool:
495
+ return True
496
+
497
+ def visit_instance(self, left: Instance) -> bool:
498
+ if left.type.fallback_to_any and not self.proper_subtype:
499
+ # NOTE: `None` is a *non-subclassable* singleton, therefore no class
500
+ # can by a subtype of it, even with an `Any` fallback.
501
+ # This special case is needed to treat descriptors in classes with
502
+ # dynamic base classes correctly, see #5456.
503
+ return not isinstance(self.right, NoneType)
504
+ right = self.right
505
+ if isinstance(right, TupleType) and right.partial_fallback.type.is_enum:
506
+ return self._is_subtype(left, mypy.typeops.tuple_fallback(right))
507
+ if isinstance(right, TupleType):
508
+ if len(right.items) == 1:
509
+ # Non-normalized Tuple type (may be left after semantic analysis
510
+ # because semanal_typearg visitor is not a type translator).
511
+ item = right.items[0]
512
+ if isinstance(item, UnpackType):
513
+ unpacked = get_proper_type(item.type)
514
+ if isinstance(unpacked, Instance):
515
+ return self._is_subtype(left, unpacked)
516
+ if left.type.has_base(right.partial_fallback.type.fullname):
517
+ mapped = map_instance_to_supertype(left, right.partial_fallback.type)
518
+ # Special cases to consider:
519
+ # * tuple[Any, ...] instance is a (non-proper) subtype of all tuple types.
520
+ # * Foo[*tuple[X, ...]] (normalized) instance is a subtype of all
521
+ # tuples with appropriate fallback (e.g. for variadic NamedTuples).
522
+ if not self.proper_subtype:
523
+ if is_erased_instance(mapped) and mapped.type.fullname == "builtins.tuple":
524
+ return True
525
+ if is_normalized_instance(mapped):
526
+ if self._is_subtype(mapped, right.partial_fallback):
527
+ return True
528
+ return False
529
+ if isinstance(right, TypeVarTupleType):
530
+ # tuple[Any, ...] is like Any in the world of tuples (see special case above).
531
+ if left.type.has_base("builtins.tuple"):
532
+ mapped = map_instance_to_supertype(left, right.tuple_fallback.type)
533
+ if isinstance(get_proper_type(mapped.args[0]), AnyType):
534
+ return not self.proper_subtype
535
+ if isinstance(right, Instance):
536
+ if type_state.is_cached_subtype_check(self._subtype_kind, left, right):
537
+ return True
538
+ if type_state.is_cached_negative_subtype_check(self._subtype_kind, left, right):
539
+ return False
540
+ if not self.subtype_context.ignore_promotions and not right.type.is_protocol:
541
+ for base in left.type.mro:
542
+ if base._promote and any(
543
+ self._is_subtype(p, self.right) for p in base._promote
544
+ ):
545
+ type_state.record_subtype_cache_entry(self._subtype_kind, left, right)
546
+ return True
547
+ # Special case: Low-level integer types are compatible with 'int'. We can't
548
+ # use promotions, since 'int' is already promoted to low-level integer types,
549
+ # and we can't have circular promotions.
550
+ if left.type.alt_promote and left.type.alt_promote.type is right.type:
551
+ return True
552
+ rname = right.type.fullname
553
+ # Always try a nominal check if possible,
554
+ # there might be errors that a user wants to silence *once*.
555
+ # NamedTuples are a special case, because `NamedTuple` is not listed
556
+ # in `TypeInfo.mro`, so when `(a: NamedTuple) -> None` is used,
557
+ # we need to check for `is_named_tuple` property
558
+ if (
559
+ left.type.has_base(rname)
560
+ or rname == "builtins.object"
561
+ or (
562
+ rname in TYPED_NAMEDTUPLE_NAMES
563
+ and any(l.is_named_tuple for l in left.type.mro)
564
+ )
565
+ ) and not self.subtype_context.ignore_declared_variance:
566
+ # Map left type to corresponding right instances.
567
+ t = map_instance_to_supertype(left, right.type)
568
+ if self.subtype_context.erase_instances:
569
+ erased = erase_type(t)
570
+ assert isinstance(erased, Instance)
571
+ t = erased
572
+ nominal = True
573
+ if right.type.has_type_var_tuple_type:
574
+ # For variadic instances we simply find the correct type argument mappings,
575
+ # all the heavy lifting is done by the tuple subtyping.
576
+ assert right.type.type_var_tuple_prefix is not None
577
+ assert right.type.type_var_tuple_suffix is not None
578
+ prefix = right.type.type_var_tuple_prefix
579
+ suffix = right.type.type_var_tuple_suffix
580
+ tvt = right.type.defn.type_vars[prefix]
581
+ assert isinstance(tvt, TypeVarTupleType)
582
+ fallback = tvt.tuple_fallback
583
+ left_prefix, left_middle, left_suffix = split_with_prefix_and_suffix(
584
+ t.args, prefix, suffix
585
+ )
586
+ right_prefix, right_middle, right_suffix = split_with_prefix_and_suffix(
587
+ right.args, prefix, suffix
588
+ )
589
+ left_args = (
590
+ left_prefix + (TupleType(list(left_middle), fallback),) + left_suffix
591
+ )
592
+ right_args = (
593
+ right_prefix + (TupleType(list(right_middle), fallback),) + right_suffix
594
+ )
595
+ if not self.proper_subtype and is_erased_instance(t):
596
+ return True
597
+ if len(left_args) != len(right_args):
598
+ return False
599
+ type_params = zip(left_args, right_args, right.type.defn.type_vars)
600
+ else:
601
+ type_params = zip(t.args, right.args, right.type.defn.type_vars)
602
+ if not self.subtype_context.ignore_type_params:
603
+ tried_infer = False
604
+ for lefta, righta, tvar in type_params:
605
+ if isinstance(tvar, TypeVarType):
606
+ if tvar.variance == VARIANCE_NOT_READY and not tried_infer:
607
+ infer_class_variances(right.type)
608
+ tried_infer = True
609
+ if (
610
+ self.subtype_context.always_covariant
611
+ and tvar.variance == INVARIANT
612
+ ):
613
+ variance = COVARIANT
614
+ else:
615
+ variance = tvar.variance
616
+ if not check_type_parameter(
617
+ lefta, righta, variance, self.proper_subtype, self.subtype_context
618
+ ):
619
+ nominal = False
620
+ else:
621
+ # TODO: everywhere else ParamSpecs are handled as invariant.
622
+ if not check_type_parameter(
623
+ lefta, righta, COVARIANT, self.proper_subtype, self.subtype_context
624
+ ):
625
+ nominal = False
626
+ if nominal:
627
+ type_state.record_subtype_cache_entry(self._subtype_kind, left, right)
628
+ else:
629
+ type_state.record_negative_subtype_cache_entry(self._subtype_kind, left, right)
630
+ return nominal
631
+ if right.type.is_protocol and is_protocol_implementation(
632
+ left, right, proper_subtype=self.proper_subtype, options=self.options
633
+ ):
634
+ return True
635
+ # We record negative cache entry here, and not in the protocol check like we do for
636
+ # positive cache, to avoid accidentally adding a type that is not a structural
637
+ # subtype, but is a nominal subtype (involving type: ignore override).
638
+ type_state.record_negative_subtype_cache_entry(self._subtype_kind, left, right)
639
+ return False
640
+ if isinstance(right, TypeType):
641
+ item = right.item
642
+ if isinstance(item, TupleType):
643
+ item = mypy.typeops.tuple_fallback(item)
644
+ # TODO: this is a bit arbitrary, we should only skip Any-related cases.
645
+ if not self.proper_subtype:
646
+ if is_named_instance(left, "builtins.type"):
647
+ return self._is_subtype(TypeType(AnyType(TypeOfAny.special_form)), right)
648
+ if left.type.is_metaclass():
649
+ if isinstance(item, AnyType):
650
+ return True
651
+ if isinstance(item, Instance):
652
+ return is_named_instance(item, "builtins.object")
653
+ if isinstance(right, LiteralType) and left.last_known_value is not None:
654
+ return self._is_subtype(left.last_known_value, right)
655
+ if isinstance(right, FunctionLike):
656
+ # Special case: Instance can be a subtype of Callable / Overloaded.
657
+ call = find_member("__call__", left, left, is_operator=True)
658
+ if call:
659
+ return self._is_subtype(call, right)
660
+ return False
661
+ else:
662
+ return False
663
+
664
+ def visit_type_var(self, left: TypeVarType) -> bool:
665
+ right = self.right
666
+ if isinstance(right, TypeVarType) and left.id == right.id:
667
+ # Fast path for most common case.
668
+ if left.upper_bound == right.upper_bound:
669
+ return True
670
+ # Corner case for self-types in classes generic in type vars
671
+ # with value restrictions.
672
+ if left.id.is_self():
673
+ return True
674
+ return self._is_subtype(left.upper_bound, right.upper_bound)
675
+ if left.values and self._is_subtype(UnionType.make_union(left.values), right):
676
+ return True
677
+ return self._is_subtype(left.upper_bound, self.right)
678
+
679
+ def visit_param_spec(self, left: ParamSpecType) -> bool:
680
+ right = self.right
681
+ if (
682
+ isinstance(right, ParamSpecType)
683
+ and right.id == left.id
684
+ and right.flavor == left.flavor
685
+ ):
686
+ return self._is_subtype(left.prefix, right.prefix)
687
+ if isinstance(right, Parameters) and are_trivial_parameters(right):
688
+ return True
689
+ return self._is_subtype(left.upper_bound, self.right)
690
+
691
+ def visit_type_var_tuple(self, left: TypeVarTupleType) -> bool:
692
+ right = self.right
693
+ if isinstance(right, TypeVarTupleType) and right.id == left.id:
694
+ return left.min_len >= right.min_len
695
+ return self._is_subtype(left.upper_bound, self.right)
696
+
697
+ def visit_unpack_type(self, left: UnpackType) -> bool:
698
+ # TODO: Ideally we should not need this (since it is not a real type).
699
+ # Instead callers (upper level types) should handle it when it appears in type list.
700
+ if isinstance(self.right, UnpackType):
701
+ return self._is_subtype(left.type, self.right.type)
702
+ if isinstance(self.right, Instance) and self.right.type.fullname == "builtins.object":
703
+ return True
704
+ return False
705
+
706
+ def visit_parameters(self, left: Parameters) -> bool:
707
+ if isinstance(self.right, Parameters):
708
+ return are_parameters_compatible(
709
+ left,
710
+ self.right,
711
+ is_compat=self._is_subtype,
712
+ # TODO: this should pass the current value, but then couple tests fail.
713
+ is_proper_subtype=False,
714
+ ignore_pos_arg_names=self.subtype_context.ignore_pos_arg_names,
715
+ )
716
+ elif isinstance(self.right, Instance):
717
+ return self.right.type.fullname == "builtins.object"
718
+ else:
719
+ return False
720
+
721
+ def visit_callable_type(self, left: CallableType) -> bool:
722
+ right = self.right
723
+ if isinstance(right, CallableType):
724
+ if left.type_guard is not None and right.type_guard is not None:
725
+ if not self._is_subtype(left.type_guard, right.type_guard):
726
+ return False
727
+ elif left.type_is is not None and right.type_is is not None:
728
+ # For TypeIs we have to check both ways; it is unsafe to pass
729
+ # a TypeIs[Child] when a TypeIs[Parent] is expected, because
730
+ # if the narrower returns False, we assume that the narrowed value is
731
+ # *not* a Parent.
732
+ if not self._is_subtype(left.type_is, right.type_is) or not self._is_subtype(
733
+ right.type_is, left.type_is
734
+ ):
735
+ return False
736
+ elif right.type_guard is not None and left.type_guard is None:
737
+ # This means that one function has `TypeGuard` and other does not.
738
+ # They are not compatible. See https://github.com/python/mypy/issues/11307
739
+ return False
740
+ elif right.type_is is not None and left.type_is is None:
741
+ # Similarly, if one function has `TypeIs` and the other does not,
742
+ # they are not compatible.
743
+ return False
744
+ strict_concatenate = False
745
+ if options := self.options:
746
+ strict_concatenate = options.extra_checks or options.strict_concatenate
747
+ return is_callable_compatible(
748
+ left,
749
+ right,
750
+ is_compat=self._is_subtype,
751
+ is_proper_subtype=self.proper_subtype,
752
+ ignore_pos_arg_names=self.subtype_context.ignore_pos_arg_names,
753
+ strict_concatenate=strict_concatenate,
754
+ )
755
+ elif isinstance(right, Overloaded):
756
+ return all(self._is_subtype(left, item) for item in right.items)
757
+ elif isinstance(right, Instance):
758
+ if right.type.is_protocol and "__call__" in right.type.protocol_members:
759
+ # OK, a callable can implement a protocol with a `__call__` member.
760
+ call = find_member("__call__", right, right, is_operator=True)
761
+ assert call is not None
762
+ if self._is_subtype(left, call):
763
+ if len(right.type.protocol_members) == 1:
764
+ return True
765
+ if is_protocol_implementation(left.fallback, right, skip=["__call__"]):
766
+ return True
767
+ if right.type.is_protocol and left.is_type_obj():
768
+ instance_type = left.get_instance_type(force_fallback=True)
769
+ if isinstance(instance_type, Instance) and is_protocol_implementation(
770
+ instance_type, right, proper_subtype=self.proper_subtype, class_obj=True
771
+ ):
772
+ return True
773
+ return self._is_subtype(left.fallback, right)
774
+ elif isinstance(right, TypeType):
775
+ # This is unsound, we don't check the __init__ signature.
776
+ return left.is_type_obj() and self._is_subtype(left.get_instance_type(), right.item)
777
+ else:
778
+ return False
779
+
780
+ def visit_tuple_type(self, left: TupleType) -> bool:
781
+ right = self.right
782
+ if isinstance(right, Instance):
783
+ if is_named_instance(right, "typing.Sized"):
784
+ return True
785
+ elif is_named_instance(right, TUPLE_LIKE_INSTANCE_NAMES):
786
+ if right.args:
787
+ iter_type = right.args[0]
788
+ else:
789
+ if self.proper_subtype:
790
+ return False
791
+ iter_type = AnyType(TypeOfAny.special_form)
792
+ if is_named_instance(right, "builtins.tuple") and isinstance(
793
+ get_proper_type(iter_type), AnyType
794
+ ):
795
+ # TODO: We shouldn't need this special case. This is currently needed
796
+ # for isinstance(x, tuple), though it's unclear why.
797
+ return True
798
+ for li in left.items:
799
+ if isinstance(li, UnpackType):
800
+ unpack = get_proper_type(li.type)
801
+ if isinstance(unpack, TypeVarTupleType):
802
+ unpack = get_proper_type(unpack.upper_bound)
803
+ assert (
804
+ isinstance(unpack, Instance)
805
+ and unpack.type.fullname == "builtins.tuple"
806
+ )
807
+ li = unpack.args[0]
808
+ if not self._is_subtype(li, iter_type):
809
+ return False
810
+ return True
811
+ elif self._is_subtype(left.partial_fallback, right) and self._is_subtype(
812
+ mypy.typeops.tuple_fallback(left), right
813
+ ):
814
+ return True
815
+ elif right.type.is_protocol and is_protocol_implementation(
816
+ left, right, proper_subtype=self.proper_subtype
817
+ ):
818
+ # Special-case protocols to get precise binding of self type for
819
+ # custom tuple types like NamedTuples.
820
+ return True
821
+ return False
822
+ elif isinstance(right, TupleType):
823
+ # If right has a variadic unpack this needs special handling. If there is a TypeVarTuple
824
+ # unpack, item count must coincide. If the left has variadic unpack but right
825
+ # doesn't have one, we will fall through.
826
+ if self.variadic_tuple_subtype(left, right):
827
+ return True
828
+ # The only case where variadic can be subtype of fixed is when left variadic item is Any.
829
+ # Otherwise, the original left will be returned, causing fall through to False.
830
+ left = self.adjust_left_if_possible(left, right)
831
+ if len(left.items) != len(right.items):
832
+ return False
833
+ if any(not self._is_subtype(l, r) for l, r in zip(left.items, right.items)):
834
+ return False
835
+ if is_named_instance(right.partial_fallback, "builtins.tuple"):
836
+ # No need to verify fallback. This is useful since the calculated fallback
837
+ # may be inconsistent due to how we calculate joins between unions vs.
838
+ # non-unions. For example, join(int, str) == object, whereas
839
+ # join(Union[int, C], Union[str, C]) == Union[int, str, C].
840
+ return True
841
+ if is_named_instance(left.partial_fallback, "builtins.tuple"):
842
+ # Again, no need to verify. At this point we know the right fallback
843
+ # is a subclass of tuple, so if left is plain tuple, it cannot be a subtype.
844
+ return False
845
+ # At this point we know both fallbacks are non-tuple.
846
+ return self._is_subtype(left.partial_fallback, right.partial_fallback)
847
+ else:
848
+ return False
849
+
850
+ def adjust_left_if_possible(self, left: TupleType, right: TupleType) -> TupleType:
851
+ """Adjust shape of left containing *tuple[Any, ...] to match right.
852
+
853
+ Note: this only works if right is fixed size (including *Ts), the variadic
854
+ right are handled by the caller, currently with variadic_tuple_subtype().
855
+ """
856
+ left_variadic = get_variadic_item(left)
857
+ if left_variadic is None:
858
+ return left
859
+ left_unpack_index, left_item = left_variadic
860
+ if not isinstance(get_proper_type(left_item), AnyType):
861
+ return left
862
+ right_unpack_index = find_unpack_in_list(right.items)
863
+ if right_unpack_index is None:
864
+ if len(left.items) > len(right.items) + 1:
865
+ return left
866
+ num_anys = len(right.items) - len(left.items) + 1
867
+ return left.copy_modified(
868
+ items=left.items[:left_unpack_index]
869
+ + [left_item] * num_anys
870
+ + left.items[left_unpack_index + 1 :]
871
+ )
872
+ right_unpack = right.items[right_unpack_index]
873
+ assert isinstance(right_unpack, UnpackType)
874
+ right_unpacked = get_proper_type(right_unpack.type)
875
+ if isinstance(right_unpacked, Instance):
876
+ return left
877
+ right_prefix = right_unpack_index
878
+ right_suffix = len(right.items) - right_prefix - 1
879
+ left_prefix = left_unpack_index
880
+ left_suffix = len(left.items) - left_prefix - 1
881
+ if left_prefix > right_prefix or left_suffix > right_suffix:
882
+ return left
883
+ new_items = extend_args_for_prefix_and_suffix(
884
+ tuple(left.items), right_prefix, right_suffix
885
+ )
886
+ return left.copy_modified(items=list(new_items))
887
+
888
+ def variadic_tuple_subtype(self, left: TupleType, right: TupleType) -> bool:
889
+ """Check subtyping between two potentially variadic tuples.
890
+
891
+ Most non-trivial cases here are due to variadic unpacks like *tuple[X, ...],
892
+ we handle such unpacks as infinite unions Tuple[()] | Tuple[X] | Tuple[X, X] | ...
893
+
894
+ Note: the cases where right is fixed or has *Ts unpack should be handled
895
+ by the caller.
896
+ """
897
+ right_variadic = get_variadic_item(right)
898
+ if right_variadic is None:
899
+ # This case should be handled by the caller.
900
+ return False
901
+ right_unpack_index, right_item = right_variadic
902
+ right_prefix = right_unpack_index
903
+ right_suffix = len(right.items) - right_prefix - 1
904
+ left_unpack_index = find_unpack_in_list(left.items)
905
+ if left_unpack_index is None:
906
+ # Simple case: left is fixed, simply find correct mapping to the right
907
+ # (effectively selecting item with matching length from an infinite union).
908
+ if len(left.items) < right_prefix + right_suffix:
909
+ return False
910
+ prefix, middle, suffix = split_with_prefix_and_suffix(
911
+ tuple(left.items), right_prefix, right_suffix
912
+ )
913
+ if not all(
914
+ self._is_subtype(li, ri) for li, ri in zip(prefix, right.items[:right_prefix])
915
+ ):
916
+ return False
917
+ if right_suffix and not all(
918
+ self._is_subtype(li, ri) for li, ri in zip(suffix, right.items[-right_suffix:])
919
+ ):
920
+ return False
921
+ return all(self._is_subtype(li, right_item) for li in middle)
922
+ else:
923
+ left_prefix = left_unpack_index
924
+ left_suffix = len(left.items) - left_prefix - 1
925
+ left_unpack = left.items[left_unpack_index]
926
+ assert isinstance(left_unpack, UnpackType)
927
+ left_unpacked = get_proper_type(left_unpack.type)
928
+ if not isinstance(left_unpacked, Instance):
929
+ if len(left.items) < len(right.items):
930
+ # There are some items on the left that will never have a matching length
931
+ # on the right.
932
+ return False
933
+ # *Ts unpack can't be split, except if it is all mapped to Anys or objects.
934
+ if self.is_top_type(right_item):
935
+ right_prefix_types, middle, right_suffix_types = split_with_prefix_and_suffix(
936
+ tuple(right.items), left_prefix, left_suffix
937
+ )
938
+ if not all(
939
+ self.is_top_type(ri) or isinstance(ri, UnpackType) for ri in middle
940
+ ):
941
+ return False
942
+ # Also check the tails match as well.
943
+ return self._all_subtypes(
944
+ left.items[:left_prefix], right_prefix_types
945
+ ) and self._all_subtypes(left.items[-left_suffix:], right_suffix_types)
946
+ return False
947
+ assert left_unpacked.type.fullname == "builtins.tuple"
948
+ left_item = left_unpacked.args[0]
949
+
950
+ # The most tricky case with two variadic unpacks we handle similar to union
951
+ # subtyping: *each* item on the left, must be a subtype of *some* item on the right.
952
+ # For this we first check the "asymptotic case", i.e. that both unpacks a subtypes,
953
+ # and then check subtyping for all finite overlaps.
954
+ # Note: if the left item is Any we use any() semantics instead of all().
955
+ use_any = isinstance(get_proper_type(left_item), AnyType)
956
+ if not use_any and len(left.items) < len(right.items):
957
+ # There are some items on the left that will never have a matching length
958
+ # on the right.
959
+ return False
960
+ if not self._is_subtype(left_item, right_item):
961
+ return False
962
+ max_overlap = max(0, right_prefix - left_prefix, right_suffix - left_suffix)
963
+ # We need to also handle the case where overlap is positive on both sides.
964
+ max_overlap = max(max_overlap, right_prefix - left_prefix + right_suffix - left_suffix)
965
+ for overlap in range(max_overlap + 1):
966
+ repr_items = left.items[:left_prefix] + [left_item] * overlap
967
+ if left_suffix:
968
+ repr_items += left.items[-left_suffix:]
969
+ left_repr = left.copy_modified(items=repr_items)
970
+ if not self._is_subtype(left_repr, right):
971
+ if not use_any:
972
+ return False
973
+ elif use_any:
974
+ return True
975
+ return not use_any
976
+
977
+ def is_top_type(self, typ: Type) -> bool:
978
+ if not self.proper_subtype and isinstance(get_proper_type(typ), AnyType):
979
+ return True
980
+ return is_named_instance(typ, "builtins.object")
981
+
982
+ def visit_typeddict_type(self, left: TypedDictType) -> bool:
983
+ right = self.right
984
+ if isinstance(right, Instance):
985
+ return self._is_subtype(left.fallback, right)
986
+ elif isinstance(right, TypedDictType):
987
+ if left == right:
988
+ return True # Fast path
989
+
990
+ # A closed type must remain closed
991
+ if right.is_closed and not left.is_closed:
992
+ return False
993
+
994
+ # Perform fast key-based checks before recursing into value types
995
+ for name, l, r in left.zipall(right):
996
+ # Required keys must remain required
997
+ if r.required and not l.required:
998
+ return False
999
+ # Mutable keys must remain mutable
1000
+ if r.mutable and not l.mutable:
1001
+ return False
1002
+ # Mutable optional keys must also remain optional,
1003
+ # to retain the ability to delete them
1004
+ if r.mutable and not r.required and l.required:
1005
+ return False
1006
+
1007
+ for name, l, r in left.zipall(right):
1008
+ if r.mutable:
1009
+ # None will only be used for missing ReadOnly[object] keys
1010
+ assert r.typ is not None
1011
+ # Guaranteed by "mutable keys must remain mutable" check
1012
+ assert l.typ is not None
1013
+
1014
+ # TODO: should we pass on the full subtype_context here and below?
1015
+ if self.proper_subtype:
1016
+ check = is_same_type(l.typ, r.typ)
1017
+ else:
1018
+ check = is_equivalent(
1019
+ l.typ,
1020
+ r.typ,
1021
+ ignore_type_params=self.subtype_context.ignore_type_params,
1022
+ options=self.options,
1023
+ )
1024
+ else:
1025
+ # Read-only items behave covariantly
1026
+ if r.typ is None:
1027
+ check = True
1028
+ elif l.typ is None:
1029
+ # Keys cannot be dropped in an open subtype
1030
+ # as this would implicitly widen the type constraint
1031
+ check = False
1032
+ else:
1033
+ check = self._is_subtype(l.typ, r.typ)
1034
+ if not check:
1035
+ return False
1036
+ # (NOTE: Fallbacks don't matter.)
1037
+ return True
1038
+ else:
1039
+ return False
1040
+
1041
+ def visit_literal_type(self, left: LiteralType) -> bool:
1042
+ if isinstance(self.right, LiteralType):
1043
+ return left == self.right
1044
+ else:
1045
+ return self._is_subtype(left.fallback, self.right)
1046
+
1047
+ def visit_overloaded(self, left: Overloaded) -> bool:
1048
+ right = self.right
1049
+ if isinstance(right, Instance):
1050
+ if right.type.is_protocol and "__call__" in right.type.protocol_members:
1051
+ # same as for CallableType
1052
+ call = find_member("__call__", right, right, is_operator=True)
1053
+ assert call is not None
1054
+ if self._is_subtype(left, call):
1055
+ if len(right.type.protocol_members) == 1:
1056
+ return True
1057
+ if is_protocol_implementation(left.fallback, right, skip=["__call__"]):
1058
+ return True
1059
+ return self._is_subtype(left.fallback, right)
1060
+ elif isinstance(right, CallableType):
1061
+ for item in left.items:
1062
+ if self._is_subtype(item, right):
1063
+ return True
1064
+ # If simple logic failed, check a (somewhat ad hoc but important)
1065
+ # edge case: Overloaded(def (int) -> int, def (str) -> str) is
1066
+ # a subtype of def (int | str) -> int | str.
1067
+ combined = union_function_signatures(left.items)
1068
+ if combined is not None and self._is_subtype(combined, right):
1069
+ return True
1070
+ return False
1071
+ elif isinstance(right, Overloaded):
1072
+ if left == self.right:
1073
+ # When it is the same overload, then the types are equal.
1074
+ return True
1075
+
1076
+ # Ensure each overload on the right side (the supertype) is accounted for.
1077
+ previous_match_left_index = -1
1078
+ matched_overloads = set()
1079
+
1080
+ for right_item in right.items:
1081
+ found_match = False
1082
+
1083
+ for left_index, left_item in enumerate(left.items):
1084
+ subtype_match = self._is_subtype(left_item, right_item)
1085
+
1086
+ # Order matters: we need to make sure that the index of
1087
+ # this item is at least the index of the previous one.
1088
+ if subtype_match and previous_match_left_index <= left_index:
1089
+ previous_match_left_index = left_index
1090
+ found_match = True
1091
+ matched_overloads.add(left_index)
1092
+ break
1093
+ else:
1094
+ # If this one overlaps with the supertype in any way, but it wasn't
1095
+ # an exact match, then it's a potential error.
1096
+ strict_concat = (
1097
+ (self.options.extra_checks or self.options.strict_concatenate)
1098
+ if self.options
1099
+ else False
1100
+ )
1101
+ if left_index not in matched_overloads and (
1102
+ is_callable_compatible(
1103
+ left_item,
1104
+ right_item,
1105
+ is_compat=self._is_subtype,
1106
+ is_proper_subtype=self.proper_subtype,
1107
+ ignore_return=True,
1108
+ ignore_pos_arg_names=self.subtype_context.ignore_pos_arg_names,
1109
+ strict_concatenate=strict_concat,
1110
+ )
1111
+ or is_callable_compatible(
1112
+ right_item,
1113
+ left_item,
1114
+ is_compat=self._is_subtype,
1115
+ is_proper_subtype=self.proper_subtype,
1116
+ ignore_return=True,
1117
+ ignore_pos_arg_names=self.subtype_context.ignore_pos_arg_names,
1118
+ strict_concatenate=strict_concat,
1119
+ )
1120
+ ):
1121
+ return False
1122
+
1123
+ if not found_match:
1124
+ return False
1125
+ return True
1126
+ elif isinstance(right, UnboundType):
1127
+ return True
1128
+ elif isinstance(right, TypeType):
1129
+ # All the items must have the same type object status, so
1130
+ # it's sufficient to query only (any) one of them.
1131
+ # This is unsound, we don't check all the __init__ signatures.
1132
+ return left.is_type_obj() and self._is_subtype(left.items[0], right)
1133
+ else:
1134
+ return False
1135
+
1136
+ def visit_union_type(self, left: UnionType) -> bool:
1137
+ if isinstance(self.right, Instance):
1138
+ literal_types: set[Instance] = set()
1139
+ # avoid redundant check for union of literals
1140
+ for item in left.relevant_items():
1141
+ p_item = get_proper_type(item)
1142
+ lit_type = mypy.typeops.simple_literal_type(p_item)
1143
+ if lit_type is not None:
1144
+ if lit_type in literal_types:
1145
+ continue
1146
+ literal_types.add(lit_type)
1147
+ item = lit_type
1148
+ if not self._is_subtype(item, self.orig_right):
1149
+ return False
1150
+ return True
1151
+
1152
+ elif isinstance(self.right, UnionType):
1153
+ # prune literals early to avoid nasty quadratic behavior which would otherwise arise when checking
1154
+ # subtype relationships between slightly different narrowings of an Enum
1155
+ # we achieve O(N+M) instead of O(N*M)
1156
+
1157
+ fast_check: set[ProperType] = set()
1158
+
1159
+ for item in flatten_types(self.right.relevant_items()):
1160
+ p_item = get_proper_type(item)
1161
+ fast_check.add(p_item)
1162
+ if isinstance(p_item, Instance) and p_item.last_known_value is not None:
1163
+ fast_check.add(p_item.last_known_value)
1164
+
1165
+ for item in left.relevant_items():
1166
+ p_item = get_proper_type(item)
1167
+ if p_item in fast_check:
1168
+ continue
1169
+ lit_type = mypy.typeops.simple_literal_type(p_item)
1170
+ if lit_type in fast_check:
1171
+ continue
1172
+ if not self._is_subtype(item, self.orig_right):
1173
+ return False
1174
+ return True
1175
+
1176
+ return all(self._is_subtype(item, self.orig_right) for item in left.items)
1177
+
1178
+ def visit_partial_type(self, left: PartialType) -> bool:
1179
+ # This is indeterminate as we don't really know the complete type yet.
1180
+ if self.proper_subtype:
1181
+ # TODO: What's the right thing to do here?
1182
+ return False
1183
+ if left.type is None:
1184
+ # Special case, partial `None`. This might happen when defining
1185
+ # class-level attributes with explicit `None`.
1186
+ # We can still recover from this.
1187
+ # https://github.com/python/mypy/issues/11105
1188
+ return self.visit_none_type(NoneType())
1189
+ raise RuntimeError(f'Partial type "{left}" cannot be checked with "issubtype()"')
1190
+
1191
+ def visit_type_type(self, left: TypeType) -> bool:
1192
+ right = self.right
1193
+ if left.is_type_form:
1194
+ if isinstance(right, TypeType):
1195
+ if not right.is_type_form:
1196
+ return False
1197
+ return self._is_subtype(left.item, right.item)
1198
+ if isinstance(right, Instance):
1199
+ if right.type.fullname == "builtins.object":
1200
+ return True
1201
+ return False
1202
+ return False
1203
+ else: # not left.is_type_form
1204
+ if isinstance(right, TypeType):
1205
+ return self._is_subtype(left.item, right.item)
1206
+ if isinstance(right, Overloaded) and right.is_type_obj():
1207
+ # Same as in other direction: if it's a constructor callable, all
1208
+ # items should belong to the same class' constructor, so it's enough
1209
+ # to check one of them.
1210
+ return self._is_subtype(left, right.items[0])
1211
+ if isinstance(right, CallableType):
1212
+ if self.proper_subtype and not right.is_type_obj():
1213
+ # We can't accept `Type[X]` as a *proper* subtype of Callable[P, X]
1214
+ # since this will break transitivity of subtyping.
1215
+ return False
1216
+ item = left.item
1217
+ # Note: self-types are special since returning `Self` is more precise
1218
+ # than its upper bound, so we don't unwrap TypeVar to its bound here.
1219
+ if isinstance(item, TupleType):
1220
+ item = mypy.typeops.tuple_fallback(item)
1221
+ if isinstance(item, Instance):
1222
+ constructor = mypy.typeops.type_object_type(item.type)
1223
+ constructor = expand_type_by_instance(constructor, item)
1224
+ if isinstance(constructor, CallableType):
1225
+ # Only consider return type to match historic behavior (see below).
1226
+ return self._is_subtype(constructor.ret_type, right.ret_type)
1227
+ elif isinstance(constructor, Overloaded):
1228
+ return all(
1229
+ self._is_subtype(c.ret_type, right.ret_type) for c in constructor.items
1230
+ )
1231
+ # This is unsound, we don't check the __init__ signature.
1232
+ return self._is_subtype(left.item, right.ret_type)
1233
+
1234
+ if isinstance(right, Instance):
1235
+ if right.type.fullname in ["builtins.object", "builtins.type"]:
1236
+ # TODO: Strictly speaking, the type builtins.type is considered equivalent to
1237
+ # Type[Any]. However, this would break the is_proper_subtype check in
1238
+ # conditional_types for cases like isinstance(x, type) when the type
1239
+ # of x is Type[int]. It's unclear what's the right way to address this.
1240
+ return True
1241
+ item = left.item
1242
+ if isinstance(item, TypeVarType):
1243
+ item = get_proper_type(item.upper_bound)
1244
+ if isinstance(item, Instance):
1245
+ if right.type.is_protocol and is_protocol_implementation(
1246
+ item, right, proper_subtype=self.proper_subtype, class_obj=True
1247
+ ):
1248
+ return True
1249
+ metaclass = item.type.metaclass_type
1250
+ return metaclass is not None and self._is_subtype(metaclass, right)
1251
+ return False
1252
+
1253
+ def visit_type_alias_type(self, left: TypeAliasType) -> bool:
1254
+ assert False, f"This should be never called, got {left}"
1255
+
1256
+
1257
+ T = TypeVar("T", bound=Type)
1258
+
1259
+
1260
+ @contextmanager
1261
+ def pop_on_exit(stack: list[tuple[T, T]], left: T, right: T) -> Iterator[None]:
1262
+ stack.append((left, right))
1263
+ yield
1264
+ stack.pop()
1265
+
1266
+
1267
+ def is_protocol_implementation(
1268
+ left: Instance | TupleType,
1269
+ right: Instance,
1270
+ proper_subtype: bool = False,
1271
+ class_obj: bool = False,
1272
+ skip: list[str] | None = None,
1273
+ options: Options | None = None,
1274
+ ) -> bool:
1275
+ """Check whether 'left' implements the protocol 'right'.
1276
+
1277
+ If 'proper_subtype' is True, then check for a proper subtype.
1278
+ Treat recursive protocols by using the 'assuming' structural subtype matrix
1279
+ (in sparse representation, i.e. as a list of pairs (subtype, supertype)),
1280
+ see also comment in nodes.TypeInfo. When we enter a check for classes
1281
+ (A, P), defined as following::
1282
+
1283
+ class P(Protocol):
1284
+ def f(self) -> P: ...
1285
+ class A:
1286
+ def f(self) -> A: ...
1287
+
1288
+ this results in A being a subtype of P without infinite recursion.
1289
+ On every false result, we pop the assumption, thus avoiding an infinite recursion
1290
+ as well.
1291
+ """
1292
+ assert right.type.is_protocol
1293
+ if skip is None:
1294
+ skip = []
1295
+ # Preserve original left type for precise self-type binding. Only tuple types are
1296
+ # supported for now.
1297
+ original_left = left
1298
+ if isinstance(left, TupleType):
1299
+ left = mypy.typeops.tuple_fallback(left)
1300
+ # We need to record this check to generate protocol fine-grained dependencies.
1301
+ type_state.record_protocol_subtype_check(left.type, right.type)
1302
+ # nominal subtyping currently ignores '__init__' and '__new__' signatures
1303
+ members_not_to_check = {"__init__", "__new__"}
1304
+ members_not_to_check.update(skip)
1305
+ # Trivial check that circumvents the bug described in issue 9771:
1306
+ if left.type.is_protocol:
1307
+ members_right = set(right.type.protocol_members) - members_not_to_check
1308
+ members_left = set(left.type.protocol_members) - members_not_to_check
1309
+ if not members_right.issubset(members_left):
1310
+ return False
1311
+ assuming = right.type.assuming_proper if proper_subtype else right.type.assuming
1312
+ if len(assuming) > MAX_PROTOCOL_DEPTH:
1313
+ return True
1314
+ for l, r in reversed(assuming):
1315
+ if l == left and r == right:
1316
+ return True
1317
+ with pop_on_exit(assuming, left, right):
1318
+ for member in right.type.protocol_members:
1319
+ if member in members_not_to_check:
1320
+ continue
1321
+ ignore_names = member != "__call__" # __call__ can be passed kwargs
1322
+ # The third argument below indicates to what self type is bound.
1323
+ # We always bind self to the subtype. (Similarly to nominal types).
1324
+ supertype = find_member(member, right, original_left)
1325
+ assert supertype is not None
1326
+
1327
+ subtype = get_protocol_member(left, original_left, member, class_obj)
1328
+ # Useful for debugging:
1329
+ # print(member, 'of', left, 'has type', subtype)
1330
+ # print(member, 'of', right, 'has type', supertype)
1331
+ if not subtype:
1332
+ return False
1333
+ if not proper_subtype:
1334
+ # Nominal check currently ignores arg names
1335
+ # NOTE: If we ever change this, be sure to also change the call to
1336
+ # SubtypeVisitor.build_subtype_kind(...) down below.
1337
+ is_compat = is_subtype(
1338
+ subtype, supertype, ignore_pos_arg_names=ignore_names, options=options
1339
+ )
1340
+ else:
1341
+ is_compat = is_proper_subtype(subtype, supertype)
1342
+ if not is_compat:
1343
+ return False
1344
+ if isinstance(get_proper_type(subtype), NoneType) and isinstance(
1345
+ get_proper_type(supertype), CallableType
1346
+ ):
1347
+ # We want __hash__ = None idiom to work even without --strict-optional
1348
+ return False
1349
+ subflags = get_member_flags(member, left, class_obj=class_obj)
1350
+ superflags = get_member_flags(member, right)
1351
+ if IS_SETTABLE in superflags:
1352
+ # Check opposite direction for settable attributes.
1353
+ if IS_EXPLICIT_SETTER in superflags:
1354
+ supertype = find_member(member, right, original_left, is_lvalue=True)
1355
+ if IS_EXPLICIT_SETTER in subflags:
1356
+ subtype = get_protocol_member(
1357
+ left, original_left, member, class_obj, is_lvalue=True
1358
+ )
1359
+ # At this point we know attribute is present on subtype, otherwise we
1360
+ # would return False above.
1361
+ assert supertype is not None and subtype is not None
1362
+ if not is_subtype(supertype, subtype, options=options):
1363
+ return False
1364
+ if IS_SETTABLE in superflags and IS_SETTABLE not in subflags:
1365
+ return False
1366
+ if not class_obj:
1367
+ if IS_SETTABLE not in superflags:
1368
+ if IS_CLASSVAR in superflags and IS_CLASSVAR not in subflags:
1369
+ return False
1370
+ elif (IS_CLASSVAR in subflags) != (IS_CLASSVAR in superflags):
1371
+ return False
1372
+ else:
1373
+ if IS_VAR in superflags and IS_CLASSVAR not in subflags:
1374
+ # Only class variables are allowed for class object access.
1375
+ return False
1376
+ if IS_CLASSVAR in superflags:
1377
+ # This can be never matched by a class object.
1378
+ return False
1379
+ # This rule is copied from nominal check in checker.py
1380
+ if IS_CLASS_OR_STATIC in superflags and IS_CLASS_OR_STATIC not in subflags:
1381
+ return False
1382
+
1383
+ if not proper_subtype:
1384
+ # Nominal check currently ignores arg names, but __call__ is special for protocols
1385
+ ignore_names = right.type.protocol_members != ["__call__"]
1386
+ else:
1387
+ ignore_names = False
1388
+ subtype_kind = SubtypeVisitor.build_subtype_kind(
1389
+ subtype_context=SubtypeContext(ignore_pos_arg_names=ignore_names),
1390
+ proper_subtype=proper_subtype,
1391
+ )
1392
+ type_state.record_subtype_cache_entry(subtype_kind, left, right)
1393
+ return True
1394
+
1395
+
1396
+ def get_protocol_member(
1397
+ left: Instance, original_left: Type, member: str, class_obj: bool, is_lvalue: bool = False
1398
+ ) -> Type | None:
1399
+ if member == "__call__" and class_obj:
1400
+ # Special case: class objects always have __call__ that is just the constructor.
1401
+ return mypy.typeops.type_object_type(left.type)
1402
+
1403
+ if member == "__call__" and left.type.is_metaclass(precise=True):
1404
+ # Special case: we want to avoid falling back to metaclass __call__
1405
+ # if constructor signature didn't match, this can cause many false negatives.
1406
+ return None
1407
+
1408
+ subtype = find_member(member, left, original_left, class_obj=class_obj, is_lvalue=is_lvalue)
1409
+ if isinstance(subtype, PartialType):
1410
+ subtype = (
1411
+ NoneType()
1412
+ if subtype.type is None
1413
+ else Instance(
1414
+ subtype.type, [AnyType(TypeOfAny.unannotated)] * len(subtype.type.type_vars)
1415
+ )
1416
+ )
1417
+ return subtype
1418
+
1419
+
1420
+ def find_member(
1421
+ name: str,
1422
+ itype: Instance,
1423
+ subtype: Type,
1424
+ *,
1425
+ is_operator: bool = False,
1426
+ class_obj: bool = False,
1427
+ is_lvalue: bool = False,
1428
+ ) -> Type | None:
1429
+ type_checker = checker_state.type_checker
1430
+ if type_checker is None:
1431
+ # Unfortunately, there are many scenarios where someone calls is_subtype() before
1432
+ # type checking phase. In this case we fallback to old (incomplete) logic.
1433
+ # TODO: reduce number of such cases (e.g. semanal_typeargs, post-semanal plugins).
1434
+ return find_member_simple(
1435
+ name, itype, subtype, is_operator=is_operator, class_obj=class_obj, is_lvalue=is_lvalue
1436
+ )
1437
+
1438
+ # We don't use ATTR_DEFINED error code below (since missing attributes can cause various
1439
+ # other error codes), instead we perform quick node lookup with all the fallbacks.
1440
+ info = itype.type
1441
+ sym = info.get(name)
1442
+ node = sym.node if sym else None
1443
+ if not node:
1444
+ name_not_found = True
1445
+ if (
1446
+ name not in ["__getattr__", "__setattr__", "__getattribute__"]
1447
+ and not is_operator
1448
+ and not class_obj
1449
+ and itype.extra_attrs is None # skip ModuleType.__getattr__
1450
+ ):
1451
+ for method_name in ("__getattribute__", "__getattr__"):
1452
+ method = info.get_method(method_name)
1453
+ if method and method.info.fullname != "builtins.object":
1454
+ name_not_found = False
1455
+ break
1456
+ if name_not_found:
1457
+ if info.fallback_to_any or class_obj and info.meta_fallback_to_any:
1458
+ return AnyType(TypeOfAny.special_form)
1459
+ if itype.extra_attrs and name in itype.extra_attrs.attrs:
1460
+ return itype.extra_attrs.attrs[name]
1461
+ return None
1462
+
1463
+ from mypy.checkmember import (
1464
+ MemberContext,
1465
+ analyze_class_attribute_access,
1466
+ analyze_instance_member_access,
1467
+ )
1468
+
1469
+ mx = MemberContext(
1470
+ is_lvalue=is_lvalue,
1471
+ is_super=False,
1472
+ is_operator=is_operator,
1473
+ original_type=TypeType.make_normalized(itype) if class_obj else itype,
1474
+ self_type=TypeType.make_normalized(subtype) if class_obj else subtype,
1475
+ context=Context(), # all errors are filtered, but this is a required argument
1476
+ chk=type_checker,
1477
+ suppress_errors=True,
1478
+ # This is needed to avoid infinite recursion in situations involving protocols like
1479
+ # class P(Protocol[T]):
1480
+ # def combine(self, other: P[S]) -> P[Tuple[T, S]]: ...
1481
+ # Normally we call freshen_all_functions_type_vars() during attribute access,
1482
+ # to avoid type variable id collisions, but for protocols this means we can't
1483
+ # use the assumption stack, that will grow indefinitely.
1484
+ # TODO: find a cleaner solution that doesn't involve massive perf impact.
1485
+ preserve_type_var_ids=True,
1486
+ )
1487
+ with type_checker.msg.filter_errors(filter_deprecated=True):
1488
+ if class_obj:
1489
+ fallback = itype.type.metaclass_type or mx.named_type("builtins.type")
1490
+ return analyze_class_attribute_access(itype, name, mx, mcs_fallback=fallback)
1491
+ else:
1492
+ return analyze_instance_member_access(name, itype, mx, info)
1493
+
1494
+
1495
+ def find_member_simple(
1496
+ name: str,
1497
+ itype: Instance,
1498
+ subtype: Type,
1499
+ *,
1500
+ is_operator: bool = False,
1501
+ class_obj: bool = False,
1502
+ is_lvalue: bool = False,
1503
+ ) -> Type | None:
1504
+ """Find the type of member by 'name' in 'itype's TypeInfo.
1505
+
1506
+ Find the member type after applying type arguments from 'itype', and binding
1507
+ 'self' to 'subtype'. Return None if member was not found.
1508
+ """
1509
+ info = itype.type
1510
+ method = info.get_method(name)
1511
+ if method:
1512
+ if isinstance(method, Decorator):
1513
+ return find_node_type(method.var, itype, subtype, class_obj=class_obj)
1514
+ if method.is_property:
1515
+ assert isinstance(method, OverloadedFuncDef)
1516
+ dec = method.items[0]
1517
+ assert isinstance(dec, Decorator)
1518
+ # Pass on is_lvalue flag as this may be a property with different setter type.
1519
+ return find_node_type(
1520
+ dec.var, itype, subtype, class_obj=class_obj, is_lvalue=is_lvalue
1521
+ )
1522
+ return find_node_type(method, itype, subtype, class_obj=class_obj)
1523
+ else:
1524
+ # don't have such method, maybe variable or decorator?
1525
+ node = info.get(name)
1526
+ v = node.node if node else None
1527
+ if isinstance(v, Var):
1528
+ return find_node_type(v, itype, subtype, class_obj=class_obj)
1529
+ if (
1530
+ not v
1531
+ and name not in ["__getattr__", "__setattr__", "__getattribute__"]
1532
+ and not is_operator
1533
+ and not class_obj
1534
+ and itype.extra_attrs is None # skip ModuleType.__getattr__
1535
+ ):
1536
+ for method_name in ("__getattribute__", "__getattr__"):
1537
+ # Normally, mypy assumes that instances that define __getattr__ have all
1538
+ # attributes with the corresponding return type. If this will produce
1539
+ # many false negatives, then this could be prohibited for
1540
+ # structural subtyping.
1541
+ method = info.get_method(method_name)
1542
+ if method and method.info.fullname != "builtins.object":
1543
+ if isinstance(method, Decorator):
1544
+ getattr_type = get_proper_type(find_node_type(method.var, itype, subtype))
1545
+ else:
1546
+ getattr_type = get_proper_type(find_node_type(method, itype, subtype))
1547
+ if isinstance(getattr_type, CallableType):
1548
+ return getattr_type.ret_type
1549
+ return getattr_type
1550
+ if itype.type.fallback_to_any or class_obj and itype.type.meta_fallback_to_any:
1551
+ return AnyType(TypeOfAny.special_form)
1552
+ if isinstance(v, TypeInfo):
1553
+ # PEP 544 doesn't specify anything about such use cases. So we just try
1554
+ # to do something meaningful (at least we should not crash).
1555
+ return TypeType(fill_typevars_with_any(v))
1556
+ if itype.extra_attrs and name in itype.extra_attrs.attrs:
1557
+ return itype.extra_attrs.attrs[name]
1558
+ return None
1559
+
1560
+
1561
+ def get_member_flags(name: str, itype: Instance, class_obj: bool = False) -> set[int]:
1562
+ """Detect whether a member 'name' is settable, whether it is an
1563
+ instance or class variable, and whether it is class or static method.
1564
+
1565
+ The flags are defined as following:
1566
+ * IS_SETTABLE: whether this attribute can be set, not set for methods and
1567
+ non-settable properties;
1568
+ * IS_CLASSVAR: set if the variable is annotated as 'x: ClassVar[t]';
1569
+ * IS_CLASS_OR_STATIC: set for methods decorated with @classmethod or
1570
+ with @staticmethod.
1571
+ """
1572
+ info = itype.type
1573
+ method = info.get_method(name)
1574
+ setattr_meth = info.get_method("__setattr__")
1575
+ if method:
1576
+ if isinstance(method, Decorator):
1577
+ if method.var.is_staticmethod or method.var.is_classmethod:
1578
+ return {IS_CLASS_OR_STATIC}
1579
+ elif method.var.is_property:
1580
+ return {IS_VAR}
1581
+ elif method.is_property: # this could be settable property
1582
+ assert isinstance(method, OverloadedFuncDef)
1583
+ dec = method.items[0]
1584
+ assert isinstance(dec, Decorator)
1585
+ if dec.var.is_settable_property or setattr_meth:
1586
+ flags = {IS_VAR, IS_SETTABLE}
1587
+ if dec.var.setter_type is not None:
1588
+ flags.add(IS_EXPLICIT_SETTER)
1589
+ return flags
1590
+ else:
1591
+ return {IS_VAR}
1592
+ return set() # Just a regular method
1593
+ node = info.get(name)
1594
+ if not node:
1595
+ if setattr_meth:
1596
+ return {IS_SETTABLE}
1597
+ if itype.extra_attrs and name in itype.extra_attrs.attrs:
1598
+ flags = set()
1599
+ if name not in itype.extra_attrs.immutable:
1600
+ flags.add(IS_SETTABLE)
1601
+ return flags
1602
+ return set()
1603
+ v = node.node
1604
+ # just a variable
1605
+ if isinstance(v, Var):
1606
+ if v.is_property:
1607
+ return {IS_VAR}
1608
+ flags = {IS_VAR}
1609
+ if not v.is_final:
1610
+ flags.add(IS_SETTABLE)
1611
+ # TODO: define cleaner rules for class vs instance variables.
1612
+ if v.is_classvar and not is_descriptor(v.type):
1613
+ flags.add(IS_CLASSVAR)
1614
+ if class_obj and v.is_inferred:
1615
+ flags.add(IS_CLASSVAR)
1616
+ return flags
1617
+ return set()
1618
+
1619
+
1620
+ def is_descriptor(typ: Type | None) -> bool:
1621
+ typ = get_proper_type(typ)
1622
+ if isinstance(typ, Instance):
1623
+ return typ.type.get("__get__") is not None
1624
+ if isinstance(typ, UnionType):
1625
+ return all(is_descriptor(item) for item in typ.relevant_items())
1626
+ return False
1627
+
1628
+
1629
+ def find_node_type(
1630
+ node: Var | FuncBase,
1631
+ itype: Instance,
1632
+ subtype: Type,
1633
+ class_obj: bool = False,
1634
+ is_lvalue: bool = False,
1635
+ ) -> Type:
1636
+ """Find type of a variable or method 'node' (maybe also a decorated method).
1637
+ Apply type arguments from 'itype', and bind 'self' to 'subtype'.
1638
+ """
1639
+ from mypy.typeops import bind_self
1640
+
1641
+ if isinstance(node, FuncBase):
1642
+ typ: Type | None = mypy.typeops.function_type(
1643
+ node, fallback=Instance(itype.type.mro[-1], [])
1644
+ )
1645
+ else:
1646
+ # This part and the one below are simply copies of the logic from checkmember.py.
1647
+ if node.is_settable_property and is_lvalue:
1648
+ typ = node.setter_type
1649
+ if typ is None and node.is_ready:
1650
+ typ = node.type
1651
+ else:
1652
+ typ = node.type
1653
+ if typ is not None:
1654
+ typ = expand_self_type(node, typ, subtype)
1655
+ p_typ = get_proper_type(typ)
1656
+ if typ is None:
1657
+ return AnyType(TypeOfAny.from_error)
1658
+ # We don't need to bind 'self' for static methods, since there is no 'self'.
1659
+ if isinstance(node, FuncBase) or (
1660
+ isinstance(p_typ, FunctionLike)
1661
+ and node.is_initialized_in_class
1662
+ and not node.is_staticmethod
1663
+ ):
1664
+ assert isinstance(p_typ, FunctionLike)
1665
+ if class_obj and not (
1666
+ node.is_class if isinstance(node, FuncBase) else node.is_classmethod
1667
+ ):
1668
+ # Don't bind instance methods on class objects.
1669
+ signature = p_typ
1670
+ else:
1671
+ signature = bind_self(
1672
+ p_typ, subtype, is_classmethod=isinstance(node, Var) and node.is_classmethod
1673
+ )
1674
+ if node.is_property and not class_obj:
1675
+ assert isinstance(signature, CallableType)
1676
+ if (
1677
+ isinstance(node, Var)
1678
+ and node.is_settable_property
1679
+ and is_lvalue
1680
+ and node.setter_type is not None
1681
+ ):
1682
+ typ = signature.arg_types[0]
1683
+ else:
1684
+ typ = signature.ret_type
1685
+ else:
1686
+ typ = signature
1687
+ itype = map_instance_to_supertype(itype, node.info)
1688
+ typ = expand_type_by_instance(typ, itype)
1689
+ return typ
1690
+
1691
+
1692
+ def non_method_protocol_members(tp: TypeInfo) -> list[str]:
1693
+ """Find all non-callable members of a protocol."""
1694
+
1695
+ assert tp.is_protocol
1696
+ result: list[str] = []
1697
+ anytype = AnyType(TypeOfAny.special_form)
1698
+ instance = Instance(tp, [anytype] * len(tp.defn.type_vars))
1699
+
1700
+ for member in tp.protocol_members:
1701
+ typ = get_proper_type(find_member(member, instance, instance))
1702
+ if not isinstance(typ, (Overloaded, CallableType)):
1703
+ result.append(member)
1704
+ return result
1705
+
1706
+
1707
+ def is_callable_compatible(
1708
+ left: CallableType,
1709
+ right: CallableType,
1710
+ *,
1711
+ is_compat: Callable[[Type, Type], bool],
1712
+ is_proper_subtype: bool,
1713
+ is_compat_return: Callable[[Type, Type], bool] | None = None,
1714
+ ignore_return: bool = False,
1715
+ ignore_pos_arg_names: bool = False,
1716
+ check_args_covariantly: bool = False,
1717
+ allow_partial_overlap: bool = False,
1718
+ strict_concatenate: bool = False,
1719
+ ) -> bool:
1720
+ """Is the left compatible with the right, using the provided compatibility check?
1721
+
1722
+ is_compat:
1723
+ The check we want to run against the parameters.
1724
+
1725
+ is_compat_return:
1726
+ The check we want to run against the return type.
1727
+ If None, use the 'is_compat' check.
1728
+
1729
+ check_args_covariantly:
1730
+ If true, check if the left's args is compatible with the right's
1731
+ instead of the other way around (contravariantly).
1732
+
1733
+ This function is mostly used to check if the left is a subtype of the right which
1734
+ is why the default is to check the args contravariantly. However, it's occasionally
1735
+ useful to check the args using some other check, so we leave the variance
1736
+ configurable.
1737
+
1738
+ For example, when checking the validity of overloads, it's useful to see if
1739
+ the first overload alternative has more precise arguments than the second.
1740
+ We would want to check the arguments covariantly in that case.
1741
+
1742
+ Note! The following two function calls are NOT equivalent:
1743
+
1744
+ is_callable_compatible(f, g, is_compat=is_subtype, check_args_covariantly=False)
1745
+ is_callable_compatible(g, f, is_compat=is_subtype, check_args_covariantly=True)
1746
+
1747
+ The two calls are similar in that they both check the function arguments in
1748
+ the same direction: they both run `is_subtype(argument_from_g, argument_from_f)`.
1749
+
1750
+ However, the two calls differ in which direction they check things like
1751
+ keyword arguments. For example, suppose f and g are defined like so:
1752
+
1753
+ def f(x: int, *y: int) -> int: ...
1754
+ def g(x: int) -> int: ...
1755
+
1756
+ In this case, the first call will succeed and the second will fail: f is a
1757
+ valid stand-in for g but not vice-versa.
1758
+
1759
+ allow_partial_overlap:
1760
+ By default this function returns True if and only if *all* calls to left are
1761
+ also calls to right (with respect to the provided 'is_compat' function).
1762
+
1763
+ If this parameter is set to 'True', we return True if *there exists at least one*
1764
+ call to left that's also a call to right.
1765
+
1766
+ In other words, we perform an existential check instead of a universal one;
1767
+ we require left to only overlap with right instead of being a subset.
1768
+
1769
+ For example, suppose we set 'is_compat' to some subtype check and compare following:
1770
+
1771
+ f(x: float, y: str = "...", *args: bool) -> str
1772
+ g(*args: int) -> str
1773
+
1774
+ This function would normally return 'False': f is not a subtype of g.
1775
+ However, we would return True if this parameter is set to 'True': the two
1776
+ calls are compatible if the user runs "f_or_g(3)". In the context of that
1777
+ specific call, the two functions effectively have signatures of:
1778
+
1779
+ f2(float) -> str
1780
+ g2(int) -> str
1781
+
1782
+ Here, f2 is a valid subtype of g2 so we return True.
1783
+
1784
+ Specifically, if this parameter is set this function will:
1785
+
1786
+ - Ignore optional arguments on either the left or right that have no
1787
+ corresponding match.
1788
+ - No longer mandate optional arguments on either side are also optional
1789
+ on the other.
1790
+ - No longer mandate that if right has a *arg or **kwarg that left must also
1791
+ have the same.
1792
+
1793
+ Note: when this argument is set to True, this function becomes "symmetric" --
1794
+ the following calls are equivalent:
1795
+
1796
+ is_callable_compatible(f, g,
1797
+ is_compat=some_check,
1798
+ check_args_covariantly=False,
1799
+ allow_partial_overlap=True)
1800
+ is_callable_compatible(g, f,
1801
+ is_compat=some_check,
1802
+ check_args_covariantly=True,
1803
+ allow_partial_overlap=True)
1804
+
1805
+ If the 'some_check' function is also symmetric, the two calls would be equivalent
1806
+ whether or not we check the args covariantly.
1807
+ """
1808
+ # Normalize both types before comparing them.
1809
+ left = left.with_unpacked_kwargs().with_normalized_var_args()
1810
+ right = right.with_unpacked_kwargs().with_normalized_var_args()
1811
+
1812
+ if is_compat_return is None:
1813
+ is_compat_return = is_compat
1814
+
1815
+ # If either function is implicitly typed, ignore positional arg names too
1816
+ if left.implicit or right.implicit:
1817
+ ignore_pos_arg_names = True
1818
+
1819
+ # Non-type cannot be a subtype of type.
1820
+ if right.is_type_obj() and not left.is_type_obj() and not allow_partial_overlap:
1821
+ return False
1822
+
1823
+ # A callable L is a subtype of a generic callable R if L is a
1824
+ # subtype of every type obtained from R by substituting types for
1825
+ # the variables of R. We can check this by simply leaving the
1826
+ # generic variables of R as type variables, effectively varying
1827
+ # over all possible values.
1828
+
1829
+ # It's okay even if these variables share ids with generic
1830
+ # type variables of L, because generating and solving
1831
+ # constraints for the variables of L to make L a subtype of R
1832
+ # (below) treats type variables on the two sides as independent.
1833
+ if left.variables:
1834
+ # Apply generic type variables away in left via type inference.
1835
+ unified = unify_generic_callable(left, right, ignore_return=ignore_return)
1836
+ if unified is None:
1837
+ return False
1838
+ left = unified
1839
+
1840
+ # Check return types.
1841
+ if not ignore_return and not is_compat_return(left.ret_type, right.ret_type):
1842
+ return False
1843
+
1844
+ if check_args_covariantly:
1845
+ is_compat = flip_compat_check(is_compat)
1846
+
1847
+ if not strict_concatenate and (left.from_concatenate or right.from_concatenate):
1848
+ strict_concatenate_check = False
1849
+ else:
1850
+ strict_concatenate_check = True
1851
+
1852
+ return are_parameters_compatible(
1853
+ left,
1854
+ right,
1855
+ is_compat=is_compat,
1856
+ is_proper_subtype=is_proper_subtype,
1857
+ ignore_pos_arg_names=ignore_pos_arg_names,
1858
+ allow_partial_overlap=allow_partial_overlap,
1859
+ strict_concatenate_check=strict_concatenate_check,
1860
+ )
1861
+
1862
+
1863
+ def are_trivial_parameters(param: Parameters | NormalizedCallableType) -> bool:
1864
+ param_star = param.var_arg()
1865
+ param_star2 = param.kw_arg()
1866
+ return (
1867
+ param.arg_kinds == [ARG_STAR, ARG_STAR2]
1868
+ and param_star is not None
1869
+ and isinstance(get_proper_type(param_star.typ), AnyType)
1870
+ and param_star2 is not None
1871
+ and isinstance(get_proper_type(param_star2.typ), AnyType)
1872
+ )
1873
+
1874
+
1875
+ def is_trivial_suffix(param: Parameters | NormalizedCallableType) -> bool:
1876
+ param_star = param.var_arg()
1877
+ param_star2 = param.kw_arg()
1878
+ return (
1879
+ param.arg_kinds[-2:] == [ARG_STAR, ARG_STAR2]
1880
+ and param_star is not None
1881
+ and isinstance(get_proper_type(param_star.typ), AnyType)
1882
+ and param_star2 is not None
1883
+ and isinstance(get_proper_type(param_star2.typ), AnyType)
1884
+ )
1885
+
1886
+
1887
+ def are_parameters_compatible(
1888
+ left: Parameters | NormalizedCallableType,
1889
+ right: Parameters | NormalizedCallableType,
1890
+ *,
1891
+ is_compat: Callable[[Type, Type], bool],
1892
+ is_proper_subtype: bool,
1893
+ ignore_pos_arg_names: bool = False,
1894
+ allow_partial_overlap: bool = False,
1895
+ strict_concatenate_check: bool = False,
1896
+ ) -> bool:
1897
+ """Helper function for is_callable_compatible, used for Parameter compatibility"""
1898
+ if right.is_ellipsis_args and not is_proper_subtype:
1899
+ return True
1900
+
1901
+ left_star = left.var_arg()
1902
+ left_star2 = left.kw_arg()
1903
+ right_star = right.var_arg()
1904
+ right_star2 = right.kw_arg()
1905
+
1906
+ # Treat "def _(*a: Any, **kw: Any) -> X" similarly to "Callable[..., X]"
1907
+ if are_trivial_parameters(right) and not is_proper_subtype:
1908
+ return True
1909
+ trivial_suffix = is_trivial_suffix(right) and not is_proper_subtype
1910
+
1911
+ trivial_vararg_suffix = False
1912
+ if (
1913
+ right.arg_kinds[-1:] == [ARG_STAR]
1914
+ and isinstance(get_proper_type(right.arg_types[-1]), AnyType)
1915
+ and not is_proper_subtype
1916
+ and all(k.is_positional(star=True) for k in left.arg_kinds)
1917
+ ):
1918
+ # Similar to how (*Any, **Any) is considered a supertype of all callables, we consider
1919
+ # (*Any) a supertype of all callables with positional arguments. This is needed in
1920
+ # particular because we often refuse to try type inference if actual type is not
1921
+ # a subtype of erased template type.
1922
+ trivial_vararg_suffix = True
1923
+
1924
+ # Match up corresponding arguments and check them for compatibility. In
1925
+ # every pair (argL, argR) of corresponding arguments from L and R, argL must
1926
+ # be "more general" than argR if L is to be a subtype of R.
1927
+
1928
+ # Arguments are corresponding if they either share a name, share a position,
1929
+ # or both. If L's corresponding argument is ambiguous, L is not a subtype of R.
1930
+
1931
+ # If left has one corresponding argument by name and another by position,
1932
+ # consider them to be one "merged" argument (and not ambiguous) if they're
1933
+ # both optional, they're name-only and position-only respectively, and they
1934
+ # have the same type. This rule allows functions with (*args, **kwargs) to
1935
+ # properly stand in for the full domain of formal arguments that they're
1936
+ # used for in practice.
1937
+
1938
+ # Every argument in R must have a corresponding argument in L, and every
1939
+ # required argument in L must have a corresponding argument in R.
1940
+
1941
+ # Phase 1: Confirm every argument in R has a corresponding argument in L.
1942
+
1943
+ # Phase 1a: If left and right can both accept an infinite number of args,
1944
+ # their types must be compatible.
1945
+ #
1946
+ # Furthermore, if we're checking for compatibility in all cases,
1947
+ # we confirm that if R accepts an infinite number of arguments,
1948
+ # L must accept the same.
1949
+ def _incompatible(left_arg: FormalArgument | None, right_arg: FormalArgument | None) -> bool:
1950
+ if right_arg is None:
1951
+ return False
1952
+ if left_arg is None:
1953
+ return not allow_partial_overlap and not trivial_suffix
1954
+ return not is_compat(right_arg.typ, left_arg.typ)
1955
+
1956
+ if (
1957
+ _incompatible(left_star, right_star)
1958
+ and not trivial_vararg_suffix
1959
+ or _incompatible(left_star2, right_star2)
1960
+ ):
1961
+ return False
1962
+
1963
+ # Phase 1b: Check non-star args: for every arg right can accept, left must
1964
+ # also accept. The only exception is if we are allowing partial
1965
+ # overlaps: in that case, we ignore optional args on the right.
1966
+ for right_arg in right.formal_arguments():
1967
+ left_arg = mypy.typeops.callable_corresponding_argument(left, right_arg)
1968
+ if left_arg is None:
1969
+ if allow_partial_overlap and not right_arg.required:
1970
+ continue
1971
+ return False
1972
+ if not are_args_compatible(
1973
+ left_arg,
1974
+ right_arg,
1975
+ is_compat,
1976
+ ignore_pos_arg_names=ignore_pos_arg_names,
1977
+ allow_partial_overlap=allow_partial_overlap,
1978
+ allow_imprecise_kinds=right.imprecise_arg_kinds,
1979
+ ):
1980
+ return False
1981
+
1982
+ if trivial_suffix:
1983
+ # For trivial right suffix we *only* check that every non-star right argument
1984
+ # has a valid match on the left.
1985
+ return True
1986
+
1987
+ # Phase 1c: Check var args. Right has an infinite series of optional positional
1988
+ # arguments. Get all further positional args of left, and make sure
1989
+ # they're more general than the corresponding member in right.
1990
+ # TODO: handle suffix in UnpackType (i.e. *args: *Tuple[Ts, X, Y]).
1991
+ if right_star is not None and not trivial_vararg_suffix:
1992
+ # Synthesize an anonymous formal argument for the right
1993
+ right_by_position = right.try_synthesizing_arg_from_vararg(None)
1994
+ assert right_by_position is not None
1995
+
1996
+ i = right_star.pos
1997
+ assert i is not None
1998
+ while i < len(left.arg_kinds) and left.arg_kinds[i].is_positional():
1999
+ if allow_partial_overlap and left.arg_kinds[i].is_optional():
2000
+ break
2001
+
2002
+ left_by_position = left.argument_by_position(i)
2003
+ assert left_by_position is not None
2004
+
2005
+ if not are_args_compatible(
2006
+ left_by_position,
2007
+ right_by_position,
2008
+ is_compat,
2009
+ ignore_pos_arg_names=ignore_pos_arg_names,
2010
+ allow_partial_overlap=allow_partial_overlap,
2011
+ ):
2012
+ return False
2013
+ i += 1
2014
+
2015
+ # Phase 1d: Check kw args. Right has an infinite series of optional named
2016
+ # arguments. Get all further named args of left, and make sure
2017
+ # they're more general than the corresponding member in right.
2018
+ if right_star2 is not None:
2019
+ right_names = {name for name in right.arg_names if name is not None}
2020
+ left_only_names = set()
2021
+ for name, kind in zip(left.arg_names, left.arg_kinds):
2022
+ if (
2023
+ name is None
2024
+ or kind.is_star()
2025
+ or name in right_names
2026
+ or not strict_concatenate_check
2027
+ ):
2028
+ continue
2029
+ left_only_names.add(name)
2030
+
2031
+ # Synthesize an anonymous formal argument for the right
2032
+ right_by_name = right.try_synthesizing_arg_from_kwarg(None)
2033
+ assert right_by_name is not None
2034
+
2035
+ for name in left_only_names:
2036
+ left_by_name = left.argument_by_name(name)
2037
+ assert left_by_name is not None
2038
+
2039
+ if allow_partial_overlap and not left_by_name.required:
2040
+ continue
2041
+
2042
+ if not are_args_compatible(
2043
+ left_by_name,
2044
+ right_by_name,
2045
+ is_compat,
2046
+ ignore_pos_arg_names=ignore_pos_arg_names,
2047
+ allow_partial_overlap=allow_partial_overlap,
2048
+ ):
2049
+ return False
2050
+
2051
+ # Phase 2: Left must not impose additional restrictions.
2052
+ # (Every required argument in L must have a corresponding argument in R)
2053
+ # Note: we already checked the *arg and **kwarg arguments in phase 1a.
2054
+ for left_arg in left.formal_arguments():
2055
+ right_by_name = (
2056
+ right.argument_by_name(left_arg.name) if left_arg.name is not None else None
2057
+ )
2058
+
2059
+ right_by_pos = (
2060
+ right.argument_by_position(left_arg.pos) if left_arg.pos is not None else None
2061
+ )
2062
+
2063
+ # If the left hand argument corresponds to two right-hand arguments,
2064
+ # neither of them can be required.
2065
+ if (
2066
+ right_by_name is not None
2067
+ and right_by_pos is not None
2068
+ and right_by_name != right_by_pos
2069
+ and (right_by_pos.required or right_by_name.required)
2070
+ and strict_concatenate_check
2071
+ and not right.imprecise_arg_kinds
2072
+ ):
2073
+ return False
2074
+
2075
+ # All *required* left-hand arguments must have a corresponding
2076
+ # right-hand argument. Optional args do not matter.
2077
+ if left_arg.required and right_by_pos is None and right_by_name is None:
2078
+ return False
2079
+
2080
+ return True
2081
+
2082
+
2083
+ def are_args_compatible(
2084
+ left: FormalArgument,
2085
+ right: FormalArgument,
2086
+ is_compat: Callable[[Type, Type], bool],
2087
+ *,
2088
+ ignore_pos_arg_names: bool,
2089
+ allow_partial_overlap: bool,
2090
+ allow_imprecise_kinds: bool = False,
2091
+ ) -> bool:
2092
+ if left.required and right.required:
2093
+ # If both arguments are required allow_partial_overlap has no effect.
2094
+ allow_partial_overlap = False
2095
+
2096
+ def is_different(
2097
+ left_item: object | None, right_item: object | None, allow_overlap: bool
2098
+ ) -> bool:
2099
+ """Checks if the left and right items are different.
2100
+
2101
+ If the right item is unspecified (e.g. if the right callable doesn't care
2102
+ about what name or position its arg has), we default to returning False.
2103
+
2104
+ If we're allowing partial overlap, we also default to returning False
2105
+ if the left callable also doesn't care."""
2106
+ if right_item is None:
2107
+ return False
2108
+ if allow_overlap and left_item is None:
2109
+ return False
2110
+ return left_item != right_item
2111
+
2112
+ # If right has a specific name it wants this argument to be, left must
2113
+ # have the same.
2114
+ if is_different(left.name, right.name, allow_partial_overlap):
2115
+ # But pay attention to whether we're ignoring positional arg names
2116
+ if not ignore_pos_arg_names or right.pos is None:
2117
+ return False
2118
+
2119
+ # If right is at a specific position, left must have the same.
2120
+ # TODO: partial overlap logic is flawed for positions.
2121
+ # We disable it to avoid false positives at a cost of few false negatives.
2122
+ if is_different(left.pos, right.pos, allow_overlap=False) and not allow_imprecise_kinds:
2123
+ return False
2124
+
2125
+ # If right's argument is optional, left's must also be
2126
+ # (unless we're relaxing the checks to allow potential
2127
+ # rather than definite compatibility).
2128
+ if not allow_partial_overlap and not right.required and left.required:
2129
+ return False
2130
+
2131
+ # If we're allowing partial overlaps and neither arg is required,
2132
+ # the types don't actually need to be the same
2133
+ if allow_partial_overlap and not left.required and not right.required:
2134
+ return True
2135
+
2136
+ # Left must have a more general type
2137
+ return is_compat(right.typ, left.typ)
2138
+
2139
+
2140
+ def flip_compat_check(is_compat: Callable[[Type, Type], bool]) -> Callable[[Type, Type], bool]:
2141
+ def new_is_compat(left: Type, right: Type) -> bool:
2142
+ return is_compat(right, left)
2143
+
2144
+ return new_is_compat
2145
+
2146
+
2147
+ def unify_generic_callable(
2148
+ type: NormalizedCallableType,
2149
+ target: NormalizedCallableType,
2150
+ ignore_return: bool,
2151
+ return_constraint_direction: int | None = None,
2152
+ ) -> NormalizedCallableType | None:
2153
+ """Try to unify a generic callable type with another callable type.
2154
+
2155
+ Return unified CallableType if successful; otherwise, return None.
2156
+ """
2157
+ import mypy.solve
2158
+
2159
+ if set(type.type_var_ids()) & {v.id for v in mypy.typeops.get_all_type_vars(target)}:
2160
+ # Overload overlap check does nasty things like unifying in opposite direction.
2161
+ # This can easily create type variable clashes, so we need to refresh.
2162
+ type = freshen_function_type_vars(type)
2163
+
2164
+ if return_constraint_direction is None:
2165
+ return_constraint_direction = mypy.constraints.SUBTYPE_OF
2166
+
2167
+ # This code is hot in numerical libraries, so we use a faster inference
2168
+ # algorithm (that may give slightly worse results in rare cases).
2169
+ keep_unions_old = type_state.keep_unions
2170
+ type_state.keep_unions = True
2171
+ try:
2172
+ # There is some special logic for inference in callables, so better use
2173
+ # them as wholes instead of picking separate arguments.
2174
+ constraints = mypy.constraints.infer_constraints(
2175
+ type.copy_modified(ret_type=UninhabitedType()),
2176
+ target.copy_modified(ret_type=UninhabitedType()),
2177
+ mypy.constraints.SUBTYPE_OF,
2178
+ skip_neg_op=True,
2179
+ )
2180
+ if not ignore_return:
2181
+ c = mypy.constraints.infer_constraints(
2182
+ type.ret_type, target.ret_type, return_constraint_direction
2183
+ )
2184
+ constraints.extend(c)
2185
+ finally:
2186
+ type_state.keep_unions = keep_unions_old
2187
+ inferred_vars, _ = mypy.solve.solve_constraints(
2188
+ type.variables, constraints, allow_polymorphic=True
2189
+ )
2190
+ if None in inferred_vars:
2191
+ return None
2192
+ non_none_inferred_vars = cast(list[Type], inferred_vars)
2193
+ had_errors = False
2194
+
2195
+ def report(*args: Any) -> None:
2196
+ nonlocal had_errors
2197
+ had_errors = True
2198
+
2199
+ # This function may be called by the solver, so we need to allow erased types here.
2200
+ # We anyway allow checking subtyping between other types containing <Erased>
2201
+ # (probably also because solver needs subtyping). See also comment in
2202
+ # ExpandTypeVisitor.visit_erased_type().
2203
+ applied = mypy.applytype.apply_generic_arguments(
2204
+ type, non_none_inferred_vars, report, context=target
2205
+ )
2206
+ if had_errors:
2207
+ return None
2208
+ return cast(NormalizedCallableType, applied)
2209
+
2210
+
2211
+ def union_function_signatures(
2212
+ callables: list[CallableType], *, simplify_unions: bool = False
2213
+ ) -> CallableType | None:
2214
+ """Combine a list of functions by taking the union of all the arguments and return types."""
2215
+ if len(callables) == 1:
2216
+ return callables[0]
2217
+
2218
+ # Note: we are assuming here that if a user uses some TypeVar 'T' in
2219
+ # two different functions, they meant for that TypeVar to mean the
2220
+ # same thing.
2221
+ #
2222
+ # This function will make sure that all instances of that TypeVar 'T'
2223
+ # refer to the same underlying TypeVarType objects to simplify the union-ing
2224
+ # logic below.
2225
+ #
2226
+ # (If the user did *not* mean for 'T' to be consistently bound to the
2227
+ # same type in their overloads, well, their code is probably too
2228
+ # confusing and ought to be re-written anyway.)
2229
+ callables, variables = merge_typevars_in_callables_by_name(callables)
2230
+
2231
+ new_callable = callables[0].with_unpacked_kwargs().with_normalized_var_args()
2232
+ new_args: list[list[Type]] = [[] for _ in new_callable.arg_types]
2233
+ new_kinds = list(new_callable.arg_kinds)
2234
+ new_names = list(new_callable.arg_names)
2235
+ new_returns: list[Type] = []
2236
+
2237
+ for target in callables:
2238
+ target = target.with_unpacked_kwargs().with_normalized_var_args()
2239
+ # TODO: Enhance the merging logic to handle a wider variety of signatures.
2240
+ # In particular, allow name-only arguments that appear in different order.
2241
+ if len(new_kinds) != len(target.arg_kinds):
2242
+ return None
2243
+ for i, (new_kind, target_kind) in enumerate(zip(new_kinds, target.arg_kinds)):
2244
+ if target.arg_names[i] != new_callable.arg_names[i]:
2245
+ if target_kind.is_named():
2246
+ return None
2247
+ if target_kind.is_positional():
2248
+ new_names[i] = None
2249
+ if isinstance(target.arg_types[i], (ParamSpecType, UnpackType)):
2250
+ # It is risky to put these inside a union.
2251
+ return None
2252
+ if new_kind == target_kind:
2253
+ continue
2254
+ if new_kind.is_positional() and target_kind.is_positional():
2255
+ new_kinds[i] = ARG_POS
2256
+ else:
2257
+ return None
2258
+
2259
+ for i, arg in enumerate(target.arg_types):
2260
+ new_args[i].append(arg)
2261
+ new_returns.append(target.ret_type)
2262
+
2263
+ if simplify_unions:
2264
+ arg_types = [mypy.typeops.make_simplified_union(args) for args in new_args]
2265
+ ret_type = mypy.typeops.make_simplified_union(new_returns)
2266
+ else:
2267
+ arg_types = [UnionType.make_union(args) for args in new_args]
2268
+ ret_type = UnionType.make_union(new_returns)
2269
+
2270
+ return new_callable.copy_modified(
2271
+ arg_types=arg_types,
2272
+ arg_kinds=new_kinds,
2273
+ arg_names=new_names,
2274
+ ret_type=ret_type,
2275
+ variables=variables,
2276
+ )
2277
+
2278
+
2279
+ def merge_typevars_in_callables_by_name(
2280
+ callables: Sequence[CallableType],
2281
+ ) -> tuple[list[CallableType], list[TypeVarLikeType]]:
2282
+ """Takes all the typevars present in the callables and 'combines' the ones with the same name.
2283
+
2284
+ For example, suppose we have two callables with signatures "f(x: T, y: S) -> T" and
2285
+ "f(x: List[Tuple[T, S]]) -> Tuple[T, S]". Both callables use typevars named "T" and
2286
+ "S", but we treat them as distinct, unrelated typevars. (E.g. they could both have
2287
+ distinct ids.)
2288
+
2289
+ If we pass in both callables into this function, it returns a list containing two
2290
+ new callables that are identical in signature, but use the same underlying TypeVarType
2291
+ for T and S.
2292
+
2293
+ This is useful if we want to take the output lists and "merge" them into one callable
2294
+ in some way -- for example, when unioning together overloads.
2295
+
2296
+ Returns both the new list of callables and a list of all distinct TypeVarType objects used.
2297
+ """
2298
+ output: list[CallableType] = []
2299
+ unique_typevars: dict[str, TypeVarLikeType] = {}
2300
+ variables: list[TypeVarLikeType] = []
2301
+
2302
+ for target in callables:
2303
+ if target.is_generic():
2304
+ rename = {} # Mapping TypeVarId -> TypeVar
2305
+ for tv in target.variables:
2306
+ name = tv.fullname
2307
+ if name not in unique_typevars:
2308
+ unique_typevars[name] = tv
2309
+ variables.append(tv)
2310
+ rename[tv.id] = unique_typevars[name]
2311
+
2312
+ target = expand_type(target, rename)
2313
+ output.append(target)
2314
+
2315
+ return output, variables
2316
+
2317
+
2318
+ def try_restrict_literal_union(t: UnionType, s: Type) -> list[Type] | None:
2319
+ """Return the items of t, excluding any occurrence of s, if and only if
2320
+ - t only contains simple literals
2321
+ - s is a simple literal
2322
+
2323
+ Otherwise, returns None
2324
+ """
2325
+ ps = get_proper_type(s)
2326
+ if not mypy.typeops.is_simple_literal(ps):
2327
+ return None
2328
+
2329
+ new_items: list[Type] = []
2330
+ for i in t.relevant_items():
2331
+ pi = get_proper_type(i)
2332
+ if not mypy.typeops.is_simple_literal(pi):
2333
+ return None
2334
+ if pi != ps:
2335
+ new_items.append(i)
2336
+ return new_items
2337
+
2338
+
2339
+ def restrict_subtype_away(t: Type, s: Type, *, consider_runtime_isinstance: bool = True) -> Type:
2340
+ """Return t minus s for runtime type assertions.
2341
+
2342
+ If we can't determine a precise result, return a supertype of the
2343
+ ideal result (just t is a valid result).
2344
+
2345
+ This is used for type inference of runtime type checks such as
2346
+ isinstance(). Currently, this just removes elements of a union type.
2347
+ """
2348
+ p_t = get_proper_type(t)
2349
+ if isinstance(p_t, UnionType):
2350
+ new_items = try_restrict_literal_union(p_t, s)
2351
+ if new_items is None:
2352
+ new_items = [
2353
+ restrict_subtype_away(
2354
+ item, s, consider_runtime_isinstance=consider_runtime_isinstance
2355
+ )
2356
+ for item in p_t.relevant_items()
2357
+ ]
2358
+ return UnionType.make_union(
2359
+ [item for item in new_items if not isinstance(get_proper_type(item), UninhabitedType)]
2360
+ )
2361
+ elif isinstance(p_t, TypeVarType):
2362
+ return p_t.copy_modified(upper_bound=restrict_subtype_away(p_t.upper_bound, s))
2363
+
2364
+ if consider_runtime_isinstance:
2365
+ if covers_at_runtime(t, s):
2366
+ return UninhabitedType()
2367
+ else:
2368
+ return t
2369
+ else:
2370
+ if is_proper_subtype(t, s, ignore_promotions=True):
2371
+ return UninhabitedType()
2372
+ if is_proper_subtype(t, s, ignore_promotions=True, erase_instances=True):
2373
+ return UninhabitedType()
2374
+ return t
2375
+
2376
+
2377
+ def covers_at_runtime(item: Type, supertype: Type) -> bool:
2378
+ """Will isinstance(item, supertype) always return True at runtime?"""
2379
+ item = get_proper_type(item)
2380
+ supertype = get_proper_type(supertype)
2381
+
2382
+ # Since runtime type checks will ignore type arguments, erase the types.
2383
+ if not (isinstance(supertype, FunctionLike) and supertype.is_type_obj()):
2384
+ supertype = erase_type(supertype)
2385
+ if is_proper_subtype(
2386
+ erase_type(item), supertype, ignore_promotions=True, erase_instances=True
2387
+ ):
2388
+ return True
2389
+ if isinstance(supertype, Instance):
2390
+ if supertype.type.is_protocol:
2391
+ # TODO: Implement more robust support for runtime isinstance() checks, see issue #3827.
2392
+ if is_proper_subtype(item, supertype, ignore_promotions=True):
2393
+ return True
2394
+ if isinstance(item, TypedDictType):
2395
+ # Special case useful for selecting TypedDicts from unions using isinstance(x, dict).
2396
+ if supertype.type.fullname == "builtins.dict":
2397
+ return True
2398
+ elif isinstance(item, TypeVarType):
2399
+ if is_proper_subtype(item.upper_bound, supertype, ignore_promotions=True):
2400
+ return True
2401
+ elif isinstance(item, Instance) and supertype.type.fullname == "builtins.int":
2402
+ # "int" covers all native int types
2403
+ if item.type.fullname in MYPYC_NATIVE_INT_NAMES:
2404
+ return True
2405
+ # TODO: Add more special cases.
2406
+ return False
2407
+
2408
+
2409
+ def is_more_precise(left: Type, right: Type, *, ignore_promotions: bool = False) -> bool:
2410
+ """Check if left is a more precise type than right.
2411
+
2412
+ A left is a proper subtype of right, left is also more precise than
2413
+ right. Also, if right is Any, left is more precise than right, for
2414
+ any left.
2415
+ """
2416
+ # TODO Should List[int] be more precise than List[Any]?
2417
+ right = get_proper_type(right)
2418
+ if isinstance(right, AnyType):
2419
+ return True
2420
+ return is_proper_subtype(left, right, ignore_promotions=ignore_promotions)
2421
+
2422
+
2423
+ def all_non_object_members(info: TypeInfo) -> set[str]:
2424
+ members = set(info.names)
2425
+ for base in info.mro[1:-1]:
2426
+ members.update(base.names)
2427
+ return members
2428
+
2429
+
2430
+ def infer_variance(info: TypeInfo, i: int) -> bool:
2431
+ """Infer the variance of the ith type variable of a generic class.
2432
+
2433
+ Return True if successful. This can fail if some inferred types aren't ready.
2434
+ """
2435
+ object_type = Instance(info.mro[-1], [])
2436
+
2437
+ for variance in COVARIANT, CONTRAVARIANT, INVARIANT:
2438
+ tv = info.defn.type_vars[i]
2439
+ assert isinstance(tv, TypeVarType)
2440
+ if tv.variance != VARIANCE_NOT_READY:
2441
+ continue
2442
+ tv.variance = variance
2443
+ co = True
2444
+ contra = True
2445
+ tvar = info.defn.type_vars[i]
2446
+ self_type = fill_typevars(info)
2447
+ for member in all_non_object_members(info):
2448
+ # __mypy-replace is an implementation detail of the dataclass plugin
2449
+ if member in {"__init__", "__new__", "__replace__", "__mypy-replace"}:
2450
+ continue
2451
+
2452
+ if isinstance(self_type, TupleType):
2453
+ self_type = mypy.typeops.tuple_fallback(self_type)
2454
+ flags = get_member_flags(member, self_type)
2455
+ settable = IS_SETTABLE in flags
2456
+
2457
+ node = info[member].node
2458
+ if isinstance(node, Var):
2459
+ if node.type is None:
2460
+ tv.variance = VARIANCE_NOT_READY
2461
+ return False
2462
+ if has_underscore_prefix(member):
2463
+ # Special case to avoid false positives (and to pass conformance tests)
2464
+ settable = False
2465
+
2466
+ # TODO: handle settable properties with setter type different from getter.
2467
+ typ = find_member(member, self_type, self_type)
2468
+ if typ:
2469
+ # It's okay for a method in a generic class with a contravariant type
2470
+ # variable to return a generic instance of the class, if it doesn't involve
2471
+ # variance (i.e. values of type variables are propagated). Our normal rules
2472
+ # would disallow this. Replace such return types with 'Any' to allow this.
2473
+ #
2474
+ # This could probably be more lenient (e.g. allow self type be nested, don't
2475
+ # require all type arguments to be identical to self_type), but this will
2476
+ # hopefully cover the vast majority of such cases, including Self.
2477
+ typ = erase_return_self_types(typ, self_type)
2478
+
2479
+ typ2 = expand_type(typ, {tvar.id: object_type})
2480
+ if not is_subtype(typ, typ2):
2481
+ co = False
2482
+ if not is_subtype(typ2, typ):
2483
+ contra = False
2484
+ if settable:
2485
+ co = False
2486
+
2487
+ # Infer variance from base classes, in case they have explicit variances
2488
+ for base in info.bases:
2489
+ base2 = expand_type(base, {tvar.id: object_type})
2490
+ if not is_subtype(base, base2):
2491
+ co = False
2492
+ if not is_subtype(base2, base):
2493
+ contra = False
2494
+
2495
+ if co:
2496
+ v = COVARIANT
2497
+ elif contra:
2498
+ v = CONTRAVARIANT
2499
+ else:
2500
+ v = INVARIANT
2501
+ if v == variance:
2502
+ break
2503
+ tv.variance = VARIANCE_NOT_READY
2504
+ return True
2505
+
2506
+
2507
+ def has_underscore_prefix(name: str) -> bool:
2508
+ return name.startswith("_") and not (name.startswith("__") and name.endswith("__"))
2509
+
2510
+
2511
+ def infer_class_variances(info: TypeInfo) -> bool:
2512
+ if not info.defn.type_args:
2513
+ return True
2514
+ tvs = info.defn.type_vars
2515
+ success = True
2516
+ for i, tv in enumerate(tvs):
2517
+ if isinstance(tv, TypeVarType) and tv.variance == VARIANCE_NOT_READY:
2518
+ if not infer_variance(info, i):
2519
+ success = False
2520
+ return success
2521
+
2522
+
2523
+ def erase_return_self_types(typ: Type, self_type: Instance) -> Type:
2524
+ """If a typ is function-like and returns self_type, replace return type with Any."""
2525
+ proper_type = get_proper_type(typ)
2526
+ if isinstance(proper_type, CallableType):
2527
+ ret = get_proper_type(proper_type.ret_type)
2528
+ if isinstance(ret, Instance) and ret == self_type:
2529
+ return proper_type.copy_modified(ret_type=AnyType(TypeOfAny.implementation_artifact))
2530
+ elif isinstance(proper_type, Overloaded):
2531
+ return Overloaded(
2532
+ [
2533
+ cast(CallableType, erase_return_self_types(it, self_type))
2534
+ for it in proper_type.items
2535
+ ]
2536
+ )
2537
+ return typ
2538
+
2539
+
2540
+ def is_erased_instance(t: Instance) -> bool:
2541
+ """Is this an instance where all args are Any types?"""
2542
+ if not t.args:
2543
+ return False
2544
+ for arg in t.args:
2545
+ if isinstance(arg, UnpackType):
2546
+ unpacked = get_proper_type(arg.type)
2547
+ if not isinstance(unpacked, Instance):
2548
+ return False
2549
+ assert unpacked.type.fullname == "builtins.tuple"
2550
+ if not isinstance(get_proper_type(unpacked.args[0]), AnyType):
2551
+ return False
2552
+ elif not isinstance(get_proper_type(arg), AnyType):
2553
+ return False
2554
+ return True
2555
+
2556
+
2557
+ def is_normalized_instance(t: Instance) -> bool:
2558
+ """Is this instance type a normalized representation of a tuple type?
2559
+
2560
+ Type like class C[T, *Ts](tuple[T, *Ts]) are internally represented as
2561
+ tuple types, so that e.g. C[int, str] is tuple[int, str, fallback=C[int, str]].
2562
+ However, in case of a variadic argument they are normalized, similar to how
2563
+ tuple[*tuple[int, ...]] (TupleType) is normalized to tuple[int, ...] (Instance).
2564
+ For example, C[int, *tuple[str, ...]] is represented as an instance. This
2565
+ function detects such instances, when they need special-casing.
2566
+ """
2567
+ if not t.args:
2568
+ return False
2569
+ if not t.type.tuple_type:
2570
+ return False
2571
+ expanded = expand_type_by_instance(t.type.tuple_type, t)
2572
+ return isinstance(expanded, Instance)