@gnost-cli/darwin-arm64 0.0.1 → 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 +1 -1
  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 +10 -7
@@ -0,0 +1,3535 @@
1
+ """Facilities for generating error messages during type checking.
2
+
3
+ Don't add any non-trivial message construction logic to the type
4
+ checker, as it can compromise clarity and make messages less
5
+ consistent. Add such logic to this module instead. Literal messages, including those
6
+ with format args, should be defined as constants in mypy.message_registry.
7
+
8
+ Historically we tried to avoid all message string literals in the type
9
+ checker but we are moving away from this convention.
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ import difflib
15
+ import itertools
16
+ import re
17
+ from collections.abc import Callable, Collection, Iterable, Iterator, Sequence
18
+ from contextlib import contextmanager
19
+ from textwrap import dedent
20
+ from typing import Any, Final, cast
21
+
22
+ import mypy.typeops
23
+ from mypy import errorcodes as codes, message_registry
24
+ from mypy.erasetype import erase_type
25
+ from mypy.errorcodes import ErrorCode
26
+ from mypy.errors import (
27
+ ErrorInfo,
28
+ Errors,
29
+ ErrorWatcher,
30
+ IterationDependentErrors,
31
+ IterationErrorWatcher,
32
+ NonOverlapErrorInfo,
33
+ )
34
+ from mypy.nodes import (
35
+ ARG_NAMED,
36
+ ARG_NAMED_OPT,
37
+ ARG_OPT,
38
+ ARG_POS,
39
+ ARG_STAR,
40
+ ARG_STAR2,
41
+ CONTRAVARIANT,
42
+ COVARIANT,
43
+ SYMBOL_FUNCBASE_TYPES,
44
+ ArgKind,
45
+ CallExpr,
46
+ Context,
47
+ Expression,
48
+ FuncDef,
49
+ IndexExpr,
50
+ MypyFile,
51
+ NameExpr,
52
+ ReturnStmt,
53
+ StrExpr,
54
+ SymbolNode,
55
+ SymbolTable,
56
+ TypeInfo,
57
+ Var,
58
+ get_func_def,
59
+ reverse_builtin_aliases,
60
+ )
61
+ from mypy.operators import op_methods, op_methods_to_symbols
62
+ from mypy.options import Options
63
+ from mypy.subtypes import (
64
+ IS_CLASS_OR_STATIC,
65
+ IS_CLASSVAR,
66
+ IS_EXPLICIT_SETTER,
67
+ IS_SETTABLE,
68
+ IS_VAR,
69
+ find_member,
70
+ get_member_flags,
71
+ get_protocol_member,
72
+ is_same_type,
73
+ is_subtype,
74
+ )
75
+ from mypy.typeops import separate_union_literals
76
+ from mypy.types import (
77
+ AnyType,
78
+ CallableType,
79
+ DeletedType,
80
+ FunctionLike,
81
+ Instance,
82
+ LiteralType,
83
+ NoneType,
84
+ Overloaded,
85
+ Parameters,
86
+ ParamSpecType,
87
+ PartialType,
88
+ ProperType,
89
+ TupleType,
90
+ Type,
91
+ TypeAliasType,
92
+ TypedDictType,
93
+ TypeOfAny,
94
+ TypeStrVisitor,
95
+ TypeType,
96
+ TypeVarLikeType,
97
+ TypeVarTupleType,
98
+ TypeVarType,
99
+ UnboundType,
100
+ UninhabitedType,
101
+ UnionType,
102
+ UnpackType,
103
+ flatten_nested_unions,
104
+ get_proper_type,
105
+ get_proper_types,
106
+ )
107
+ from mypy.typetraverser import TypeTraverserVisitor
108
+ from mypy.util import plural_s, unmangle
109
+
110
+ TYPES_FOR_UNIMPORTED_HINTS: Final = {
111
+ "typing.Any",
112
+ "typing.Callable",
113
+ "typing.Dict",
114
+ "typing.Iterable",
115
+ "typing.Iterator",
116
+ "typing.List",
117
+ "typing.Optional",
118
+ "typing.Set",
119
+ "typing.Tuple",
120
+ "typing.TypeVar",
121
+ "typing.Union",
122
+ "typing.cast",
123
+ }
124
+
125
+
126
+ ARG_CONSTRUCTOR_NAMES: Final = {
127
+ ARG_POS: "Arg",
128
+ ARG_OPT: "DefaultArg",
129
+ ARG_NAMED: "NamedArg",
130
+ ARG_NAMED_OPT: "DefaultNamedArg",
131
+ ARG_STAR: "VarArg",
132
+ ARG_STAR2: "KwArg",
133
+ }
134
+
135
+
136
+ # Map from the full name of a missing definition to the test fixture (under
137
+ # test-data/unit/fixtures/) that provides the definition. This is used for
138
+ # generating better error messages when running mypy tests only.
139
+ SUGGESTED_TEST_FIXTURES: Final = {
140
+ "builtins.set": "set.pyi",
141
+ "builtins.tuple": "tuple.pyi",
142
+ "builtins.bool": "bool.pyi",
143
+ "builtins.Exception": "exception.pyi",
144
+ "builtins.BaseException": "exception.pyi",
145
+ "builtins.isinstance": "isinstancelist.pyi",
146
+ "builtins.property": "property.pyi",
147
+ "builtins.classmethod": "classmethod.pyi",
148
+ "typing._SpecialForm": "typing-medium.pyi",
149
+ }
150
+
151
+ UNSUPPORTED_NUMBERS_TYPES: Final = {
152
+ "numbers.Number",
153
+ "numbers.Complex",
154
+ "numbers.Real",
155
+ "numbers.Rational",
156
+ "numbers.Integral",
157
+ }
158
+
159
+ MAX_TUPLE_ITEMS = 10
160
+ MAX_UNION_ITEMS = 10
161
+
162
+
163
+ class MessageBuilder:
164
+ """Helper class for reporting type checker error messages with parameters.
165
+
166
+ The methods of this class need to be provided with the context within a
167
+ file; the errors member manages the wider context.
168
+
169
+ IDEA: Support a 'verbose mode' that includes full information about types
170
+ in error messages and that may otherwise produce more detailed error
171
+ messages.
172
+ """
173
+
174
+ # Report errors using this instance. It knows about the current file and
175
+ # import context.
176
+ errors: Errors
177
+
178
+ modules: dict[str, MypyFile]
179
+
180
+ # Hack to deduplicate error messages from union types
181
+ _disable_type_names: list[bool]
182
+
183
+ def __init__(self, errors: Errors, modules: dict[str, MypyFile]) -> None:
184
+ self.errors = errors
185
+ self.options = errors.options
186
+ self.modules = modules
187
+ self._disable_type_names = []
188
+
189
+ #
190
+ # Helpers
191
+ #
192
+
193
+ def filter_errors(
194
+ self,
195
+ *,
196
+ filter_errors: bool | Callable[[str, ErrorInfo], bool] = True,
197
+ save_filtered_errors: bool = False,
198
+ filter_deprecated: bool = False,
199
+ filter_revealed_type: bool = False,
200
+ ) -> ErrorWatcher:
201
+ return ErrorWatcher(
202
+ self.errors,
203
+ filter_errors=filter_errors,
204
+ save_filtered_errors=save_filtered_errors,
205
+ filter_deprecated=filter_deprecated,
206
+ filter_revealed_type=filter_revealed_type,
207
+ )
208
+
209
+ def add_errors(self, errors: list[ErrorInfo]) -> None:
210
+ """Add errors in messages to this builder."""
211
+ for info in errors:
212
+ self.errors.add_error_info(info)
213
+
214
+ @contextmanager
215
+ def disable_type_names(self) -> Iterator[None]:
216
+ self._disable_type_names.append(True)
217
+ try:
218
+ yield
219
+ finally:
220
+ self._disable_type_names.pop()
221
+
222
+ def are_type_names_disabled(self) -> bool:
223
+ return len(self._disable_type_names) > 0 and self._disable_type_names[-1]
224
+
225
+ def prefer_simple_messages(self) -> bool:
226
+ """Should we generate simple/fast error messages?
227
+
228
+ If errors aren't shown to the user, we don't want to waste cycles producing
229
+ complex error messages.
230
+ """
231
+ return self.errors.prefer_simple_messages()
232
+
233
+ def span_from_context(self, ctx: Context) -> Iterable[int]:
234
+ """This determines where a type: ignore for a given context has effect."""
235
+ if not isinstance(ctx, Expression):
236
+ return [ctx.line]
237
+ return range(ctx.line, (ctx.end_line or ctx.line) + 1)
238
+
239
+ def report(
240
+ self,
241
+ msg: str,
242
+ context: Context,
243
+ severity: str,
244
+ offset: int = 0,
245
+ *,
246
+ code: ErrorCode | None = None,
247
+ origin_context: Context | None,
248
+ parent_error: ErrorInfo | None = None,
249
+ ) -> ErrorInfo:
250
+ """Report an error or note (unless disabled).
251
+
252
+ Note that context controls where error is reported, while origin_context
253
+ controls where # type: ignore comments have effect.
254
+ """
255
+
256
+ origin_span = self.span_from_context(context)
257
+ if origin_context is not None:
258
+ origin_span = itertools.chain(origin_span, self.span_from_context(origin_context))
259
+
260
+ return self.errors.report(
261
+ context.line if context else -1,
262
+ context.column if context else -1,
263
+ msg,
264
+ code=code,
265
+ severity=severity,
266
+ offset=offset,
267
+ origin_span=origin_span,
268
+ end_line=context.end_line if context else -1,
269
+ end_column=context.end_column if context else -1,
270
+ parent_error=parent_error,
271
+ )
272
+
273
+ def fail(
274
+ self,
275
+ msg: str,
276
+ context: Context,
277
+ *,
278
+ code: ErrorCode | None = None,
279
+ origin_context: Context | None = None,
280
+ ) -> ErrorInfo:
281
+ """Report an error message (unless disabled)."""
282
+ return self.report(msg, context, "error", code=code, origin_context=origin_context)
283
+
284
+ def note(
285
+ self,
286
+ msg: str,
287
+ context: Context,
288
+ offset: int = 0,
289
+ *,
290
+ code: ErrorCode | None = None,
291
+ origin_context: Context | None = None,
292
+ parent_error: ErrorInfo | None = None,
293
+ ) -> None:
294
+ """Report a note (unless disabled)."""
295
+ self.report(
296
+ msg,
297
+ context,
298
+ "note",
299
+ offset=offset,
300
+ code=code,
301
+ origin_context=origin_context,
302
+ parent_error=parent_error,
303
+ )
304
+
305
+ def note_multiline(
306
+ self,
307
+ messages: str,
308
+ context: Context,
309
+ offset: int = 0,
310
+ *,
311
+ code: ErrorCode | None = None,
312
+ origin_context: Context | None = None,
313
+ parent_error: ErrorInfo | None = None,
314
+ ) -> None:
315
+ """Report as many notes as lines in the message (unless disabled)."""
316
+ for msg in dedent(messages.lstrip("\n")).splitlines():
317
+ self.report(
318
+ msg,
319
+ context,
320
+ "note",
321
+ offset,
322
+ code=code,
323
+ origin_context=origin_context,
324
+ parent_error=parent_error,
325
+ )
326
+
327
+ #
328
+ # Specific operations
329
+ #
330
+
331
+ # The following operations are for generating specific error messages. They
332
+ # get some information as arguments, and they build an error message based
333
+ # on them.
334
+
335
+ def has_no_attr(
336
+ self,
337
+ original_type: Type,
338
+ typ: Type,
339
+ member: str,
340
+ context: Context,
341
+ module_symbol_table: SymbolTable | None = None,
342
+ ) -> ErrorCode | None:
343
+ """Report a missing or non-accessible member.
344
+
345
+ original_type is the top-level type on which the error occurred.
346
+ typ is the actual type that is missing the member. These can be
347
+ different, e.g., in a union, original_type will be the union and typ
348
+ will be the specific item in the union that does not have the member
349
+ attribute.
350
+
351
+ 'module_symbol_table' is passed to this function if the type for which we
352
+ are trying to get a member was originally a module. The SymbolTable allows
353
+ us to look up and suggests attributes of the module since they are not
354
+ directly available on original_type
355
+
356
+ If member corresponds to an operator, use the corresponding operator
357
+ name in the messages. Return the error code that was produced, if any.
358
+ """
359
+ original_type = get_proper_type(original_type)
360
+ typ = get_proper_type(typ)
361
+
362
+ if isinstance(original_type, Instance) and original_type.type.has_readable_member(member):
363
+ self.fail(f'Member "{member}" is not assignable', context)
364
+ return None
365
+ elif member == "__contains__":
366
+ self.fail(
367
+ f"Unsupported right operand type for in ({format_type(original_type, self.options)})",
368
+ context,
369
+ code=codes.OPERATOR,
370
+ )
371
+ return codes.OPERATOR
372
+ elif member in op_methods.values():
373
+ # Access to a binary operator member (e.g. _add). This case does
374
+ # not handle indexing operations.
375
+ for op, method in op_methods.items():
376
+ if method == member:
377
+ self.unsupported_left_operand(op, original_type, context)
378
+ return codes.OPERATOR
379
+ elif member == "__neg__":
380
+ self.fail(
381
+ f"Unsupported operand type for unary - ({format_type(original_type, self.options)})",
382
+ context,
383
+ code=codes.OPERATOR,
384
+ )
385
+ return codes.OPERATOR
386
+ elif member == "__pos__":
387
+ self.fail(
388
+ f"Unsupported operand type for unary + ({format_type(original_type, self.options)})",
389
+ context,
390
+ code=codes.OPERATOR,
391
+ )
392
+ return codes.OPERATOR
393
+ elif member == "__invert__":
394
+ self.fail(
395
+ f"Unsupported operand type for ~ ({format_type(original_type, self.options)})",
396
+ context,
397
+ code=codes.OPERATOR,
398
+ )
399
+ return codes.OPERATOR
400
+ elif member == "__getitem__":
401
+ # Indexed get.
402
+ # TODO: Fix this consistently in format_type
403
+ if isinstance(original_type, FunctionLike) and original_type.is_type_obj():
404
+ self.fail(
405
+ "The type {} is not generic and not indexable".format(
406
+ format_type(original_type, self.options)
407
+ ),
408
+ context,
409
+ )
410
+ return None
411
+ else:
412
+ self.fail(
413
+ f"Value of type {format_type(original_type, self.options)} is not indexable",
414
+ context,
415
+ code=codes.INDEX,
416
+ )
417
+ return codes.INDEX
418
+ elif member == "__setitem__":
419
+ # Indexed set.
420
+ self.fail(
421
+ "Unsupported target for indexed assignment ({})".format(
422
+ format_type(original_type, self.options)
423
+ ),
424
+ context,
425
+ code=codes.INDEX,
426
+ )
427
+ return codes.INDEX
428
+ elif member == "__call__":
429
+ if isinstance(original_type, Instance) and (
430
+ original_type.type.fullname == "builtins.function"
431
+ ):
432
+ # "'function' not callable" is a confusing error message.
433
+ # Explain that the problem is that the type of the function is not known.
434
+ self.fail("Cannot call function of unknown type", context, code=codes.OPERATOR)
435
+ return codes.OPERATOR
436
+ else:
437
+ self.fail(
438
+ message_registry.NOT_CALLABLE.format(format_type(original_type, self.options)),
439
+ context,
440
+ code=codes.OPERATOR,
441
+ )
442
+ return codes.OPERATOR
443
+ else:
444
+ # The non-special case: a missing ordinary attribute.
445
+ extra = ""
446
+ if member == "__iter__":
447
+ extra = " (not iterable)"
448
+ elif member == "__aiter__":
449
+ extra = " (not async iterable)"
450
+ if not self.are_type_names_disabled():
451
+ failed = False
452
+ if isinstance(original_type, Instance) and original_type.type.names:
453
+ if (
454
+ module_symbol_table is not None
455
+ and member in module_symbol_table
456
+ and not module_symbol_table[member].module_public
457
+ ):
458
+ self.fail(
459
+ f"{format_type(original_type, self.options, module_names=True)} does not "
460
+ f'explicitly export attribute "{member}"',
461
+ context,
462
+ code=codes.ATTR_DEFINED,
463
+ )
464
+ failed = True
465
+ else:
466
+ alternatives = set(original_type.type.names.keys())
467
+ if module_symbol_table is not None:
468
+ alternatives |= {
469
+ k for k, v in module_symbol_table.items() if v.module_public
470
+ }
471
+ # Rare but possible, see e.g. testNewAnalyzerCyclicDefinitionCrossModule
472
+ alternatives.discard(member)
473
+
474
+ matches = [m for m in COMMON_MISTAKES.get(member, []) if m in alternatives]
475
+ matches.extend(best_matches(member, alternatives, n=3))
476
+ if member == "__aiter__" and matches == ["__iter__"]:
477
+ matches = [] # Avoid misleading suggestion
478
+ if matches:
479
+ self.fail(
480
+ '{} has no attribute "{}"; maybe {}?{}'.format(
481
+ format_type(original_type, self.options),
482
+ member,
483
+ pretty_seq(matches, "or"),
484
+ extra,
485
+ ),
486
+ context,
487
+ code=codes.ATTR_DEFINED,
488
+ )
489
+ failed = True
490
+ if not failed:
491
+ self.fail(
492
+ '{} has no attribute "{}"{}'.format(
493
+ format_type(original_type, self.options), member, extra
494
+ ),
495
+ context,
496
+ code=codes.ATTR_DEFINED,
497
+ )
498
+ return codes.ATTR_DEFINED
499
+ elif isinstance(original_type, UnionType):
500
+ # The checker passes "object" in lieu of "None" for attribute
501
+ # checks, so we manually convert it back.
502
+ typ_format, orig_type_format = format_type_distinctly(
503
+ typ, original_type, options=self.options
504
+ )
505
+ if typ_format == '"object"' and any(
506
+ type(item) == NoneType for item in original_type.items
507
+ ):
508
+ typ_format = '"None"'
509
+ self.fail(
510
+ 'Item {} of {} has no attribute "{}"{}'.format(
511
+ typ_format, orig_type_format, member, extra
512
+ ),
513
+ context,
514
+ code=codes.UNION_ATTR,
515
+ )
516
+ return codes.UNION_ATTR
517
+ elif isinstance(original_type, TypeVarType):
518
+ bound = get_proper_type(original_type.upper_bound)
519
+ if isinstance(bound, UnionType):
520
+ typ_fmt, bound_fmt = format_type_distinctly(typ, bound, options=self.options)
521
+ original_type_fmt = format_type(original_type, self.options)
522
+ self.fail(
523
+ "Item {} of the upper bound {} of type variable {} has no "
524
+ 'attribute "{}"{}'.format(
525
+ typ_fmt, bound_fmt, original_type_fmt, member, extra
526
+ ),
527
+ context,
528
+ code=codes.UNION_ATTR,
529
+ )
530
+ return codes.UNION_ATTR
531
+ else:
532
+ self.fail(
533
+ '{} has no attribute "{}"{}'.format(
534
+ format_type(original_type, self.options), member, extra
535
+ ),
536
+ context,
537
+ code=codes.ATTR_DEFINED,
538
+ )
539
+ return codes.ATTR_DEFINED
540
+ return None
541
+
542
+ def unsupported_operand_types(
543
+ self,
544
+ op: str,
545
+ left_type: Any,
546
+ right_type: Any,
547
+ context: Context,
548
+ *,
549
+ code: ErrorCode = codes.OPERATOR,
550
+ ) -> ErrorInfo:
551
+ """Report unsupported operand types for a binary operation.
552
+
553
+ Types can be Type objects or strings.
554
+ """
555
+ left_str = ""
556
+ if isinstance(left_type, str):
557
+ left_str = left_type
558
+ else:
559
+ left_str = format_type(left_type, self.options)
560
+
561
+ right_str = ""
562
+ if isinstance(right_type, str):
563
+ right_str = right_type
564
+ else:
565
+ right_str = format_type(right_type, self.options)
566
+
567
+ if self.are_type_names_disabled():
568
+ msg = f"Unsupported operand types for {op} (likely involving Union)"
569
+ else:
570
+ msg = f"Unsupported operand types for {op} ({left_str} and {right_str})"
571
+ return self.fail(msg, context, code=code)
572
+
573
+ def unsupported_left_operand(self, op: str, typ: Type, context: Context) -> None:
574
+ if self.are_type_names_disabled():
575
+ msg = f"Unsupported left operand type for {op} (some union)"
576
+ else:
577
+ msg = f"Unsupported left operand type for {op} ({format_type(typ, self.options)})"
578
+ self.fail(msg, context, code=codes.OPERATOR)
579
+
580
+ def not_callable(self, typ: Type, context: Context) -> Type:
581
+ self.fail(message_registry.NOT_CALLABLE.format(format_type(typ, self.options)), context)
582
+ return AnyType(TypeOfAny.from_error)
583
+
584
+ def untyped_function_call(self, callee: CallableType, context: Context) -> Type:
585
+ name = callable_name(callee) or "(unknown)"
586
+ self.fail(
587
+ f"Call to untyped function {name} in typed context",
588
+ context,
589
+ code=codes.NO_UNTYPED_CALL,
590
+ )
591
+ return AnyType(TypeOfAny.from_error)
592
+
593
+ def incompatible_argument(
594
+ self,
595
+ n: int,
596
+ m: int,
597
+ callee: CallableType,
598
+ arg_type: Type,
599
+ arg_kind: ArgKind,
600
+ object_type: Type | None,
601
+ context: Context,
602
+ outer_context: Context,
603
+ ) -> ErrorInfo:
604
+ """Report an error about an incompatible argument type.
605
+
606
+ The argument type is arg_type, argument number is n and the
607
+ callee type is 'callee'. If the callee represents a method
608
+ that corresponds to an operator, use the corresponding
609
+ operator name in the messages.
610
+
611
+ Return the error code that used for the argument (multiple error
612
+ codes are possible).
613
+ """
614
+ arg_type = get_proper_type(arg_type)
615
+
616
+ target = ""
617
+ callee_name = callable_name(callee)
618
+ if callee_name is not None:
619
+ name = callee_name
620
+ if object_type is not None:
621
+ base = format_type(object_type, self.options)
622
+ else:
623
+ base = extract_type(name)
624
+
625
+ if name.startswith('"__getitem__" of'):
626
+ return self.invalid_index_type(
627
+ arg_type, callee.arg_types[n - 1], base, context, code=codes.INDEX
628
+ )
629
+ elif name.startswith('"__setitem__" of'):
630
+ if n == 1:
631
+ return self.invalid_index_type(
632
+ arg_type, callee.arg_types[n - 1], base, context, code=codes.INDEX
633
+ )
634
+ else:
635
+ arg_type_str, callee_type_str = format_type_distinctly(
636
+ arg_type, callee.arg_types[n - 1], options=self.options
637
+ )
638
+ info = (
639
+ f" (expression has type {arg_type_str}, target has type {callee_type_str})"
640
+ )
641
+ error_msg = (
642
+ message_registry.INCOMPATIBLE_TYPES_IN_ASSIGNMENT.with_additional_msg(info)
643
+ )
644
+ return self.fail(error_msg.value, context, code=error_msg.code)
645
+ elif name.startswith('"__'):
646
+ for method, op in op_methods_to_symbols.items():
647
+ for variant in method, "__r" + method[2:]:
648
+ # FIX: do not rely on textual formatting
649
+ if name.startswith(f'"{variant}" of'):
650
+ if op == "in" or variant != method:
651
+ # Reversed order of base/argument.
652
+ return self.unsupported_operand_types(
653
+ op, arg_type, base, context, code=codes.OPERATOR
654
+ )
655
+ else:
656
+ return self.unsupported_operand_types(
657
+ op, base, arg_type, context, code=codes.OPERATOR
658
+ )
659
+
660
+ target = f"to {name} "
661
+
662
+ msg = ""
663
+ code = codes.MISC
664
+ notes: list[str] = []
665
+ if callee_name == "<list>":
666
+ name = callee_name[1:-1]
667
+ n -= 1
668
+ actual_type_str, expected_type_str = format_type_distinctly(
669
+ arg_type, callee.arg_types[0], options=self.options
670
+ )
671
+ msg = "{} item {} has incompatible type {}; expected {}".format(
672
+ name.title(), n, actual_type_str, expected_type_str
673
+ )
674
+ code = codes.LIST_ITEM
675
+ elif callee_name == "<dict>" and isinstance(
676
+ get_proper_type(callee.arg_types[n - 1]), TupleType
677
+ ):
678
+ name = callee_name[1:-1]
679
+ n -= 1
680
+ key_type, value_type = cast(TupleType, arg_type).items
681
+ expected_key_type, expected_value_type = cast(TupleType, callee.arg_types[n]).items
682
+
683
+ # don't increase verbosity unless there is need to do so
684
+ if is_subtype(key_type, expected_key_type):
685
+ key_type_str = format_type(key_type, self.options)
686
+ expected_key_type_str = format_type(expected_key_type, self.options)
687
+ else:
688
+ key_type_str, expected_key_type_str = format_type_distinctly(
689
+ key_type, expected_key_type, options=self.options
690
+ )
691
+ if is_subtype(value_type, expected_value_type):
692
+ value_type_str = format_type(value_type, self.options)
693
+ expected_value_type_str = format_type(expected_value_type, self.options)
694
+ else:
695
+ value_type_str, expected_value_type_str = format_type_distinctly(
696
+ value_type, expected_value_type, options=self.options
697
+ )
698
+
699
+ msg = "{} entry {} has incompatible type {}: {}; expected {}: {}".format(
700
+ name.title(),
701
+ n,
702
+ key_type_str,
703
+ value_type_str,
704
+ expected_key_type_str,
705
+ expected_value_type_str,
706
+ )
707
+ code = codes.DICT_ITEM
708
+ elif callee_name == "<dict>":
709
+ value_type_str, expected_value_type_str = format_type_distinctly(
710
+ arg_type, callee.arg_types[n - 1], options=self.options
711
+ )
712
+ msg = "Unpacked dict entry {} has incompatible type {}; expected {}".format(
713
+ n - 1, value_type_str, expected_value_type_str
714
+ )
715
+ code = codes.DICT_ITEM
716
+ elif callee_name == "<list-comprehension>":
717
+ actual_type_str, expected_type_str = map(
718
+ strip_quotes,
719
+ format_type_distinctly(arg_type, callee.arg_types[0], options=self.options),
720
+ )
721
+ msg = "List comprehension has incompatible type List[{}]; expected List[{}]".format(
722
+ actual_type_str, expected_type_str
723
+ )
724
+ elif callee_name == "<set-comprehension>":
725
+ actual_type_str, expected_type_str = map(
726
+ strip_quotes,
727
+ format_type_distinctly(arg_type, callee.arg_types[0], options=self.options),
728
+ )
729
+ msg = "Set comprehension has incompatible type Set[{}]; expected Set[{}]".format(
730
+ actual_type_str, expected_type_str
731
+ )
732
+ elif callee_name == "<dictionary-comprehension>":
733
+ actual_type_str, expected_type_str = format_type_distinctly(
734
+ arg_type, callee.arg_types[n - 1], options=self.options
735
+ )
736
+ msg = (
737
+ "{} expression in dictionary comprehension has incompatible type {}; "
738
+ "expected type {}"
739
+ ).format("Key" if n == 1 else "Value", actual_type_str, expected_type_str)
740
+ elif callee_name == "<generator>":
741
+ actual_type_str, expected_type_str = format_type_distinctly(
742
+ arg_type, callee.arg_types[0], options=self.options
743
+ )
744
+ msg = "Generator has incompatible item type {}; expected {}".format(
745
+ actual_type_str, expected_type_str
746
+ )
747
+ else:
748
+ if self.prefer_simple_messages():
749
+ msg = "Argument has incompatible type"
750
+ else:
751
+ try:
752
+ expected_type = callee.arg_types[m - 1]
753
+ except IndexError: # Varargs callees
754
+ expected_type = callee.arg_types[-1]
755
+ arg_type_str, expected_type_str = format_type_distinctly(
756
+ arg_type, expected_type, bare=True, options=self.options
757
+ )
758
+ if arg_kind == ARG_STAR:
759
+ arg_type_str = "*" + arg_type_str
760
+ elif arg_kind == ARG_STAR2:
761
+ arg_type_str = "**" + arg_type_str
762
+
763
+ # For function calls with keyword arguments, display the argument name rather
764
+ # than the number.
765
+ arg_label = str(n)
766
+ if isinstance(outer_context, CallExpr) and len(outer_context.arg_names) >= n:
767
+ arg_name = outer_context.arg_names[n - 1]
768
+ if arg_name is not None:
769
+ arg_label = f'"{arg_name}"'
770
+ if (
771
+ arg_kind == ARG_STAR2
772
+ and isinstance(arg_type, TypedDictType)
773
+ and m <= len(callee.arg_names)
774
+ and callee.arg_names[m - 1] is not None
775
+ and callee.arg_kinds[m - 1] != ARG_STAR2
776
+ ):
777
+ arg_name = callee.arg_names[m - 1]
778
+ assert arg_name is not None
779
+ arg_type_str, expected_type_str = format_type_distinctly(
780
+ arg_type.items[arg_name], expected_type, bare=True, options=self.options
781
+ )
782
+ arg_label = f'"{arg_name}"'
783
+ if isinstance(outer_context, IndexExpr) and isinstance(
784
+ outer_context.index, StrExpr
785
+ ):
786
+ msg = 'Value of "{}" has incompatible type {}; expected {}'.format(
787
+ outer_context.index.value,
788
+ quote_type_string(arg_type_str),
789
+ quote_type_string(expected_type_str),
790
+ )
791
+ else:
792
+ msg = "Argument {} {}has incompatible type {}; expected {}".format(
793
+ arg_label,
794
+ target,
795
+ quote_type_string(arg_type_str),
796
+ quote_type_string(expected_type_str),
797
+ )
798
+ expected_type = get_proper_type(expected_type)
799
+ if isinstance(expected_type, UnionType):
800
+ expected_types = get_proper_types(expected_type.items)
801
+ else:
802
+ expected_types = [expected_type]
803
+ for type in expected_types:
804
+ if isinstance(arg_type, Instance) and isinstance(type, Instance):
805
+ notes = append_invariance_notes(notes, arg_type, type)
806
+ notes = append_numbers_notes(notes, arg_type, type)
807
+ object_type = get_proper_type(object_type)
808
+ if isinstance(object_type, TypedDictType):
809
+ code = codes.TYPEDDICT_ITEM
810
+ else:
811
+ code = codes.ARG_TYPE
812
+ error = self.fail(msg, context, code=code)
813
+ if notes:
814
+ for note_msg in notes:
815
+ self.note(note_msg, context, code=code)
816
+ return error
817
+
818
+ def incompatible_argument_note(
819
+ self,
820
+ original_caller_type: ProperType,
821
+ callee_type: ProperType,
822
+ context: Context,
823
+ parent_error: ErrorInfo,
824
+ ) -> None:
825
+ if self.prefer_simple_messages():
826
+ return
827
+ if isinstance(
828
+ original_caller_type, (Instance, TupleType, TypedDictType, TypeType, CallableType)
829
+ ):
830
+ if isinstance(callee_type, Instance) and callee_type.type.is_protocol:
831
+ self.report_protocol_problems(
832
+ original_caller_type, callee_type, context, parent_error=parent_error
833
+ )
834
+ if isinstance(callee_type, UnionType):
835
+ for item in callee_type.items:
836
+ item = get_proper_type(item)
837
+ if isinstance(item, Instance) and item.type.is_protocol:
838
+ self.report_protocol_problems(
839
+ original_caller_type, item, context, parent_error=parent_error
840
+ )
841
+ if isinstance(callee_type, CallableType) and isinstance(original_caller_type, Instance):
842
+ call = find_member(
843
+ "__call__", original_caller_type, original_caller_type, is_operator=True
844
+ )
845
+ if call:
846
+ self.note_call(original_caller_type, call, context, code=parent_error.code)
847
+ if isinstance(callee_type, Instance) and callee_type.type.is_protocol:
848
+ call = find_member("__call__", callee_type, callee_type, is_operator=True)
849
+ if call:
850
+ self.note_call(callee_type, call, context, code=parent_error.code)
851
+ self.maybe_note_concatenate_pos_args(
852
+ original_caller_type, callee_type, context, parent_error.code
853
+ )
854
+
855
+ def maybe_note_concatenate_pos_args(
856
+ self,
857
+ original_caller_type: ProperType,
858
+ callee_type: ProperType,
859
+ context: Context,
860
+ code: ErrorCode | None = None,
861
+ ) -> None:
862
+ # pos-only vs positional can be confusing, with Concatenate
863
+ if (
864
+ isinstance(callee_type, CallableType)
865
+ and isinstance(original_caller_type, CallableType)
866
+ and (original_caller_type.from_concatenate or callee_type.from_concatenate)
867
+ ):
868
+ names: list[str] = []
869
+ for c, o in zip(
870
+ callee_type.formal_arguments(), original_caller_type.formal_arguments()
871
+ ):
872
+ if None in (c.pos, o.pos):
873
+ # non-positional
874
+ continue
875
+ if c.name != o.name and c.name is None and o.name is not None:
876
+ names.append(o.name)
877
+
878
+ if names:
879
+ missing_arguments = '"' + '", "'.join(names) + '"'
880
+ self.note(
881
+ f'This is likely because "{original_caller_type.name}" has named arguments: '
882
+ f"{missing_arguments}. Consider marking them positional-only",
883
+ context,
884
+ code=code,
885
+ )
886
+
887
+ def invalid_index_type(
888
+ self,
889
+ index_type: Type,
890
+ expected_type: Type,
891
+ base_str: str,
892
+ context: Context,
893
+ *,
894
+ code: ErrorCode,
895
+ ) -> ErrorInfo:
896
+ index_str, expected_str = format_type_distinctly(
897
+ index_type, expected_type, options=self.options
898
+ )
899
+ return self.fail(
900
+ "Invalid index type {} for {}; expected type {}".format(
901
+ index_str, base_str, expected_str
902
+ ),
903
+ context,
904
+ code=code,
905
+ )
906
+
907
+ def readonly_keys_mutated(self, keys: set[str], context: Context) -> None:
908
+ if len(keys) == 1:
909
+ suffix = "is"
910
+ else:
911
+ suffix = "are"
912
+ self.fail(
913
+ "ReadOnly {} TypedDict {} mutated".format(format_key_list(sorted(keys)), suffix),
914
+ code=codes.TYPEDDICT_READONLY_MUTATED,
915
+ context=context,
916
+ )
917
+
918
+ def too_few_arguments(
919
+ self, callee: CallableType, context: Context, argument_names: Sequence[str | None] | None
920
+ ) -> None:
921
+ if self.prefer_simple_messages():
922
+ msg = "Too few arguments"
923
+ elif argument_names is not None:
924
+ num_positional_args = sum(k is None for k in argument_names)
925
+ arguments_left = callee.arg_names[num_positional_args : callee.min_args]
926
+ diff = [k for k in arguments_left if k not in argument_names]
927
+ if len(diff) == 1:
928
+ msg = "Missing positional argument"
929
+ else:
930
+ msg = "Missing positional arguments"
931
+ callee_name = callable_name(callee)
932
+ if callee_name is not None and diff and all(d is not None for d in diff):
933
+ args = '", "'.join(cast(list[str], diff))
934
+ msg += f' "{args}" in call to {callee_name}'
935
+ else:
936
+ msg = "Too few arguments" + for_function(callee)
937
+
938
+ else:
939
+ msg = "Too few arguments" + for_function(callee)
940
+ self.fail(msg, context, code=codes.CALL_ARG)
941
+
942
+ def missing_named_argument(self, callee: CallableType, context: Context, name: str) -> None:
943
+ msg = f'Missing named argument "{name}"' + for_function(callee)
944
+ self.fail(msg, context, code=codes.CALL_ARG)
945
+ self.note_defined_here(callee, context)
946
+
947
+ def too_many_arguments(self, callee: CallableType, context: Context) -> None:
948
+ if self.prefer_simple_messages():
949
+ msg = "Too many arguments"
950
+ else:
951
+ msg = "Too many arguments" + for_function(callee)
952
+ self.fail(msg, context, code=codes.CALL_ARG)
953
+ self.maybe_note_about_special_args(callee, context)
954
+
955
+ def too_many_arguments_from_typed_dict(
956
+ self, callee: CallableType, arg_type: TypedDictType, context: Context
957
+ ) -> None:
958
+ # Try to determine the name of the extra argument.
959
+ for key in arg_type.items:
960
+ if key not in callee.arg_names:
961
+ msg = f'Extra argument "{key}" from **args' + for_function(callee)
962
+ break
963
+ else:
964
+ self.too_many_arguments(callee, context)
965
+ return
966
+ self.fail(msg, context)
967
+
968
+ def too_many_positional_arguments(self, callee: CallableType, context: Context) -> None:
969
+ if self.prefer_simple_messages():
970
+ msg = "Too many positional arguments"
971
+ else:
972
+ msg = "Too many positional arguments" + for_function(callee)
973
+ self.fail(msg, context, code=codes.CALL_ARG_MISC)
974
+ self.maybe_note_about_special_args(callee, context)
975
+ self.note_defined_here(callee, context, code=codes.CALL_ARG_MISC)
976
+
977
+ def maybe_note_about_special_args(self, callee: CallableType, context: Context) -> None:
978
+ if self.prefer_simple_messages():
979
+ return
980
+ # https://github.com/python/mypy/issues/11309
981
+ first_arg = get_first_arg(callee)
982
+ if first_arg and first_arg not in {"self", "cls", "mcs"}:
983
+ self.note(
984
+ "Looks like the first special argument in a method "
985
+ 'is not named "self", "cls", or "mcs", '
986
+ "maybe it is missing?",
987
+ context,
988
+ )
989
+
990
+ def unexpected_keyword_argument_for_function(
991
+ self, for_func: str, name: str, context: Context, *, matches: list[str] | None = None
992
+ ) -> None:
993
+ msg = f'Unexpected keyword argument "{name}"' + for_func
994
+ if matches:
995
+ msg += f"; did you mean {pretty_seq(matches, 'or')}?"
996
+ self.fail(msg, context, code=codes.CALL_ARG)
997
+
998
+ def unexpected_keyword_argument(
999
+ self, callee: CallableType, name: str, arg_type: Type, context: Context
1000
+ ) -> None:
1001
+ # Suggest intended keyword, look for type match else fallback on any match.
1002
+ matching_type_args = []
1003
+ not_matching_type_args = []
1004
+ for i, kwarg_type in enumerate(callee.arg_types):
1005
+ callee_arg_name = callee.arg_names[i]
1006
+ if callee_arg_name is not None and callee.arg_kinds[i] != ARG_STAR:
1007
+ if is_subtype(arg_type, kwarg_type):
1008
+ matching_type_args.append(callee_arg_name)
1009
+ else:
1010
+ not_matching_type_args.append(callee_arg_name)
1011
+ if not self.prefer_simple_messages():
1012
+ matches = best_matches(name, matching_type_args, n=3)
1013
+ if not matches:
1014
+ matches = best_matches(name, not_matching_type_args, n=3)
1015
+ else:
1016
+ matches = []
1017
+ self.unexpected_keyword_argument_for_function(
1018
+ for_function(callee), name, context, matches=matches
1019
+ )
1020
+ self.note_defined_here(callee, context)
1021
+
1022
+ def note_defined_here(
1023
+ self, callee: CallableType, context: Context, code: ErrorCode = codes.CALL_ARG
1024
+ ) -> None:
1025
+ module = find_defining_module(self.modules, callee)
1026
+ if (
1027
+ module
1028
+ and module.path != self.errors.file
1029
+ and module.fullname not in ("builtins", "typing")
1030
+ ):
1031
+ assert callee.definition is not None
1032
+ fname = callable_name(callee)
1033
+ if not fname: # an alias to function with a different name
1034
+ fname = "Called function"
1035
+ else:
1036
+ fname = fname.split(" of ")[0] # use short method names in the note
1037
+ self.note(f'{fname} defined in "{module.fullname}"', context, code=code)
1038
+
1039
+ def duplicate_argument_value(self, callee: CallableType, index: int, context: Context) -> None:
1040
+ self.fail(
1041
+ '{} gets multiple values for keyword argument "{}"'.format(
1042
+ callable_name(callee) or "Function", callee.arg_names[index]
1043
+ ),
1044
+ context,
1045
+ )
1046
+
1047
+ def does_not_return_value(self, callee_type: Type | None, context: Context) -> None:
1048
+ """Report an error about use of an unusable type."""
1049
+ callee_type = get_proper_type(callee_type)
1050
+ callee_name = callable_name(callee_type) if isinstance(callee_type, FunctionLike) else None
1051
+ name = callee_name or "Function"
1052
+ message = f"{name} does not return a value (it only ever returns None)"
1053
+ self.fail(message, context, code=codes.FUNC_RETURNS_VALUE)
1054
+
1055
+ def deleted_as_rvalue(self, typ: DeletedType, context: Context) -> None:
1056
+ """Report an error about using an deleted type as an rvalue."""
1057
+ if typ.source is None:
1058
+ s = ""
1059
+ else:
1060
+ s = f' "{typ.source}"'
1061
+ self.fail(f"Trying to read deleted variable{s}", context)
1062
+
1063
+ def deleted_as_lvalue(self, typ: DeletedType, context: Context) -> None:
1064
+ """Report an error about using an deleted type as an lvalue.
1065
+
1066
+ Currently, this only occurs when trying to assign to an
1067
+ exception variable outside the local except: blocks.
1068
+ """
1069
+ if typ.source is None:
1070
+ s = ""
1071
+ else:
1072
+ s = f' "{typ.source}"'
1073
+ self.fail(f"Assignment to variable{s} outside except: block", context)
1074
+
1075
+ def no_variant_matches_arguments(
1076
+ self,
1077
+ overload: Overloaded,
1078
+ arg_types: list[Type],
1079
+ context: Context,
1080
+ *,
1081
+ arg_names: Sequence[str | None] | None,
1082
+ arg_kinds: list[ArgKind] | None = None,
1083
+ code: ErrorCode | None = None,
1084
+ ) -> None:
1085
+ code = code or codes.CALL_OVERLOAD
1086
+ name = callable_name(overload)
1087
+ if name:
1088
+ name_str = f" of {name}"
1089
+ for_func = f" for overloaded function {name}"
1090
+ else:
1091
+ name_str = ""
1092
+ for_func = ""
1093
+
1094
+ # For keyword argument errors
1095
+ unexpected_kwargs: list[tuple[str, Type]] = []
1096
+ if arg_names is not None and arg_kinds is not None:
1097
+ all_valid_kwargs: set[str] = set()
1098
+ for item in overload.items:
1099
+ for i, arg_name in enumerate(item.arg_names):
1100
+ if arg_name is not None and item.arg_kinds[i] != ARG_STAR:
1101
+ all_valid_kwargs.add(arg_name)
1102
+ if item.is_kw_arg:
1103
+ all_valid_kwargs.clear()
1104
+ break
1105
+
1106
+ if all_valid_kwargs:
1107
+ for i, (arg_name, arg_kind) in enumerate(zip(arg_names, arg_kinds)):
1108
+ if arg_kind == ARG_NAMED and arg_name is not None:
1109
+ if arg_name not in all_valid_kwargs:
1110
+ unexpected_kwargs.append((arg_name, arg_types[i]))
1111
+
1112
+ if unexpected_kwargs:
1113
+ all_kwargs_confident = True
1114
+ kwargs_with_suggestions: list[tuple[str, list[str]]] = []
1115
+ kwargs_without_suggestions: list[str] = []
1116
+
1117
+ # Find suggestions for each unexpected kwarg, prioritizing type-matching args
1118
+ for kwarg_name, kwarg_type in unexpected_kwargs:
1119
+ matching_type_args: list[str] = []
1120
+ not_matching_type_args: list[str] = []
1121
+ has_matching_variant = False
1122
+
1123
+ for item in overload.items:
1124
+ item_has_type_match = False
1125
+ for i, formal_type in enumerate(item.arg_types):
1126
+ formal_name = item.arg_names[i]
1127
+ if formal_name is not None and item.arg_kinds[i] != ARG_STAR:
1128
+ if is_subtype(kwarg_type, formal_type):
1129
+ if formal_name not in matching_type_args:
1130
+ matching_type_args.append(formal_name)
1131
+ item_has_type_match = True
1132
+ elif formal_name not in not_matching_type_args:
1133
+ not_matching_type_args.append(formal_name)
1134
+ if item_has_type_match:
1135
+ has_matching_variant = True
1136
+
1137
+ if not self.prefer_simple_messages():
1138
+ matches = best_matches(kwarg_name, matching_type_args, n=3)
1139
+ if not matches:
1140
+ matches = best_matches(kwarg_name, not_matching_type_args, n=3)
1141
+ else:
1142
+ matches = []
1143
+
1144
+ if matches:
1145
+ kwargs_with_suggestions.append((kwarg_name, matches))
1146
+ else:
1147
+ kwargs_without_suggestions.append(kwarg_name)
1148
+
1149
+ if not has_matching_variant:
1150
+ all_kwargs_confident = False
1151
+
1152
+ for kwarg_name, matches in kwargs_with_suggestions:
1153
+ self.fail(
1154
+ f'Unexpected keyword argument "{kwarg_name}"'
1155
+ f"{for_func}; did you mean {pretty_seq(matches, 'or')}?",
1156
+ context,
1157
+ code=code,
1158
+ )
1159
+
1160
+ if kwargs_without_suggestions:
1161
+ if len(kwargs_without_suggestions) == 1:
1162
+ self.fail(
1163
+ f'Unexpected keyword argument "{kwargs_without_suggestions[0]}"{for_func}',
1164
+ context,
1165
+ code=code,
1166
+ )
1167
+ else:
1168
+ quoted_names = ", ".join(f'"{n}"' for n in kwargs_without_suggestions)
1169
+ self.fail(
1170
+ f"Unexpected keyword arguments {quoted_names}{for_func}",
1171
+ context,
1172
+ code=code,
1173
+ )
1174
+
1175
+ if all_kwargs_confident and len(unexpected_kwargs) == len(arg_types):
1176
+ return
1177
+
1178
+ arg_types_str = ", ".join(format_type(arg, self.options) for arg in arg_types)
1179
+ num_args = len(arg_types)
1180
+ if num_args == 0:
1181
+ self.fail(
1182
+ f"All overload variants{name_str} require at least one argument",
1183
+ context,
1184
+ code=code,
1185
+ )
1186
+ elif num_args == 1:
1187
+ self.fail(
1188
+ f"No overload variant{name_str} matches argument type {arg_types_str}",
1189
+ context,
1190
+ code=code,
1191
+ )
1192
+ else:
1193
+ self.fail(
1194
+ f"No overload variant{name_str} matches argument types {arg_types_str}",
1195
+ context,
1196
+ code=code,
1197
+ )
1198
+
1199
+ self.note(f"Possible overload variant{plural_s(len(overload.items))}:", context, code=code)
1200
+ for item in overload.items:
1201
+ self.note(pretty_callable(item, self.options), context, offset=4, code=code)
1202
+
1203
+ def wrong_number_values_to_unpack(
1204
+ self, provided: int, expected: int, context: Context
1205
+ ) -> None:
1206
+ if provided < expected:
1207
+ if provided == 1:
1208
+ self.fail(f"Need more than 1 value to unpack ({expected} expected)", context)
1209
+ else:
1210
+ self.fail(
1211
+ f"Need more than {provided} values to unpack ({expected} expected)", context
1212
+ )
1213
+ elif provided > expected:
1214
+ self.fail(
1215
+ f"Too many values to unpack ({expected} expected, {provided} provided)", context
1216
+ )
1217
+
1218
+ def unpacking_strings_disallowed(self, context: Context) -> None:
1219
+ self.fail("Unpacking a string is disallowed", context, code=codes.STR_UNPACK)
1220
+
1221
+ def type_not_iterable(self, type: Type, context: Context) -> None:
1222
+ self.fail(f"{format_type(type, self.options)} object is not iterable", context)
1223
+
1224
+ def possible_missing_await(self, context: Context, code: ErrorCode | None) -> None:
1225
+ self.note('Maybe you forgot to use "await"?', context, code=code)
1226
+
1227
+ def incompatible_operator_assignment(self, op: str, context: Context) -> None:
1228
+ self.fail(f"Result type of {op} incompatible in assignment", context)
1229
+
1230
+ def overload_signature_incompatible_with_supertype(
1231
+ self, name: str, name_in_super: str, supertype: str, context: Context
1232
+ ) -> None:
1233
+ target = self.override_target(name, name_in_super, supertype)
1234
+ self.fail(
1235
+ f'Signature of "{name}" incompatible with {target}', context, code=codes.OVERRIDE
1236
+ )
1237
+
1238
+ note_template = 'Overload variants must be defined in the same order as they are in "{}"'
1239
+ self.note(note_template.format(supertype), context, code=codes.OVERRIDE)
1240
+
1241
+ def incompatible_setter_override(
1242
+ self, defn: Context, typ: Type, original_type: Type, base: TypeInfo
1243
+ ) -> None:
1244
+ self.fail("Incompatible override of a setter type", defn, code=codes.OVERRIDE)
1245
+ base_str, override_str = format_type_distinctly(original_type, typ, options=self.options)
1246
+ self.note(
1247
+ f' (base class "{base.name}" defined the type as {base_str},',
1248
+ defn,
1249
+ code=codes.OVERRIDE,
1250
+ )
1251
+ self.note(f" override has type {override_str})", defn, code=codes.OVERRIDE)
1252
+ if is_subtype(typ, original_type):
1253
+ self.note(" Setter types should behave contravariantly", defn, code=codes.OVERRIDE)
1254
+
1255
+ def signature_incompatible_with_supertype(
1256
+ self,
1257
+ name: str,
1258
+ name_in_super: str,
1259
+ supertype: str,
1260
+ context: Context,
1261
+ *,
1262
+ original: ProperType,
1263
+ override: ProperType,
1264
+ ) -> None:
1265
+ target = self.override_target(name, name_in_super, supertype)
1266
+ error = self.fail(
1267
+ f'Signature of "{name}" incompatible with {target}', context, code=codes.OVERRIDE
1268
+ )
1269
+
1270
+ original_str, override_str = format_type_distinctly(
1271
+ original, override, options=self.options, bare=True
1272
+ )
1273
+
1274
+ INCLUDE_DECORATOR = True # Include @classmethod and @staticmethod decorators, if any
1275
+ ALIGN_OFFSET = 1 # One space, to account for the difference between error and note
1276
+ OFFSET = 4 # Four spaces, so that notes will look like this:
1277
+ # error: Signature of "f" incompatible with supertype "A"
1278
+ # note: Superclass:
1279
+ # note: def f(self) -> str
1280
+ # note: Subclass:
1281
+ # note: def f(self, x: str) -> None
1282
+ self.note("Superclass:", context, offset=ALIGN_OFFSET + OFFSET, parent_error=error)
1283
+ if isinstance(original, (CallableType, Overloaded)):
1284
+ self.pretty_callable_or_overload(
1285
+ original,
1286
+ context,
1287
+ offset=ALIGN_OFFSET + 2 * OFFSET,
1288
+ add_class_or_static_decorator=INCLUDE_DECORATOR,
1289
+ parent_error=error,
1290
+ )
1291
+ else:
1292
+ self.note(original_str, context, offset=ALIGN_OFFSET + 2 * OFFSET, parent_error=error)
1293
+
1294
+ self.note("Subclass:", context, offset=ALIGN_OFFSET + OFFSET, parent_error=error)
1295
+ if isinstance(override, (CallableType, Overloaded)):
1296
+ self.pretty_callable_or_overload(
1297
+ override,
1298
+ context,
1299
+ offset=ALIGN_OFFSET + 2 * OFFSET,
1300
+ add_class_or_static_decorator=INCLUDE_DECORATOR,
1301
+ parent_error=error,
1302
+ )
1303
+ else:
1304
+ self.note(override_str, context, offset=ALIGN_OFFSET + 2 * OFFSET, parent_error=error)
1305
+
1306
+ def pretty_callable_or_overload(
1307
+ self,
1308
+ tp: CallableType | Overloaded,
1309
+ context: Context,
1310
+ *,
1311
+ parent_error: ErrorInfo,
1312
+ offset: int = 0,
1313
+ add_class_or_static_decorator: bool = False,
1314
+ ) -> None:
1315
+ if isinstance(tp, CallableType):
1316
+ if add_class_or_static_decorator:
1317
+ decorator = pretty_class_or_static_decorator(tp)
1318
+ if decorator is not None:
1319
+ self.note(decorator, context, offset=offset, parent_error=parent_error)
1320
+ self.note(
1321
+ pretty_callable(tp, self.options),
1322
+ context,
1323
+ offset=offset,
1324
+ parent_error=parent_error,
1325
+ )
1326
+ elif isinstance(tp, Overloaded):
1327
+ self.pretty_overload(
1328
+ tp,
1329
+ context,
1330
+ offset,
1331
+ add_class_or_static_decorator=add_class_or_static_decorator,
1332
+ parent_error=parent_error,
1333
+ )
1334
+
1335
+ def argument_incompatible_with_supertype(
1336
+ self,
1337
+ arg_num: int,
1338
+ name: str,
1339
+ type_name: str | None,
1340
+ name_in_supertype: str,
1341
+ arg_type_in_supertype: Type,
1342
+ supertype: str,
1343
+ context: Context,
1344
+ origin_context: Context,
1345
+ ) -> None:
1346
+ target = self.override_target(name, name_in_supertype, supertype)
1347
+ arg_type_in_supertype_f = format_type_bare(arg_type_in_supertype, self.options)
1348
+ self.fail(
1349
+ 'Argument {} of "{}" is incompatible with {}; '
1350
+ 'supertype defines the argument type as "{}"'.format(
1351
+ arg_num, name, target, arg_type_in_supertype_f
1352
+ ),
1353
+ context,
1354
+ code=codes.OVERRIDE,
1355
+ origin_context=origin_context,
1356
+ )
1357
+ if name != "__post_init__":
1358
+ # `__post_init__` is special, it can be incompatible by design.
1359
+ # So, this note is misleading.
1360
+ invariant_message = """
1361
+ This violates the Liskov substitution principle
1362
+ See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
1363
+ """
1364
+ self.note_multiline(
1365
+ invariant_message, context, code=codes.OVERRIDE, origin_context=origin_context
1366
+ )
1367
+ if name == "__eq__" and type_name:
1368
+ eq_message = """
1369
+ It is recommended for "__eq__" to work with arbitrary objects, for example:
1370
+ def __eq__(self, other: object) -> bool:
1371
+ if not isinstance(other, {class_name}):
1372
+ return NotImplemented
1373
+ return <logic to compare two {class_name} instances>
1374
+ """.format(class_name=type_name)
1375
+ self.note_multiline(
1376
+ eq_message, context, code=codes.OVERRIDE, origin_context=origin_context
1377
+ )
1378
+
1379
+ def return_type_incompatible_with_supertype(
1380
+ self,
1381
+ name: str,
1382
+ name_in_supertype: str,
1383
+ supertype: str,
1384
+ original: Type,
1385
+ override: Type,
1386
+ context: Context,
1387
+ ) -> None:
1388
+ target = self.override_target(name, name_in_supertype, supertype)
1389
+ override_str, original_str = format_type_distinctly(
1390
+ override, original, options=self.options
1391
+ )
1392
+ self.fail(
1393
+ 'Return type {} of "{}" incompatible with return type {} in {}'.format(
1394
+ override_str, name, original_str, target
1395
+ ),
1396
+ context,
1397
+ code=codes.OVERRIDE,
1398
+ )
1399
+
1400
+ original = get_proper_type(original)
1401
+ override = get_proper_type(override)
1402
+ if (
1403
+ isinstance(original, Instance)
1404
+ and isinstance(override, Instance)
1405
+ and override.type.fullname == "typing.AsyncIterator"
1406
+ and original.type.fullname == "typing.Coroutine"
1407
+ and len(original.args) == 3
1408
+ and original.args[2] == override
1409
+ ):
1410
+ self.note(f'Consider declaring "{name}" in {target} without "async"', context)
1411
+ self.note(
1412
+ "See https://mypy.readthedocs.io/en/stable/more_types.html#asynchronous-iterators",
1413
+ context,
1414
+ )
1415
+
1416
+ def override_target(self, name: str, name_in_super: str, supertype: str) -> str:
1417
+ target = f'supertype "{supertype}"'
1418
+ if name_in_super != name:
1419
+ target = f'"{name_in_super}" of {target}'
1420
+ return target
1421
+
1422
+ def incompatible_type_application(
1423
+ self, min_arg_count: int, max_arg_count: int, actual_arg_count: int, context: Context
1424
+ ) -> None:
1425
+ if max_arg_count == 0:
1426
+ self.fail("Type application targets a non-generic function or class", context)
1427
+ return
1428
+
1429
+ if min_arg_count == max_arg_count:
1430
+ s = f"{max_arg_count} expected"
1431
+ else:
1432
+ s = f"expected between {min_arg_count} and {max_arg_count}"
1433
+
1434
+ if actual_arg_count > max_arg_count:
1435
+ self.fail(f"Type application has too many types ({s})", context)
1436
+ else:
1437
+ self.fail(f"Type application has too few types ({s})", context)
1438
+
1439
+ def could_not_infer_type_arguments(
1440
+ self, callee_type: CallableType, tv: TypeVarLikeType, context: Context
1441
+ ) -> None:
1442
+ callee_name = callable_name(callee_type)
1443
+ if callee_name is not None:
1444
+ self.fail(
1445
+ f"Cannot infer value of type parameter {format_type(tv, self.options)} of {callee_name}",
1446
+ context,
1447
+ )
1448
+ if callee_name == "<dict>":
1449
+ # Invariance in key type causes more of these errors than we would want.
1450
+ self.note(
1451
+ "Try assigning the literal to a variable annotated as dict[<key>, <val>]",
1452
+ context,
1453
+ )
1454
+ else:
1455
+ self.fail("Cannot infer function type argument", context)
1456
+
1457
+ def invalid_var_arg(self, typ: Type, context: Context) -> None:
1458
+ self.fail("Expected iterable as variadic argument", context)
1459
+
1460
+ def invalid_keyword_var_arg(self, typ: Type, is_mapping: bool, context: Context) -> None:
1461
+ typ = get_proper_type(typ)
1462
+ if isinstance(typ, Instance) and is_mapping:
1463
+ self.fail("Argument after ** must have string keys", context, code=codes.ARG_TYPE)
1464
+ else:
1465
+ self.fail(
1466
+ f"Argument after ** must be a mapping, not {format_type(typ, self.options)}",
1467
+ context,
1468
+ code=codes.ARG_TYPE,
1469
+ )
1470
+
1471
+ def undefined_in_superclass(self, member: str, context: Context) -> None:
1472
+ self.fail(f'"{member}" undefined in superclass', context)
1473
+
1474
+ def variable_may_be_undefined(self, name: str, context: Context) -> None:
1475
+ self.fail(f'Name "{name}" may be undefined', context, code=codes.POSSIBLY_UNDEFINED)
1476
+
1477
+ def var_used_before_def(self, name: str, context: Context) -> None:
1478
+ self.fail(f'Name "{name}" is used before definition', context, code=codes.USED_BEFORE_DEF)
1479
+
1480
+ def first_argument_for_super_must_be_type(self, actual: Type, context: Context) -> None:
1481
+ actual = get_proper_type(actual)
1482
+ if isinstance(actual, Instance):
1483
+ # Don't include type of instance, because it can look confusingly like a type
1484
+ # object.
1485
+ type_str = "a non-type instance"
1486
+ else:
1487
+ type_str = format_type(actual, self.options)
1488
+ self.fail(
1489
+ f'Argument 1 for "super" must be a type object; got {type_str}',
1490
+ context,
1491
+ code=codes.ARG_TYPE,
1492
+ )
1493
+
1494
+ def unsafe_super(self, method: str, cls: str, ctx: Context) -> None:
1495
+ self.fail(
1496
+ f'Call to abstract method "{method}" of "{cls}" with trivial body via super() is unsafe',
1497
+ ctx,
1498
+ code=codes.SAFE_SUPER,
1499
+ )
1500
+
1501
+ def too_few_string_formatting_arguments(self, context: Context) -> None:
1502
+ self.fail("Not enough arguments for format string", context, code=codes.STRING_FORMATTING)
1503
+
1504
+ def too_many_string_formatting_arguments(self, context: Context) -> None:
1505
+ self.fail(
1506
+ "Not all arguments converted during string formatting",
1507
+ context,
1508
+ code=codes.STRING_FORMATTING,
1509
+ )
1510
+
1511
+ def unsupported_placeholder(self, placeholder: str, context: Context) -> None:
1512
+ self.fail(
1513
+ f'Unsupported format character "{placeholder}"', context, code=codes.STRING_FORMATTING
1514
+ )
1515
+
1516
+ def string_interpolation_with_star_and_key(self, context: Context) -> None:
1517
+ self.fail(
1518
+ "String interpolation contains both stars and mapping keys",
1519
+ context,
1520
+ code=codes.STRING_FORMATTING,
1521
+ )
1522
+
1523
+ def requires_int_or_single_byte(self, context: Context, format_call: bool = False) -> None:
1524
+ self.fail(
1525
+ '"{}c" requires an integer in range(256) or a single byte'.format(
1526
+ ":" if format_call else "%"
1527
+ ),
1528
+ context,
1529
+ code=codes.STRING_FORMATTING,
1530
+ )
1531
+
1532
+ def requires_int_or_char(self, context: Context, format_call: bool = False) -> None:
1533
+ self.fail(
1534
+ '"{}c" requires int or char'.format(":" if format_call else "%"),
1535
+ context,
1536
+ code=codes.STRING_FORMATTING,
1537
+ )
1538
+
1539
+ def key_not_in_mapping(self, key: str, context: Context) -> None:
1540
+ self.fail(f'Key "{key}" not found in mapping', context, code=codes.STRING_FORMATTING)
1541
+
1542
+ def string_interpolation_mixing_key_and_non_keys(self, context: Context) -> None:
1543
+ self.fail(
1544
+ "String interpolation mixes specifier with and without mapping keys",
1545
+ context,
1546
+ code=codes.STRING_FORMATTING,
1547
+ )
1548
+
1549
+ def cannot_determine_type(self, name: str, context: Context) -> None:
1550
+ self.fail(f'Cannot determine type of "{name}"', context, code=codes.HAS_TYPE)
1551
+
1552
+ def cannot_determine_type_in_base(self, name: str, base: str, context: Context) -> None:
1553
+ self.fail(f'Cannot determine type of "{name}" in base class "{base}"', context)
1554
+
1555
+ def no_formal_self(self, name: str, item: CallableType, context: Context) -> None:
1556
+ type = format_type(item, self.options)
1557
+ self.fail(
1558
+ f'Attribute function "{name}" with type {type} does not accept self argument', context
1559
+ )
1560
+
1561
+ def incompatible_self_argument(
1562
+ self, name: str, arg: Type, sig: CallableType, is_classmethod: bool, context: Context
1563
+ ) -> None:
1564
+ kind = "class attribute function" if is_classmethod else "attribute function"
1565
+ arg_type = format_type(arg, self.options)
1566
+ sig_type = format_type(sig, self.options)
1567
+ self.fail(
1568
+ f'Invalid self argument {arg_type} to {kind} "{name}" with type {sig_type}', context
1569
+ )
1570
+
1571
+ def incompatible_conditional_function_def(
1572
+ self, defn: FuncDef, old_type: FunctionLike, new_type: FunctionLike
1573
+ ) -> None:
1574
+ error = self.fail("All conditional function variants must have identical signatures", defn)
1575
+ if isinstance(old_type, (CallableType, Overloaded)) and isinstance(
1576
+ new_type, (CallableType, Overloaded)
1577
+ ):
1578
+ self.note("Original:", defn)
1579
+ self.pretty_callable_or_overload(old_type, defn, offset=4, parent_error=error)
1580
+ self.note("Redefinition:", defn)
1581
+ self.pretty_callable_or_overload(new_type, defn, offset=4, parent_error=error)
1582
+
1583
+ def cannot_instantiate_abstract_class(
1584
+ self, class_name: str, abstract_attributes: dict[str, bool], context: Context
1585
+ ) -> None:
1586
+ attrs = format_string_list([f'"{a}"' for a in abstract_attributes])
1587
+ self.fail(
1588
+ f'Cannot instantiate abstract class "{class_name}" with abstract '
1589
+ f"attribute{plural_s(abstract_attributes)} {attrs}",
1590
+ context,
1591
+ code=codes.ABSTRACT,
1592
+ )
1593
+ attrs_with_none = [
1594
+ f'"{a}"'
1595
+ for a, implicit_and_can_return_none in abstract_attributes.items()
1596
+ if implicit_and_can_return_none
1597
+ ]
1598
+ if not attrs_with_none:
1599
+ return
1600
+ if len(attrs_with_none) == 1:
1601
+ note = (
1602
+ f"{attrs_with_none[0]} is implicitly abstract because it has an empty function "
1603
+ "body. If it is not meant to be abstract, explicitly `return` or `return None`."
1604
+ )
1605
+ else:
1606
+ note = (
1607
+ "The following methods were marked implicitly abstract because they have empty "
1608
+ f"function bodies: {format_string_list(attrs_with_none)}. "
1609
+ "If they are not meant to be abstract, explicitly `return` or `return None`."
1610
+ )
1611
+ self.note(note, context, code=codes.ABSTRACT)
1612
+
1613
+ def base_class_definitions_incompatible(
1614
+ self, name: str, base1: TypeInfo, base2: TypeInfo, context: Context
1615
+ ) -> None:
1616
+ self.fail(
1617
+ 'Definition of "{}" in base class "{}" is incompatible '
1618
+ 'with definition in base class "{}"'.format(name, base1.name, base2.name),
1619
+ context,
1620
+ )
1621
+
1622
+ def cant_assign_to_method(self, context: Context) -> None:
1623
+ self.fail(message_registry.CANNOT_ASSIGN_TO_METHOD, context, code=codes.METHOD_ASSIGN)
1624
+
1625
+ def cant_assign_to_classvar(self, name: str, context: Context) -> None:
1626
+ self.fail(f'Cannot assign to class variable "{name}" via instance', context)
1627
+
1628
+ def no_overridable_method(self, name: str, context: Context) -> None:
1629
+ self.fail(
1630
+ f'Method "{name}" is marked as an override, '
1631
+ "but no base method was found with this name",
1632
+ context,
1633
+ )
1634
+
1635
+ def explicit_override_decorator_missing(
1636
+ self, name: str, base_name: str, context: Context
1637
+ ) -> None:
1638
+ self.fail(
1639
+ f'Method "{name}" is not using @override '
1640
+ f'but is overriding a method in class "{base_name}"',
1641
+ context,
1642
+ code=codes.EXPLICIT_OVERRIDE_REQUIRED,
1643
+ )
1644
+
1645
+ def final_cant_override_writable(self, name: str, ctx: Context) -> None:
1646
+ self.fail(f'Cannot override writable attribute "{name}" with a final one', ctx)
1647
+
1648
+ def cant_override_final(self, name: str, base_name: str, ctx: Context) -> None:
1649
+ self.fail(
1650
+ (
1651
+ f'Cannot override final attribute "{name}" '
1652
+ f'(previously declared in base class "{base_name}")'
1653
+ ),
1654
+ ctx,
1655
+ )
1656
+
1657
+ def cant_assign_to_final(self, name: str, attr_assign: bool, ctx: Context) -> None:
1658
+ """Warn about a prohibited assignment to a final attribute.
1659
+
1660
+ Pass `attr_assign=True` if the assignment assigns to an attribute.
1661
+ """
1662
+ kind = "attribute" if attr_assign else "name"
1663
+ self.fail(f'Cannot assign to final {kind} "{unmangle(name)}"', ctx)
1664
+
1665
+ def protocol_members_cant_be_final(self, ctx: Context) -> None:
1666
+ self.fail("Protocol member cannot be final", ctx)
1667
+
1668
+ def final_without_value(self, ctx: Context) -> None:
1669
+ self.fail("Final name must be initialized with a value", ctx)
1670
+
1671
+ def read_only_property(self, name: str, type: TypeInfo, context: Context) -> None:
1672
+ self.fail(f'Property "{name}" defined in "{type.name}" is read-only', context)
1673
+
1674
+ def incompatible_typevar_value(
1675
+ self, callee: CallableType, typ: Type, typevar_name: str, context: Context
1676
+ ) -> None:
1677
+ self.fail(
1678
+ message_registry.INCOMPATIBLE_TYPEVAR_VALUE.format(
1679
+ typevar_name, callable_name(callee) or "function", format_type(typ, self.options)
1680
+ ),
1681
+ context,
1682
+ code=codes.TYPE_VAR,
1683
+ )
1684
+
1685
+ def dangerous_comparison(self, left: Type, right: Type, kind: str, ctx: Context) -> None:
1686
+ # In loops (and similar cases), the same expression might be analysed multiple
1687
+ # times and thereby confronted with different types. We only want to raise a
1688
+ # `comparison-overlap` error if it occurs in all cases and therefore collect the
1689
+ # respective types of the current iteration here so that we can report the error
1690
+ # later if it is persistent over all iteration steps:
1691
+ for watcher in self.errors.get_watchers():
1692
+ if watcher._filter:
1693
+ break
1694
+ if isinstance(watcher, IterationErrorWatcher):
1695
+ watcher.iteration_dependent_errors.nonoverlapping_types[-1][
1696
+ NonOverlapErrorInfo(
1697
+ line=ctx.line,
1698
+ column=ctx.column,
1699
+ end_line=ctx.end_line,
1700
+ end_column=ctx.end_column,
1701
+ kind=kind,
1702
+ )
1703
+ ] = (left, right)
1704
+ return
1705
+
1706
+ left_str = "element" if kind == "container" else "left operand"
1707
+ right_str = "container item" if kind == "container" else "right operand"
1708
+ message = "Non-overlapping {} check ({} type: {}, {} type: {})"
1709
+ left_typ, right_typ = format_type_distinctly(left, right, options=self.options)
1710
+ self.fail(
1711
+ message.format(kind, left_str, left_typ, right_str, right_typ),
1712
+ ctx,
1713
+ code=codes.COMPARISON_OVERLAP,
1714
+ )
1715
+
1716
+ def overload_inconsistently_applies_decorator(self, decorator: str, context: Context) -> None:
1717
+ self.fail(
1718
+ f'Overload does not consistently use the "@{decorator}" '
1719
+ + "decorator on all function signatures.",
1720
+ context,
1721
+ )
1722
+
1723
+ def overloaded_signatures_overlap(
1724
+ self, index1: int, index2: int, flip_note: bool, context: Context
1725
+ ) -> None:
1726
+ self.fail(
1727
+ "Overloaded function signatures {} and {} overlap with "
1728
+ "incompatible return types".format(index1, index2),
1729
+ context,
1730
+ code=codes.OVERLOAD_OVERLAP,
1731
+ )
1732
+ if flip_note:
1733
+ self.note(
1734
+ "Flipping the order of overloads will fix this error",
1735
+ context,
1736
+ code=codes.OVERLOAD_OVERLAP,
1737
+ )
1738
+
1739
+ def overloaded_signature_will_never_match(
1740
+ self, index1: int, index2: int, context: Context
1741
+ ) -> None:
1742
+ self.fail(
1743
+ "Overloaded function signature {index2} will never be matched: "
1744
+ "signature {index1}'s parameter type(s) are the same or broader".format(
1745
+ index1=index1, index2=index2
1746
+ ),
1747
+ context,
1748
+ code=codes.OVERLOAD_CANNOT_MATCH,
1749
+ )
1750
+
1751
+ def overloaded_signatures_typevar_specific(self, index: int, context: Context) -> None:
1752
+ self.fail(
1753
+ f"Overloaded function implementation cannot satisfy signature {index} "
1754
+ + "due to inconsistencies in how they use type variables",
1755
+ context,
1756
+ )
1757
+
1758
+ def overloaded_signatures_param_specific(self, index: int, context: Context) -> None:
1759
+ self.fail(
1760
+ (
1761
+ f"Overloaded function implementation does not accept all possible parameters "
1762
+ f"of signature {index}"
1763
+ ),
1764
+ context,
1765
+ )
1766
+
1767
+ def overloaded_signatures_ret_specific(self, index: int, context: Context) -> None:
1768
+ self.fail(
1769
+ f"Overloaded function implementation cannot produce return type of signature {index}",
1770
+ context,
1771
+ )
1772
+
1773
+ def warn_both_operands_are_from_unions(self, context: Context) -> None:
1774
+ self.note("Both left and right operands are unions", context, code=codes.OPERATOR)
1775
+
1776
+ def warn_operand_was_from_union(self, side: str, original: Type, context: Context) -> None:
1777
+ self.note(
1778
+ f"{side} operand is of type {format_type(original, self.options)}",
1779
+ context,
1780
+ code=codes.OPERATOR,
1781
+ )
1782
+
1783
+ def operator_method_signatures_overlap(
1784
+ self,
1785
+ reverse_class: TypeInfo,
1786
+ reverse_method: str,
1787
+ forward_class: Type,
1788
+ forward_method: str,
1789
+ context: Context,
1790
+ ) -> None:
1791
+ self.fail(
1792
+ 'Signatures of "{}" of "{}" and "{}" of {} are unsafely overlapping'.format(
1793
+ reverse_method,
1794
+ reverse_class.name,
1795
+ forward_method,
1796
+ format_type(forward_class, self.options),
1797
+ ),
1798
+ context,
1799
+ )
1800
+
1801
+ def forward_operator_not_callable(self, forward_method: str, context: Context) -> None:
1802
+ self.fail(f'Forward operator "{forward_method}" is not callable', context)
1803
+
1804
+ def signatures_incompatible(self, method: str, other_method: str, context: Context) -> None:
1805
+ self.fail(f'Signatures of "{method}" and "{other_method}" are incompatible', context)
1806
+
1807
+ def yield_from_invalid_operand_type(self, expr: Type, context: Context) -> Type:
1808
+ text = (
1809
+ format_type(expr, self.options)
1810
+ if format_type(expr, self.options) != "object"
1811
+ else expr
1812
+ )
1813
+ self.fail(f'"yield from" can\'t be applied to {text}', context)
1814
+ return AnyType(TypeOfAny.from_error)
1815
+
1816
+ def invalid_signature(self, func_type: Type, context: Context) -> None:
1817
+ self.fail(f"Invalid signature {format_type(func_type, self.options)}", context)
1818
+
1819
+ def invalid_signature_for_special_method(
1820
+ self, func_type: Type, context: Context, method_name: str
1821
+ ) -> None:
1822
+ self.fail(
1823
+ f'Invalid signature {format_type(func_type, self.options)} for "{method_name}"',
1824
+ context,
1825
+ )
1826
+
1827
+ def reveal_type(self, typ: Type, context: Context) -> None:
1828
+
1829
+ # Search for an error watcher that modifies the "normal" behaviour (we do not
1830
+ # rely on the normal `ErrorWatcher` filtering approach because we might need to
1831
+ # collect the original types for a later unionised response):
1832
+ for watcher in self.errors.get_watchers():
1833
+ # The `reveal_type` statement should be ignored:
1834
+ if watcher.filter_revealed_type:
1835
+ return
1836
+ # The `reveal_type` statement might be visited iteratively due to being
1837
+ # placed in a loop or so. Hence, we collect the respective types of
1838
+ # individual iterations so that we can report them all in one step later:
1839
+ if isinstance(watcher, IterationErrorWatcher):
1840
+ watcher.iteration_dependent_errors.revealed_types[
1841
+ (context.line, context.column, context.end_line, context.end_column)
1842
+ ].append(typ)
1843
+ return
1844
+
1845
+ # Nothing special here; just create the note:
1846
+ visitor = TypeStrVisitor(options=self.options)
1847
+ self.note(f'Revealed type is "{typ.accept(visitor)}"', context)
1848
+
1849
+ def reveal_locals(self, type_map: dict[str, Type | None], context: Context) -> None:
1850
+ # To ensure that the output is predictable on Python < 3.6,
1851
+ # use an ordered dictionary sorted by variable name
1852
+ sorted_locals = dict(sorted(type_map.items(), key=lambda t: t[0]))
1853
+ if sorted_locals:
1854
+ self.note("Revealed local types are:", context)
1855
+ for k, v in sorted_locals.items():
1856
+ visitor = TypeStrVisitor(options=self.options)
1857
+ self.note(f" {k}: {v.accept(visitor) if v is not None else None}", context)
1858
+ else:
1859
+ self.note("There are no locals to reveal", context)
1860
+
1861
+ def unsupported_type_type(self, item: Type, context: Context) -> None:
1862
+ self.fail(
1863
+ f'Cannot instantiate type "type[{format_type_bare(item, self.options)}]"', context
1864
+ )
1865
+
1866
+ def redundant_cast(self, typ: Type, context: Context) -> None:
1867
+ self.fail(
1868
+ f"Redundant cast to {format_type(typ, self.options)}",
1869
+ context,
1870
+ code=codes.REDUNDANT_CAST,
1871
+ )
1872
+
1873
+ def assert_type_fail(self, source_type: Type, target_type: Type, context: Context) -> None:
1874
+ source, target = format_type_distinctly(source_type, target_type, options=self.options)
1875
+ self.fail(f"Expression is of type {source}, not {target}", context, code=codes.ASSERT_TYPE)
1876
+
1877
+ def unimported_type_becomes_any(self, prefix: str, typ: Type, ctx: Context) -> None:
1878
+ self.fail(
1879
+ f"{prefix} becomes {format_type(typ, self.options)} due to an unfollowed import",
1880
+ ctx,
1881
+ code=codes.NO_ANY_UNIMPORTED,
1882
+ )
1883
+
1884
+ def need_annotation_for_var(
1885
+ self, node: SymbolNode, context: Context, options: Options | None = None
1886
+ ) -> None:
1887
+ hint = ""
1888
+ # type to recommend the user adds
1889
+ recommended_type = None
1890
+ # Only gives hint if it's a variable declaration and the partial type is a builtin type
1891
+ if options and isinstance(node, Var) and isinstance(node.type, PartialType):
1892
+ type_dec = "<type>"
1893
+ if not node.type.type:
1894
+ # partial None
1895
+ recommended_type = f"{type_dec} | None"
1896
+ elif node.type.type.fullname in reverse_builtin_aliases:
1897
+ # partial types other than partial None
1898
+ name = node.type.type.fullname.partition(".")[2]
1899
+ if name == "dict":
1900
+ type_dec = f"{type_dec}, {type_dec}"
1901
+ recommended_type = f"{name}[{type_dec}]"
1902
+ if recommended_type is not None:
1903
+ hint = f' (hint: "{node.name}: {recommended_type} = ...")'
1904
+
1905
+ self.fail(
1906
+ f'Need type annotation for "{unmangle(node.name)}"{hint}',
1907
+ context,
1908
+ code=codes.VAR_ANNOTATED,
1909
+ )
1910
+
1911
+ def explicit_any(self, ctx: Context) -> None:
1912
+ self.fail('Explicit "Any" is not allowed', ctx, code=codes.EXPLICIT_ANY)
1913
+
1914
+ def unsupported_target_for_star_typeddict(self, typ: Type, ctx: Context) -> None:
1915
+ self.fail(
1916
+ "Unsupported type {} for ** expansion in TypedDict".format(
1917
+ format_type(typ, self.options)
1918
+ ),
1919
+ ctx,
1920
+ code=codes.TYPEDDICT_ITEM,
1921
+ )
1922
+
1923
+ def non_required_keys_absent_with_star(self, keys: list[str], ctx: Context) -> None:
1924
+ self.fail(
1925
+ "Non-required {} not explicitly found in any ** item".format(
1926
+ format_key_list(keys, short=True)
1927
+ ),
1928
+ ctx,
1929
+ code=codes.TYPEDDICT_ITEM,
1930
+ )
1931
+
1932
+ def unexpected_typeddict_keys(
1933
+ self,
1934
+ typ: TypedDictType,
1935
+ expected_keys: list[str],
1936
+ actual_keys: list[str],
1937
+ context: Context,
1938
+ ) -> None:
1939
+ actual_set = set(actual_keys)
1940
+ expected_set = set(expected_keys)
1941
+ if not typ.is_anonymous():
1942
+ # Generate simpler messages for some common special cases.
1943
+ # Use list comprehension instead of set operations to preserve order.
1944
+ missing = [key for key in expected_keys if key not in actual_set]
1945
+ if missing:
1946
+ self.fail(
1947
+ "Missing {} for TypedDict {}".format(
1948
+ format_key_list(missing, short=True), format_type(typ, self.options)
1949
+ ),
1950
+ context,
1951
+ code=codes.TYPEDDICT_ITEM,
1952
+ )
1953
+ extra = [key for key in actual_keys if key not in expected_set]
1954
+ if extra:
1955
+ self.fail(
1956
+ "Extra {} for TypedDict {}".format(
1957
+ format_key_list(extra, short=True), format_type(typ, self.options)
1958
+ ),
1959
+ context,
1960
+ code=codes.TYPEDDICT_UNKNOWN_KEY,
1961
+ )
1962
+ if missing or extra:
1963
+ # No need to check for further errors
1964
+ return
1965
+ found = format_key_list(actual_keys, short=True)
1966
+ if not expected_keys:
1967
+ self.fail(f"Unexpected TypedDict {found}", context)
1968
+ return
1969
+ expected = format_key_list(expected_keys)
1970
+ if actual_keys and actual_set < expected_set:
1971
+ found = f"only {found}"
1972
+ self.fail(f"Expected {expected} but found {found}", context, code=codes.TYPEDDICT_ITEM)
1973
+
1974
+ def typeddict_key_must_be_string_literal(self, typ: TypedDictType, context: Context) -> None:
1975
+ self.fail(
1976
+ "TypedDict key must be a string literal; expected one of {}".format(
1977
+ format_item_name_list(typ.items.keys())
1978
+ ),
1979
+ context,
1980
+ code=codes.LITERAL_REQ,
1981
+ )
1982
+
1983
+ def typeddict_key_not_found(
1984
+ self, typ: TypedDictType, item_name: str, context: Context, setitem: bool = False
1985
+ ) -> None:
1986
+ """Handle error messages for TypedDicts that have unknown keys.
1987
+
1988
+ Note, that we differentiate in between reading a value and setting a
1989
+ value.
1990
+ Setting a value on a TypedDict is an 'unknown-key' error, whereas
1991
+ reading it is the more serious/general 'item' error.
1992
+ """
1993
+ if typ.is_anonymous():
1994
+ self.fail(
1995
+ '"{}" is not a valid TypedDict key; expected one of {}'.format(
1996
+ item_name, format_item_name_list(typ.items.keys())
1997
+ ),
1998
+ context,
1999
+ )
2000
+ else:
2001
+ err_code = codes.TYPEDDICT_UNKNOWN_KEY if setitem else codes.TYPEDDICT_ITEM
2002
+ self.fail(
2003
+ f'TypedDict {format_type(typ, self.options)} has no key "{item_name}"',
2004
+ context,
2005
+ code=err_code,
2006
+ )
2007
+ matches = best_matches(item_name, typ.items.keys(), n=3)
2008
+ if matches:
2009
+ self.note(
2010
+ "Did you mean {}?".format(pretty_seq(matches, "or")), context, code=err_code
2011
+ )
2012
+
2013
+ def typeddict_context_ambiguous(self, types: list[TypedDictType], context: Context) -> None:
2014
+ formatted_types = ", ".join(list(format_type_distinctly(*types, options=self.options)))
2015
+ self.fail(
2016
+ f"Type of TypedDict is ambiguous, none of ({formatted_types}) matches cleanly", context
2017
+ )
2018
+
2019
+ def typeddict_key_cannot_be_deleted(
2020
+ self, typ: TypedDictType, item_name: str, context: Context
2021
+ ) -> None:
2022
+ if typ.is_anonymous():
2023
+ self.fail(f'TypedDict key "{item_name}" cannot be deleted', context)
2024
+ else:
2025
+ self.fail(
2026
+ f'Key "{item_name}" of TypedDict {format_type(typ, self.options)} cannot be deleted',
2027
+ context,
2028
+ )
2029
+
2030
+ def typeddict_setdefault_arguments_inconsistent(
2031
+ self, default: Type, expected: Type, context: Context
2032
+ ) -> None:
2033
+ msg = 'Argument 2 to "setdefault" of "TypedDict" has incompatible type {}; expected {}'
2034
+ self.fail(
2035
+ msg.format(format_type(default, self.options), format_type(expected, self.options)),
2036
+ context,
2037
+ code=codes.TYPEDDICT_ITEM,
2038
+ )
2039
+
2040
+ def type_arguments_not_allowed(self, context: Context) -> None:
2041
+ self.fail("Parameterized generics cannot be used with class or instance checks", context)
2042
+
2043
+ def disallowed_any_type(self, typ: Type, context: Context) -> None:
2044
+ typ = get_proper_type(typ)
2045
+ if isinstance(typ, AnyType):
2046
+ message = 'Expression has type "Any"'
2047
+ else:
2048
+ message = f'Expression type contains "Any" (has type {format_type(typ, self.options)})'
2049
+ self.fail(message, context)
2050
+
2051
+ def incorrectly_returning_any(self, typ: Type, context: Context) -> None:
2052
+ message = (
2053
+ f"Returning Any from function declared to return {format_type(typ, self.options)}"
2054
+ )
2055
+ self.fail(message, context, code=codes.NO_ANY_RETURN)
2056
+
2057
+ def incorrect__exit__return(self, context: Context) -> None:
2058
+ self.fail(
2059
+ '"bool" is invalid as return type for "__exit__" that always returns False',
2060
+ context,
2061
+ code=codes.EXIT_RETURN,
2062
+ )
2063
+ self.note(
2064
+ 'Use "typing.Literal[False]" as the return type or change it to "None"',
2065
+ context,
2066
+ code=codes.EXIT_RETURN,
2067
+ )
2068
+ self.note(
2069
+ 'If return type of "__exit__" implies that it may return True, '
2070
+ "the context manager may swallow exceptions",
2071
+ context,
2072
+ code=codes.EXIT_RETURN,
2073
+ )
2074
+
2075
+ def untyped_decorated_function(self, typ: Type, context: Context) -> None:
2076
+ typ = get_proper_type(typ)
2077
+ if isinstance(typ, AnyType):
2078
+ self.fail("Function is untyped after decorator transformation", context)
2079
+ else:
2080
+ self.fail(
2081
+ f'Type of decorated function contains type "Any" ({format_type(typ, self.options)})',
2082
+ context,
2083
+ )
2084
+
2085
+ def typed_function_untyped_decorator(self, func_name: str, context: Context) -> None:
2086
+ self.fail(
2087
+ f'Untyped decorator makes function "{func_name}" untyped',
2088
+ context,
2089
+ code=codes.UNTYPED_DECORATOR,
2090
+ )
2091
+
2092
+ def bad_proto_variance(
2093
+ self, actual: int, tvar_name: str, expected: int, context: Context
2094
+ ) -> None:
2095
+ msg = capitalize(
2096
+ '{} type variable "{}" used in protocol where {} one is expected'.format(
2097
+ variance_string(actual), tvar_name, variance_string(expected)
2098
+ )
2099
+ )
2100
+ self.fail(msg, context)
2101
+
2102
+ def concrete_only_assign(self, typ: Type, context: Context) -> None:
2103
+ self.fail(
2104
+ f"Can only assign concrete classes to a variable of type {format_type(typ, self.options)}",
2105
+ context,
2106
+ code=codes.TYPE_ABSTRACT,
2107
+ )
2108
+
2109
+ def concrete_only_call(self, typ: Type, context: Context) -> None:
2110
+ self.fail(
2111
+ f"Only concrete class can be given where {format_type(typ, self.options)} is expected",
2112
+ context,
2113
+ code=codes.TYPE_ABSTRACT,
2114
+ )
2115
+
2116
+ def cannot_use_function_with_type(
2117
+ self, method_name: str, type_name: str, context: Context
2118
+ ) -> None:
2119
+ self.fail(f"Cannot use {method_name}() with {type_name} type", context)
2120
+
2121
+ def report_non_method_protocol(
2122
+ self, tp: TypeInfo, members: list[str], context: Context
2123
+ ) -> None:
2124
+ self.fail(
2125
+ "Only protocols that don't have non-method members can be used with issubclass()",
2126
+ context,
2127
+ )
2128
+ if len(members) < 3:
2129
+ attrs = ", ".join(members)
2130
+ self.note(f'Protocol "{tp.name}" has non-method member(s): {attrs}', context)
2131
+
2132
+ def note_call(
2133
+ self, subtype: Type, call: Type, context: Context, *, code: ErrorCode | None
2134
+ ) -> None:
2135
+ self.note(
2136
+ '"{}.__call__" has type {}'.format(
2137
+ format_type_bare(subtype, self.options),
2138
+ format_type(call, self.options, verbosity=1),
2139
+ ),
2140
+ context,
2141
+ code=code,
2142
+ )
2143
+
2144
+ def unreachable_statement(self, context: Context) -> None:
2145
+ self.fail("Statement is unreachable", context, code=codes.UNREACHABLE)
2146
+
2147
+ def redundant_left_operand(self, op_name: str, context: Context) -> None:
2148
+ """Indicates that the left operand of a boolean expression is redundant:
2149
+ it does not change the truth value of the entire condition as a whole.
2150
+ 'op_name' should either be the string "and" or the string "or".
2151
+ """
2152
+ self.redundant_expr(f'Left operand of "{op_name}"', op_name == "and", context)
2153
+
2154
+ def unreachable_right_operand(self, op_name: str, context: Context) -> None:
2155
+ """Indicates that the right operand of a boolean expression is redundant:
2156
+ it does not change the truth value of the entire condition as a whole.
2157
+ 'op_name' should either be the string "and" or the string "or".
2158
+ """
2159
+ self.fail(
2160
+ f'Right operand of "{op_name}" is never evaluated', context, code=codes.UNREACHABLE
2161
+ )
2162
+
2163
+ def redundant_condition_in_comprehension(self, truthiness: bool, context: Context) -> None:
2164
+ self.redundant_expr("If condition in comprehension", truthiness, context)
2165
+
2166
+ def redundant_condition_in_if(self, truthiness: bool, context: Context) -> None:
2167
+ self.redundant_expr("If condition", truthiness, context)
2168
+
2169
+ def redundant_expr(self, description: str, truthiness: bool, context: Context) -> None:
2170
+ self.fail(
2171
+ f"{description} is always {str(truthiness).lower()}",
2172
+ context,
2173
+ code=codes.REDUNDANT_EXPR,
2174
+ )
2175
+
2176
+ def impossible_intersection(
2177
+ self, formatted_base_class_list: str, reason: str, context: Context
2178
+ ) -> None:
2179
+ template = "Subclass of {} cannot exist: {}"
2180
+ self.fail(
2181
+ template.format(formatted_base_class_list, reason), context, code=codes.UNREACHABLE
2182
+ )
2183
+
2184
+ def tvar_without_default_type(
2185
+ self, tvar_name: str, last_tvar_name_with_default: str, context: Context
2186
+ ) -> None:
2187
+ self.fail(
2188
+ f'"{tvar_name}" cannot appear after "{last_tvar_name_with_default}" '
2189
+ "in type parameter list because it has no default type",
2190
+ context,
2191
+ )
2192
+
2193
+ def report_protocol_problems(
2194
+ self,
2195
+ subtype: Instance | TupleType | TypedDictType | TypeType | CallableType,
2196
+ supertype: Instance,
2197
+ context: Context,
2198
+ *,
2199
+ parent_error: ErrorInfo,
2200
+ ) -> None:
2201
+ """Report possible protocol conflicts between 'subtype' and 'supertype'.
2202
+
2203
+ This includes missing members, incompatible types, and incompatible
2204
+ attribute flags, such as settable vs read-only or class variable vs
2205
+ instance variable.
2206
+ """
2207
+ OFFSET = 4 # Four spaces, so that notes will look like this:
2208
+ # note: 'Cls' is missing following 'Proto' members:
2209
+ # note: method, attr
2210
+ MAX_ITEMS = 2 # Maximum number of conflicts, missing members, and overloads shown
2211
+ # List of special situations where we don't want to report additional problems
2212
+ exclusions: dict[type, list[str]] = {
2213
+ TypedDictType: ["typing.Mapping"],
2214
+ TupleType: ["typing.Iterable", "typing.Sequence"],
2215
+ }
2216
+ if supertype.type.fullname in exclusions.get(type(subtype), []):
2217
+ return
2218
+ if any(isinstance(tp, UninhabitedType) for tp in get_proper_types(supertype.args)):
2219
+ # We don't want to add notes for failed inference (e.g. Iterable[Never]).
2220
+ # This will be only confusing a user even more.
2221
+ return
2222
+
2223
+ class_obj = False
2224
+ is_module = False
2225
+ skip = []
2226
+ original_subtype = subtype
2227
+ if isinstance(subtype, TupleType):
2228
+ subtype = mypy.typeops.tuple_fallback(subtype)
2229
+ elif isinstance(subtype, TypedDictType):
2230
+ subtype = subtype.fallback
2231
+ elif isinstance(subtype, TypeType):
2232
+ if not isinstance(subtype.item, Instance):
2233
+ return
2234
+ class_obj = True
2235
+ subtype = subtype.item
2236
+ elif isinstance(subtype, CallableType):
2237
+ if subtype.is_type_obj():
2238
+ instance_type = subtype.get_instance_type(force_fallback=True)
2239
+ if not isinstance(instance_type, Instance):
2240
+ return
2241
+ class_obj = True
2242
+ subtype = instance_type
2243
+ else:
2244
+ subtype = subtype.fallback
2245
+ skip = ["__call__"]
2246
+ if subtype.extra_attrs and subtype.extra_attrs.mod_name:
2247
+ is_module = True
2248
+ if not isinstance(original_subtype, TupleType):
2249
+ # Apart from instances, only tuples are supported by
2250
+ # is_protocol_implementation() for now.
2251
+ original_subtype = subtype
2252
+
2253
+ # Report missing members
2254
+ missing = get_missing_protocol_members(subtype, supertype, skip=skip)
2255
+ if (
2256
+ missing
2257
+ and (len(missing) < len(supertype.type.protocol_members) or missing == ["__call__"])
2258
+ and len(missing) <= MAX_ITEMS
2259
+ ):
2260
+ if missing == ["__call__"] and class_obj:
2261
+ self.note(
2262
+ '"{}" has constructor incompatible with "__call__" of "{}"'.format(
2263
+ subtype.type.name, supertype.type.name
2264
+ ),
2265
+ context,
2266
+ parent_error=parent_error,
2267
+ )
2268
+ else:
2269
+ self.note(
2270
+ '"{}" is missing following "{}" protocol member{}:'.format(
2271
+ subtype.type.name, supertype.type.name, plural_s(missing)
2272
+ ),
2273
+ context,
2274
+ parent_error=parent_error,
2275
+ )
2276
+ self.note(", ".join(missing), context, offset=OFFSET, parent_error=parent_error)
2277
+ elif len(missing) > MAX_ITEMS or len(missing) == len(supertype.type.protocol_members):
2278
+ # This is an obviously wrong type: too many missing members
2279
+ return
2280
+
2281
+ # Report member type conflicts
2282
+ conflict_types = get_conflict_protocol_types(
2283
+ subtype, original_subtype, supertype, class_obj=class_obj, options=self.options
2284
+ )
2285
+ if conflict_types and (
2286
+ not is_subtype(subtype, erase_type(supertype), options=self.options)
2287
+ or not subtype.type.defn.type_vars
2288
+ or not supertype.type.defn.type_vars
2289
+ # Always show detailed message for ParamSpec
2290
+ or subtype.type.has_param_spec_type
2291
+ or supertype.type.has_param_spec_type
2292
+ ):
2293
+ type_name = format_type(subtype, self.options, module_names=True)
2294
+ self.note(
2295
+ f"Following member(s) of {type_name} have conflicts:",
2296
+ context,
2297
+ parent_error=parent_error,
2298
+ )
2299
+ for name, got, exp, is_lvalue in conflict_types[:MAX_ITEMS]:
2300
+ exp = get_proper_type(exp)
2301
+ got = get_proper_type(got)
2302
+ setter_suffix = " setter type" if is_lvalue else ""
2303
+ if (
2304
+ not isinstance(exp, (CallableType, Overloaded))
2305
+ or not isinstance(got, (CallableType, Overloaded))
2306
+ # If expected type is a type object, it means it is a nested class.
2307
+ # Showing constructor signature in errors would be confusing in this case,
2308
+ # since we don't check the signature, only subclassing of type objects.
2309
+ or exp.is_type_obj()
2310
+ ):
2311
+ self.note(
2312
+ "{}: expected{} {}, got {}".format(
2313
+ name,
2314
+ setter_suffix,
2315
+ *format_type_distinctly(exp, got, options=self.options),
2316
+ ),
2317
+ context,
2318
+ offset=OFFSET,
2319
+ parent_error=parent_error,
2320
+ )
2321
+ if is_lvalue and is_subtype(got, exp, options=self.options):
2322
+ self.note(
2323
+ "Setter types should behave contravariantly",
2324
+ context,
2325
+ offset=OFFSET,
2326
+ parent_error=parent_error,
2327
+ )
2328
+ else:
2329
+ self.note(
2330
+ "Expected{}:".format(setter_suffix),
2331
+ context,
2332
+ offset=OFFSET,
2333
+ parent_error=parent_error,
2334
+ )
2335
+ if isinstance(exp, CallableType):
2336
+ self.note(
2337
+ pretty_callable(exp, self.options, skip_self=class_obj or is_module),
2338
+ context,
2339
+ offset=2 * OFFSET,
2340
+ parent_error=parent_error,
2341
+ )
2342
+ else:
2343
+ assert isinstance(exp, Overloaded)
2344
+ self.pretty_overload(
2345
+ exp,
2346
+ context,
2347
+ 2 * OFFSET,
2348
+ parent_error=parent_error,
2349
+ skip_self=class_obj or is_module,
2350
+ )
2351
+ self.note("Got:", context, offset=OFFSET, parent_error=parent_error)
2352
+ if isinstance(got, CallableType):
2353
+ self.note(
2354
+ pretty_callable(got, self.options, skip_self=class_obj or is_module),
2355
+ context,
2356
+ offset=2 * OFFSET,
2357
+ parent_error=parent_error,
2358
+ )
2359
+ else:
2360
+ assert isinstance(got, Overloaded)
2361
+ self.pretty_overload(
2362
+ got,
2363
+ context,
2364
+ 2 * OFFSET,
2365
+ parent_error=parent_error,
2366
+ skip_self=class_obj or is_module,
2367
+ )
2368
+ self.print_more(conflict_types, context, OFFSET, MAX_ITEMS, code=parent_error.code)
2369
+
2370
+ # Report flag conflicts (i.e. settable vs read-only etc.)
2371
+ conflict_flags = get_bad_protocol_flags(subtype, supertype, class_obj=class_obj)
2372
+ for name, subflags, superflags in conflict_flags[:MAX_ITEMS]:
2373
+ if not class_obj and IS_CLASSVAR in subflags and IS_CLASSVAR not in superflags:
2374
+ self.note(
2375
+ "Protocol member {}.{} expected instance variable, got class variable".format(
2376
+ supertype.type.name, name
2377
+ ),
2378
+ context,
2379
+ parent_error=parent_error,
2380
+ )
2381
+ if not class_obj and IS_CLASSVAR in superflags and IS_CLASSVAR not in subflags:
2382
+ self.note(
2383
+ "Protocol member {}.{} expected class variable, got instance variable".format(
2384
+ supertype.type.name, name
2385
+ ),
2386
+ context,
2387
+ parent_error=parent_error,
2388
+ )
2389
+ if IS_SETTABLE in superflags and IS_SETTABLE not in subflags:
2390
+ self.note(
2391
+ "Protocol member {}.{} expected settable variable,"
2392
+ " got read-only attribute".format(supertype.type.name, name),
2393
+ context,
2394
+ parent_error=parent_error,
2395
+ )
2396
+ if IS_CLASS_OR_STATIC in superflags and IS_CLASS_OR_STATIC not in subflags:
2397
+ self.note(
2398
+ "Protocol member {}.{} expected class or static method".format(
2399
+ supertype.type.name, name
2400
+ ),
2401
+ context,
2402
+ parent_error=parent_error,
2403
+ )
2404
+ if (
2405
+ class_obj
2406
+ and IS_VAR in superflags
2407
+ and (IS_VAR in subflags and IS_CLASSVAR not in subflags)
2408
+ ):
2409
+ self.note(
2410
+ "Only class variables allowed for class object access on protocols,"
2411
+ ' {} is an instance variable of "{}"'.format(name, subtype.type.name),
2412
+ context,
2413
+ parent_error=parent_error,
2414
+ )
2415
+ if class_obj and IS_CLASSVAR in superflags:
2416
+ self.note(
2417
+ "ClassVar protocol member {}.{} can never be matched by a class object".format(
2418
+ supertype.type.name, name
2419
+ ),
2420
+ context,
2421
+ parent_error=parent_error,
2422
+ )
2423
+ self.print_more(conflict_flags, context, OFFSET, MAX_ITEMS, code=parent_error.code)
2424
+
2425
+ def pretty_overload(
2426
+ self,
2427
+ tp: Overloaded,
2428
+ context: Context,
2429
+ offset: int,
2430
+ *,
2431
+ parent_error: ErrorInfo,
2432
+ add_class_or_static_decorator: bool = False,
2433
+ skip_self: bool = False,
2434
+ ) -> None:
2435
+ for item in tp.items:
2436
+ self.note("@overload", context, offset=offset, parent_error=parent_error)
2437
+
2438
+ if add_class_or_static_decorator:
2439
+ decorator = pretty_class_or_static_decorator(item)
2440
+ if decorator is not None:
2441
+ self.note(decorator, context, offset=offset, parent_error=parent_error)
2442
+
2443
+ self.note(
2444
+ pretty_callable(item, self.options, skip_self=skip_self),
2445
+ context,
2446
+ offset=offset,
2447
+ parent_error=parent_error,
2448
+ )
2449
+
2450
+ def print_more(
2451
+ self,
2452
+ conflicts: Sequence[Any],
2453
+ context: Context,
2454
+ offset: int,
2455
+ max_items: int,
2456
+ *,
2457
+ code: ErrorCode | None = None,
2458
+ ) -> None:
2459
+ if len(conflicts) > max_items:
2460
+ self.note(
2461
+ f"<{len(conflicts) - max_items} more conflict(s) not shown>",
2462
+ context,
2463
+ offset=offset,
2464
+ code=code,
2465
+ )
2466
+
2467
+ def try_report_long_tuple_assignment_error(
2468
+ self,
2469
+ subtype: ProperType,
2470
+ supertype: ProperType,
2471
+ context: Context,
2472
+ msg: message_registry.ErrorMessage,
2473
+ subtype_label: str | None = None,
2474
+ supertype_label: str | None = None,
2475
+ ) -> bool:
2476
+ """Try to generate meaningful error message for very long tuple assignment
2477
+
2478
+ Returns a bool: True when generating long tuple assignment error,
2479
+ False when no such error reported
2480
+ """
2481
+ if isinstance(subtype, TupleType):
2482
+ if (
2483
+ len(subtype.items) > MAX_TUPLE_ITEMS
2484
+ and isinstance(supertype, Instance)
2485
+ and supertype.type.fullname == "builtins.tuple"
2486
+ ):
2487
+ lhs_type = supertype.args[0]
2488
+ lhs_types = [lhs_type] * len(subtype.items)
2489
+ self.generate_incompatible_tuple_error(lhs_types, subtype.items, context, msg)
2490
+ return True
2491
+ elif isinstance(supertype, TupleType) and (
2492
+ len(subtype.items) > MAX_TUPLE_ITEMS or len(supertype.items) > MAX_TUPLE_ITEMS
2493
+ ):
2494
+ if len(subtype.items) != len(supertype.items):
2495
+ if supertype_label is not None and subtype_label is not None:
2496
+ msg = msg.with_additional_msg(
2497
+ " ({} {}, {} {})".format(
2498
+ subtype_label,
2499
+ self.format_long_tuple_type(subtype),
2500
+ supertype_label,
2501
+ self.format_long_tuple_type(supertype),
2502
+ )
2503
+ )
2504
+ self.fail(msg.value, context, code=msg.code)
2505
+ return True
2506
+ self.generate_incompatible_tuple_error(
2507
+ supertype.items, subtype.items, context, msg
2508
+ )
2509
+ return True
2510
+ return False
2511
+
2512
+ def format_long_tuple_type(self, typ: TupleType) -> str:
2513
+ """Format very long tuple type using an ellipsis notation"""
2514
+ item_cnt = len(typ.items)
2515
+ if item_cnt > MAX_TUPLE_ITEMS:
2516
+ return '"tuple[{}, {}, ... <{} more items>]"'.format(
2517
+ format_type_bare(typ.items[0], self.options),
2518
+ format_type_bare(typ.items[1], self.options),
2519
+ str(item_cnt - 2),
2520
+ )
2521
+ else:
2522
+ return format_type(typ, self.options)
2523
+
2524
+ def generate_incompatible_tuple_error(
2525
+ self,
2526
+ lhs_types: list[Type],
2527
+ rhs_types: list[Type],
2528
+ context: Context,
2529
+ msg: message_registry.ErrorMessage,
2530
+ ) -> None:
2531
+ """Generate error message for individual incompatible tuple pairs"""
2532
+ error_cnt = 0
2533
+ notes: list[str] = []
2534
+ for i, (lhs_t, rhs_t) in enumerate(zip(lhs_types, rhs_types)):
2535
+ if not is_subtype(rhs_t, lhs_t):
2536
+ if error_cnt < 3:
2537
+ notes.append(
2538
+ "Expression tuple item {} has type {}; {} expected; ".format(
2539
+ str(i),
2540
+ format_type(rhs_t, self.options),
2541
+ format_type(lhs_t, self.options),
2542
+ )
2543
+ )
2544
+ error_cnt += 1
2545
+
2546
+ info = f" ({str(error_cnt)} tuple items are incompatible"
2547
+ if error_cnt - 3 > 0:
2548
+ info += f"; {str(error_cnt - 3)} items are omitted)"
2549
+ else:
2550
+ info += ")"
2551
+ msg = msg.with_additional_msg(info)
2552
+ self.fail(msg.value, context, code=msg.code)
2553
+ for note in notes:
2554
+ self.note(note, context, code=msg.code)
2555
+
2556
+ def add_fixture_note(self, fullname: str, ctx: Context) -> None:
2557
+ self.note(f'Maybe your test fixture does not define "{fullname}"?', ctx)
2558
+ if fullname in SUGGESTED_TEST_FIXTURES:
2559
+ self.note(
2560
+ "Consider adding [builtins fixtures/{}] to your test description".format(
2561
+ SUGGESTED_TEST_FIXTURES[fullname]
2562
+ ),
2563
+ ctx,
2564
+ )
2565
+
2566
+ def annotation_in_unchecked_function(self, context: Context) -> None:
2567
+ self.note(
2568
+ "By default the bodies of untyped functions are not checked,"
2569
+ " consider using --check-untyped-defs",
2570
+ context,
2571
+ code=codes.ANNOTATION_UNCHECKED,
2572
+ )
2573
+
2574
+ def type_parameters_should_be_declared(self, undeclared: list[str], context: Context) -> None:
2575
+ names = ", ".join('"' + n + '"' for n in undeclared)
2576
+ self.fail(
2577
+ message_registry.TYPE_PARAMETERS_SHOULD_BE_DECLARED.format(names),
2578
+ context,
2579
+ code=codes.VALID_TYPE,
2580
+ )
2581
+
2582
+ def match_statement_inexhaustive_match(self, typ: Type, context: Context) -> None:
2583
+ type_str = format_type(typ, self.options)
2584
+ msg = f"Match statement has unhandled case for values of type {type_str}"
2585
+ self.fail(msg, context, code=codes.EXHAUSTIVE_MATCH)
2586
+ self.note(
2587
+ "If match statement is intended to be non-exhaustive, add `case _: pass`",
2588
+ context,
2589
+ code=codes.EXHAUSTIVE_MATCH,
2590
+ )
2591
+
2592
+ def iteration_dependent_errors(self, iter_errors: IterationDependentErrors) -> None:
2593
+ for error_info in iter_errors.yield_uselessness_error_infos():
2594
+ self.fail(*error_info[:2], code=error_info[2])
2595
+ for nonoverlaps, kind, context in iter_errors.yield_nonoverlapping_types():
2596
+ self.dangerous_comparison(
2597
+ mypy.typeops.make_simplified_union(nonoverlaps[0]),
2598
+ mypy.typeops.make_simplified_union(nonoverlaps[1]),
2599
+ kind,
2600
+ context,
2601
+ )
2602
+ for types, context in iter_errors.yield_revealed_type_infos():
2603
+ self.reveal_type(mypy.typeops.make_simplified_union(types), context)
2604
+
2605
+
2606
+ def quote_type_string(type_string: str) -> str:
2607
+ """Quotes a type representation for use in messages."""
2608
+ if (
2609
+ type_string in ["Module", "overloaded function", "<deleted>"]
2610
+ or type_string.startswith("Module ")
2611
+ or type_string.endswith("?")
2612
+ ):
2613
+ # These messages are easier to read if these aren't quoted.
2614
+ return type_string
2615
+ return f'"{type_string}"'
2616
+
2617
+
2618
+ def should_format_arg_as_type(arg_kind: ArgKind, arg_name: str | None, verbosity: int) -> bool:
2619
+ """
2620
+ Determine whether a function argument should be formatted as its Type or with name.
2621
+ """
2622
+ return (arg_kind == ARG_POS and arg_name is None) or (
2623
+ verbosity == 0 and arg_kind.is_positional()
2624
+ )
2625
+
2626
+
2627
+ def format_callable_args(
2628
+ arg_types: list[Type],
2629
+ arg_kinds: list[ArgKind],
2630
+ arg_names: list[str | None],
2631
+ format: Callable[[Type], str],
2632
+ verbosity: int,
2633
+ ) -> str:
2634
+ """Format a bunch of Callable arguments into a string"""
2635
+ arg_strings = []
2636
+ for arg_name, arg_type, arg_kind in zip(arg_names, arg_types, arg_kinds):
2637
+ if should_format_arg_as_type(arg_kind, arg_name, verbosity):
2638
+ arg_strings.append(format(arg_type))
2639
+ else:
2640
+ constructor = ARG_CONSTRUCTOR_NAMES[arg_kind]
2641
+ if arg_kind.is_star() or arg_name is None:
2642
+ arg_strings.append(f"{constructor}({format(arg_type)})")
2643
+ else:
2644
+ arg_strings.append(f"{constructor}({format(arg_type)}, {repr(arg_name)})")
2645
+
2646
+ return ", ".join(arg_strings)
2647
+
2648
+
2649
+ def format_type_inner(
2650
+ typ: Type,
2651
+ verbosity: int,
2652
+ options: Options,
2653
+ fullnames: set[str] | None,
2654
+ module_names: bool = False,
2655
+ use_pretty_callable: bool = True,
2656
+ ) -> str:
2657
+ """
2658
+ Convert a type to a relatively short string suitable for error messages.
2659
+
2660
+ Args:
2661
+ typ: type to be formatted
2662
+ verbosity: a coarse grained control on the verbosity of the type
2663
+ options: Options object controlling formatting
2664
+ fullnames: a set of names that should be printed in full
2665
+ module_names: whether to show module names for module types
2666
+ use_pretty_callable: use pretty_callable to format Callable types.
2667
+ """
2668
+
2669
+ def format(typ: Type) -> str:
2670
+ return format_type_inner(typ, verbosity, options, fullnames)
2671
+
2672
+ def format_list(types: Sequence[Type]) -> str:
2673
+ return ", ".join(format(typ) for typ in types)
2674
+
2675
+ def format_union_items(types: Sequence[Type]) -> list[str]:
2676
+ formatted = [format(typ) for typ in types if format(typ) != "None"]
2677
+ if len(formatted) > MAX_UNION_ITEMS and verbosity == 0:
2678
+ more = len(formatted) - MAX_UNION_ITEMS // 2
2679
+ formatted = formatted[: MAX_UNION_ITEMS // 2]
2680
+ else:
2681
+ more = 0
2682
+ if more:
2683
+ formatted.append(f"<{more} more items>")
2684
+ if any(format(typ) == "None" for typ in types):
2685
+ formatted.append("None")
2686
+ return formatted
2687
+
2688
+ def format_union(types: Sequence[Type]) -> str:
2689
+ return " | ".join(format_union_items(types))
2690
+
2691
+ def format_literal_value(typ: LiteralType) -> str:
2692
+ if typ.is_enum_literal():
2693
+ underlying_type = format(typ.fallback)
2694
+ return f"{underlying_type}.{typ.value}"
2695
+ else:
2696
+ return typ.value_repr()
2697
+
2698
+ if isinstance(typ, TypeAliasType) and typ.is_recursive:
2699
+ if typ.alias is None:
2700
+ type_str = "<alias (unfixed)>"
2701
+ else:
2702
+ if verbosity >= 2 or (fullnames and typ.alias.fullname in fullnames):
2703
+ type_str = typ.alias.fullname
2704
+ else:
2705
+ type_str = typ.alias.name
2706
+ if typ.args:
2707
+ type_str += f"[{format_list(typ.args)}]"
2708
+ return type_str
2709
+
2710
+ # TODO: always mention type alias names in errors.
2711
+ typ = get_proper_type(typ)
2712
+
2713
+ if isinstance(typ, Instance):
2714
+ itype = typ
2715
+ # Get the short name of the type.
2716
+ if itype.type.fullname == "types.ModuleType":
2717
+ # Make some common error messages simpler and tidier.
2718
+ base_str = "Module"
2719
+ if itype.extra_attrs and itype.extra_attrs.mod_name and module_names:
2720
+ return f'{base_str} "{itype.extra_attrs.mod_name}"'
2721
+ return base_str
2722
+ if itype.type.fullname == "typing._SpecialForm":
2723
+ # This is not a real type but used for some typing-related constructs.
2724
+ return "<typing special form>"
2725
+ if verbosity >= 2 or (fullnames and itype.type.fullname in fullnames):
2726
+ base_str = itype.type.fullname
2727
+ else:
2728
+ base_str = itype.type.name
2729
+ if not itype.args:
2730
+ if itype.type.has_type_var_tuple_type and len(itype.type.type_vars) == 1:
2731
+ return base_str + "[()]"
2732
+ # No type arguments, just return the type name
2733
+ return base_str
2734
+ elif itype.type.fullname == "builtins.tuple":
2735
+ item_type_str = format(itype.args[0])
2736
+ return f"tuple[{item_type_str}, ...]"
2737
+ else:
2738
+ # There are type arguments. Convert the arguments to strings.
2739
+ return f"{base_str}[{format_list(itype.args)}]"
2740
+ elif isinstance(typ, UnpackType):
2741
+ if options.use_star_unpack():
2742
+ return f"*{format(typ.type)}"
2743
+ return f"Unpack[{format(typ.type)}]"
2744
+ elif isinstance(typ, TypeVarType):
2745
+ # This is similar to non-generic instance types.
2746
+ fullname = scoped_type_var_name(typ)
2747
+ if verbosity >= 2 or (fullnames and fullname in fullnames):
2748
+ return fullname
2749
+ return typ.name
2750
+ elif isinstance(typ, TypeVarTupleType):
2751
+ # This is similar to non-generic instance types.
2752
+ fullname = scoped_type_var_name(typ)
2753
+ if verbosity >= 2 or (fullnames and fullname in fullnames):
2754
+ return fullname
2755
+ return typ.name
2756
+ elif isinstance(typ, ParamSpecType):
2757
+ # Concatenate[..., P]
2758
+ if typ.prefix.arg_types:
2759
+ args = format_callable_args(
2760
+ typ.prefix.arg_types, typ.prefix.arg_kinds, typ.prefix.arg_names, format, verbosity
2761
+ )
2762
+
2763
+ return f"[{args}, **{typ.name_with_suffix()}]"
2764
+ else:
2765
+ # TODO: better disambiguate ParamSpec name clashes.
2766
+ return typ.name_with_suffix()
2767
+ elif isinstance(typ, TupleType):
2768
+ # Prefer the name of the fallback class (if not tuple), as it's more informative.
2769
+ if typ.partial_fallback.type.fullname != "builtins.tuple":
2770
+ return format(typ.partial_fallback)
2771
+ type_items = format_list(typ.items) or "()"
2772
+ return f"tuple[{type_items}]"
2773
+ elif isinstance(typ, TypedDictType):
2774
+ # If the TypedDictType is named, return the name
2775
+ if not typ.is_anonymous():
2776
+ return format(typ.fallback)
2777
+ items = []
2778
+ for item_name, item_type in typ.items.items():
2779
+ modifier = ""
2780
+ if item_name not in typ.required_keys:
2781
+ modifier += "?"
2782
+ if item_name in typ.readonly_keys:
2783
+ modifier += "="
2784
+ items.append(f"{item_name!r}{modifier}: {format(item_type)}")
2785
+ return f"TypedDict({{{', '.join(items)}}})"
2786
+ elif isinstance(typ, LiteralType) and typ.is_sentinel_literal():
2787
+ return format_literal_value(typ)
2788
+ elif isinstance(typ, LiteralType):
2789
+ return f"Literal[{format_literal_value(typ)}]"
2790
+ elif isinstance(typ, UnionType):
2791
+ typ = get_proper_type(ignore_last_known_values(typ))
2792
+ if not isinstance(typ, UnionType):
2793
+ return format(typ)
2794
+ literal_items, union_items = separate_union_literals(typ)
2795
+ sentinel_items = [item for item in literal_items if item.is_sentinel_literal()]
2796
+ literal_items = [item for item in literal_items if not item.is_sentinel_literal()]
2797
+ union_items = [*sentinel_items, *union_items]
2798
+
2799
+ # Coalesce multiple Literal[] members. This also changes output order.
2800
+ # If there's just one Literal item, retain the original ordering.
2801
+ if len(literal_items) > 1:
2802
+ literal_str = "Literal[{}]".format(
2803
+ ", ".join(format_literal_value(t) for t in literal_items)
2804
+ )
2805
+
2806
+ if len(union_items) == 1 and isinstance(get_proper_type(union_items[0]), NoneType):
2807
+ return f"{literal_str} | None"
2808
+ elif union_items:
2809
+ return f"{literal_str} | {format_union(union_items)}"
2810
+ else:
2811
+ return literal_str
2812
+ else:
2813
+ # Only print Union as Optional if the Optional wouldn't have to contain another Union
2814
+ print_as_optional = (
2815
+ len(typ.items) - sum(isinstance(get_proper_type(t), NoneType) for t in typ.items)
2816
+ == 1
2817
+ )
2818
+ if print_as_optional:
2819
+ rest = [t for t in typ.items if not isinstance(get_proper_type(t), NoneType)]
2820
+ return f"{format(rest[0])} | None"
2821
+ else:
2822
+ s = format_union(typ.items)
2823
+ return s
2824
+ elif isinstance(typ, NoneType):
2825
+ return "None"
2826
+ elif isinstance(typ, AnyType):
2827
+ return "Any"
2828
+ elif isinstance(typ, DeletedType):
2829
+ return "<deleted>"
2830
+ elif isinstance(typ, UninhabitedType):
2831
+ return "Never"
2832
+ elif isinstance(typ, TypeType):
2833
+ if typ.is_type_form:
2834
+ type_name = "TypeForm"
2835
+ else:
2836
+ type_name = "type"
2837
+ return f"{type_name}[{format(typ.item)}]"
2838
+ elif isinstance(typ, FunctionLike):
2839
+ func = typ
2840
+ if func.is_type_obj():
2841
+ return format(TypeType.make_normalized(func.items[0].get_instance_type()))
2842
+ elif isinstance(func, CallableType):
2843
+ if func.type_guard is not None:
2844
+ return_type = f"TypeGuard[{format(func.type_guard)}]"
2845
+ elif func.type_is is not None:
2846
+ return_type = f"TypeIs[{format(func.type_is)}]"
2847
+ else:
2848
+ return_type = format(func.ret_type)
2849
+ if func.is_ellipsis_args:
2850
+ return f"Callable[..., {return_type}]"
2851
+ param_spec = func.param_spec()
2852
+ if param_spec is not None:
2853
+ return f"Callable[{format(param_spec)}, {return_type}]"
2854
+
2855
+ # Use pretty format (def-style) for complex signatures with named, optional, or star args.
2856
+ # Use compact Callable[[...], ...] only for signatures with all simple positional args.
2857
+ if use_pretty_callable:
2858
+ if any(
2859
+ not should_format_arg_as_type(kind, name, verbosity)
2860
+ for kind, name in zip(func.arg_kinds, func.arg_names)
2861
+ ):
2862
+ return pretty_callable(func, options)
2863
+
2864
+ args = format_callable_args(
2865
+ func.arg_types, func.arg_kinds, func.arg_names, format, verbosity
2866
+ )
2867
+ return f"Callable[[{args}], {return_type}]"
2868
+ else:
2869
+ # Use a simple representation for function types; proper
2870
+ # function types may result in long and difficult-to-read
2871
+ # error messages.
2872
+ return "overloaded function"
2873
+ elif isinstance(typ, UnboundType):
2874
+ return typ.accept(TypeStrVisitor(options=options))
2875
+ elif isinstance(typ, Parameters):
2876
+ args = format_callable_args(typ.arg_types, typ.arg_kinds, typ.arg_names, format, verbosity)
2877
+ return f"[{args}]"
2878
+ elif typ is None:
2879
+ raise RuntimeError("Type is None")
2880
+ else:
2881
+ # Default case; we simply have to return something meaningful here.
2882
+ return "object"
2883
+
2884
+
2885
+ def collect_all_named_types(t: Type) -> list[Type]:
2886
+ """Return all instances/aliases/type variables that `t` contains (including `t`).
2887
+
2888
+ This is similar to collect_all_inner_types from typeanal but only
2889
+ returns instances and will recurse into fallbacks.
2890
+ """
2891
+ visitor = CollectAllNamedTypesQuery()
2892
+ t.accept(visitor)
2893
+ return visitor.types
2894
+
2895
+
2896
+ class CollectAllNamedTypesQuery(TypeTraverserVisitor):
2897
+ def __init__(self) -> None:
2898
+ self.types: list[Type] = []
2899
+
2900
+ def visit_instance(self, t: Instance) -> None:
2901
+ self.types.append(t)
2902
+ super().visit_instance(t)
2903
+
2904
+ def visit_type_alias_type(self, t: TypeAliasType) -> None:
2905
+ if t.alias and not t.is_recursive:
2906
+ get_proper_type(t).accept(self)
2907
+ else:
2908
+ self.types.append(t)
2909
+ super().visit_type_alias_type(t)
2910
+
2911
+ def visit_type_var(self, t: TypeVarType) -> None:
2912
+ self.types.append(t)
2913
+ super().visit_type_var(t)
2914
+
2915
+ def visit_type_var_tuple(self, t: TypeVarTupleType) -> None:
2916
+ self.types.append(t)
2917
+ super().visit_type_var_tuple(t)
2918
+
2919
+ def visit_param_spec(self, t: ParamSpecType) -> None:
2920
+ self.types.append(t)
2921
+ super().visit_param_spec(t)
2922
+
2923
+
2924
+ def scoped_type_var_name(t: TypeVarLikeType) -> str:
2925
+ if not t.id.namespace:
2926
+ return t.name
2927
+ # TODO: support rare cases when both TypeVar name and namespace suffix coincide.
2928
+ *_, suffix = t.id.namespace.split(".")
2929
+ return f"{t.name}@{suffix}"
2930
+
2931
+
2932
+ def find_type_overlaps(*types: Type) -> set[str]:
2933
+ """Return a set of fullnames that share a short name and appear in either type.
2934
+
2935
+ This is used to ensure that distinct types with the same short name are printed
2936
+ with their fullname.
2937
+ """
2938
+ d: dict[str, set[str]] = {}
2939
+ for type in types:
2940
+ for t in collect_all_named_types(type):
2941
+ if isinstance(t, ProperType) and isinstance(t, Instance):
2942
+ d.setdefault(t.type.name, set()).add(t.type.fullname)
2943
+ elif isinstance(t, TypeAliasType) and t.alias:
2944
+ d.setdefault(t.alias.name, set()).add(t.alias.fullname)
2945
+ else:
2946
+ assert isinstance(t, TypeVarLikeType)
2947
+ d.setdefault(t.name, set()).add(scoped_type_var_name(t))
2948
+ for shortname in d.keys():
2949
+ if f"typing.{shortname}" in TYPES_FOR_UNIMPORTED_HINTS:
2950
+ d[shortname].add(f"typing.{shortname}")
2951
+
2952
+ overlaps: set[str] = set()
2953
+ for fullnames in d.values():
2954
+ if len(fullnames) > 1:
2955
+ overlaps.update(fullnames)
2956
+ return overlaps
2957
+
2958
+
2959
+ def format_type(
2960
+ typ: Type, options: Options, verbosity: int = 0, module_names: bool = False
2961
+ ) -> str:
2962
+ """
2963
+ Convert a type to a relatively short string suitable for error messages.
2964
+
2965
+ `verbosity` is a coarse-grained control on the verbosity of the type
2966
+
2967
+ This function returns a string appropriate for unmodified use in error
2968
+ messages; this means that it will be quoted in most cases. If
2969
+ modification of the formatted string is required, callers should use
2970
+ format_type_bare.
2971
+ """
2972
+ return quote_type_string(format_type_bare(typ, options, verbosity, module_names))
2973
+
2974
+
2975
+ def format_type_bare(
2976
+ typ: Type, options: Options, verbosity: int = 0, module_names: bool = False
2977
+ ) -> str:
2978
+ """
2979
+ Convert a type to a relatively short string suitable for error messages.
2980
+
2981
+ `verbosity` is a coarse-grained control on the verbosity of the type
2982
+ `fullnames` specifies a set of names that should be printed in full
2983
+
2984
+ This function will return an unquoted string. If a caller doesn't need to
2985
+ perform post-processing on the string output, format_type should be used
2986
+ instead. (The caller may want to use quote_type_string after
2987
+ processing has happened, to maintain consistent quoting in messages.)
2988
+ """
2989
+ return format_type_inner(typ, verbosity, options, find_type_overlaps(typ), module_names)
2990
+
2991
+
2992
+ def format_type_distinctly(*types: Type, options: Options, bare: bool = False) -> tuple[str, ...]:
2993
+ """Jointly format types to distinct strings.
2994
+
2995
+ Increase the verbosity of the type strings until they become distinct
2996
+ while also requiring that distinct types with the same short name are
2997
+ formatted distinctly.
2998
+
2999
+ By default, the returned strings are created using format_type() and will be
3000
+ quoted accordingly. If ``bare`` is True, the returned strings will not
3001
+ be quoted; callers who need to do post-processing of the strings before
3002
+ quoting them (such as prepending * or **) should use this.
3003
+ """
3004
+ overlapping = find_type_overlaps(*types)
3005
+
3006
+ def format_single(arg: Type) -> str:
3007
+ return format_type_inner(arg, verbosity=0, options=options, fullnames=overlapping)
3008
+
3009
+ min_verbosity = 0
3010
+ # Prevent emitting weird errors like:
3011
+ # ... has incompatible type "Callable[[int], Child]"; expected "Callable[[int], Parent]"
3012
+ if len(types) == 2:
3013
+ left, right = types
3014
+ left = get_proper_type(left)
3015
+ right = get_proper_type(right)
3016
+ # If the right type has named arguments, they may be the reason for incompatibility.
3017
+ # This excludes cases when right is Callable[[Something], None] without named args,
3018
+ # because that's usually the right thing to do.
3019
+ if (
3020
+ isinstance(left, CallableType)
3021
+ and isinstance(right, CallableType)
3022
+ and any(right.arg_names)
3023
+ and is_subtype(left, right, ignore_pos_arg_names=True)
3024
+ ):
3025
+ min_verbosity = 1
3026
+
3027
+ for verbosity in range(min_verbosity, 2):
3028
+ strs = [
3029
+ format_type_inner(type, verbosity=verbosity, options=options, fullnames=overlapping)
3030
+ for type in types
3031
+ ]
3032
+ if len(set(strs)) == len(strs):
3033
+ break
3034
+ if bare:
3035
+ return tuple(strs)
3036
+ else:
3037
+ return tuple(quote_type_string(s) for s in strs)
3038
+
3039
+
3040
+ def pretty_class_or_static_decorator(tp: CallableType) -> str | None:
3041
+ """Return @classmethod or @staticmethod, if any, for the given callable type."""
3042
+ definition = get_func_def(tp)
3043
+ if definition is not None and isinstance(definition, SYMBOL_FUNCBASE_TYPES):
3044
+ if definition.is_class:
3045
+ return "@classmethod"
3046
+ if definition.is_static:
3047
+ return "@staticmethod"
3048
+ return None
3049
+
3050
+
3051
+ def pretty_callable(tp: CallableType, options: Options, skip_self: bool = False) -> str:
3052
+ """Return a nice easily-readable representation of a callable type.
3053
+ For example:
3054
+ def [T <: int] f(self, x: int, y: T) -> None
3055
+
3056
+ If skip_self is True, print an actual callable type, as it would appear
3057
+ when bound on an instance/class, rather than how it would appear in the
3058
+ defining statement.
3059
+ """
3060
+ s = ""
3061
+ asterisk = False
3062
+ slash = False
3063
+ for i in range(len(tp.arg_types)):
3064
+ if s:
3065
+ s += ", "
3066
+ if tp.arg_kinds[i].is_named() and not asterisk:
3067
+ s += "*, "
3068
+ asterisk = True
3069
+ if tp.arg_kinds[i] == ARG_STAR:
3070
+ s += "*"
3071
+ asterisk = True
3072
+ if tp.arg_kinds[i] == ARG_STAR2:
3073
+ s += "**"
3074
+ name = tp.arg_names[i]
3075
+ if not name and not options.reveal_verbose_types:
3076
+ # Avoid ambiguous (and weird) formatting for anonymous args/kwargs.
3077
+ if tp.arg_kinds[i] == ARG_STAR and isinstance(tp.arg_types[i], UnpackType):
3078
+ name = "args"
3079
+ elif tp.arg_kinds[i] == ARG_STAR2 and tp.unpack_kwargs:
3080
+ name = "kwargs"
3081
+ if name:
3082
+ s += name + ": "
3083
+ type_str = format_type_bare(tp.arg_types[i], options)
3084
+ if tp.arg_kinds[i] == ARG_STAR2 and tp.unpack_kwargs:
3085
+ if options.reveal_verbose_types:
3086
+ type_str = f"Unpack[{type_str}]"
3087
+ else:
3088
+ type_str = f"**{type_str}"
3089
+ s += type_str
3090
+ if tp.arg_kinds[i].is_optional():
3091
+ s += " = ..."
3092
+ if (
3093
+ not slash
3094
+ and tp.arg_kinds[i].is_positional()
3095
+ and name is None
3096
+ and (
3097
+ i == len(tp.arg_types) - 1
3098
+ or (tp.arg_names[i + 1] is not None or not tp.arg_kinds[i + 1].is_positional())
3099
+ )
3100
+ ):
3101
+ s += ", /"
3102
+ slash = True
3103
+
3104
+ definition = get_func_def(tp)
3105
+
3106
+ # Extract function name, prefer the "human-readable" name if available.
3107
+ func_name = None
3108
+ if tp.name:
3109
+ func_name = tp.name.split()[0] # skip "of Class" part
3110
+ elif isinstance(definition, FuncDef):
3111
+ func_name = definition.name
3112
+
3113
+ # If we got a "special arg" (i.e: self, cls, etc...), prepend it to the arg list
3114
+ first_arg = None
3115
+ if (
3116
+ isinstance(definition, FuncDef)
3117
+ and hasattr(definition, "arguments")
3118
+ and not tp.from_concatenate
3119
+ ):
3120
+ definition_arg_names = [arg.variable.name for arg in definition.arguments]
3121
+ if len(definition_arg_names) > len(tp.arg_names) and definition_arg_names[0]:
3122
+ first_arg = definition_arg_names[0]
3123
+ else:
3124
+ # TODO: avoid different logic for incremental runs.
3125
+ first_arg = get_first_arg(tp)
3126
+
3127
+ if tp.is_type_obj():
3128
+ skip_self = True
3129
+ if first_arg and not skip_self:
3130
+ if s:
3131
+ s = ", " + s
3132
+ s = first_arg + s
3133
+ if func_name:
3134
+ s = f"{func_name}({s})"
3135
+ else:
3136
+ s = f"({s})"
3137
+
3138
+ s += " -> "
3139
+ if tp.type_guard is not None:
3140
+ s += f"TypeGuard[{format_type_bare(tp.type_guard, options)}]"
3141
+ elif tp.type_is is not None:
3142
+ s += f"TypeIs[{format_type_bare(tp.type_is, options)}]"
3143
+ else:
3144
+ s += format_type_bare(tp.ret_type, options)
3145
+
3146
+ if tp.variables:
3147
+ tvars = []
3148
+ for tvar in tp.variables:
3149
+ if isinstance(tvar, TypeVarType):
3150
+ upper_bound = get_proper_type(tvar.upper_bound)
3151
+ if not (
3152
+ isinstance(upper_bound, Instance)
3153
+ and upper_bound.type.fullname == "builtins.object"
3154
+ ):
3155
+ tvars.append(f"{tvar.name}: {format_type_bare(upper_bound, options)}")
3156
+ elif tvar.values:
3157
+ tvars.append(
3158
+ "{}: ({})".format(
3159
+ tvar.name,
3160
+ ", ".join([format_type_bare(tp, options) for tp in tvar.values]),
3161
+ )
3162
+ )
3163
+ else:
3164
+ tvars.append(tvar.name)
3165
+ else:
3166
+ # For other TypeVarLikeTypes, just use the repr
3167
+ tvars.append(repr(tvar))
3168
+ s = f"[{', '.join(tvars)}] {s}"
3169
+ return f"def {s}"
3170
+
3171
+
3172
+ def get_first_arg(tp: CallableType) -> str | None:
3173
+ definition = get_func_def(tp)
3174
+ if not isinstance(definition, FuncDef) or not definition.info or definition.is_static:
3175
+ return None
3176
+ return definition.original_first_arg
3177
+
3178
+
3179
+ def variance_string(variance: int) -> str:
3180
+ if variance == COVARIANT:
3181
+ return "covariant"
3182
+ elif variance == CONTRAVARIANT:
3183
+ return "contravariant"
3184
+ else:
3185
+ return "invariant"
3186
+
3187
+
3188
+ def get_missing_protocol_members(left: Instance, right: Instance, skip: list[str]) -> list[str]:
3189
+ """Find all protocol members of 'right' that are not implemented
3190
+ (i.e. completely missing) in 'left'.
3191
+ """
3192
+ assert right.type.is_protocol
3193
+ missing: list[str] = []
3194
+ for member in right.type.protocol_members:
3195
+ if member in skip:
3196
+ continue
3197
+ if not find_member(member, left, left):
3198
+ missing.append(member)
3199
+ return missing
3200
+
3201
+
3202
+ def get_conflict_protocol_types(
3203
+ left: Instance,
3204
+ original_left: Type,
3205
+ right: Instance,
3206
+ class_obj: bool = False,
3207
+ options: Options | None = None,
3208
+ ) -> list[tuple[str, Type, Type, bool]]:
3209
+ """Find members that are defined in 'left' but have incompatible types.
3210
+ Return them as a list of ('member', 'got', 'expected', 'is_lvalue').
3211
+ """
3212
+ assert right.type.is_protocol
3213
+ conflicts: list[tuple[str, Type, Type, bool]] = []
3214
+ for member in right.type.protocol_members:
3215
+ if member in ("__init__", "__new__"):
3216
+ continue
3217
+ supertype = find_member(member, right, left)
3218
+ assert supertype is not None
3219
+ subtype = get_protocol_member(left, original_left, member, class_obj)
3220
+ if not subtype:
3221
+ continue
3222
+ is_compat = is_subtype(subtype, supertype, ignore_pos_arg_names=True, options=options)
3223
+ if not is_compat:
3224
+ conflicts.append((member, subtype, supertype, False))
3225
+ superflags = get_member_flags(member, right)
3226
+ if IS_SETTABLE not in superflags:
3227
+ continue
3228
+ different_setter = False
3229
+ if IS_EXPLICIT_SETTER in superflags:
3230
+ set_supertype = find_member(member, right, left, is_lvalue=True)
3231
+ if set_supertype and not is_same_type(set_supertype, supertype):
3232
+ different_setter = True
3233
+ supertype = set_supertype
3234
+ if IS_EXPLICIT_SETTER in get_member_flags(member, left):
3235
+ set_subtype = get_protocol_member(
3236
+ left, original_left, member, class_obj, is_lvalue=True
3237
+ )
3238
+ if set_subtype and not is_same_type(set_subtype, subtype):
3239
+ different_setter = True
3240
+ subtype = set_subtype
3241
+ if not is_compat and not different_setter:
3242
+ # We already have this conflict listed, avoid duplicates.
3243
+ continue
3244
+ assert supertype is not None and subtype is not None
3245
+ is_compat = is_subtype(supertype, subtype, options=options)
3246
+ if not is_compat:
3247
+ conflicts.append((member, subtype, supertype, different_setter))
3248
+ return conflicts
3249
+
3250
+
3251
+ def get_bad_protocol_flags(
3252
+ left: Instance, right: Instance, class_obj: bool = False
3253
+ ) -> list[tuple[str, set[int], set[int]]]:
3254
+ """Return all incompatible attribute flags for members that are present in both
3255
+ 'left' and 'right'.
3256
+ """
3257
+ assert right.type.is_protocol
3258
+ all_flags: list[tuple[str, set[int], set[int]]] = []
3259
+ for member in right.type.protocol_members:
3260
+ if find_member(member, left, left, class_obj=class_obj):
3261
+ all_flags.append(
3262
+ (
3263
+ member,
3264
+ get_member_flags(member, left, class_obj=class_obj),
3265
+ get_member_flags(member, right),
3266
+ )
3267
+ )
3268
+ bad_flags = []
3269
+ for name, subflags, superflags in all_flags:
3270
+ if (
3271
+ IS_CLASSVAR in subflags
3272
+ and IS_CLASSVAR not in superflags
3273
+ and IS_SETTABLE in superflags
3274
+ or IS_CLASSVAR in superflags
3275
+ and IS_CLASSVAR not in subflags
3276
+ or IS_SETTABLE in superflags
3277
+ and IS_SETTABLE not in subflags
3278
+ or IS_CLASS_OR_STATIC in superflags
3279
+ and IS_CLASS_OR_STATIC not in subflags
3280
+ or class_obj
3281
+ and IS_VAR in superflags
3282
+ and IS_CLASSVAR not in subflags
3283
+ or class_obj
3284
+ and IS_CLASSVAR in superflags
3285
+ ):
3286
+ bad_flags.append((name, subflags, superflags))
3287
+ return bad_flags
3288
+
3289
+
3290
+ def capitalize(s: str) -> str:
3291
+ """Capitalize the first character of a string."""
3292
+ if s == "":
3293
+ return ""
3294
+ else:
3295
+ return s[0].upper() + s[1:]
3296
+
3297
+
3298
+ def extract_type(name: str) -> str:
3299
+ """If the argument is the name of a method (of form C.m), return
3300
+ the type portion in quotes (e.g. "y"). Otherwise, return the string
3301
+ unmodified.
3302
+ """
3303
+ name = re.sub('^"[a-zA-Z0-9_]+" of ', "", name)
3304
+ return name
3305
+
3306
+
3307
+ def strip_quotes(s: str) -> str:
3308
+ """Strip a double quote at the beginning and end of the string, if any."""
3309
+ s = re.sub('^"', "", s)
3310
+ s = re.sub('"$', "", s)
3311
+ return s
3312
+
3313
+
3314
+ def format_string_list(lst: list[str]) -> str:
3315
+ assert lst
3316
+ if len(lst) == 1:
3317
+ return lst[0]
3318
+ elif len(lst) <= 5:
3319
+ return f"{', '.join(lst[:-1])} and {lst[-1]}"
3320
+ else:
3321
+ return "%s, ... and %s (%i methods suppressed)" % (
3322
+ ", ".join(lst[:2]),
3323
+ lst[-1],
3324
+ len(lst) - 3,
3325
+ )
3326
+
3327
+
3328
+ def format_item_name_list(s: Iterable[str]) -> str:
3329
+ lst = list(s)
3330
+ if len(lst) <= 5:
3331
+ return "(" + ", ".join([f'"{name}"' for name in lst]) + ")"
3332
+ else:
3333
+ return "(" + ", ".join([f'"{name}"' for name in lst[:5]]) + ", ...)"
3334
+
3335
+
3336
+ def callable_name(type: FunctionLike) -> str | None:
3337
+ name = type.get_name()
3338
+ if name is not None and name[0] != "<":
3339
+ return f'"{name}"'.replace(" of ", '" of "')
3340
+ return name
3341
+
3342
+
3343
+ def for_function(callee: CallableType) -> str:
3344
+ name = callable_name(callee)
3345
+ if name is not None:
3346
+ return f" for {name}"
3347
+ return ""
3348
+
3349
+
3350
+ def wrong_type_arg_count(low: int, high: int, act: str, name: str) -> str:
3351
+ if low == high:
3352
+ s = f"{low} type arguments"
3353
+ if low == 0:
3354
+ s = "no type arguments"
3355
+ elif low == 1:
3356
+ s = "1 type argument"
3357
+ else:
3358
+ s = f"between {low} and {high} type arguments"
3359
+ if act == "0":
3360
+ act = "none"
3361
+ return f'"{name}" expects {s}, but {act} given'
3362
+
3363
+
3364
+ def find_defining_module(modules: dict[str, MypyFile], typ: CallableType) -> MypyFile | None:
3365
+ if not typ.definition:
3366
+ return None
3367
+ fullname = typ.definition.fullname
3368
+ if "." in fullname:
3369
+ for i in range(fullname.count(".")):
3370
+ module_name = fullname.rsplit(".", i + 1)[0]
3371
+ try:
3372
+ return modules[module_name]
3373
+ except KeyError:
3374
+ pass
3375
+ assert False, "Couldn't determine module from CallableType"
3376
+ return None
3377
+
3378
+
3379
+ # For hard-coding suggested missing member alternatives.
3380
+ COMMON_MISTAKES: Final[dict[str, Sequence[str]]] = {"add": ("append", "extend")}
3381
+
3382
+
3383
+ def _real_quick_ratio(a: str, b: str) -> float:
3384
+ # this is an upper bound on difflib.SequenceMatcher.ratio
3385
+ # similar to difflib.SequenceMatcher.real_quick_ratio, but faster since we don't instantiate
3386
+ al = len(a)
3387
+ bl = len(b)
3388
+ return 2.0 * min(al, bl) / (al + bl)
3389
+
3390
+
3391
+ def best_matches(current: str, options: Collection[str], n: int) -> list[str]:
3392
+ if not current:
3393
+ return []
3394
+ # narrow down options cheaply
3395
+ options = [o for o in options if _real_quick_ratio(current, o) > 0.75]
3396
+ if len(options) >= 50:
3397
+ options = [o for o in options if abs(len(o) - len(current)) <= 1]
3398
+
3399
+ ratios = {option: difflib.SequenceMatcher(a=current, b=option).ratio() for option in options}
3400
+ options = [option for option, ratio in ratios.items() if ratio > 0.75]
3401
+ return sorted(options, key=lambda v: (-ratios[v], v))[:n]
3402
+
3403
+
3404
+ def pretty_seq(args: Sequence[str], conjunction: str) -> str:
3405
+ quoted = ['"' + a + '"' for a in args]
3406
+ if len(quoted) == 1:
3407
+ return quoted[0]
3408
+ if len(quoted) == 2:
3409
+ return f"{quoted[0]} {conjunction} {quoted[1]}"
3410
+ last_sep = ", " + conjunction + " "
3411
+ return ", ".join(quoted[:-1]) + last_sep + quoted[-1]
3412
+
3413
+
3414
+ def append_invariance_notes(
3415
+ notes: list[str], arg_type: Instance, expected_type: Instance
3416
+ ) -> list[str]:
3417
+ """Explain that the type is invariant and give notes for how to solve the issue."""
3418
+ invariant_type = ""
3419
+ covariant_suggestion = ""
3420
+ if (
3421
+ arg_type.type.fullname == "builtins.list"
3422
+ and expected_type.type.fullname == "builtins.list"
3423
+ and is_subtype(arg_type.args[0], expected_type.args[0])
3424
+ ):
3425
+ invariant_type = "list"
3426
+ covariant_suggestion = 'Consider using "Sequence" instead, which is covariant'
3427
+ elif (
3428
+ arg_type.type.fullname == "builtins.dict"
3429
+ and expected_type.type.fullname == "builtins.dict"
3430
+ and is_same_type(arg_type.args[0], expected_type.args[0])
3431
+ and is_subtype(arg_type.args[1], expected_type.args[1])
3432
+ ):
3433
+ invariant_type = "dict"
3434
+ covariant_suggestion = (
3435
+ 'Consider using "Mapping" instead, which is covariant in the value type'
3436
+ )
3437
+ if invariant_type and covariant_suggestion:
3438
+ notes.append(
3439
+ f'"{invariant_type}" is invariant -- see '
3440
+ + "https://mypy.readthedocs.io/en/stable/common_issues.html#variance"
3441
+ )
3442
+ notes.append(covariant_suggestion)
3443
+ return notes
3444
+
3445
+
3446
+ def append_union_note(
3447
+ notes: list[str], arg_type: UnionType, expected_type: UnionType, options: Options
3448
+ ) -> list[str]:
3449
+ """Point to specific union item(s) that may cause failure in subtype check."""
3450
+ non_matching = []
3451
+ items = flatten_nested_unions(arg_type.items)
3452
+ if len(items) < MAX_UNION_ITEMS:
3453
+ return notes
3454
+ for item in items:
3455
+ if not is_subtype(item, expected_type):
3456
+ non_matching.append(item)
3457
+ if non_matching:
3458
+ types = ", ".join([format_type(typ, options) for typ in non_matching])
3459
+ notes.append(f"Item{plural_s(non_matching)} in the first union not in the second: {types}")
3460
+ return notes
3461
+
3462
+
3463
+ def append_numbers_notes(
3464
+ notes: list[str], arg_type: Instance, expected_type: Instance
3465
+ ) -> list[str]:
3466
+ """Explain if an unsupported type from "numbers" is used in a subtype check."""
3467
+ if expected_type.type.fullname in UNSUPPORTED_NUMBERS_TYPES:
3468
+ notes.append('Types from "numbers" are not supported for static type checking')
3469
+ notes.append("See https://peps.python.org/pep-0484/#the-numeric-tower")
3470
+ notes.append("Consider using a protocol instead, such as typing.SupportsFloat")
3471
+ return notes
3472
+
3473
+
3474
+ def make_inferred_type_note(
3475
+ context: Context, subtype: Type, supertype: Type, supertype_str: str
3476
+ ) -> str:
3477
+ """Explain that the user may have forgotten to type a variable.
3478
+
3479
+ The user does not expect an error if the inferred container type is the same as the return
3480
+ type of a function and the argument type(s) are a subtype of the argument type(s) of the
3481
+ return type. This note suggests that they add a type annotation with the return type instead
3482
+ of relying on the inferred type.
3483
+ """
3484
+ subtype = get_proper_type(subtype)
3485
+ supertype = get_proper_type(supertype)
3486
+ if (
3487
+ isinstance(subtype, Instance)
3488
+ and isinstance(supertype, Instance)
3489
+ and subtype.type.fullname == supertype.type.fullname
3490
+ and subtype.args
3491
+ and supertype.args
3492
+ and isinstance(context, ReturnStmt)
3493
+ and isinstance(context.expr, NameExpr)
3494
+ and isinstance(context.expr.node, Var)
3495
+ and context.expr.node.is_inferred
3496
+ ):
3497
+ for subtype_arg, supertype_arg in zip(subtype.args, supertype.args):
3498
+ if not is_subtype(subtype_arg, supertype_arg):
3499
+ return ""
3500
+ var_name = context.expr.name
3501
+ return 'Perhaps you need a type annotation for "{}"? Suggestion: {}'.format(
3502
+ var_name, supertype_str
3503
+ )
3504
+ return ""
3505
+
3506
+
3507
+ def format_key_list(keys: list[str], *, short: bool = False) -> str:
3508
+ formatted_keys = [f'"{key}"' for key in keys]
3509
+ td = "" if short else "TypedDict "
3510
+ if len(keys) == 0:
3511
+ return f"no {td}keys"
3512
+ elif len(keys) == 1:
3513
+ return f"{td}key {formatted_keys[0]}"
3514
+ else:
3515
+ return f"{td}keys ({', '.join(formatted_keys)})"
3516
+
3517
+
3518
+ def ignore_last_known_values(t: UnionType) -> Type:
3519
+ """This will avoid types like str | str in error messages.
3520
+
3521
+ last_known_values are kept during union simplification, but may cause
3522
+ weird formatting for e.g. tuples of literals.
3523
+ """
3524
+ union_items: list[Type] = []
3525
+ seen_instances = set()
3526
+ for item in t.items:
3527
+ if isinstance(item, ProperType) and isinstance(item, Instance):
3528
+ erased = item.copy_modified(last_known_value=None)
3529
+ if erased in seen_instances:
3530
+ continue
3531
+ seen_instances.add(erased)
3532
+ union_items.append(erased)
3533
+ else:
3534
+ union_items.append(item)
3535
+ return UnionType.make_union(union_items, t.line, t.column)