@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,3417 @@
1
+ from __future__ import annotations
2
+
3
+ import contextlib
4
+ import inspect
5
+ import io
6
+ import os
7
+ import re
8
+ import sys
9
+ import tempfile
10
+ import textwrap
11
+ import unittest
12
+ from collections.abc import Callable, Iterator
13
+ from pathlib import Path
14
+ from typing import Any
15
+
16
+ from pytest import raises
17
+
18
+ import mypy.stubtest
19
+ from mypy import build, nodes
20
+ from mypy.modulefinder import BuildSource
21
+ from mypy.options import Options
22
+ from mypy.stubtest import parse_options, test_stubs
23
+ from mypy.test.config import test_temp_dir
24
+ from mypy.test.data import root_dir
25
+
26
+
27
+ @contextlib.contextmanager
28
+ def use_tmp_dir(mod_name: str) -> Iterator[str]:
29
+ current = os.getcwd()
30
+ current_syspath = sys.path.copy()
31
+ with tempfile.TemporaryDirectory() as tmp:
32
+ try:
33
+ os.chdir(tmp)
34
+ if sys.path[0] != tmp:
35
+ sys.path.insert(0, tmp)
36
+ yield tmp
37
+ finally:
38
+ sys.path = current_syspath.copy()
39
+ if mod_name in sys.modules:
40
+ del sys.modules[mod_name]
41
+
42
+ os.chdir(current)
43
+
44
+
45
+ TEST_MODULE_NAME = "test_module"
46
+
47
+
48
+ stubtest_typing_stub = """
49
+ Any = object()
50
+
51
+ class _SpecialForm:
52
+ def __getitem__(self, typeargs: Any) -> object: ...
53
+
54
+ Callable: _SpecialForm = ...
55
+ Generic: _SpecialForm = ...
56
+ Protocol: _SpecialForm = ...
57
+ Union: _SpecialForm = ...
58
+ ClassVar: _SpecialForm = ...
59
+
60
+ Final = 0
61
+ Literal = 0
62
+ NewType = 0
63
+ TypedDict = 0
64
+ Unpack = 0
65
+
66
+ class TypeVar:
67
+ def __init__(self, name, covariant: bool = ..., contravariant: bool = ...) -> None: ...
68
+
69
+ class ParamSpec:
70
+ def __init__(self, name: str) -> None: ...
71
+
72
+ AnyStr = TypeVar("AnyStr", str, bytes)
73
+ _T = TypeVar("_T")
74
+ _T_co = TypeVar("_T_co", covariant=True)
75
+ _K = TypeVar("_K")
76
+ _V = TypeVar("_V")
77
+ _S = TypeVar("_S", contravariant=True)
78
+ _R = TypeVar("_R", covariant=True)
79
+
80
+ class Coroutine(Generic[_T_co, _S, _R]): ...
81
+ class Iterable(Generic[_T_co]): ...
82
+ class Iterator(Iterable[_T_co]): ...
83
+ class Mapping(Generic[_K, _V]): ...
84
+ class MutableMapping(Mapping[_K, _V]): ...
85
+ class Match(Generic[AnyStr]): ...
86
+ class Sequence(Iterable[_T_co]): ...
87
+ class Tuple(Sequence[_T_co]): ...
88
+ class NamedTuple(tuple[Any, ...]): ...
89
+ class _TypedDict(Mapping[str, object]):
90
+ __required_keys__: ClassVar[frozenset[str]]
91
+ __optional_keys__: ClassVar[frozenset[str]]
92
+ __total__: ClassVar[bool]
93
+ __readonly_keys__: ClassVar[frozenset[str]]
94
+ __mutable_keys__: ClassVar[frozenset[str]]
95
+ __closed__: ClassVar[bool | None]
96
+ __extra_items__: ClassVar[Any]
97
+ def overload(func: _T) -> _T: ...
98
+ def type_check_only(func: _T) -> _T: ...
99
+ def final(func: _T) -> _T: ...
100
+ """
101
+
102
+ stubtest_builtins_stub = """
103
+ import types
104
+ from typing import Generic, Mapping, Sequence, TypeVar, overload
105
+
106
+ T = TypeVar('T')
107
+ T_co = TypeVar('T_co', covariant=True)
108
+ KT = TypeVar('KT')
109
+ VT = TypeVar('VT')
110
+
111
+ class object:
112
+ __module__: str
113
+ def __init__(self) -> None: pass
114
+ def __repr__(self) -> str: pass
115
+ class type: ...
116
+
117
+ class tuple(Sequence[T_co], Generic[T_co]):
118
+ def __ge__(self, __other: tuple[T_co, ...]) -> bool: pass
119
+
120
+ class dict(Mapping[KT, VT]): ...
121
+
122
+ class frozenset(Generic[T]): ...
123
+
124
+ class function: pass
125
+
126
+ class sentinel:
127
+ __name__: str
128
+ __module__: str
129
+ def __new__(cls, name: str, /, *, repr: str | None = None) -> sentinel: ...
130
+
131
+ class int: ...
132
+ class float: ...
133
+ class bool(int): ...
134
+ class str: ...
135
+ class bytes: ...
136
+
137
+ class list(Sequence[T]): ...
138
+
139
+ def property(f: T) -> T: ...
140
+ def classmethod(f: T) -> T: ...
141
+ def staticmethod(f: T) -> T: ...
142
+ """
143
+
144
+ stubtest_enum_stub = """
145
+ import sys
146
+ from typing import Any, TypeVar, Iterator
147
+
148
+ _T = TypeVar('_T')
149
+
150
+ class EnumMeta(type):
151
+ def __len__(self) -> int: pass
152
+ def __iter__(self: type[_T]) -> Iterator[_T]: pass
153
+ def __reversed__(self: type[_T]) -> Iterator[_T]: pass
154
+ def __getitem__(self: type[_T], name: str) -> _T: pass
155
+
156
+ class Enum(metaclass=EnumMeta):
157
+ def __new__(cls: type[_T], value: object) -> _T: pass
158
+ def __repr__(self) -> str: pass
159
+ def __str__(self) -> str: pass
160
+ def __format__(self, format_spec: str) -> str: pass
161
+ def __hash__(self) -> Any: pass
162
+ def __reduce_ex__(self, proto: Any) -> Any: pass
163
+ name: str
164
+ value: Any
165
+
166
+ class Flag(Enum):
167
+ def __or__(self: _T, other: _T) -> _T: pass
168
+ def __and__(self: _T, other: _T) -> _T: pass
169
+ def __xor__(self: _T, other: _T) -> _T: pass
170
+ def __invert__(self: _T) -> _T: pass
171
+ if sys.version_info >= (3, 11):
172
+ __ror__ = __or__
173
+ __rand__ = __and__
174
+ __rxor__ = __xor__
175
+ """
176
+
177
+
178
+ def build_helper(source: str) -> build.BuildResult:
179
+ return build.build(
180
+ sources=[BuildSource("main.pyi", None, textwrap.dedent(source))],
181
+ options=Options(),
182
+ alt_lib_path=test_temp_dir,
183
+ )
184
+
185
+
186
+ def run_stubtest_with_stderr(
187
+ stub: str,
188
+ runtime: str,
189
+ options: list[str],
190
+ config_file: str | None = None,
191
+ output: io.StringIO | None = None,
192
+ outerr: io.StringIO | None = None,
193
+ ) -> tuple[str, str]:
194
+ with use_tmp_dir(TEST_MODULE_NAME) as tmp_dir:
195
+ with open("builtins.pyi", "w") as f:
196
+ f.write(stubtest_builtins_stub)
197
+ with open("typing.pyi", "w") as f:
198
+ f.write(stubtest_typing_stub)
199
+ with open("enum.pyi", "w") as f:
200
+ f.write(stubtest_enum_stub)
201
+ with open(f"{TEST_MODULE_NAME}.pyi", "w") as f:
202
+ f.write(stub)
203
+ with open(f"{TEST_MODULE_NAME}.py", "w") as f:
204
+ f.write(runtime)
205
+ if config_file:
206
+ with open(f"{TEST_MODULE_NAME}_config.ini", "w") as f:
207
+ f.write(config_file)
208
+ options = options + ["--mypy-config-file", f"{TEST_MODULE_NAME}_config.ini"]
209
+ output = io.StringIO() if output is None else output
210
+ outerr = io.StringIO() if outerr is None else outerr
211
+ with contextlib.redirect_stdout(output), contextlib.redirect_stderr(outerr):
212
+ test_stubs(parse_options([TEST_MODULE_NAME] + options), use_builtins_fixtures=True)
213
+ filtered_output = remove_color_code(
214
+ output.getvalue()
215
+ # remove cwd as it's not available from outside
216
+ .replace(os.path.realpath(tmp_dir) + os.sep, "").replace(tmp_dir + os.sep, "")
217
+ )
218
+ filtered_outerr = remove_color_code(
219
+ outerr.getvalue()
220
+ # remove cwd as it's not available from outside
221
+ .replace(os.path.realpath(tmp_dir) + os.sep, "").replace(tmp_dir + os.sep, "")
222
+ )
223
+ return filtered_output, filtered_outerr
224
+
225
+
226
+ def run_stubtest(
227
+ stub: str, runtime: str, options: list[str], config_file: str | None = None
228
+ ) -> str:
229
+ return run_stubtest_with_stderr(stub, runtime, options, config_file)[0]
230
+
231
+
232
+ class Case:
233
+ def __init__(self, stub: str, runtime: str, error: str | None) -> None:
234
+ self.stub = stub
235
+ self.runtime = runtime
236
+ self.error = error
237
+
238
+
239
+ def collect_cases(fn: Callable[..., Iterator[Case]]) -> Callable[..., None]:
240
+ """run_stubtest used to be slow, so we used this decorator to combine cases.
241
+
242
+ If you're reading this and bored, feel free to refactor this and make it more like
243
+ other mypy tests.
244
+
245
+ """
246
+
247
+ def test(*args: Any, **kwargs: Any) -> None:
248
+ cases = list(fn(*args, **kwargs))
249
+ expected_errors = set()
250
+ for c in cases:
251
+ if c.error is None:
252
+ continue
253
+ expected_error = c.error
254
+ if expected_error == "":
255
+ expected_error = TEST_MODULE_NAME
256
+ elif not expected_error.startswith(f"{TEST_MODULE_NAME}."):
257
+ expected_error = f"{TEST_MODULE_NAME}.{expected_error}"
258
+ assert expected_error not in expected_errors, (
259
+ "collect_cases merges cases into a single stubtest invocation; we already "
260
+ "expect an error for {}".format(expected_error)
261
+ )
262
+ expected_errors.add(expected_error)
263
+ output = run_stubtest(
264
+ stub="\n\n".join(textwrap.dedent(c.stub.lstrip("\n")) for c in cases),
265
+ runtime="\n\n".join(textwrap.dedent(c.runtime.lstrip("\n")) for c in cases),
266
+ options=["--generate-allowlist", "--strict-type-check-only"],
267
+ )
268
+
269
+ actual_errors = set(output.splitlines())
270
+ if actual_errors != expected_errors:
271
+ output = run_stubtest(
272
+ stub="\n\n".join(textwrap.dedent(c.stub.lstrip("\n")) for c in cases),
273
+ runtime="\n\n".join(textwrap.dedent(c.runtime.lstrip("\n")) for c in cases),
274
+ options=[],
275
+ )
276
+ assert actual_errors == expected_errors, output
277
+
278
+ return test
279
+
280
+
281
+ class StubtestUnit(unittest.TestCase):
282
+ @collect_cases
283
+ def test_basic_good(self) -> Iterator[Case]:
284
+ yield Case(
285
+ stub="def f(number: int, text: str) -> None: ...",
286
+ runtime="def f(number, text): pass",
287
+ error=None,
288
+ )
289
+ yield Case(
290
+ stub="""
291
+ class X:
292
+ def f(self, number: int, text: str) -> None: ...
293
+ """,
294
+ runtime="""
295
+ class X:
296
+ def f(self, number, text): pass
297
+ """,
298
+ error=None,
299
+ )
300
+
301
+ @collect_cases
302
+ def test_types(self) -> Iterator[Case]:
303
+ yield Case(
304
+ stub="def mistyped_class() -> None: ...",
305
+ runtime="class mistyped_class: pass",
306
+ error="mistyped_class",
307
+ )
308
+ yield Case(
309
+ stub="class mistyped_fn: ...", runtime="def mistyped_fn(): pass", error="mistyped_fn"
310
+ )
311
+ yield Case(
312
+ stub="""
313
+ class X:
314
+ def mistyped_var(self) -> int: ...
315
+ """,
316
+ runtime="""
317
+ class X:
318
+ mistyped_var = 1
319
+ """,
320
+ error="X.mistyped_var",
321
+ )
322
+
323
+ @collect_cases
324
+ def test_transparent_type_check_only_subclasses(self) -> Iterator[Case]:
325
+ # See https://github.com/python/mypy/issues/20223
326
+ yield Case(
327
+ stub="""
328
+ from typing import type_check_only
329
+
330
+ class UFunc: ...
331
+
332
+ @type_check_only
333
+ class _BinaryUFunc(UFunc): ...
334
+
335
+ equal: _BinaryUFunc
336
+ """,
337
+ runtime="""
338
+ class UFunc:
339
+ pass
340
+
341
+ equal = UFunc()
342
+ """,
343
+ error=None,
344
+ )
345
+
346
+ @collect_cases
347
+ def test_coroutines(self) -> Iterator[Case]:
348
+ yield Case(stub="def bar() -> int: ...", runtime="async def bar(): return 5", error="bar")
349
+ # Don't error for this one -- we get false positives otherwise
350
+ yield Case(stub="async def foo() -> int: ...", runtime="def foo(): return 5", error=None)
351
+ yield Case(stub="def baz() -> int: ...", runtime="def baz(): return 5", error=None)
352
+ yield Case(
353
+ stub="async def bingo() -> int: ...", runtime="async def bingo(): return 5", error=None
354
+ )
355
+
356
+ @collect_cases
357
+ def test_arg_name(self) -> Iterator[Case]:
358
+ yield Case(
359
+ stub="def bad(number: int, text: str) -> None: ...",
360
+ runtime="def bad(num, text) -> None: pass",
361
+ error="bad",
362
+ )
363
+ yield Case(
364
+ stub="def good_posonly(__number: int, text: str) -> None: ...",
365
+ runtime="def good_posonly(num, /, text): pass",
366
+ error=None,
367
+ )
368
+ yield Case(
369
+ stub="def bad_posonly(__number: int, text: str) -> None: ...",
370
+ runtime="def bad_posonly(flag, /, text): pass",
371
+ error="bad_posonly",
372
+ )
373
+ yield Case(
374
+ stub="""
375
+ class BadMethod:
376
+ def f(self, number: int, text: str) -> None: ...
377
+ """,
378
+ runtime="""
379
+ class BadMethod:
380
+ def f(self, n, text): pass
381
+ """,
382
+ error="BadMethod.f",
383
+ )
384
+ yield Case(
385
+ stub="""
386
+ class GoodDunder:
387
+ def __exit__(self, t, v, tb) -> None: ...
388
+ """,
389
+ runtime="""
390
+ class GoodDunder:
391
+ def __exit__(self, exc_type, exc_val, exc_tb): pass
392
+ """,
393
+ error=None,
394
+ )
395
+ yield Case(
396
+ stub="""def dunder_name(__x: int) -> None: ...""",
397
+ runtime="""def dunder_name(__x: int) -> None: ...""",
398
+ error=None,
399
+ )
400
+ yield Case(
401
+ stub="""def dunder_name_posonly(__x: int, /) -> None: ...""",
402
+ runtime="""def dunder_name_posonly(__x: int) -> None: ...""",
403
+ error=None,
404
+ )
405
+ yield Case(
406
+ stub="""def dunder_name_bad(x: int) -> None: ...""",
407
+ runtime="""def dunder_name_bad(__x: int) -> None: ...""",
408
+ error="dunder_name_bad",
409
+ )
410
+
411
+ @collect_cases
412
+ def test_arg_kind(self) -> Iterator[Case]:
413
+ yield Case(
414
+ stub="def runtime_kwonly(number: int, text: str) -> None: ...",
415
+ runtime="def runtime_kwonly(number, *, text): pass",
416
+ error="runtime_kwonly",
417
+ )
418
+ yield Case(
419
+ stub="def stub_kwonly(number: int, *, text: str) -> None: ...",
420
+ runtime="def stub_kwonly(number, text): pass",
421
+ error="stub_kwonly",
422
+ )
423
+ yield Case(
424
+ stub="def stub_posonly(__number: int, text: str) -> None: ...",
425
+ runtime="def stub_posonly(number, text): pass",
426
+ error="stub_posonly",
427
+ )
428
+ yield Case(
429
+ stub="def good_posonly(__number: int, text: str) -> None: ...",
430
+ runtime="def good_posonly(number, /, text): pass",
431
+ error=None,
432
+ )
433
+ yield Case(
434
+ stub="def runtime_posonly(number: int, text: str) -> None: ...",
435
+ runtime="def runtime_posonly(number, /, text): pass",
436
+ error="runtime_posonly",
437
+ )
438
+ yield Case(
439
+ stub="def stub_posonly_570(number: int, /, text: str) -> None: ...",
440
+ runtime="def stub_posonly_570(number, text): pass",
441
+ error="stub_posonly_570",
442
+ )
443
+
444
+ @collect_cases
445
+ def test_private_parameters(self) -> Iterator[Case]:
446
+ # Private parameters can optionally be omitted.
447
+ yield Case(
448
+ stub="def priv_pos_arg_missing() -> None: ...",
449
+ runtime="def priv_pos_arg_missing(_p1=None): pass",
450
+ error=None,
451
+ )
452
+ yield Case(
453
+ stub="def multi_priv_args() -> None: ...",
454
+ runtime="def multi_priv_args(_p='', _q=''): pass",
455
+ error=None,
456
+ )
457
+ yield Case(
458
+ stub="def priv_kwarg_missing() -> None: ...",
459
+ runtime="def priv_kwarg_missing(*, _p2=''): pass",
460
+ error=None,
461
+ )
462
+ # But if they are included, they must be correct.
463
+ yield Case(
464
+ stub="def priv_pos_arg_wrong(_p: int = ...) -> None: ...",
465
+ runtime="def priv_pos_arg_wrong(_p=None): pass",
466
+ error="priv_pos_arg_wrong",
467
+ )
468
+ yield Case(
469
+ stub="def priv_kwarg_wrong(*, _p: int = ...) -> None: ...",
470
+ runtime="def priv_kwarg_wrong(*, _p=None): pass",
471
+ error="priv_kwarg_wrong",
472
+ )
473
+ # Private parameters must have a default and start with exactly one
474
+ # underscore.
475
+ yield Case(
476
+ stub="def pos_arg_no_default() -> None: ...",
477
+ runtime="def pos_arg_no_default(_np): pass",
478
+ error="pos_arg_no_default",
479
+ )
480
+ yield Case(
481
+ stub="def kwarg_no_default() -> None: ...",
482
+ runtime="def kwarg_no_default(*, _np): pass",
483
+ error="kwarg_no_default",
484
+ )
485
+ yield Case(
486
+ stub="def double_underscore_pos_arg() -> None: ...",
487
+ runtime="def double_underscore_pos_arg(__np = None): pass",
488
+ error="double_underscore_pos_arg",
489
+ )
490
+ yield Case(
491
+ stub="def double_underscore_kwarg() -> None: ...",
492
+ runtime="def double_underscore_kwarg(*, __np = None): pass",
493
+ error="double_underscore_kwarg",
494
+ )
495
+ # But spot parameters that are accidentally not marked kw-only and
496
+ # vice-versa.
497
+ yield Case(
498
+ stub="def priv_arg_is_kwonly(_p=...) -> None: ...",
499
+ runtime="def priv_arg_is_kwonly(*, _p=''): pass",
500
+ error="priv_arg_is_kwonly",
501
+ )
502
+ yield Case(
503
+ stub="def priv_arg_is_positional(*, _p=...) -> None: ...",
504
+ runtime="def priv_arg_is_positional(_p=''): pass",
505
+ error="priv_arg_is_positional",
506
+ )
507
+ # Private parameters not at the end of the parameter list must be
508
+ # included so that users can pass the following arguments using
509
+ # positional syntax.
510
+ yield Case(
511
+ stub="def priv_args_not_at_end(*, q='') -> None: ...",
512
+ runtime="def priv_args_not_at_end(_p='', q=''): pass",
513
+ error="priv_args_not_at_end",
514
+ )
515
+
516
+ @collect_cases
517
+ def test_default_presence(self) -> Iterator[Case]:
518
+ yield Case(
519
+ stub="def f1(text: str = ...) -> None: ...",
520
+ runtime="def f1(text = 'asdf'): pass",
521
+ error=None,
522
+ )
523
+ yield Case(
524
+ stub="def f2(text: str = ...) -> None: ...", runtime="def f2(text): pass", error="f2"
525
+ )
526
+ yield Case(
527
+ stub="def f3(text: str) -> None: ...",
528
+ runtime="def f3(text = 'asdf'): pass",
529
+ error="f3",
530
+ )
531
+ yield Case(
532
+ stub="def f4(text: str = ...) -> None: ...",
533
+ runtime="def f4(text = None): pass",
534
+ error="f4",
535
+ )
536
+ yield Case(
537
+ stub="def f5(data: bytes = ...) -> None: ...",
538
+ runtime="def f5(data = 'asdf'): pass",
539
+ error="f5",
540
+ )
541
+ yield Case(
542
+ stub="""
543
+ from typing import TypeVar
544
+ _T = TypeVar("_T", bound=str)
545
+ def f6(text: _T = ...) -> None: ...
546
+ """,
547
+ runtime="def f6(text = None): pass",
548
+ error="f6",
549
+ )
550
+
551
+ @collect_cases
552
+ def test_default_value(self) -> Iterator[Case]:
553
+ yield Case(
554
+ stub="def f1(text: str = 'x') -> None: ...",
555
+ runtime="def f1(text = 'y'): pass",
556
+ error="f1",
557
+ )
558
+ yield Case(
559
+ stub='def f2(text: bytes = b"x\'") -> None: ...',
560
+ runtime='def f2(text = b"x\'"): pass',
561
+ error=None,
562
+ )
563
+ yield Case(
564
+ stub='def f3(text: bytes = b"y\'") -> None: ...',
565
+ runtime='def f3(text = b"x\'"): pass',
566
+ error="f3",
567
+ )
568
+ yield Case(
569
+ stub="def f4(text: object = 1) -> None: ...",
570
+ runtime="def f4(text = 1.0): pass",
571
+ error="f4",
572
+ )
573
+ yield Case(
574
+ stub="def f5(text: object = True) -> None: ...",
575
+ runtime="def f5(text = 1): pass",
576
+ error="f5",
577
+ )
578
+ yield Case(
579
+ stub="def f6(text: object = True) -> None: ...",
580
+ runtime="def f6(text = True): pass",
581
+ error=None,
582
+ )
583
+ yield Case(
584
+ stub="def f7(text: object = not True) -> None: ...",
585
+ runtime="def f7(text = False): pass",
586
+ error=None,
587
+ )
588
+ yield Case(
589
+ stub="def f8(text: object = not True) -> None: ...",
590
+ runtime="def f8(text = True): pass",
591
+ error="f8",
592
+ )
593
+ yield Case(
594
+ stub="def f9(text: object = {1: 2}) -> None: ...",
595
+ runtime="def f9(text = {1: 3}): pass",
596
+ error="f9",
597
+ )
598
+ yield Case(
599
+ stub="def f10(text: object = [1, 2]) -> None: ...",
600
+ runtime="def f10(text = [1, 2]): pass",
601
+ error=None,
602
+ )
603
+
604
+ # Simulate "<unrepresentable>"
605
+ yield Case(
606
+ stub="def f11() -> None: ...",
607
+ runtime="""
608
+ def f11(text=None) -> None: pass
609
+ f11.__text_signature__ = "(text=<unrepresentable>)"
610
+ """,
611
+ error="f11",
612
+ )
613
+
614
+ # Simulate numpy ndarray.__bool__ that raises an error
615
+ yield Case(
616
+ stub="def f12(x=1): ...",
617
+ runtime="""
618
+ class _ndarray:
619
+ def __eq__(self, obj): return self
620
+ def __bool__(self): raise ValueError
621
+ def f12(x=_ndarray()) -> None: pass
622
+ """,
623
+ error="f12",
624
+ )
625
+
626
+ @collect_cases
627
+ def test_static_class_method(self) -> Iterator[Case]:
628
+ yield Case(
629
+ stub="""
630
+ class Good:
631
+ @classmethod
632
+ def f(cls, number: int, text: str) -> None: ...
633
+ """,
634
+ runtime="""
635
+ class Good:
636
+ @classmethod
637
+ def f(cls, number, text): pass
638
+ """,
639
+ error=None,
640
+ )
641
+ yield Case(
642
+ stub="""
643
+ class Bad1:
644
+ def f(cls, number: int, text: str) -> None: ...
645
+ """,
646
+ runtime="""
647
+ class Bad1:
648
+ @classmethod
649
+ def f(cls, number, text): pass
650
+ """,
651
+ error="Bad1.f",
652
+ )
653
+ yield Case(
654
+ stub="""
655
+ class Bad2:
656
+ @classmethod
657
+ def f(cls, number: int, text: str) -> None: ...
658
+ """,
659
+ runtime="""
660
+ class Bad2:
661
+ @staticmethod
662
+ def f(self, number, text): pass
663
+ """,
664
+ error="Bad2.f",
665
+ )
666
+ yield Case(
667
+ stub="""
668
+ class Bad3:
669
+ @staticmethod
670
+ def f(cls, number: int, text: str) -> None: ...
671
+ """,
672
+ runtime="""
673
+ class Bad3:
674
+ @classmethod
675
+ def f(self, number, text): pass
676
+ """,
677
+ error="Bad3.f",
678
+ )
679
+ yield Case(
680
+ stub="""
681
+ class GoodNew:
682
+ def __new__(cls, *args, **kwargs): ...
683
+ """,
684
+ runtime="""
685
+ class GoodNew:
686
+ def __new__(cls, *args, **kwargs): pass
687
+ """,
688
+ error=None,
689
+ )
690
+
691
+ @collect_cases
692
+ def test_arg_mismatch(self) -> Iterator[Case]:
693
+ yield Case(
694
+ stub="def f1(a, *, b, c) -> None: ...", runtime="def f1(a, *, b, c): pass", error=None
695
+ )
696
+ yield Case(
697
+ stub="def f2(a, *, b) -> None: ...", runtime="def f2(a, *, b, c): pass", error="f2"
698
+ )
699
+ yield Case(
700
+ stub="def f3(a, *, b, c) -> None: ...", runtime="def f3(a, *, b): pass", error="f3"
701
+ )
702
+ yield Case(
703
+ stub="def f4(a, *, b, c) -> None: ...", runtime="def f4(a, b, *, c): pass", error="f4"
704
+ )
705
+ yield Case(
706
+ stub="def f5(a, b, *, c) -> None: ...", runtime="def f5(a, *, b, c): pass", error="f5"
707
+ )
708
+
709
+ @collect_cases
710
+ def test_varargs_varkwargs(self) -> Iterator[Case]:
711
+ yield Case(
712
+ stub="def f1(*args, **kwargs) -> None: ...",
713
+ runtime="def f1(*args, **kwargs): pass",
714
+ error=None,
715
+ )
716
+ yield Case(
717
+ stub="def f2(*args, **kwargs) -> None: ...",
718
+ runtime="def f2(**kwargs): pass",
719
+ error="f2",
720
+ )
721
+ yield Case(
722
+ stub="def g1(a, b, c, d) -> None: ...", runtime="def g1(a, *args): pass", error=None
723
+ )
724
+ yield Case(
725
+ stub="def g2(a, b, c, d, *args) -> None: ...", runtime="def g2(a): pass", error="g2"
726
+ )
727
+ yield Case(
728
+ stub="def g3(a, b, c, d, *args) -> None: ...",
729
+ runtime="def g3(a, *args): pass",
730
+ error=None,
731
+ )
732
+ yield Case(
733
+ stub="def h1(a) -> None: ...", runtime="def h1(a, b, c, d, *args): pass", error="h1"
734
+ )
735
+ yield Case(
736
+ stub="def h2(a, *args) -> None: ...", runtime="def h2(a, b, c, d): pass", error="h2"
737
+ )
738
+ yield Case(
739
+ stub="def h3(a, *args) -> None: ...",
740
+ runtime="def h3(a, b, c, d, *args): pass",
741
+ error="h3",
742
+ )
743
+ yield Case(
744
+ stub="def j1(a: int, *args) -> None: ...", runtime="def j1(a): pass", error="j1"
745
+ )
746
+ yield Case(
747
+ stub="def j2(a: int) -> None: ...", runtime="def j2(a, *args): pass", error="j2"
748
+ )
749
+ yield Case(
750
+ stub="def j3(a, b, c) -> None: ...", runtime="def j3(a, *args, c): pass", error="j3"
751
+ )
752
+ yield Case(stub="def k1(a, **kwargs) -> None: ...", runtime="def k1(a): pass", error="k1")
753
+ yield Case(
754
+ # In theory an error, but led to worse results in practice
755
+ stub="def k2(a) -> None: ...",
756
+ runtime="def k2(a, **kwargs): pass",
757
+ error=None,
758
+ )
759
+ yield Case(
760
+ stub="def k3(a, b) -> None: ...", runtime="def k3(a, **kwargs): pass", error="k3"
761
+ )
762
+ yield Case(
763
+ stub="def k4(a, *, b) -> None: ...", runtime="def k4(a, **kwargs): pass", error=None
764
+ )
765
+ yield Case(
766
+ stub="def k5(a, *, b) -> None: ...",
767
+ runtime="def k5(a, *, b, c, **kwargs): pass",
768
+ error="k5",
769
+ )
770
+ yield Case(
771
+ stub="def k6(a, *, b, **kwargs) -> None: ...",
772
+ runtime="def k6(a, *, b, c, **kwargs): pass",
773
+ error="k6",
774
+ )
775
+
776
+ @collect_cases
777
+ def test_kwargs_unpack_typeddict(self) -> Iterator[Case]:
778
+ yield Case(
779
+ stub="""
780
+ from typing import TypedDict, Unpack, type_check_only
781
+
782
+ @type_check_only
783
+ class _Args(TypedDict):
784
+ a: int
785
+ b: int
786
+
787
+ def f1(**kwargs: Unpack[_Args]) -> None: ...
788
+ """,
789
+ runtime="def f1(*, a, b): pass",
790
+ error=None,
791
+ )
792
+ yield Case(
793
+ stub="def f2(**kwargs: Unpack[_Args]) -> None: ...",
794
+ runtime="def f2(*, a, c): pass",
795
+ error="f2",
796
+ )
797
+ yield Case(
798
+ stub="""
799
+ @type_check_only
800
+ class _OptionalArgs(TypedDict, total=False):
801
+ a: int
802
+
803
+ def f3(**kwargs: Unpack[_OptionalArgs]) -> None: ...
804
+ def f4(**kwargs: Unpack[_OptionalArgs]) -> None: ...
805
+ """,
806
+ runtime="""
807
+ def f3(*, a): pass
808
+ def f4(*, a=0): pass
809
+ """,
810
+ error="f3",
811
+ )
812
+
813
+ @collect_cases
814
+ def test_overload(self) -> Iterator[Case]:
815
+ yield Case(
816
+ stub="""
817
+ from typing import overload
818
+
819
+ @overload
820
+ def f1(a: int, *, c: int = ...) -> int: ...
821
+ @overload
822
+ def f1(a: int, b: int, c: int = ...) -> str: ...
823
+ """,
824
+ runtime="def f1(a, b = 0, c = 0): pass",
825
+ error=None,
826
+ )
827
+ yield Case(
828
+ stub="""
829
+ @overload
830
+ def f2(a: int, *, c: int = ...) -> int: ...
831
+ @overload
832
+ def f2(a: int, b: int, c: int = ...) -> str: ...
833
+ """,
834
+ runtime="def f2(a, b, c = 0): pass",
835
+ error="f2",
836
+ )
837
+ yield Case(
838
+ stub="""
839
+ @overload
840
+ def f3(a: int) -> int: ...
841
+ @overload
842
+ def f3(a: int, b: str) -> str: ...
843
+ """,
844
+ runtime="def f3(a, b = None): pass",
845
+ error="f3",
846
+ )
847
+ yield Case(
848
+ stub="""
849
+ @overload
850
+ def f4(a: int, *args, b: int, **kwargs) -> int: ...
851
+ @overload
852
+ def f4(a: str, *args, b: int, **kwargs) -> str: ...
853
+ """,
854
+ runtime="def f4(a, *args, b, **kwargs): pass",
855
+ error=None,
856
+ )
857
+ yield Case(
858
+ stub="""
859
+ @overload
860
+ def f5(__a: int) -> int: ...
861
+ @overload
862
+ def f5(__b: str) -> str: ...
863
+ """,
864
+ runtime="def f5(x, /): pass",
865
+ error=None,
866
+ )
867
+ yield Case(
868
+ stub="""
869
+ from typing import final
870
+ from typing_extensions import deprecated
871
+ class Foo:
872
+ @overload
873
+ @final
874
+ def f6(self, __a: int) -> int: ...
875
+ @overload
876
+ @deprecated("evil")
877
+ def f6(self, __b: str) -> str: ...
878
+ """,
879
+ runtime="""
880
+ class Foo:
881
+ def f6(self, x, /): pass
882
+ """,
883
+ error=None,
884
+ )
885
+ yield Case(
886
+ stub="""
887
+ @overload
888
+ def f7(a: int, /) -> int: ...
889
+ @overload
890
+ def f7(b: str, /) -> str: ...
891
+ """,
892
+ runtime="def f7(x, /): pass",
893
+ error=None,
894
+ )
895
+ yield Case(
896
+ stub="""
897
+ @overload
898
+ def f8(a: int, c: int = 0, /) -> int: ...
899
+ @overload
900
+ def f8(b: str, d: int, /) -> str: ...
901
+ """,
902
+ runtime="def f8(x, y, /): pass",
903
+ error="f8",
904
+ )
905
+ yield Case(
906
+ stub="""
907
+ @overload
908
+ def f9(a: int, c: int = 0, /) -> int: ...
909
+ @overload
910
+ def f9(b: str, d: int, /) -> str: ...
911
+ """,
912
+ runtime="def f9(x, y=0, /): pass",
913
+ error=None,
914
+ )
915
+ yield Case(
916
+ stub="""
917
+ class Bar:
918
+ @overload
919
+ def f1(self) -> int: ...
920
+ @overload
921
+ def f1(self, a: int, /) -> int: ...
922
+
923
+ @overload
924
+ def f2(self, a: int, /) -> int: ...
925
+ @overload
926
+ def f2(self, a: str, /) -> int: ...
927
+ """,
928
+ runtime="""
929
+ class Bar:
930
+ def f1(self, *a) -> int: ...
931
+ def f2(self, *a) -> int: ...
932
+ """,
933
+ error=None,
934
+ )
935
+ yield Case(
936
+ stub="""
937
+ @overload
938
+ def f(a: int) -> int: ...
939
+ @overload
940
+ def f(a: int, b: str, /) -> str: ...
941
+ """,
942
+ runtime="""
943
+ def f(a, *args): ...
944
+ """,
945
+ error=None,
946
+ )
947
+
948
+ @collect_cases
949
+ def test_decorated_overload(self) -> Iterator[Case]:
950
+ yield Case(
951
+ stub="""
952
+ from typing import overload, type_check_only
953
+
954
+ @type_check_only
955
+ class _dec1:
956
+ def __init__(self, func: object) -> None: ...
957
+ def __call__(self, x: str) -> str: ...
958
+
959
+ @overload
960
+ def good1(x: int) -> int: ...
961
+ @overload
962
+ @_dec1
963
+ def good1(unrelated: int, whatever: str) -> str: ...
964
+ """,
965
+ runtime="def good1(x): ...",
966
+ error=None,
967
+ )
968
+ yield Case(
969
+ stub="""
970
+ @type_check_only
971
+ class _dec2:
972
+ def __init__(self, func: object) -> None: ...
973
+ def __call__(self, x: str, y: int) -> str: ...
974
+
975
+ @overload
976
+ def good2(x: int) -> str: ...
977
+ @overload
978
+ @_dec2
979
+ def good2(unrelated: int, whatever: str) -> str: ...
980
+ """,
981
+ runtime="def good2(x, y=...): ...",
982
+ error=None,
983
+ )
984
+ yield Case(
985
+ stub="""
986
+ @type_check_only
987
+ class _dec3:
988
+ def __init__(self, func: object) -> None: ...
989
+ def __call__(self, x: str, y: int) -> str: ...
990
+
991
+ @overload
992
+ def bad(x: int) -> str: ...
993
+ @overload
994
+ @_dec3
995
+ def bad(unrelated: int, whatever: str) -> str: ...
996
+ """,
997
+ runtime="def bad(x): ...",
998
+ error="bad",
999
+ )
1000
+
1001
+ @collect_cases
1002
+ def test_property(self) -> Iterator[Case]:
1003
+ yield Case(
1004
+ stub="""
1005
+ class Good:
1006
+ @property
1007
+ def read_only_attr(self) -> int: ...
1008
+ read_only_attr_alias = read_only_attr
1009
+ """,
1010
+ runtime="""
1011
+ class Good:
1012
+ @property
1013
+ def read_only_attr(self): return 1
1014
+ read_only_attr_alias = read_only_attr
1015
+ """,
1016
+ error=None,
1017
+ )
1018
+ yield Case(
1019
+ stub="""
1020
+ class Bad:
1021
+ @property
1022
+ def f(self) -> int: ...
1023
+ """,
1024
+ runtime="""
1025
+ class Bad:
1026
+ def f(self) -> int: return 1
1027
+ """,
1028
+ error="Bad.f",
1029
+ )
1030
+ yield Case(
1031
+ stub="""
1032
+ class GoodReadOnly:
1033
+ @property
1034
+ def f(self) -> int: ...
1035
+ """,
1036
+ runtime="""
1037
+ class GoodReadOnly:
1038
+ f = 1
1039
+ """,
1040
+ error=None,
1041
+ )
1042
+ yield Case(
1043
+ stub="""
1044
+ class BadReadOnly:
1045
+ @property
1046
+ def f(self) -> str: ...
1047
+ """,
1048
+ runtime="""
1049
+ class BadReadOnly:
1050
+ f = 1
1051
+ """,
1052
+ error="BadReadOnly.f",
1053
+ )
1054
+ yield Case(
1055
+ stub="""
1056
+ class Y:
1057
+ @property
1058
+ def read_only_attr(self) -> int: ...
1059
+ @read_only_attr.setter
1060
+ def read_only_attr(self, val: int) -> None: ...
1061
+ """,
1062
+ runtime="""
1063
+ class Y:
1064
+ @property
1065
+ def read_only_attr(self): return 5
1066
+ """,
1067
+ error="Y.read_only_attr",
1068
+ )
1069
+ yield Case(
1070
+ stub="""
1071
+ class Z:
1072
+ @property
1073
+ def read_write_attr(self) -> int: ...
1074
+ @read_write_attr.setter
1075
+ def read_write_attr(self, val: int) -> None: ...
1076
+ read_write_attr_alias = read_write_attr
1077
+ """,
1078
+ runtime="""
1079
+ class Z:
1080
+ @property
1081
+ def read_write_attr(self): return self._val
1082
+ @read_write_attr.setter
1083
+ def read_write_attr(self, val): self._val = val
1084
+ read_write_attr_alias = read_write_attr
1085
+ """,
1086
+ error=None,
1087
+ )
1088
+ yield Case(
1089
+ stub="""
1090
+ class FineAndDandy:
1091
+ @property
1092
+ def attr(self) -> int: ...
1093
+ """,
1094
+ runtime="""
1095
+ class _EvilDescriptor:
1096
+ def __get__(self, instance, ownerclass=None):
1097
+ if instance is None:
1098
+ raise AttributeError('no')
1099
+ return 42
1100
+ def __set__(self, instance, value):
1101
+ raise AttributeError('no')
1102
+
1103
+ class FineAndDandy:
1104
+ attr = _EvilDescriptor()
1105
+ """,
1106
+ error=None,
1107
+ )
1108
+ yield Case(
1109
+ stub="""
1110
+ class spam:
1111
+ @property
1112
+ def eggs(self) -> int: ...
1113
+ @eggs.deleter
1114
+ def eggs(self) -> None: ...
1115
+ """,
1116
+ runtime="""
1117
+ class spam:
1118
+ @property
1119
+ def eggs(self):
1120
+ return 42
1121
+ @eggs.deleter
1122
+ def eggs(self):
1123
+ print("eggs")
1124
+ """,
1125
+ error=None,
1126
+ )
1127
+
1128
+ @collect_cases
1129
+ def test_cached_property(self) -> Iterator[Case]:
1130
+ yield Case(
1131
+ stub="""
1132
+ from functools import cached_property
1133
+ class Good:
1134
+ @cached_property
1135
+ def read_only_attr(self) -> int: ...
1136
+ @cached_property
1137
+ def read_only_attr2(self) -> int: ...
1138
+ """,
1139
+ runtime="""
1140
+ import functools as ft
1141
+ from functools import cached_property
1142
+ class Good:
1143
+ @cached_property
1144
+ def read_only_attr(self): return 1
1145
+ @ft.cached_property
1146
+ def read_only_attr2(self): return 1
1147
+ """,
1148
+ error=None,
1149
+ )
1150
+ yield Case(
1151
+ stub="""
1152
+ from functools import cached_property
1153
+ class Bad:
1154
+ @cached_property
1155
+ def f(self) -> int: ...
1156
+ """,
1157
+ runtime="""
1158
+ class Bad:
1159
+ def f(self) -> int: return 1
1160
+ """,
1161
+ error="Bad.f",
1162
+ )
1163
+ yield Case(
1164
+ stub="""
1165
+ from functools import cached_property
1166
+ class GoodCachedAttr:
1167
+ @cached_property
1168
+ def f(self) -> int: ...
1169
+ """,
1170
+ runtime="""
1171
+ class GoodCachedAttr:
1172
+ f = 1
1173
+ """,
1174
+ error=None,
1175
+ )
1176
+ yield Case(
1177
+ stub="""
1178
+ from functools import cached_property
1179
+ class BadCachedAttr:
1180
+ @cached_property
1181
+ def f(self) -> str: ...
1182
+ """,
1183
+ runtime="""
1184
+ class BadCachedAttr:
1185
+ f = 1
1186
+ """,
1187
+ error="BadCachedAttr.f",
1188
+ )
1189
+ yield Case(
1190
+ stub="""
1191
+ from functools import cached_property
1192
+ from typing import final
1193
+ class FinalGood:
1194
+ @cached_property
1195
+ @final
1196
+ def attr(self) -> int: ...
1197
+ """,
1198
+ runtime="""
1199
+ from functools import cached_property
1200
+ from typing import final
1201
+ class FinalGood:
1202
+ @cached_property
1203
+ @final
1204
+ def attr(self):
1205
+ return 1
1206
+ """,
1207
+ error=None,
1208
+ )
1209
+ yield Case(
1210
+ stub="""
1211
+ from functools import cached_property
1212
+ class FinalBad:
1213
+ @cached_property
1214
+ def attr(self) -> int: ...
1215
+ """,
1216
+ runtime="""
1217
+ from functools import cached_property
1218
+ from typing_extensions import final
1219
+ class FinalBad:
1220
+ @cached_property
1221
+ @final
1222
+ def attr(self):
1223
+ return 1
1224
+ """,
1225
+ error="FinalBad.attr",
1226
+ )
1227
+
1228
+ @collect_cases
1229
+ def test_var(self) -> Iterator[Case]:
1230
+ yield Case(stub="x1: int", runtime="x1 = 5", error=None)
1231
+ yield Case(stub="x2: str", runtime="x2 = 5", error="x2")
1232
+ yield Case("from typing import Tuple", "", None) # dummy case
1233
+ yield Case(
1234
+ stub="""
1235
+ x3: Tuple[int, int]
1236
+ """,
1237
+ runtime="x3 = (1, 3)",
1238
+ error=None,
1239
+ )
1240
+ yield Case(
1241
+ stub="""
1242
+ x4: Tuple[int, int]
1243
+ """,
1244
+ runtime="x4 = (1, 3, 5)",
1245
+ error="x4",
1246
+ )
1247
+ yield Case(stub="x5: int", runtime="def x5(a, b): pass", error="x5")
1248
+ yield Case(
1249
+ stub="def foo(a: int, b: int) -> None: ...\nx6 = foo",
1250
+ runtime="def foo(a, b): pass\ndef x6(c, d): pass",
1251
+ error="x6",
1252
+ )
1253
+ yield Case(
1254
+ stub="""
1255
+ class X:
1256
+ f: int
1257
+ """,
1258
+ runtime="""
1259
+ class X:
1260
+ def __init__(self):
1261
+ self.f = "asdf"
1262
+ """,
1263
+ error=None,
1264
+ )
1265
+ yield Case(
1266
+ stub="""
1267
+ class Y:
1268
+ read_only_attr: int
1269
+ """,
1270
+ runtime="""
1271
+ class Y:
1272
+ @property
1273
+ def read_only_attr(self): return 5
1274
+ """,
1275
+ error="Y.read_only_attr",
1276
+ )
1277
+ yield Case(
1278
+ stub="""
1279
+ class Z:
1280
+ read_write_attr: int
1281
+ """,
1282
+ runtime="""
1283
+ class Z:
1284
+ @property
1285
+ def read_write_attr(self): return self._val
1286
+ @read_write_attr.setter
1287
+ def read_write_attr(self, val): self._val = val
1288
+ """,
1289
+ error=None,
1290
+ )
1291
+ yield Case(
1292
+ stub="""
1293
+ from typing import Final
1294
+ X_FINAL: Final = 2
1295
+ """,
1296
+ runtime="X_FINAL = 1",
1297
+ error="X_FINAL",
1298
+ )
1299
+ yield Case(
1300
+ stub="""
1301
+ from typing import Final
1302
+ X_FINAL_OK: Final = 1
1303
+ """,
1304
+ runtime="X_FINAL_OK = 1",
1305
+ error=None,
1306
+ )
1307
+
1308
+ @collect_cases
1309
+ def test_type_alias(self) -> Iterator[Case]:
1310
+ yield Case(
1311
+ stub="""
1312
+ import collections.abc
1313
+ import re
1314
+ import typing
1315
+ from typing import Callable, Dict, Generic, Iterable, List, Match, Tuple, TypeVar, Union, type_check_only
1316
+ """,
1317
+ runtime="""
1318
+ import collections.abc
1319
+ import re
1320
+ from typing import Callable, Dict, Generic, Iterable, List, Match, Tuple, TypeVar, Union
1321
+ """,
1322
+ error=None,
1323
+ )
1324
+ yield Case(
1325
+ stub="""
1326
+ class X:
1327
+ def f(self) -> None: ...
1328
+ Y = X
1329
+ """,
1330
+ runtime="""
1331
+ class X:
1332
+ def f(self) -> None: ...
1333
+ class Y: ...
1334
+ """,
1335
+ error="Y.f",
1336
+ )
1337
+ yield Case(stub="A = Tuple[int, str]", runtime="A = (int, str)", error="A")
1338
+ # Error if an alias isn't present at runtime...
1339
+ yield Case(stub="B = str", runtime="", error="B")
1340
+ # ... but only if the alias isn't private
1341
+ yield Case(stub="_C = int", runtime="", error=None)
1342
+ yield Case(
1343
+ stub="""
1344
+ D = tuple[str, str]
1345
+ E = Tuple[int, int, int]
1346
+ F = Tuple[str, int]
1347
+ """,
1348
+ runtime="""
1349
+ D = Tuple[str, str]
1350
+ E = Tuple[int, int, int]
1351
+ F = List[str]
1352
+ """,
1353
+ error="F",
1354
+ )
1355
+ yield Case(
1356
+ stub="""
1357
+ G = str | int
1358
+ H = Union[str, bool]
1359
+ I = str | int
1360
+ """,
1361
+ runtime="""
1362
+ G = Union[str, int]
1363
+ H = Union[str, bool]
1364
+ I = str
1365
+ """,
1366
+ error="I",
1367
+ )
1368
+ yield Case(
1369
+ stub="""
1370
+ K = dict[str, str]
1371
+ L = Dict[int, int]
1372
+ KK = collections.abc.Iterable[str]
1373
+ LL = typing.Iterable[str]
1374
+ """,
1375
+ runtime="""
1376
+ K = Dict[str, str]
1377
+ L = Dict[int, int]
1378
+ KK = Iterable[str]
1379
+ LL = Iterable[str]
1380
+ """,
1381
+ error=None,
1382
+ )
1383
+ yield Case(
1384
+ stub="""
1385
+ _T = TypeVar("_T")
1386
+ @type_check_only
1387
+ class _Spam(Generic[_T]):
1388
+ def foo(self) -> None: ...
1389
+ IntFood = _Spam[int]
1390
+ """,
1391
+ runtime="""
1392
+ _T = TypeVar("_T")
1393
+ class _Bacon(Generic[_T]):
1394
+ def foo(self, arg): pass
1395
+ IntFood = _Bacon[int]
1396
+ """,
1397
+ error="IntFood.foo",
1398
+ )
1399
+ yield Case(stub="StrList = list[str]", runtime="StrList = ['foo', 'bar']", error="StrList")
1400
+ yield Case(
1401
+ stub="""
1402
+ N = typing.Callable[[str], bool]
1403
+ O = collections.abc.Callable[[int], str]
1404
+ P = typing.Callable[[str], bool]
1405
+ """,
1406
+ runtime="""
1407
+ N = Callable[[str], bool]
1408
+ O = Callable[[int], str]
1409
+ P = int
1410
+ """,
1411
+ error="P",
1412
+ )
1413
+ yield Case(
1414
+ stub="""
1415
+ class Foo:
1416
+ class Bar: ...
1417
+ BarAlias = Foo.Bar
1418
+ """,
1419
+ runtime="""
1420
+ class Foo:
1421
+ class Bar: pass
1422
+ BarAlias = Foo.Bar
1423
+ """,
1424
+ error=None,
1425
+ )
1426
+ yield Case(
1427
+ stub="""
1428
+ from io import StringIO
1429
+ StringIOAlias = StringIO
1430
+ """,
1431
+ runtime="""
1432
+ from _io import StringIO
1433
+ StringIOAlias = StringIO
1434
+ """,
1435
+ error=None,
1436
+ )
1437
+ yield Case(stub="M = Match[str]", runtime="M = Match[str]", error=None)
1438
+ yield Case(
1439
+ stub="""
1440
+ class Baz:
1441
+ def fizz(self) -> None: ...
1442
+ BazAlias = Baz
1443
+ """,
1444
+ runtime="""
1445
+ class Baz:
1446
+ def fizz(self): pass
1447
+ BazAlias = Baz
1448
+ Baz.__name__ = Baz.__qualname__ = Baz.__module__ = "New"
1449
+ """,
1450
+ error=None,
1451
+ )
1452
+ yield Case(
1453
+ stub="""
1454
+ class FooBar:
1455
+ __module__: None # type: ignore
1456
+ def fizz(self) -> None: ...
1457
+ FooBarAlias = FooBar
1458
+ """,
1459
+ runtime="""
1460
+ class FooBar:
1461
+ def fizz(self): pass
1462
+ FooBarAlias = FooBar
1463
+ FooBar.__module__ = None
1464
+ """,
1465
+ error=None,
1466
+ )
1467
+ yield Case(
1468
+ stub="""
1469
+ Q = Dict[str, str]
1470
+ R = dict[int, int]
1471
+ S = Tuple[int, int]
1472
+ T = tuple[str, str]
1473
+ U = int | str
1474
+ V = Union[int, str]
1475
+ W = typing.Callable[[str], bool]
1476
+ Z = collections.abc.Callable[[str], bool]
1477
+ QQ = typing.Iterable[str]
1478
+ RR = collections.abc.Iterable[str]
1479
+ MM = typing.Match[str]
1480
+ MMM = re.Match[str]
1481
+ """,
1482
+ runtime="""
1483
+ Q = dict[str, str]
1484
+ R = dict[int, int]
1485
+ S = tuple[int, int]
1486
+ T = tuple[str, str]
1487
+ U = int | str
1488
+ V = int | str
1489
+ W = collections.abc.Callable[[str], bool]
1490
+ Z = collections.abc.Callable[[str], bool]
1491
+ QQ = collections.abc.Iterable[str]
1492
+ RR = collections.abc.Iterable[str]
1493
+ MM = re.Match[str]
1494
+ MMM = re.Match[str]
1495
+ """,
1496
+ error=None,
1497
+ )
1498
+
1499
+ @collect_cases
1500
+ def test_enum(self) -> Iterator[Case]:
1501
+ yield Case(stub="import enum", runtime="import enum", error=None)
1502
+ yield Case(
1503
+ stub="""
1504
+ class X(enum.Enum):
1505
+ a = ...
1506
+ b = "asdf"
1507
+ c = "oops"
1508
+ """,
1509
+ runtime="""
1510
+ class X(enum.Enum):
1511
+ a = 1
1512
+ b = "asdf"
1513
+ c = 2
1514
+ """,
1515
+ error="X.c",
1516
+ )
1517
+ yield Case(
1518
+ stub="""
1519
+ class Flags1(enum.Flag):
1520
+ a = ...
1521
+ b = 2
1522
+ def foo(x: Flags1 = ...) -> None: ...
1523
+ """,
1524
+ runtime="""
1525
+ class Flags1(enum.Flag):
1526
+ a = 1
1527
+ b = 2
1528
+ def foo(x=Flags1.a|Flags1.b): pass
1529
+ """,
1530
+ error=None,
1531
+ )
1532
+ yield Case(
1533
+ stub="""
1534
+ class Flags2(enum.Flag):
1535
+ a = ...
1536
+ b = 2
1537
+ def bar(x: Flags2 | None = None) -> None: ...
1538
+ """,
1539
+ runtime="""
1540
+ class Flags2(enum.Flag):
1541
+ a = 1
1542
+ b = 2
1543
+ def bar(x=Flags2.a|Flags2.b): pass
1544
+ """,
1545
+ error="bar",
1546
+ )
1547
+ yield Case(
1548
+ stub="""
1549
+ class Flags3(enum.Flag):
1550
+ a = ...
1551
+ b = 2
1552
+ def baz(x: Flags3 | None = ...) -> None: ...
1553
+ """,
1554
+ runtime="""
1555
+ class Flags3(enum.Flag):
1556
+ a = 1
1557
+ b = 2
1558
+ def baz(x=Flags3(0)): pass
1559
+ """,
1560
+ error=None,
1561
+ )
1562
+ yield Case(
1563
+ runtime="""
1564
+ import enum
1565
+ class SomeObject: ...
1566
+
1567
+ class WeirdEnum(enum.Enum):
1568
+ a = SomeObject()
1569
+ b = SomeObject()
1570
+ """,
1571
+ stub="""
1572
+ import enum
1573
+ class SomeObject: ...
1574
+ class WeirdEnum(enum.Enum):
1575
+ _value_: SomeObject
1576
+ a = ...
1577
+ b = ...
1578
+ """,
1579
+ error=None,
1580
+ )
1581
+ yield Case(
1582
+ stub="""
1583
+ class Flags4(enum.Flag):
1584
+ a = 1
1585
+ b = 2
1586
+ def spam(x: Flags4 | None = None) -> None: ...
1587
+ """,
1588
+ runtime="""
1589
+ class Flags4(enum.Flag):
1590
+ a = 1
1591
+ b = 2
1592
+ def spam(x=Flags4(0)): pass
1593
+ """,
1594
+ error="spam",
1595
+ )
1596
+ yield Case(
1597
+ stub="""
1598
+ import sys
1599
+ from typing import Final, Literal
1600
+ class BytesEnum(bytes, enum.Enum):
1601
+ a = b'foo'
1602
+
1603
+ FOO: Literal[BytesEnum.a]
1604
+ BAR: Final = BytesEnum.a
1605
+ BAZ: BytesEnum
1606
+ EGGS: bytes
1607
+ """,
1608
+ runtime="""
1609
+ class BytesEnum(bytes, enum.Enum):
1610
+ a = b'foo'
1611
+ FOO = BytesEnum.a
1612
+ BAR = BytesEnum.a
1613
+ BAZ = BytesEnum.a
1614
+ EGGS = BytesEnum.a
1615
+ """,
1616
+ error=None,
1617
+ )
1618
+ yield Case(
1619
+ stub="""
1620
+ class HasSlotsAndNothingElse:
1621
+ __slots__ = ("x",)
1622
+ x: int
1623
+
1624
+ class HasInheritedSlots(HasSlotsAndNothingElse):
1625
+ pass
1626
+
1627
+ class HasEmptySlots:
1628
+ __slots__ = ()
1629
+ """,
1630
+ runtime="""
1631
+ class HasSlotsAndNothingElse:
1632
+ __slots__ = ("x",)
1633
+ x: int
1634
+
1635
+ class HasInheritedSlots(HasSlotsAndNothingElse):
1636
+ pass
1637
+
1638
+ class HasEmptySlots:
1639
+ __slots__ = ()
1640
+ """,
1641
+ error=None,
1642
+ )
1643
+ yield Case(
1644
+ stub="""
1645
+ class HasCompatibleValue(enum.Enum):
1646
+ _value_: str
1647
+ FOO = ...
1648
+ """,
1649
+ runtime="""
1650
+ class HasCompatibleValue(enum.Enum):
1651
+ FOO = "foo"
1652
+ """,
1653
+ error=None,
1654
+ )
1655
+ yield Case(
1656
+ stub="""
1657
+ class HasIncompatibleValue(enum.Enum):
1658
+ _value_: int
1659
+ FOO = ...
1660
+ """,
1661
+ runtime="""
1662
+ class HasIncompatibleValue(enum.Enum):
1663
+ FOO = "foo"
1664
+ """,
1665
+ error="HasIncompatibleValue.FOO",
1666
+ )
1667
+
1668
+ @collect_cases
1669
+ def test_decorator(self) -> Iterator[Case]:
1670
+ yield Case(
1671
+ stub="""
1672
+ from typing import Any, Callable
1673
+ def decorator(f: Callable[[], int]) -> Callable[..., Any]: ...
1674
+ @decorator
1675
+ def f() -> Any: ...
1676
+ """,
1677
+ runtime="""
1678
+ def decorator(f): return f
1679
+ @decorator
1680
+ def f(): return 3
1681
+ """,
1682
+ error=None,
1683
+ )
1684
+
1685
+ @collect_cases
1686
+ def test_proxy_object(self) -> Iterator[Case]:
1687
+ yield Case(
1688
+ stub="""
1689
+ class LazyObject:
1690
+ def __init__(self, func: object) -> None: ...
1691
+ def __bool__(self) -> bool: ...
1692
+ """,
1693
+ runtime="""
1694
+ class LazyObject:
1695
+ def __init__(self, func):
1696
+ self.__dict__["_wrapped"] = None
1697
+ self.__dict__["_setupfunc"] = func
1698
+ def _setup(self):
1699
+ self.__dict__["_wrapped"] = self._setupfunc()
1700
+ @property
1701
+ def __class__(self):
1702
+ if self._wrapped is None:
1703
+ self._setup()
1704
+ return type(self._wrapped)
1705
+ def __bool__(self):
1706
+ if self._wrapped is None:
1707
+ self._setup()
1708
+ return bool(self._wrapped)
1709
+ """,
1710
+ error="test_module.LazyObject.__class__",
1711
+ )
1712
+ yield Case(
1713
+ stub="""
1714
+ def default_value() -> bool: ...
1715
+
1716
+ DEFAULT_VALUE: bool
1717
+ """,
1718
+ runtime="""
1719
+ def default_value():
1720
+ return True
1721
+
1722
+ DEFAULT_VALUE = LazyObject(default_value)
1723
+ bool(DEFAULT_VALUE) # evaluate the lazy object
1724
+ """,
1725
+ error="test_module.DEFAULT_VALUE",
1726
+ )
1727
+
1728
+ @collect_cases
1729
+ def test_all_at_runtime_not_stub(self) -> Iterator[Case]:
1730
+ yield Case(
1731
+ stub="Z: int",
1732
+ runtime="""
1733
+ __all__ = []
1734
+ Z = 5""",
1735
+ error="__all__",
1736
+ )
1737
+
1738
+ @collect_cases
1739
+ def test_all_in_stub_not_at_runtime(self) -> Iterator[Case]:
1740
+ yield Case(stub="__all__ = ()", runtime="", error="__all__")
1741
+
1742
+ @collect_cases
1743
+ def test_all_in_stub_different_to_all_at_runtime(self) -> Iterator[Case]:
1744
+ # We *should* emit an error with the module name itself + __all__,
1745
+ # if the stub *does* define __all__,
1746
+ # but the stub's __all__ is inconsistent with the runtime's __all__
1747
+ yield Case(
1748
+ stub="""
1749
+ __all__ = ['foo']
1750
+ foo: str
1751
+ """,
1752
+ runtime="""
1753
+ __all__ = []
1754
+ foo = 'foo'
1755
+ """,
1756
+ error="__all__",
1757
+ )
1758
+
1759
+ @collect_cases
1760
+ def test_missing(self) -> Iterator[Case]:
1761
+ yield Case(stub="x = 5", runtime="", error="x")
1762
+ yield Case(stub="def f(): ...", runtime="", error="f")
1763
+ yield Case(stub="class X: ...", runtime="", error="X")
1764
+ yield Case(stub="class _X: ...", runtime="", error="_X")
1765
+ yield Case(
1766
+ stub="""
1767
+ from typing import overload
1768
+ @overload
1769
+ def h(x: int): ...
1770
+ @overload
1771
+ def h(x: str): ...
1772
+ """,
1773
+ runtime="",
1774
+ error="h",
1775
+ )
1776
+ yield Case(stub="", runtime="__all__ = []", error="__all__") # dummy case
1777
+ yield Case(stub="", runtime="__all__ += ['y']\ny = 5", error="y")
1778
+ yield Case(stub="", runtime="__all__ += ['g']\ndef g(): pass", error="g")
1779
+ # Here we should only check that runtime has B, since the stub explicitly re-exports it
1780
+ yield Case(
1781
+ stub="from mystery import A, B as B, C as D # type: ignore", runtime="", error="B"
1782
+ )
1783
+ yield Case(
1784
+ stub="class Y: ...",
1785
+ runtime="__all__ += ['Y']\nclass Y:\n def __or__(self, other): return self|other",
1786
+ error="Y.__or__",
1787
+ )
1788
+ yield Case(
1789
+ stub="class Z: ...",
1790
+ runtime="__all__ += ['Z']\nclass Z:\n def __reduce__(self): return (Z,)",
1791
+ error=None,
1792
+ )
1793
+ # __call__ exists on type, so it appears to exist on the class.
1794
+ # This checks that we identify it as missing at runtime anyway.
1795
+ yield Case(
1796
+ stub="""
1797
+ class ClassWithMetaclassOverride:
1798
+ def __call__(*args, **kwds): ...
1799
+ """,
1800
+ runtime="class ClassWithMetaclassOverride: ...",
1801
+ error="ClassWithMetaclassOverride.__call__",
1802
+ )
1803
+ # Test that we ignore object.__setattr__ and object.__delattr__ inheritance
1804
+ yield Case(
1805
+ stub="""
1806
+ from typing import Any
1807
+ class FakeSetattrClass:
1808
+ def __setattr__(self, name: str, value: Any, /) -> None: ...
1809
+ """,
1810
+ runtime="class FakeSetattrClass: ...",
1811
+ error="FakeSetattrClass.__setattr__",
1812
+ )
1813
+ yield Case(
1814
+ stub="""
1815
+ class FakeDelattrClass:
1816
+ def __delattr__(self, name: str, /) -> None: ...
1817
+ """,
1818
+ runtime="class FakeDelattrClass: ...",
1819
+ error="FakeDelattrClass.__delattr__",
1820
+ )
1821
+ yield Case(stub="from typing import NewType", runtime="", error=None)
1822
+ yield Case(stub="_Int = NewType('_Int', int)", runtime="", error=None)
1823
+
1824
+ @collect_cases
1825
+ def test_missing_no_runtime_all(self) -> Iterator[Case]:
1826
+ yield Case(stub="", runtime="import sys", error=None)
1827
+ yield Case(stub="", runtime="def g(): ...", error="g")
1828
+ yield Case(stub="", runtime="CONSTANT = 0", error="CONSTANT")
1829
+ yield Case(stub="", runtime="import re; constant = re.compile('foo')", error="constant")
1830
+ yield Case(stub="", runtime="from json.scanner import NUMBER_RE", error=None)
1831
+ yield Case(stub="", runtime="from string import ascii_letters", error=None)
1832
+
1833
+ @collect_cases
1834
+ def test_missing_no_runtime_all_terrible(self) -> Iterator[Case]:
1835
+ yield Case(
1836
+ stub="",
1837
+ runtime="""
1838
+ import sys
1839
+ import types
1840
+ import __future__
1841
+ _m = types.SimpleNamespace()
1842
+ _m.annotations = __future__.annotations
1843
+ sys.modules["_terrible_stubtest_test_module"] = _m
1844
+
1845
+ from _terrible_stubtest_test_module import *
1846
+ assert annotations
1847
+ """,
1848
+ error=None,
1849
+ )
1850
+
1851
+ @collect_cases
1852
+ def test_non_public_1(self) -> Iterator[Case]:
1853
+ yield Case(
1854
+ stub="__all__: list[str]", runtime="", error=f"{TEST_MODULE_NAME}.__all__"
1855
+ ) # dummy case
1856
+ yield Case(stub="_f: int", runtime="def _f(): ...", error="_f")
1857
+
1858
+ @collect_cases
1859
+ def test_non_public_2(self) -> Iterator[Case]:
1860
+ yield Case(stub="__all__: list[str] = ['f']", runtime="__all__ = ['f']", error=None)
1861
+ yield Case(stub="f: int", runtime="def f(): ...", error="f")
1862
+ yield Case(stub="g: int", runtime="def g(): ...", error="g")
1863
+
1864
+ @collect_cases
1865
+ def test_dunders(self) -> Iterator[Case]:
1866
+ yield Case(
1867
+ stub="class A:\n def __init__(self, a: int, b: int) -> None: ...",
1868
+ runtime="class A:\n def __init__(self, a, bx): pass",
1869
+ error="A.__init__",
1870
+ )
1871
+ yield Case(
1872
+ stub="class B:\n def __call__(self, c: int, d: int) -> None: ...",
1873
+ runtime="class B:\n def __call__(self, c, dx): pass",
1874
+ error="B.__call__",
1875
+ )
1876
+ yield Case(
1877
+ stub=(
1878
+ "class C:\n"
1879
+ " def __init_subclass__(\n"
1880
+ " cls, e: int = ..., **kwargs: int\n"
1881
+ " ) -> None: ...\n"
1882
+ ),
1883
+ runtime="class C:\n def __init_subclass__(cls, e=1, **kwargs): pass",
1884
+ error=None,
1885
+ )
1886
+ yield Case(
1887
+ stub="class D:\n def __class_getitem__(cls, type: type) -> type: ...",
1888
+ runtime="class D:\n def __class_getitem__(cls, type): ...",
1889
+ error=None,
1890
+ )
1891
+ yield Case(
1892
+ stub="class E:\n def __getitem__(self, item: object) -> object: ...",
1893
+ runtime="class E:\n def __getitem__(self, item: object, /) -> object: ...",
1894
+ error="E.__getitem__",
1895
+ )
1896
+ yield Case(
1897
+ stub="class F:\n def __getitem__(self, item: object, /) -> object: ...",
1898
+ runtime="class F:\n def __getitem__(self, item: object) -> object: ...",
1899
+ error=None,
1900
+ )
1901
+
1902
+ @collect_cases
1903
+ def test_missing_wrapper_descriptors(self) -> Iterator[Case]:
1904
+ """
1905
+ Dunders present at runtime but missing in the stub are usually ignored
1906
+ if the runtime dunder is an instance of `WrapperDescriptorType` -- these
1907
+ are often not actually callable at runtime. However, in certain specific
1908
+ situations we still report a diagnostic when the stub is missing a dunder
1909
+ that is present as a `WrapperDescriptorType` at runtime.
1910
+ """
1911
+
1912
+ # If the stub has `__add__` and `__radd__` exists at runtime,
1913
+ # it's likely that the missing `__radd__` is a true positive,
1914
+ # so we report it.
1915
+ yield Case(
1916
+ stub="""
1917
+ class Forward:
1918
+ def __add__(self, other: object) -> object: ...
1919
+ """,
1920
+ runtime="""
1921
+ class Forward:
1922
+ def __add__(self, other): pass
1923
+ __radd__ = int.__radd__
1924
+ """,
1925
+ error="Forward.__radd__",
1926
+ )
1927
+ yield Case(
1928
+ stub="""
1929
+ class Reflected:
1930
+ def __radd__(self, other: object) -> object: ...
1931
+ """,
1932
+ runtime="""
1933
+ class Reflected:
1934
+ def __radd__(self, other): pass
1935
+ __add__ = int.__add__
1936
+ """,
1937
+ error="Reflected.__add__",
1938
+ )
1939
+ yield Case(
1940
+ stub="""
1941
+ class Ordering:
1942
+ def __lt__(self, other: object) -> bool: ...
1943
+ """,
1944
+ runtime="""
1945
+ class Ordering:
1946
+ def __lt__(self, other): pass
1947
+ __gt__ = int.__gt__
1948
+ """,
1949
+ error="Ordering.__gt__",
1950
+ )
1951
+ yield Case(
1952
+ stub="""
1953
+ class ContextManager:
1954
+ def __enter__(self) -> object: ...
1955
+ """,
1956
+ runtime="""
1957
+ class ContextManager:
1958
+ def __enter__(self): pass
1959
+ __exit__ = int.__add__
1960
+ """,
1961
+ error="ContextManager.__exit__",
1962
+ )
1963
+ yield Case(
1964
+ stub="""
1965
+ class LessThanOrEqual:
1966
+ def __lt__(self, other: object) -> bool: ...
1967
+ def __eq__(self, other: object) -> bool: ...
1968
+ """,
1969
+ runtime="""
1970
+ class LessThanOrEqual:
1971
+ def __lt__(self, other): pass
1972
+ def __eq__(self, other): pass
1973
+ __le__ = int.__le__
1974
+ """,
1975
+ error="LessThanOrEqual.__le__",
1976
+ )
1977
+ yield Case(
1978
+ stub="""
1979
+ from typing import Mapping
1980
+ class MappingOr(Mapping[str, int]): ...
1981
+ """,
1982
+ runtime="""
1983
+ class MappingOr:
1984
+ __or__ = dict.__or__
1985
+ """,
1986
+ error="MappingOr.__or__",
1987
+ )
1988
+ yield Case(
1989
+ stub="""
1990
+ from typing import MutableMapping
1991
+ class MutableMappingIor(MutableMapping[str, int]): ...
1992
+ """,
1993
+ runtime="""
1994
+ class MutableMappingIor:
1995
+ __ior__ = dict.__ior__
1996
+ """,
1997
+ error="MutableMappingIor.__ior__",
1998
+ )
1999
+ yield Case(
2000
+ stub="""
2001
+ from typing import Sequence
2002
+ class SequenceRmul(Sequence[int]): ...
2003
+ """,
2004
+ runtime="""
2005
+ class SequenceRmul:
2006
+ __rmul__ = list.__rmul__
2007
+ """,
2008
+ error="SequenceRmul.__rmul__",
2009
+ )
2010
+
2011
+ @collect_cases
2012
+ def test_not_subclassable(self) -> Iterator[Case]:
2013
+ yield Case(
2014
+ stub="class CanBeSubclassed: ...", runtime="class CanBeSubclassed: ...", error=None
2015
+ )
2016
+ yield Case(
2017
+ stub="class CannotBeSubclassed:\n def __init_subclass__(cls) -> None: ...",
2018
+ runtime="class CannotBeSubclassed:\n def __init_subclass__(cls): raise TypeError",
2019
+ error="CannotBeSubclassed",
2020
+ )
2021
+
2022
+ @collect_cases
2023
+ def test_disjoint_base(self) -> Iterator[Case]:
2024
+ yield Case(
2025
+ stub="""
2026
+ class A: pass
2027
+ """,
2028
+ runtime="""
2029
+ class A: pass
2030
+ """,
2031
+ error=None,
2032
+ )
2033
+ yield Case(
2034
+ stub="""
2035
+ from typing_extensions import disjoint_base
2036
+
2037
+ @disjoint_base
2038
+ class B: pass
2039
+ """,
2040
+ runtime="""
2041
+ class B: pass
2042
+ """,
2043
+ error="test_module.B",
2044
+ )
2045
+ yield Case(
2046
+ stub="""
2047
+ from typing_extensions import Self
2048
+
2049
+ class mytakewhile:
2050
+ def __new__(cls, predicate: object, iterable: object, /) -> Self: ...
2051
+ def __iter__(self) -> Self: ...
2052
+ def __next__(self) -> object: ...
2053
+ """,
2054
+ runtime="""
2055
+ from itertools import takewhile as mytakewhile
2056
+ """,
2057
+ # Should have @disjoint_base
2058
+ error="test_module.mytakewhile",
2059
+ )
2060
+ yield Case(
2061
+ stub="""
2062
+ from typing_extensions import disjoint_base, Self
2063
+
2064
+ @disjoint_base
2065
+ class mycorrecttakewhile:
2066
+ def __new__(cls, predicate: object, iterable: object, /) -> Self: ...
2067
+ def __iter__(self) -> Self: ...
2068
+ def __next__(self) -> object: ...
2069
+ """,
2070
+ runtime="""
2071
+ from itertools import takewhile as mycorrecttakewhile
2072
+ """,
2073
+ error=None,
2074
+ )
2075
+ yield Case(
2076
+ runtime="""
2077
+ class IsDisjointBaseBecauseItHasSlots:
2078
+ __slots__ = ("a",)
2079
+ a: int
2080
+ """,
2081
+ stub="""
2082
+ from typing_extensions import disjoint_base
2083
+
2084
+ @disjoint_base
2085
+ class IsDisjointBaseBecauseItHasSlots:
2086
+ a: int
2087
+ """,
2088
+ error="test_module.IsDisjointBaseBecauseItHasSlots",
2089
+ )
2090
+ yield Case(
2091
+ runtime="""
2092
+ class IsFinalSoDisjointBaseIsRedundant: ...
2093
+ """,
2094
+ stub="""
2095
+ from typing_extensions import disjoint_base, final
2096
+
2097
+ @final
2098
+ @disjoint_base
2099
+ class IsFinalSoDisjointBaseIsRedundant: ...
2100
+ """,
2101
+ error="test_module.IsFinalSoDisjointBaseIsRedundant",
2102
+ )
2103
+ yield Case(
2104
+ runtime="""
2105
+ import enum
2106
+
2107
+ class IsEnumWithMembersSoDisjointBaseIsRedundant(enum.Enum):
2108
+ A = 1
2109
+ B = 2
2110
+ """,
2111
+ stub="""
2112
+ from typing_extensions import disjoint_base
2113
+ import enum
2114
+
2115
+ @disjoint_base
2116
+ class IsEnumWithMembersSoDisjointBaseIsRedundant(enum.Enum):
2117
+ A = 1
2118
+ B = 2
2119
+ """,
2120
+ error="test_module.IsEnumWithMembersSoDisjointBaseIsRedundant",
2121
+ )
2122
+
2123
+ @collect_cases
2124
+ def test_has_runtime_final_decorator(self) -> Iterator[Case]:
2125
+ yield Case(
2126
+ stub="from typing_extensions import final",
2127
+ runtime="""
2128
+ import functools
2129
+ from typing_extensions import final
2130
+ """,
2131
+ error=None,
2132
+ )
2133
+ yield Case(
2134
+ stub="""
2135
+ @final
2136
+ class A: ...
2137
+ """,
2138
+ runtime="""
2139
+ @final
2140
+ class A: ...
2141
+ """,
2142
+ error=None,
2143
+ )
2144
+ yield Case( # Runtime can miss `@final` decorator
2145
+ stub="""
2146
+ @final
2147
+ class B: ...
2148
+ """,
2149
+ runtime="""
2150
+ class B: ...
2151
+ """,
2152
+ error=None,
2153
+ )
2154
+ yield Case( # Stub cannot miss `@final` decorator
2155
+ stub="""
2156
+ class C: ...
2157
+ """,
2158
+ runtime="""
2159
+ @final
2160
+ class C: ...
2161
+ """,
2162
+ error="C",
2163
+ )
2164
+ yield Case(
2165
+ stub="""
2166
+ class D:
2167
+ @final
2168
+ def foo(self) -> None: ...
2169
+ @final
2170
+ @staticmethod
2171
+ def bar() -> None: ...
2172
+ @staticmethod
2173
+ @final
2174
+ def bar2() -> None: ...
2175
+ @final
2176
+ @classmethod
2177
+ def baz(cls) -> None: ...
2178
+ @classmethod
2179
+ @final
2180
+ def baz2(cls) -> None: ...
2181
+ @property
2182
+ @final
2183
+ def eggs(self) -> int: ...
2184
+ @final
2185
+ @property
2186
+ def eggs2(self) -> int: ...
2187
+ @final
2188
+ def ham(self, obj: int) -> int: ...
2189
+ """,
2190
+ runtime="""
2191
+ class D:
2192
+ @final
2193
+ def foo(self): pass
2194
+ @final
2195
+ @staticmethod
2196
+ def bar(): pass
2197
+ @staticmethod
2198
+ @final
2199
+ def bar2(): pass
2200
+ @final
2201
+ @classmethod
2202
+ def baz(cls): pass
2203
+ @classmethod
2204
+ @final
2205
+ def baz2(cls): pass
2206
+ @property
2207
+ @final
2208
+ def eggs(self): return 42
2209
+ @final
2210
+ @property
2211
+ def eggs2(self): pass
2212
+ @final
2213
+ @functools.lru_cache()
2214
+ def ham(self, obj): return obj * 2
2215
+ """,
2216
+ error=None,
2217
+ )
2218
+ # Stub methods are allowed to have @final even if the runtime doesn't...
2219
+ yield Case(
2220
+ stub="""
2221
+ class E:
2222
+ @final
2223
+ def foo(self) -> None: ...
2224
+ @final
2225
+ @staticmethod
2226
+ def bar() -> None: ...
2227
+ @staticmethod
2228
+ @final
2229
+ def bar2() -> None: ...
2230
+ @final
2231
+ @classmethod
2232
+ def baz(cls) -> None: ...
2233
+ @classmethod
2234
+ @final
2235
+ def baz2(cls) -> None: ...
2236
+ @property
2237
+ @final
2238
+ def eggs(self) -> int: ...
2239
+ @final
2240
+ @property
2241
+ def eggs2(self) -> int: ...
2242
+ @final
2243
+ def ham(self, obj: int) -> int: ...
2244
+ """,
2245
+ runtime="""
2246
+ class E:
2247
+ def foo(self): pass
2248
+ @staticmethod
2249
+ def bar(): pass
2250
+ @staticmethod
2251
+ def bar2(): pass
2252
+ @classmethod
2253
+ def baz(cls): pass
2254
+ @classmethod
2255
+ def baz2(cls): pass
2256
+ @property
2257
+ def eggs(self): return 42
2258
+ @property
2259
+ def eggs2(self): return 42
2260
+ @functools.lru_cache()
2261
+ def ham(self, obj): return obj * 2
2262
+ """,
2263
+ error=None,
2264
+ )
2265
+ # ...But if the runtime has @final, the stub must have it as well
2266
+ yield Case(
2267
+ stub="""
2268
+ class F:
2269
+ def foo(self) -> None: ...
2270
+ """,
2271
+ runtime="""
2272
+ class F:
2273
+ @final
2274
+ def foo(self): pass
2275
+ """,
2276
+ error="F.foo",
2277
+ )
2278
+ yield Case(
2279
+ stub="""
2280
+ class G:
2281
+ @staticmethod
2282
+ def foo() -> None: ...
2283
+ """,
2284
+ runtime="""
2285
+ class G:
2286
+ @final
2287
+ @staticmethod
2288
+ def foo(): pass
2289
+ """,
2290
+ error="G.foo",
2291
+ )
2292
+ yield Case(
2293
+ stub="""
2294
+ class H:
2295
+ @staticmethod
2296
+ def foo() -> None: ...
2297
+ """,
2298
+ runtime="""
2299
+ class H:
2300
+ @staticmethod
2301
+ @final
2302
+ def foo(): pass
2303
+ """,
2304
+ error="H.foo",
2305
+ )
2306
+ yield Case(
2307
+ stub="""
2308
+ class I:
2309
+ @classmethod
2310
+ def foo(cls) -> None: ...
2311
+ """,
2312
+ runtime="""
2313
+ class I:
2314
+ @final
2315
+ @classmethod
2316
+ def foo(cls): pass
2317
+ """,
2318
+ error="I.foo",
2319
+ )
2320
+ yield Case(
2321
+ stub="""
2322
+ class J:
2323
+ @classmethod
2324
+ def foo(cls) -> None: ...
2325
+ """,
2326
+ runtime="""
2327
+ class J:
2328
+ @classmethod
2329
+ @final
2330
+ def foo(cls): pass
2331
+ """,
2332
+ error="J.foo",
2333
+ )
2334
+ yield Case(
2335
+ stub="""
2336
+ class K:
2337
+ @property
2338
+ def foo(self) -> int: ...
2339
+ """,
2340
+ runtime="""
2341
+ class K:
2342
+ @property
2343
+ @final
2344
+ def foo(self): return 42
2345
+ """,
2346
+ error="K.foo",
2347
+ )
2348
+ # This test wouldn't pass,
2349
+ # because the runtime can't set __final__ on instances of builtins.property,
2350
+ # so stubtest has non way of knowing that the runtime was decorated with @final:
2351
+ #
2352
+ # yield Case(
2353
+ # stub="""
2354
+ # class K2:
2355
+ # @property
2356
+ # def foo(self) -> int: ...
2357
+ # """,
2358
+ # runtime="""
2359
+ # class K2:
2360
+ # @final
2361
+ # @property
2362
+ # def foo(self): return 42
2363
+ # """,
2364
+ # error="K2.foo",
2365
+ # )
2366
+ yield Case(
2367
+ stub="""
2368
+ class L:
2369
+ def foo(self, obj: int) -> int: ...
2370
+ """,
2371
+ runtime="""
2372
+ class L:
2373
+ @final
2374
+ @functools.lru_cache()
2375
+ def foo(self, obj): return obj * 2
2376
+ """,
2377
+ error="L.foo",
2378
+ )
2379
+
2380
+ @collect_cases
2381
+ def test_name_mangling(self) -> Iterator[Case]:
2382
+ yield Case(
2383
+ stub="""
2384
+ class X:
2385
+ def __mangle_good(self, text: str) -> None: ...
2386
+ def __mangle_bad(self, number: int) -> None: ...
2387
+ """,
2388
+ runtime="""
2389
+ class X:
2390
+ def __mangle_good(self, text): pass
2391
+ def __mangle_bad(self, text): pass
2392
+ """,
2393
+ error="X.__mangle_bad",
2394
+ )
2395
+ yield Case(
2396
+ stub="""
2397
+ class Klass:
2398
+ class __Mangled1:
2399
+ class __Mangled2:
2400
+ def __mangle_good(self, text: str) -> None: ...
2401
+ def __mangle_bad(self, number: int) -> None: ...
2402
+ """,
2403
+ runtime="""
2404
+ class Klass:
2405
+ class __Mangled1:
2406
+ class __Mangled2:
2407
+ def __mangle_good(self, text): pass
2408
+ def __mangle_bad(self, text): pass
2409
+ """,
2410
+ error="Klass.__Mangled1.__Mangled2.__mangle_bad",
2411
+ )
2412
+ yield Case(
2413
+ stub="""
2414
+ class __Dunder__:
2415
+ def __mangle_good(self, text: str) -> None: ...
2416
+ def __mangle_bad(self, number: int) -> None: ...
2417
+ """,
2418
+ runtime="""
2419
+ class __Dunder__:
2420
+ def __mangle_good(self, text): pass
2421
+ def __mangle_bad(self, text): pass
2422
+ """,
2423
+ error="__Dunder__.__mangle_bad",
2424
+ )
2425
+ yield Case(
2426
+ stub="""
2427
+ class _Private:
2428
+ def __mangle_good(self, text: str) -> None: ...
2429
+ def __mangle_bad(self, number: int) -> None: ...
2430
+ """,
2431
+ runtime="""
2432
+ class _Private:
2433
+ def __mangle_good(self, text): pass
2434
+ def __mangle_bad(self, text): pass
2435
+ """,
2436
+ error="_Private.__mangle_bad",
2437
+ )
2438
+
2439
+ @collect_cases
2440
+ def test_mro(self) -> Iterator[Case]:
2441
+ yield Case(
2442
+ stub="""
2443
+ class A:
2444
+ def foo(self, x: int) -> None: ...
2445
+ class B(A):
2446
+ pass
2447
+ class C(A):
2448
+ pass
2449
+ """,
2450
+ runtime="""
2451
+ class A:
2452
+ def foo(self, x: int) -> None: ...
2453
+ class B(A):
2454
+ def foo(self, x: int) -> None: ...
2455
+ class C(A):
2456
+ def foo(self, y: int) -> None: ...
2457
+ """,
2458
+ error="C.foo",
2459
+ )
2460
+ yield Case(
2461
+ stub="""
2462
+ class X: ...
2463
+ """,
2464
+ runtime="""
2465
+ class X:
2466
+ def __init__(self, x): pass
2467
+ """,
2468
+ error="X.__init__",
2469
+ )
2470
+
2471
+ @collect_cases
2472
+ def test_good_literal(self) -> Iterator[Case]:
2473
+ yield Case(
2474
+ stub=r"""
2475
+ from typing import Literal
2476
+
2477
+ import enum
2478
+ class Color(enum.Enum):
2479
+ RED = ...
2480
+
2481
+ NUM: Literal[1]
2482
+ CHAR: Literal['a']
2483
+ FLAG: Literal[True]
2484
+ NON: Literal[None]
2485
+ BYT1: Literal[b'abc']
2486
+ BYT2: Literal[b'\x90']
2487
+ ENUM: Literal[Color.RED]
2488
+ """,
2489
+ runtime=r"""
2490
+ import enum
2491
+ class Color(enum.Enum):
2492
+ RED = 3
2493
+
2494
+ NUM = 1
2495
+ CHAR = 'a'
2496
+ NON = None
2497
+ FLAG = True
2498
+ BYT1 = b"abc"
2499
+ BYT2 = b'\x90'
2500
+ ENUM = Color.RED
2501
+ """,
2502
+ error=None,
2503
+ )
2504
+
2505
+ @collect_cases
2506
+ def test_bad_literal(self) -> Iterator[Case]:
2507
+ yield Case("from typing import Literal", "", None) # dummy case
2508
+ yield Case(
2509
+ stub="INT_FLOAT_MISMATCH: Literal[1]",
2510
+ runtime="INT_FLOAT_MISMATCH = 1.0",
2511
+ error="INT_FLOAT_MISMATCH",
2512
+ )
2513
+ yield Case(stub="WRONG_INT: Literal[1]", runtime="WRONG_INT = 2", error="WRONG_INT")
2514
+ yield Case(stub="WRONG_STR: Literal['a']", runtime="WRONG_STR = 'b'", error="WRONG_STR")
2515
+ yield Case(
2516
+ stub="BYTES_STR_MISMATCH: Literal[b'value']",
2517
+ runtime="BYTES_STR_MISMATCH = 'value'",
2518
+ error="BYTES_STR_MISMATCH",
2519
+ )
2520
+ yield Case(
2521
+ stub="STR_BYTES_MISMATCH: Literal['value']",
2522
+ runtime="STR_BYTES_MISMATCH = b'value'",
2523
+ error="STR_BYTES_MISMATCH",
2524
+ )
2525
+ yield Case(
2526
+ stub="WRONG_BYTES: Literal[b'abc']",
2527
+ runtime="WRONG_BYTES = b'xyz'",
2528
+ error="WRONG_BYTES",
2529
+ )
2530
+ yield Case(
2531
+ stub="WRONG_BOOL_1: Literal[True]",
2532
+ runtime="WRONG_BOOL_1 = False",
2533
+ error="WRONG_BOOL_1",
2534
+ )
2535
+ yield Case(
2536
+ stub="WRONG_BOOL_2: Literal[False]",
2537
+ runtime="WRONG_BOOL_2 = True",
2538
+ error="WRONG_BOOL_2",
2539
+ )
2540
+
2541
+ @collect_cases
2542
+ def test_special_subtype(self) -> Iterator[Case]:
2543
+ yield Case(
2544
+ stub="""
2545
+ b1: bool
2546
+ b2: bool
2547
+ b3: bool
2548
+ """,
2549
+ runtime="""
2550
+ b1 = 0
2551
+ b2 = 1
2552
+ b3 = 2
2553
+ """,
2554
+ error="b3",
2555
+ )
2556
+ yield Case(
2557
+ stub="""
2558
+ from typing import TypedDict, type_check_only
2559
+
2560
+ @type_check_only
2561
+ class _Options(TypedDict):
2562
+ a: str
2563
+ b: int
2564
+
2565
+ opt1: _Options
2566
+ opt2: _Options
2567
+ opt3: _Options
2568
+ """,
2569
+ runtime="""
2570
+ opt1 = {"a": "3.", "b": 14}
2571
+ opt2 = {"some": "stuff"} # false negative
2572
+ opt3 = 0
2573
+ """,
2574
+ error="opt3",
2575
+ )
2576
+
2577
+ @collect_cases
2578
+ def test_runtime_typing_objects(self) -> Iterator[Case]:
2579
+ yield Case(
2580
+ stub="from typing import Protocol, TypedDict",
2581
+ runtime="from typing import Protocol, TypedDict",
2582
+ error=None,
2583
+ )
2584
+ yield Case(
2585
+ stub="""
2586
+ class X(Protocol):
2587
+ bar: int
2588
+ def foo(self, x: int, y: bytes = ...) -> str: ...
2589
+ """,
2590
+ runtime="""
2591
+ class X(Protocol):
2592
+ bar: int
2593
+ def foo(self, x: int, y: bytes = ...) -> str: ...
2594
+ """,
2595
+ error=None,
2596
+ )
2597
+ yield Case(
2598
+ stub="""
2599
+ class Y(TypedDict):
2600
+ a: int
2601
+ """,
2602
+ runtime="""
2603
+ class Y(TypedDict):
2604
+ a: int
2605
+ """,
2606
+ error=None,
2607
+ )
2608
+
2609
+ @collect_cases
2610
+ def test_named_tuple(self) -> Iterator[Case]:
2611
+ yield Case(
2612
+ stub="from typing import NamedTuple",
2613
+ runtime="from typing import NamedTuple",
2614
+ error=None,
2615
+ )
2616
+ yield Case(
2617
+ stub="""
2618
+ class X1(NamedTuple):
2619
+ bar: int
2620
+ foo: str = ...
2621
+ """,
2622
+ runtime="""
2623
+ class X1(NamedTuple):
2624
+ bar: int
2625
+ foo: str = 'a'
2626
+ """,
2627
+ error=None,
2628
+ )
2629
+ yield Case(
2630
+ stub="""
2631
+ class X2(NamedTuple):
2632
+ bar: int
2633
+ foo: str
2634
+ """,
2635
+ runtime="""
2636
+ class X2(NamedTuple):
2637
+ bar: int
2638
+ foo: str = 'a'
2639
+ """,
2640
+ # `__new__` will miss a default value for a `foo` parameter,
2641
+ # but we don't generate special errors for `foo` missing `...` part.
2642
+ error="X2.__new__",
2643
+ )
2644
+
2645
+ @collect_cases
2646
+ def test_named_tuple_typing_and_collections(self) -> Iterator[Case]:
2647
+ yield Case(
2648
+ stub="from typing import NamedTuple",
2649
+ runtime="from collections import namedtuple",
2650
+ error=None,
2651
+ )
2652
+ yield Case(
2653
+ stub="""
2654
+ class X1(NamedTuple):
2655
+ bar: int
2656
+ foo: str = ...
2657
+ """,
2658
+ runtime="""
2659
+ X1 = namedtuple('X1', ['bar', 'foo'], defaults=['a'])
2660
+ """,
2661
+ error=None,
2662
+ )
2663
+ yield Case(
2664
+ stub="""
2665
+ class X2(NamedTuple):
2666
+ bar: int
2667
+ foo: str
2668
+ """,
2669
+ runtime="""
2670
+ X2 = namedtuple('X1', ['bar', 'foo'], defaults=['a'])
2671
+ """,
2672
+ error="X2.__new__",
2673
+ )
2674
+
2675
+ @collect_cases
2676
+ def test_type_var(self) -> Iterator[Case]:
2677
+ yield Case(
2678
+ stub="from typing import TypeVar", runtime="from typing import TypeVar", error=None
2679
+ )
2680
+ yield Case(stub="A = TypeVar('A')", runtime="A = TypeVar('A')", error=None)
2681
+ yield Case(stub="B = TypeVar('B')", runtime="B = 5", error="B")
2682
+ yield Case(
2683
+ stub="from typing import ParamSpec", runtime="from typing import ParamSpec", error=None
2684
+ )
2685
+ yield Case(stub="C = ParamSpec('C')", runtime="C = ParamSpec('C')", error=None)
2686
+
2687
+ @collect_cases
2688
+ def test_metaclass_match(self) -> Iterator[Case]:
2689
+ yield Case(stub="class Meta(type): ...", runtime="class Meta(type): ...", error=None)
2690
+ yield Case(stub="class A0: ...", runtime="class A0: ...", error=None)
2691
+ yield Case(
2692
+ stub="class A1(metaclass=Meta): ...",
2693
+ runtime="class A1(metaclass=Meta): ...",
2694
+ error=None,
2695
+ )
2696
+ yield Case(stub="class A2: ...", runtime="class A2(metaclass=Meta): ...", error="A2")
2697
+ yield Case(stub="class A3(metaclass=Meta): ...", runtime="class A3: ...", error="A3")
2698
+
2699
+ # Explicit `type` metaclass can always be added in any part:
2700
+ yield Case(
2701
+ stub="class T1(metaclass=type): ...",
2702
+ runtime="class T1(metaclass=type): ...",
2703
+ error=None,
2704
+ )
2705
+ yield Case(stub="class T2: ...", runtime="class T2(metaclass=type): ...", error=None)
2706
+ yield Case(stub="class T3(metaclass=type): ...", runtime="class T3: ...", error=None)
2707
+
2708
+ # Explicit check that `_protected` names are also supported:
2709
+ yield Case(stub="class _P1(type): ...", runtime="class _P1(type): ...", error=None)
2710
+ yield Case(stub="class P2: ...", runtime="class P2(metaclass=_P1): ...", error="P2")
2711
+
2712
+ # With inheritance:
2713
+ yield Case(
2714
+ stub="""
2715
+ class I1(metaclass=Meta): ...
2716
+ class S1(I1): ...
2717
+ """,
2718
+ runtime="""
2719
+ class I1(metaclass=Meta): ...
2720
+ class S1(I1): ...
2721
+ """,
2722
+ error=None,
2723
+ )
2724
+ yield Case(
2725
+ stub="""
2726
+ class I2(metaclass=Meta): ...
2727
+ class S2: ... # missing inheritance
2728
+ """,
2729
+ runtime="""
2730
+ class I2(metaclass=Meta): ...
2731
+ class S2(I2): ...
2732
+ """,
2733
+ error="S2",
2734
+ )
2735
+
2736
+ @collect_cases
2737
+ def test_metaclass_abcmeta(self) -> Iterator[Case]:
2738
+ # Handling abstract metaclasses is special:
2739
+ yield Case(stub="from abc import ABCMeta", runtime="from abc import ABCMeta", error=None)
2740
+ yield Case(
2741
+ stub="class A1(metaclass=ABCMeta): ...",
2742
+ runtime="class A1(metaclass=ABCMeta): ...",
2743
+ error=None,
2744
+ )
2745
+ # Stubs cannot miss abstract metaclass:
2746
+ yield Case(stub="class A2: ...", runtime="class A2(metaclass=ABCMeta): ...", error="A2")
2747
+ # But, stubs can add extra abstract metaclass, this might be a typing hack:
2748
+ yield Case(stub="class A3(metaclass=ABCMeta): ...", runtime="class A3: ...", error=None)
2749
+
2750
+ @collect_cases
2751
+ def test_abstract_methods(self) -> Iterator[Case]:
2752
+ yield Case(
2753
+ stub="""
2754
+ from abc import abstractmethod
2755
+ from typing import overload
2756
+ """,
2757
+ runtime="from abc import abstractmethod",
2758
+ error=None,
2759
+ )
2760
+ yield Case(
2761
+ stub="""
2762
+ class A1:
2763
+ def some(self) -> None: ...
2764
+ """,
2765
+ runtime="""
2766
+ class A1:
2767
+ @abstractmethod
2768
+ def some(self) -> None: ...
2769
+ """,
2770
+ error="A1.some",
2771
+ )
2772
+ yield Case(
2773
+ stub="""
2774
+ class A2:
2775
+ @abstractmethod
2776
+ def some(self) -> None: ...
2777
+ """,
2778
+ runtime="""
2779
+ class A2:
2780
+ @abstractmethod
2781
+ def some(self) -> None: ...
2782
+ """,
2783
+ error=None,
2784
+ )
2785
+ yield Case(
2786
+ stub="""
2787
+ class A3:
2788
+ @overload
2789
+ def some(self, other: int) -> str: ...
2790
+ @overload
2791
+ def some(self, other: str) -> int: ...
2792
+ """,
2793
+ runtime="""
2794
+ class A3:
2795
+ @abstractmethod
2796
+ def some(self, other) -> None: ...
2797
+ """,
2798
+ error="A3.some",
2799
+ )
2800
+ yield Case(
2801
+ stub="""
2802
+ class A4:
2803
+ @overload
2804
+ @abstractmethod
2805
+ def some(self, other: int) -> str: ...
2806
+ @overload
2807
+ @abstractmethod
2808
+ def some(self, other: str) -> int: ...
2809
+ """,
2810
+ runtime="""
2811
+ class A4:
2812
+ @abstractmethod
2813
+ def some(self, other) -> None: ...
2814
+ """,
2815
+ error=None,
2816
+ )
2817
+ yield Case(
2818
+ stub="""
2819
+ class A5:
2820
+ @abstractmethod
2821
+ @overload
2822
+ def some(self, other: int) -> str: ...
2823
+ @abstractmethod
2824
+ @overload
2825
+ def some(self, other: str) -> int: ...
2826
+ """,
2827
+ runtime="""
2828
+ class A5:
2829
+ @abstractmethod
2830
+ def some(self, other) -> None: ...
2831
+ """,
2832
+ error=None,
2833
+ )
2834
+ # Runtime can miss `@abstractmethod`:
2835
+ yield Case(
2836
+ stub="""
2837
+ class A6:
2838
+ @abstractmethod
2839
+ def some(self) -> None: ...
2840
+ """,
2841
+ runtime="""
2842
+ class A6:
2843
+ def some(self) -> None: ...
2844
+ """,
2845
+ error=None,
2846
+ )
2847
+
2848
+ @collect_cases
2849
+ def test_abstract_properties(self) -> Iterator[Case]:
2850
+ # TODO: test abstract properties with setters
2851
+ yield Case(
2852
+ stub="from abc import abstractmethod",
2853
+ runtime="from abc import abstractmethod",
2854
+ error=None,
2855
+ )
2856
+ # Ensure that `@property` also can be abstract:
2857
+ yield Case(
2858
+ stub="""
2859
+ class AP1:
2860
+ @property
2861
+ def some(self) -> int: ...
2862
+ """,
2863
+ runtime="""
2864
+ class AP1:
2865
+ @property
2866
+ @abstractmethod
2867
+ def some(self) -> int: ...
2868
+ """,
2869
+ error="AP1.some",
2870
+ )
2871
+ yield Case(
2872
+ stub="""
2873
+ class AP1_2:
2874
+ def some(self) -> int: ... # missing `@property` decorator
2875
+ """,
2876
+ runtime="""
2877
+ class AP1_2:
2878
+ @property
2879
+ @abstractmethod
2880
+ def some(self) -> int: ...
2881
+ """,
2882
+ error="AP1_2.some",
2883
+ )
2884
+ yield Case(
2885
+ stub="""
2886
+ class AP2:
2887
+ @property
2888
+ @abstractmethod
2889
+ def some(self) -> int: ...
2890
+ """,
2891
+ runtime="""
2892
+ class AP2:
2893
+ @property
2894
+ @abstractmethod
2895
+ def some(self) -> int: ...
2896
+ """,
2897
+ error=None,
2898
+ )
2899
+ # Runtime can miss `@abstractmethod`:
2900
+ yield Case(
2901
+ stub="""
2902
+ class AP3:
2903
+ @property
2904
+ @abstractmethod
2905
+ def some(self) -> int: ...
2906
+ """,
2907
+ runtime="""
2908
+ class AP3:
2909
+ @property
2910
+ def some(self) -> int: ...
2911
+ """,
2912
+ error=None,
2913
+ )
2914
+
2915
+ @collect_cases
2916
+ def test_type_check_only(self) -> Iterator[Case]:
2917
+ yield Case(
2918
+ stub="from typing import type_check_only, overload",
2919
+ runtime="from typing import overload",
2920
+ error=None,
2921
+ )
2922
+ # You can have public types that are only defined in stubs
2923
+ # with `@type_check_only`:
2924
+ yield Case(
2925
+ stub="""
2926
+ @type_check_only
2927
+ class A1: ...
2928
+ """,
2929
+ runtime="",
2930
+ error=None,
2931
+ )
2932
+ # Having `@type_check_only` on a type that exists at runtime is an error
2933
+ yield Case(
2934
+ stub="""
2935
+ @type_check_only
2936
+ class A2: ...
2937
+ """,
2938
+ runtime="class A2: ...",
2939
+ error="A2",
2940
+ )
2941
+ # The same is true for NamedTuples and TypedDicts:
2942
+ yield Case(
2943
+ stub="from typing import NamedTuple, TypedDict",
2944
+ runtime="from typing import NamedTuple, TypedDict",
2945
+ error=None,
2946
+ )
2947
+ yield Case(
2948
+ stub="""
2949
+ @type_check_only
2950
+ class NT1(NamedTuple): ...
2951
+ """,
2952
+ runtime="class NT1(NamedTuple): ...",
2953
+ error="NT1",
2954
+ )
2955
+ yield Case(
2956
+ stub="""
2957
+ @type_check_only
2958
+ class TD1(TypedDict): ...
2959
+ """,
2960
+ runtime="class TD1(TypedDict): ...",
2961
+ error="TD1",
2962
+ )
2963
+ # The same is true for functions:
2964
+ yield Case(
2965
+ stub="""
2966
+ @type_check_only
2967
+ def func1() -> None: ...
2968
+ """,
2969
+ runtime="",
2970
+ error=None,
2971
+ )
2972
+ yield Case(
2973
+ stub="""
2974
+ @type_check_only
2975
+ def func2() -> None: ...
2976
+ """,
2977
+ runtime="def func2() -> None: ...",
2978
+ error="func2",
2979
+ )
2980
+ # The same is true for private types
2981
+ yield Case(
2982
+ stub="""
2983
+ @type_check_only
2984
+ class _P1: ...
2985
+ """,
2986
+ runtime="",
2987
+ error=None,
2988
+ )
2989
+ yield Case(
2990
+ stub="""
2991
+ @type_check_only
2992
+ class _P2: ...
2993
+ """,
2994
+ runtime="class _P2: ...",
2995
+ error="_P2",
2996
+ )
2997
+ # Private TypedDicts which do not exist at runtime must be decorated with
2998
+ # '@type_check_only', unless they contain keys that are not valid identifiers.
2999
+ yield Case(
3000
+ stub="""
3001
+ class _TD1(TypedDict): ...
3002
+ """,
3003
+ runtime="",
3004
+ error="_TD1",
3005
+ )
3006
+ yield Case(
3007
+ stub="""
3008
+ _TD2 = TypedDict("_TD2", {"foo": int})
3009
+ """,
3010
+ runtime="",
3011
+ error="_TD2",
3012
+ )
3013
+ yield Case(
3014
+ stub="""
3015
+ _TD3 = TypedDict("_TD3", {"foo-bar": int})
3016
+ """,
3017
+ runtime="",
3018
+ error=None,
3019
+ )
3020
+ yield Case(
3021
+ stub="""
3022
+ _TD4 = TypedDict("_TD4", {"class": int})
3023
+ """,
3024
+ runtime="",
3025
+ error=None,
3026
+ )
3027
+ # Private NamedTuples which do not exist at runtime must be decorated with
3028
+ # '@type_check_only'.
3029
+ yield Case(
3030
+ stub="""
3031
+ class _NT1(NamedTuple): ...
3032
+ """,
3033
+ runtime="",
3034
+ error="_NT1",
3035
+ )
3036
+ yield Case(
3037
+ stub="""
3038
+ @type_check_only
3039
+ class _NT2(NamedTuple): ...
3040
+ """,
3041
+ runtime="",
3042
+ error=None,
3043
+ )
3044
+ # A type that exists at runtime is allowed to alias a type marked
3045
+ # as '@type_check_only' in the stubs.
3046
+ yield Case(
3047
+ stub="""
3048
+ @type_check_only
3049
+ class _X1: ...
3050
+ X2 = _X1
3051
+ """,
3052
+ runtime="class X2: ...",
3053
+ error=None,
3054
+ )
3055
+
3056
+ @collect_cases
3057
+ def test_type_default_protocol(self) -> Iterator[Case]:
3058
+ yield Case(
3059
+ stub="""
3060
+ from typing import Protocol, type_check_only
3061
+
3062
+ @type_check_only
3063
+ class _FormatterClass(Protocol):
3064
+ def __call__(self, *, prog: str) -> HelpFormatter: ...
3065
+
3066
+ class ArgumentParser:
3067
+ def __init__(self, formatter_class: _FormatterClass = ...) -> None: ...
3068
+
3069
+ class HelpFormatter:
3070
+ def __init__(self, prog: str, indent_increment: int = 2) -> None: ...
3071
+ """,
3072
+ runtime="""
3073
+ class HelpFormatter:
3074
+ def __init__(self, prog, indent_increment=2) -> None: ...
3075
+
3076
+ class ArgumentParser:
3077
+ def __init__(self, formatter_class=HelpFormatter): ...
3078
+ """,
3079
+ error=None,
3080
+ )
3081
+
3082
+ @collect_cases
3083
+ def test_object_marker(self) -> Iterator[Case]:
3084
+ yield Case(
3085
+ stub="""
3086
+ def f(x: int = ...) -> None: ...
3087
+ """,
3088
+ runtime="""
3089
+ _MISSING = object()
3090
+
3091
+
3092
+ def f(x=_MISSING):
3093
+ pass
3094
+ """,
3095
+ error=None,
3096
+ )
3097
+
3098
+ @collect_cases
3099
+ def test_sentinel_object_like_marker(self) -> Iterator[Case]:
3100
+ yield Case(
3101
+ stub="""
3102
+ def f(x: int = ...) -> None: ...
3103
+ """,
3104
+ runtime="""
3105
+ from typing_extensions import sentinel
3106
+
3107
+ _MISSING = sentinel("_MISSING")
3108
+
3109
+
3110
+ def f(x=_MISSING):
3111
+ pass
3112
+ """,
3113
+ error=None,
3114
+ )
3115
+
3116
+ @collect_cases
3117
+ def test_legacy_sentinel_object_like_marker(self) -> Iterator[Case]:
3118
+ yield Case(
3119
+ stub="""
3120
+ def f(x: int = ...) -> None: ...
3121
+ """,
3122
+ runtime="""
3123
+ from typing_extensions import Sentinel
3124
+
3125
+ _MISSING = Sentinel("_MISSING")
3126
+
3127
+
3128
+ def f(x=_MISSING):
3129
+ pass
3130
+ """,
3131
+ error=None,
3132
+ )
3133
+
3134
+
3135
+ def remove_color_code(s: str) -> str:
3136
+ return re.sub("\\x1b.*?m", "", s) # this works!
3137
+
3138
+
3139
+ class StubtestMiscUnit(unittest.TestCase):
3140
+ def test_output(self) -> None:
3141
+ output = run_stubtest(
3142
+ stub="def bad(number: int, text: str) -> None: ...",
3143
+ runtime="def bad(num, text): pass",
3144
+ options=[],
3145
+ )
3146
+ expected = (
3147
+ f'error: {TEST_MODULE_NAME}.bad is inconsistent, stub parameter "number" differs '
3148
+ 'from runtime parameter "num"\n'
3149
+ f"Stub: in file {TEST_MODULE_NAME}.pyi:1\n"
3150
+ "def (number: int, text: str)\n"
3151
+ f"Runtime: in file {TEST_MODULE_NAME}.py:1\ndef (num, text)\n\n"
3152
+ "Found 1 error (checked 1 module)\n"
3153
+ )
3154
+ assert output == expected
3155
+
3156
+ output = run_stubtest(
3157
+ stub="def bad(number: int, text: str) -> None: ...",
3158
+ runtime="def bad(num, text): pass",
3159
+ options=["--concise"],
3160
+ )
3161
+ expected = (
3162
+ "{}.bad is inconsistent, "
3163
+ 'stub parameter "number" differs from runtime parameter "num"\n'.format(
3164
+ TEST_MODULE_NAME
3165
+ )
3166
+ )
3167
+ assert output == expected
3168
+
3169
+ def test_reexport_reports_import_location(self) -> None:
3170
+ with use_tmp_dir(TEST_MODULE_NAME) as tmp_dir:
3171
+ Path("builtins.pyi").write_text(stubtest_builtins_stub)
3172
+ Path("typing.pyi").write_text(stubtest_typing_stub)
3173
+ Path("enum.pyi").write_text(stubtest_enum_stub)
3174
+
3175
+ os.makedirs("test_module", exist_ok=True)
3176
+ Path("test_module/__init__.pyi").write_text("from .mod import f")
3177
+ Path("test_module/__init__.py").write_text("from .mod import f")
3178
+ Path("test_module/mod.pyi").write_text("def f(self) -> None: ...")
3179
+ Path("test_module/mod.py").write_text("def f(self, x): pass")
3180
+
3181
+ output = io.StringIO()
3182
+ outerr = io.StringIO()
3183
+ with contextlib.redirect_stdout(output), contextlib.redirect_stderr(outerr):
3184
+ test_stubs(parse_options([TEST_MODULE_NAME]), use_builtins_fixtures=True)
3185
+
3186
+ filtered_output = remove_color_code(
3187
+ output.getvalue()
3188
+ .replace(os.path.realpath(tmp_dir) + os.sep, "")
3189
+ .replace(tmp_dir + os.sep, "")
3190
+ )
3191
+
3192
+ assert filtered_output.count('stub does not have parameter "x"') == 1
3193
+ assert "__init__.pyi" not in filtered_output
3194
+ assert "mod.py:1" in filtered_output
3195
+
3196
+ def test_ignore_flags(self) -> None:
3197
+ output = run_stubtest(
3198
+ stub="", runtime="__all__ = ['f']\ndef f(): pass", options=["--ignore-missing-stub"]
3199
+ )
3200
+ assert output == "Success: no issues found in 1 module\n"
3201
+
3202
+ output = run_stubtest(stub="", runtime="def f(): pass", options=["--ignore-missing-stub"])
3203
+ assert output == "Success: no issues found in 1 module\n"
3204
+
3205
+ output = run_stubtest(
3206
+ stub="def f(__a): ...", runtime="def f(a): pass", options=["--ignore-positional-only"]
3207
+ )
3208
+ assert output == "Success: no issues found in 1 module\n"
3209
+
3210
+ def test_allowlist(self) -> None:
3211
+ # Can't use this as a context because Windows
3212
+ allowlist = tempfile.NamedTemporaryFile(mode="w+", delete=False)
3213
+ try:
3214
+ with allowlist:
3215
+ allowlist.write(f"{TEST_MODULE_NAME}.bad # comment\n# comment")
3216
+
3217
+ output = run_stubtest(
3218
+ stub="def bad(number: int, text: str) -> None: ...",
3219
+ runtime="def bad(asdf, text): pass",
3220
+ options=["--allowlist", allowlist.name],
3221
+ )
3222
+ assert output == "Success: no issues found in 1 module\n"
3223
+
3224
+ # test unused entry detection
3225
+ output = run_stubtest(stub="", runtime="", options=["--allowlist", allowlist.name])
3226
+ assert output == (
3227
+ f"note: unused allowlist entry {TEST_MODULE_NAME}.bad\n"
3228
+ "Found 1 error (checked 1 module)\n"
3229
+ )
3230
+
3231
+ output = run_stubtest(
3232
+ stub="",
3233
+ runtime="",
3234
+ options=["--allowlist", allowlist.name, "--ignore-unused-allowlist"],
3235
+ )
3236
+ assert output == "Success: no issues found in 1 module\n"
3237
+
3238
+ # test regex matching
3239
+ with open(allowlist.name, mode="w+") as f:
3240
+ f.write(f"{TEST_MODULE_NAME}.b.*\n")
3241
+ f.write("(unused_missing)?\n")
3242
+ f.write("unused.*\n")
3243
+
3244
+ output = run_stubtest(
3245
+ stub=textwrap.dedent("""
3246
+ def good() -> None: ...
3247
+ def bad(number: int) -> None: ...
3248
+ def also_bad(number: int) -> None: ...
3249
+ """.lstrip("\n")),
3250
+ runtime=textwrap.dedent("""
3251
+ def good(): pass
3252
+ def bad(asdf): pass
3253
+ def also_bad(asdf): pass
3254
+ """.lstrip("\n")),
3255
+ options=["--allowlist", allowlist.name, "--generate-allowlist"],
3256
+ )
3257
+ assert output == (
3258
+ f"note: unused allowlist entry unused.*\n{TEST_MODULE_NAME}.also_bad\n"
3259
+ )
3260
+ finally:
3261
+ os.unlink(allowlist.name)
3262
+
3263
+ def test_mypy_build(self) -> None:
3264
+ output = run_stubtest(stub="+", runtime="", options=[])
3265
+ assert output == (
3266
+ "error: not checking stubs due to failed mypy compile:\n{}.pyi:1: "
3267
+ "error: Expected an expression [syntax]\n".format(TEST_MODULE_NAME)
3268
+ )
3269
+
3270
+ output = run_stubtest(stub="def f(): ...\ndef f(): ...", runtime="", options=[])
3271
+ assert output == (
3272
+ "error: not checking stubs due to mypy build errors:\n{}.pyi:2: "
3273
+ 'error: Name "f" already defined on line 1 [no-redef]\n'.format(TEST_MODULE_NAME)
3274
+ )
3275
+
3276
+ def test_missing_stubs(self) -> None:
3277
+ output = io.StringIO()
3278
+ with contextlib.redirect_stdout(output):
3279
+ test_stubs(parse_options(["not_a_module"]))
3280
+ assert remove_color_code(output.getvalue()) == (
3281
+ "error: not_a_module failed to find stubs\n"
3282
+ "Stub:\nMISSING\nRuntime:\nN/A\n\n"
3283
+ "Found 1 error (checked 1 module)\n"
3284
+ )
3285
+
3286
+ def test_only_py(self) -> None:
3287
+ # in this case, stubtest will check the py against itself
3288
+ # this is useful to support packages with a mix of stubs and inline types
3289
+ with use_tmp_dir(TEST_MODULE_NAME):
3290
+ with open(f"{TEST_MODULE_NAME}.py", "w") as f:
3291
+ f.write("a = 1")
3292
+ output = io.StringIO()
3293
+ with contextlib.redirect_stdout(output):
3294
+ test_stubs(parse_options([TEST_MODULE_NAME]))
3295
+ output_str = remove_color_code(output.getvalue())
3296
+ assert output_str == "Success: no issues found in 1 module\n"
3297
+
3298
+ def test_get_typeshed_stdlib_modules(self) -> None:
3299
+ stdlib = mypy.stubtest.get_typeshed_stdlib_modules(None, (3, 7))
3300
+ assert "builtins" in stdlib
3301
+ assert "os" in stdlib
3302
+ assert "os.path" in stdlib
3303
+ assert "asyncio" in stdlib
3304
+ assert "graphlib" not in stdlib
3305
+ assert "contextvars" in stdlib # 3.7+
3306
+ assert "importlib.metadata" not in stdlib
3307
+
3308
+ stdlib = mypy.stubtest.get_typeshed_stdlib_modules(None, (3, 10))
3309
+ assert "graphlib" in stdlib
3310
+ assert "formatter" not in stdlib
3311
+ assert "importlib.metadata" in stdlib
3312
+
3313
+ def test_signature(self) -> None:
3314
+ def f(a: int, b: int, *, c: int, d: int = 0, **kwargs: Any) -> None:
3315
+ pass
3316
+
3317
+ assert (
3318
+ str(mypy.stubtest.Signature.from_inspect_signature(inspect.signature(f)))
3319
+ == "def (a, b, *, c, d = ..., **kwargs)"
3320
+ )
3321
+
3322
+ def test_builtin_signature_with_unrepresentable_default(self) -> None:
3323
+ sig = mypy.stubtest.safe_inspect_signature(bytes.hex)
3324
+ assert sig is not None
3325
+ assert (
3326
+ str(mypy.stubtest.Signature.from_inspect_signature(sig))
3327
+ == "def (self, sep = ..., bytes_per_sep = ...)"
3328
+ )
3329
+
3330
+ def test_overload_signature(self) -> None:
3331
+ # The same argument as both positional-only and pos-or-kw in
3332
+ # different overloads previously produced incorrect signatures
3333
+ source = """
3334
+ from typing import overload
3335
+ @overload
3336
+ def myfunction(arg: int) -> None: ...
3337
+ @overload
3338
+ def myfunction(arg: str, /) -> None: ...
3339
+ """
3340
+ result = build_helper(source)
3341
+ stub = result.files["__main__"].names["myfunction"].node
3342
+ assert isinstance(stub, nodes.OverloadedFuncDef)
3343
+ sig = mypy.stubtest.Signature.from_overloadedfuncdef(stub)
3344
+ assert str(sig) == "def (arg: int | str)"
3345
+
3346
+ def test_config_file(self) -> None:
3347
+ runtime = "temp = 5\n"
3348
+ stub = "from decimal import Decimal\ntemp: Decimal\n"
3349
+ config_file = f"[mypy]\nplugins={root_dir}/test-data/unit/plugins/decimal_to_int.py\n"
3350
+ output = run_stubtest(stub=stub, runtime=runtime, options=[])
3351
+ assert output == (
3352
+ f"error: {TEST_MODULE_NAME}.temp variable differs from runtime type Literal[5]\n"
3353
+ f"Stub: in file {TEST_MODULE_NAME}.pyi:2\n_decimal.Decimal\nRuntime:\n5\n\n"
3354
+ "Found 1 error (checked 1 module)\n"
3355
+ )
3356
+ output = run_stubtest(stub=stub, runtime=runtime, options=[], config_file=config_file)
3357
+ assert output == "Success: no issues found in 1 module\n"
3358
+
3359
+ def test_config_file_error_codes(self) -> None:
3360
+ runtime = "temp = 5\n"
3361
+ stub = "temp = SOME_GLOBAL_CONST"
3362
+ output = run_stubtest(stub=stub, runtime=runtime, options=[])
3363
+ assert output == (
3364
+ "error: not checking stubs due to mypy build errors:\n"
3365
+ 'test_module.pyi:1: error: Name "SOME_GLOBAL_CONST" is not defined [name-defined]\n'
3366
+ )
3367
+
3368
+ config_file = "[mypy]\ndisable_error_code = name-defined\n"
3369
+ output = run_stubtest(stub=stub, runtime=runtime, options=[], config_file=config_file)
3370
+ assert output == "Success: no issues found in 1 module\n"
3371
+
3372
+ def test_config_file_error_codes_invalid(self) -> None:
3373
+ runtime = "temp = 5\n"
3374
+ stub = "temp: int\n"
3375
+ config_file = "[mypy]\ndisable_error_code = not-a-valid-name\n"
3376
+ output = io.StringIO()
3377
+ outerr = io.StringIO()
3378
+ with raises(SystemExit):
3379
+ run_stubtest_with_stderr(
3380
+ stub=stub,
3381
+ runtime=runtime,
3382
+ options=[],
3383
+ config_file=config_file,
3384
+ output=output,
3385
+ outerr=outerr,
3386
+ )
3387
+
3388
+ assert output.getvalue() == "error: Invalid error code(s): not-a-valid-name\n"
3389
+ assert outerr.getvalue() == ""
3390
+
3391
+ def test_config_file_wrong_incomplete_feature(self) -> None:
3392
+ runtime = "x = 1\n"
3393
+ stub = "x: int\n"
3394
+ config_file = "[mypy]\nenable_incomplete_feature = Unpack\n"
3395
+ output = run_stubtest(stub=stub, runtime=runtime, options=[], config_file=config_file)
3396
+ assert output == (
3397
+ "warning: Warning: Unpack is already enabled by default\n"
3398
+ "Success: no issues found in 1 module\n"
3399
+ )
3400
+
3401
+ config_file = "[mypy]\nenable_incomplete_feature = not-a-valid-name\n"
3402
+ with self.assertRaises(SystemExit):
3403
+ run_stubtest(stub=stub, runtime=runtime, options=[], config_file=config_file)
3404
+
3405
+ def test_no_modules(self) -> None:
3406
+ output = io.StringIO()
3407
+ with contextlib.redirect_stdout(output):
3408
+ test_stubs(parse_options([]))
3409
+ assert remove_color_code(output.getvalue()) == "error: no modules to check\n"
3410
+
3411
+ def test_module_and_typeshed(self) -> None:
3412
+ output = io.StringIO()
3413
+ with contextlib.redirect_stdout(output):
3414
+ test_stubs(parse_options(["--check-typeshed", "some_module"]))
3415
+ assert remove_color_code(output.getvalue()) == (
3416
+ "error: cannot pass both --check-typeshed and a list of modules\n"
3417
+ )