jaclang 0.7.34__py3-none-any.whl → 0.8.1__py3-none-any.whl

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.

Potentially problematic release.


This version of jaclang might be problematic. Click here for more details.

Files changed (1503) hide show
  1. jaclang/__init__.py +7 -414
  2. jaclang/cli/cli.md +5 -5
  3. jaclang/cli/cli.py +316 -217
  4. jaclang/cli/cmdreg.py +188 -31
  5. jaclang/compiler/__init__.py +10 -15
  6. jaclang/compiler/{codeloc.py → codeinfo.py} +11 -30
  7. jaclang/compiler/constant.py +10 -33
  8. jaclang/compiler/jac.lark +65 -106
  9. jaclang/compiler/larkparse/jac_parser.py +3444 -0
  10. jaclang/compiler/parser.py +1137 -1517
  11. jaclang/compiler/passes/__init__.py +2 -2
  12. jaclang/compiler/passes/main/__init__.py +33 -14
  13. jaclang/compiler/passes/main/annex_pass.py +85 -0
  14. jaclang/compiler/passes/main/cfg_build_pass.py +275 -0
  15. jaclang/compiler/passes/main/def_impl_match_pass.py +159 -114
  16. jaclang/compiler/passes/main/def_use_pass.py +66 -274
  17. jaclang/compiler/passes/main/import_pass.py +178 -363
  18. jaclang/compiler/passes/main/inheritance_pass.py +109 -107
  19. jaclang/compiler/passes/main/pyast_gen_pass.py +1242 -1735
  20. jaclang/compiler/passes/main/pyast_load_pass.py +579 -819
  21. jaclang/compiler/passes/main/pybc_gen_pass.py +38 -35
  22. jaclang/compiler/passes/main/pyjac_ast_link_pass.py +50 -163
  23. jaclang/compiler/passes/main/sym_tab_build_pass.py +114 -1203
  24. jaclang/compiler/passes/main/sym_tab_link_pass.py +141 -0
  25. jaclang/{tests → compiler/passes/main/tests}/fixtures/access_modifier.jac +10 -9
  26. jaclang/compiler/passes/main/tests/fixtures/atest.impl.jac +3 -0
  27. jaclang/compiler/passes/main/tests/fixtures/atest.jac +11 -0
  28. jaclang/compiler/passes/main/tests/fixtures/autoimpl.impl/getme.impl.jac +1 -1
  29. jaclang/compiler/passes/main/tests/fixtures/autoimpl.impl.jac +1 -1
  30. jaclang/compiler/passes/main/tests/fixtures/autoimpl.jac +3 -3
  31. jaclang/compiler/passes/main/tests/fixtures/autoimpl.something.else.impl.jac +1 -1
  32. jaclang/compiler/passes/main/tests/fixtures/base.impl.jac +8 -0
  33. jaclang/compiler/passes/main/tests/fixtures/base.jac +4 -4
  34. jaclang/compiler/passes/main/tests/fixtures/base2.impl.jac +8 -0
  35. jaclang/compiler/passes/main/tests/fixtures/base2.jac +4 -4
  36. jaclang/compiler/passes/main/tests/fixtures/blip.jac +1 -1
  37. jaclang/compiler/passes/main/tests/fixtures/cfg_ability_test.jac +23 -0
  38. jaclang/compiler/passes/main/tests/fixtures/cfg_gen.jac +19 -0
  39. jaclang/compiler/passes/main/tests/fixtures/circular_import.jac +7 -0
  40. jaclang/compiler/passes/main/tests/fixtures/data_spatial_types.jac +12 -12
  41. jaclang/compiler/passes/main/tests/fixtures/decls.jac +4 -4
  42. jaclang/compiler/passes/main/tests/fixtures/defn_decl_mismatch.jac +4 -4
  43. jaclang/compiler/passes/main/tests/fixtures/defs_and_uses.jac +6 -6
  44. jaclang/compiler/passes/main/tests/fixtures/enumerations.jac +13 -0
  45. jaclang/compiler/passes/main/tests/fixtures/fstrings.jac +1 -1
  46. jaclang/compiler/passes/main/tests/fixtures/func.jac +2 -2
  47. jaclang/compiler/passes/main/tests/fixtures/func2.jac +1 -1
  48. jaclang/compiler/passes/main/tests/fixtures/game1.jac +4 -4
  49. jaclang/compiler/passes/main/tests/fixtures/impl/defs1.jac +2 -2
  50. jaclang/compiler/passes/main/tests/fixtures/impl/defs2.jac +2 -2
  51. jaclang/compiler/passes/main/tests/fixtures/impl/imps.jac +0 -8
  52. jaclang/compiler/passes/main/tests/fixtures/impl_grab.impl.jac +5 -0
  53. jaclang/{tests → compiler/passes/main/tests}/fixtures/impl_grab.jac +1 -1
  54. jaclang/compiler/passes/main/tests/fixtures/incautoimpl.jac +1 -1
  55. jaclang/compiler/passes/main/tests/fixtures/main_err.impl.jac +6 -0
  56. jaclang/compiler/passes/main/tests/fixtures/main_err.jac +6 -0
  57. jaclang/compiler/passes/main/tests/fixtures/mod_type_assign.jac +1 -1
  58. jaclang/compiler/passes/main/tests/fixtures/mtest.impl.jac +6 -0
  59. jaclang/{tests → compiler/passes/main/tests}/fixtures/mtest.jac +1 -1
  60. jaclang/{tests → compiler/passes/main/tests}/fixtures/nested_impls.jac +14 -15
  61. jaclang/compiler/passes/main/tests/fixtures/py_imp_test.jac +7 -7
  62. jaclang/compiler/passes/main/tests/fixtures/second_err.jac +4 -0
  63. jaclang/compiler/passes/main/tests/fixtures/str2doc.py +3 -0
  64. jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/action/__init__.py +5 -0
  65. jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/action/actions.jac +19 -0
  66. jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/main.jac +7 -0
  67. jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/no_dupls.jac +35 -0
  68. jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/one.jac +8 -0
  69. jaclang/compiler/passes/main/tests/fixtures/type_info.jac +4 -4
  70. jaclang/compiler/passes/main/tests/test_cfg_build_pass.py +101 -0
  71. jaclang/compiler/passes/main/tests/test_decl_impl_match_pass.py +157 -0
  72. jaclang/compiler/passes/main/tests/test_def_use_pass.py +4 -6
  73. jaclang/compiler/passes/main/tests/test_import_pass.py +59 -46
  74. jaclang/compiler/passes/main/tests/test_pyast_build_pass.py +15 -0
  75. jaclang/compiler/passes/main/tests/test_pyast_gen_pass.py +25 -34
  76. jaclang/compiler/passes/main/tests/test_pybc_gen_pass.py +3 -3
  77. jaclang/compiler/passes/main/tests/test_sub_node_pass.py +8 -7
  78. jaclang/compiler/passes/main/tests/test_sym_tab_build_pass.py +4 -4
  79. jaclang/compiler/passes/main/tests/test_sym_tab_link_pass.py +62 -0
  80. jaclang/compiler/passes/tool/__init__.py +2 -0
  81. jaclang/compiler/passes/tool/doc_ir.py +179 -0
  82. jaclang/compiler/passes/tool/doc_ir_gen_pass.py +1287 -0
  83. jaclang/compiler/passes/tool/fuse_comments_pass.py +90 -70
  84. jaclang/compiler/passes/tool/jac_formatter_pass.py +122 -2554
  85. jaclang/compiler/passes/tool/tests/fixtures/corelib.jac +249 -97
  86. jaclang/compiler/passes/tool/tests/fixtures/corelib_fmt.jac +94 -97
  87. jaclang/compiler/passes/tool/tests/fixtures/doc_string.jac +2 -2
  88. jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/access_mod_check.jac +5 -5
  89. jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/archetype_test.jac +13 -0
  90. jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/decorator_stack.jac +7 -7
  91. jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/line_spacing.jac +8 -8
  92. jaclang/compiler/passes/tool/tests/fixtures/multi_def_err.dot +3 -3
  93. jaclang/compiler/passes/tool/tests/fixtures/multi_def_err.txt +3 -3
  94. jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/ability_impl_long_comprehension.jac +1 -1
  95. jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/call_with_many_parameters.jac +2 -2
  96. jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/simple_walker.jac +3 -3
  97. jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/try_block_and_walker_spawn_and_fstrings.jac +1 -1
  98. jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/type_annotation.jac +1 -1
  99. jaclang/compiler/passes/tool/tests/fixtures/simple_walk.jac +1 -1
  100. jaclang/compiler/passes/tool/tests/fixtures/simple_walk_fmt.jac +10 -4
  101. jaclang/compiler/passes/tool/tests/test_doc_ir_gen_pass.py +29 -0
  102. jaclang/compiler/passes/tool/tests/test_jac_format_pass.py +63 -88
  103. jaclang/compiler/passes/tool/tests/test_unparse_validate.py +27 -28
  104. jaclang/compiler/passes/transform.py +56 -16
  105. jaclang/compiler/passes/{ir_pass.py → uni_pass.py} +35 -52
  106. jaclang/compiler/program.py +200 -0
  107. jaclang/compiler/tests/fixtures/codegentext.jac +31 -0
  108. jaclang/compiler/tests/fixtures/fam.jac +12 -12
  109. jaclang/compiler/tests/fixtures/hello_world.jac +1 -1
  110. jaclang/compiler/tests/fixtures/pkg_import_lib/__init__.jac +1 -0
  111. jaclang/compiler/tests/fixtures/pkg_import_lib/sub/__init__.jac +1 -0
  112. jaclang/compiler/tests/fixtures/pkg_import_lib/sub/helper.jac +3 -0
  113. jaclang/compiler/tests/fixtures/pkg_import_lib/tools.jac +3 -0
  114. jaclang/compiler/tests/fixtures/pkg_import_lib_py/__init__.py +11 -0
  115. jaclang/compiler/tests/fixtures/pkg_import_lib_py/sub/__init__.py +7 -0
  116. jaclang/compiler/tests/fixtures/pkg_import_lib_py/sub/helper.jac +3 -0
  117. jaclang/compiler/tests/fixtures/pkg_import_lib_py/tools.jac +3 -0
  118. jaclang/compiler/tests/fixtures/pkg_import_main.jac +10 -0
  119. jaclang/compiler/tests/fixtures/pkg_import_main_py.jac +11 -0
  120. jaclang/compiler/tests/fixtures/staticcheck.jac +2 -2
  121. jaclang/compiler/tests/test_importer.py +41 -16
  122. jaclang/compiler/tests/test_parser.py +39 -17
  123. jaclang/compiler/{absyntree.py → unitree.py} +1521 -1261
  124. jaclang/langserve/engine.jac +498 -0
  125. jaclang/langserve/sem_manager.jac +309 -0
  126. jaclang/langserve/server.jac +186 -0
  127. jaclang/langserve/tests/fixtures/base_module_structure.jac +7 -7
  128. jaclang/langserve/tests/fixtures/circle.jac +6 -6
  129. jaclang/langserve/tests/fixtures/circle_err.jac +6 -6
  130. jaclang/langserve/tests/fixtures/circle_pure.impl.jac +5 -5
  131. jaclang/langserve/tests/fixtures/circle_pure.jac +7 -7
  132. jaclang/langserve/tests/fixtures/circle_pure_err.impl.jac +2 -2
  133. jaclang/langserve/tests/fixtures/circle_pure_err.jac +7 -7
  134. jaclang/langserve/tests/fixtures/import_include_statements.jac +6 -6
  135. jaclang/langserve/tests/fixtures/rename.jac +6 -6
  136. jaclang/langserve/tests/server_test/test_lang_serve.py +261 -0
  137. jaclang/langserve/tests/server_test/utils.py +118 -0
  138. jaclang/langserve/tests/session.jac +294 -0
  139. jaclang/langserve/tests/test_sem_tokens.py +4 -4
  140. jaclang/langserve/tests/test_server.py +53 -30
  141. jaclang/langserve/utils.jac +459 -0
  142. jaclang/runtimelib/{architype.py → archetype.py} +86 -62
  143. jaclang/runtimelib/builtin.py +95 -0
  144. jaclang/runtimelib/constructs.py +11 -13
  145. jaclang/runtimelib/importer.py +83 -53
  146. jaclang/runtimelib/machine.py +1592 -144
  147. jaclang/runtimelib/memory.py +6 -6
  148. jaclang/{plugin → runtimelib}/tests/fixtures/graph_purger.jac +1 -1
  149. jaclang/{plugin → runtimelib}/tests/fixtures/impl_match.jac +2 -2
  150. jaclang/runtimelib/tests/fixtures/impl_match_impl.jac +3 -0
  151. jaclang/{plugin → runtimelib}/tests/fixtures/other_root_access.jac +7 -7
  152. jaclang/{plugin → runtimelib}/tests/fixtures/savable_object.jac +3 -5
  153. jaclang/{plugin → runtimelib}/tests/fixtures/simple_node_connection.jac +6 -6
  154. jaclang/{plugin → runtimelib}/tests/fixtures/simple_persistent.jac +1 -1
  155. jaclang/{plugin → runtimelib}/tests/fixtures/traversing_save.jac +7 -5
  156. jaclang/runtimelib/tests/test_features.py +72 -0
  157. jaclang/{plugin → runtimelib}/tests/test_jaseci.py +6 -5
  158. jaclang/runtimelib/utils.py +34 -66
  159. jaclang/settings.py +1 -6
  160. jaclang/tests/fixtures/{abc.jac → abc_check.jac} +6 -6
  161. jaclang/tests/fixtures/arch_rel_import_creation.jac +4 -4
  162. jaclang/tests/fixtures/async_ability.jac +18 -0
  163. jaclang/tests/fixtures/async_walker.jac +23 -0
  164. jaclang/tests/fixtures/backward_edge_visit.jac +31 -0
  165. jaclang/tests/fixtures/baddy.jac +1 -1
  166. jaclang/tests/fixtures/base_class1.jac +2 -2
  167. jaclang/tests/fixtures/base_class2.jac +2 -2
  168. jaclang/tests/fixtures/base_class_complex_expr.jac +3 -3
  169. jaclang/tests/fixtures/builtin_printgraph.jac +85 -0
  170. jaclang/tests/fixtures/builtin_printgraph_json.jac +21 -0
  171. jaclang/tests/fixtures/builtin_printgraph_mermaid.jac +16 -0
  172. jaclang/tests/fixtures/byllmissue.jac +1 -1
  173. jaclang/tests/fixtures/chandra_bugs.jac +1 -1
  174. jaclang/tests/fixtures/chandra_bugs2.jac +21 -14
  175. jaclang/tests/fixtures/cls_method.jac +6 -6
  176. jaclang/tests/fixtures/concurrency.jac +39 -0
  177. jaclang/tests/fixtures/connect_traverse_syntax.jac +18 -0
  178. jaclang/tests/fixtures/create_dynamic_archetype.jac +35 -0
  179. jaclang/tests/fixtures/decl_defn_param_name.jac +4 -4
  180. jaclang/tests/fixtures/deep/deeper/__init__.jac +1 -0
  181. jaclang/tests/fixtures/deep/deeper/deep_outer_import.jac +2 -3
  182. jaclang/tests/fixtures/deep/deeper/deep_outer_import2.jac +3 -3
  183. jaclang/tests/fixtures/deep/deeper/snd_lev.jac +2 -2
  184. jaclang/tests/fixtures/deep/mycode.jac +1 -1
  185. jaclang/tests/fixtures/deep/one_lev.jac +3 -4
  186. jaclang/tests/fixtures/deep/one_lev_dup.jac +2 -2
  187. jaclang/tests/fixtures/deep_convert.jac +1 -1
  188. jaclang/tests/fixtures/deep_import.jac +2 -2
  189. jaclang/tests/fixtures/deep_import_interp.jac +8 -0
  190. jaclang/tests/fixtures/deep_import_mods.jac +3 -3
  191. jaclang/tests/fixtures/deferred_field.jac +1 -1
  192. jaclang/tests/fixtures/del_clean.jac +7 -0
  193. jaclang/tests/fixtures/disconn.jac +2 -2
  194. jaclang/tests/fixtures/dynamic_archetype.jac +34 -0
  195. jaclang/tests/fixtures/edge_ability.jac +49 -0
  196. jaclang/tests/fixtures/edge_node_walk.jac +12 -12
  197. jaclang/tests/fixtures/edge_ops.jac +7 -7
  198. jaclang/tests/fixtures/edges_walk.jac +10 -10
  199. jaclang/tests/fixtures/edgetypeissue.jac +1 -1
  200. jaclang/tests/fixtures/enum_inside_archtype.jac +4 -4
  201. jaclang/tests/fixtures/err.impl.jac +1 -1
  202. jaclang/tests/fixtures/err.jac +2 -2
  203. jaclang/tests/fixtures/err_runtime.jac +2 -2
  204. jaclang/tests/fixtures/foo.jac +7 -7
  205. jaclang/tests/fixtures/game1.jac +4 -4
  206. jaclang/tests/fixtures/gendot_bubble_sort.jac +4 -4
  207. jaclang/tests/fixtures/glob_multivar_statement.jac +1 -1
  208. jaclang/tests/fixtures/guess_game.jac +6 -6
  209. jaclang/tests/fixtures/has_goodness.jac +1 -1
  210. jaclang/tests/fixtures/hash_init_check.jac +3 -3
  211. jaclang/tests/fixtures/hello.jac +1 -1
  212. jaclang/tests/fixtures/here_usage_error.jac +21 -0
  213. jaclang/tests/fixtures/here_visitor_usage.jac +21 -0
  214. jaclang/tests/fixtures/ignore.jac +3 -3
  215. jaclang/tests/fixtures/ignore_dup.jac +3 -3
  216. jaclang/tests/fixtures/impl_match_confused.impl.jac +1 -1
  217. jaclang/tests/fixtures/import.jac +9 -9
  218. jaclang/tests/fixtures/import_all.jac +1 -1
  219. jaclang/tests/fixtures/index_slice.jac +1 -1
  220. jaclang/tests/fixtures/inherit_check.jac +3 -3
  221. jaclang/tests/fixtures/jac_from_py.py +4 -0
  222. jaclang/tests/fixtures/jacsamp.jac +1 -1
  223. jaclang/tests/fixtures/jactest_main.jac +1 -1
  224. jaclang/tests/fixtures/jp_importer.jac +7 -8
  225. jaclang/tests/fixtures/jp_importer_auto.jac +3 -3
  226. jaclang/tests/fixtures/lambda.jac +2 -2
  227. jaclang/tests/fixtures/needs_import.jac +6 -6
  228. jaclang/tests/fixtures/needs_import_1.jac +1 -1
  229. jaclang/tests/fixtures/needs_import_2.jac +1 -1
  230. jaclang/tests/fixtures/needs_import_3.jac +1 -1
  231. jaclang/tests/fixtures/needs_import_dup.jac +6 -6
  232. jaclang/tests/fixtures/node_del.jac +54 -0
  233. jaclang/tests/fixtures/nosigself.jac +3 -3
  234. jaclang/tests/fixtures/py2jac.py +30 -0
  235. jaclang/tests/fixtures/py_bool_expr.py +7 -0
  236. jaclang/tests/fixtures/py_namedexpr.py +7 -0
  237. jaclang/tests/fixtures/pyfunc_3.py +0 -2
  238. jaclang/tests/fixtures/random_check.jac +5 -5
  239. jaclang/tests/fixtures/simple_archs.jac +2 -2
  240. jaclang/tests/fixtures/simple_walk.jac +52 -0
  241. jaclang/tests/fixtures/slice_vals.jac +3 -3
  242. jaclang/tests/fixtures/sub_abil_sep.jac +3 -3
  243. jaclang/tests/fixtures/sub_abil_sep_multilev.jac +3 -3
  244. jaclang/tests/fixtures/trailing_comma.jac +4 -4
  245. jaclang/tests/fixtures/type_info.jac +5 -5
  246. jaclang/{compiler/passes/main/tests → tests}/fixtures/uninitialized_hasvars.jac +1 -1
  247. jaclang/tests/fixtures/visit_order.jac +4 -4
  248. jaclang/tests/fixtures/visit_traversal.jac +47 -0
  249. jaclang/tests/fixtures/walker_override.jac +2 -2
  250. jaclang/tests/fixtures/walker_update.jac +5 -5
  251. jaclang/tests/fixtures/with_context.jac +4 -4
  252. jaclang/tests/test_bugs.py +2 -2
  253. jaclang/tests/test_cli.py +127 -227
  254. jaclang/tests/test_language.py +542 -474
  255. jaclang/tests/test_man_code.py +2 -2
  256. jaclang/tests/test_reference.py +4 -4
  257. jaclang/tests/test_settings.py +16 -16
  258. jaclang/tests/test_typecheck.py +555 -0
  259. jaclang/utils/__init__.py +4 -0
  260. jaclang/utils/helpers.py +24 -31
  261. jaclang/utils/lang_tools.py +84 -75
  262. jaclang/utils/module_resolver.py +69 -0
  263. jaclang/utils/test.py +8 -5
  264. jaclang/utils/tests/test_lang_tools.py +40 -14
  265. jaclang/utils/treeprinter.py +178 -42
  266. jaclang/vendor/__init__.py +1 -2
  267. jaclang/vendor/attr/__init__.py +14 -44
  268. jaclang/vendor/attr/__init__.pyi +155 -321
  269. jaclang/vendor/attr/_cmp.py +25 -15
  270. jaclang/vendor/attr/_cmp.pyi +7 -7
  271. jaclang/vendor/attr/_compat.py +15 -8
  272. jaclang/vendor/attr/_config.py +1 -1
  273. jaclang/vendor/attr/_funcs.py +148 -163
  274. jaclang/vendor/attr/_make.py +859 -855
  275. jaclang/vendor/attr/_next_gen.py +426 -32
  276. jaclang/vendor/attr/converters.py +67 -49
  277. jaclang/vendor/attr/converters.pyi +13 -7
  278. jaclang/vendor/attr/filters.py +17 -11
  279. jaclang/vendor/attr/filters.pyi +3 -3
  280. jaclang/vendor/attr/setters.py +11 -5
  281. jaclang/vendor/attr/setters.pyi +2 -1
  282. jaclang/vendor/attr/validators.py +191 -162
  283. jaclang/vendor/attr/validators.pyi +25 -27
  284. jaclang/vendor/attrs/__init__.py +9 -5
  285. jaclang/vendor/attrs/__init__.pyi +225 -29
  286. jaclang/vendor/attrs-25.3.0.dist-info/INSTALLER +1 -0
  287. jaclang/vendor/{attrs-23.2.0.dist-info → attrs-25.3.0.dist-info}/METADATA +83 -53
  288. jaclang/vendor/attrs-25.3.0.dist-info/RECORD +56 -0
  289. jaclang/vendor/{attrs-23.2.0.dist-info → attrs-25.3.0.dist-info}/WHEEL +1 -1
  290. jaclang/vendor/bin/dmypy +8 -0
  291. jaclang/vendor/bin/mypy +8 -0
  292. jaclang/vendor/bin/mypyc +8 -0
  293. jaclang/vendor/bin/stubgen +8 -0
  294. jaclang/vendor/bin/stubtest +8 -0
  295. jaclang/vendor/cattr/gen.py +2 -2
  296. jaclang/vendor/cattr/preconf/bson.py +1 -0
  297. jaclang/vendor/cattr/preconf/json.py +1 -0
  298. jaclang/vendor/cattr/preconf/msgpack.py +1 -0
  299. jaclang/vendor/cattr/preconf/orjson.py +1 -0
  300. jaclang/vendor/cattr/preconf/pyyaml.py +1 -0
  301. jaclang/vendor/cattr/preconf/tomlkit.py +1 -0
  302. jaclang/vendor/cattr/preconf/ujson.py +1 -0
  303. jaclang/vendor/cattrs/__init__.py +21 -21
  304. jaclang/vendor/cattrs/_compat.py +176 -62
  305. jaclang/vendor/cattrs/_generics.py +5 -3
  306. jaclang/vendor/cattrs/cols.py +289 -0
  307. jaclang/vendor/cattrs/converters.py +505 -187
  308. jaclang/vendor/cattrs/disambiguators.py +118 -45
  309. jaclang/vendor/cattrs/dispatch.py +66 -36
  310. jaclang/vendor/cattrs/fns.py +6 -1
  311. jaclang/vendor/cattrs/gen/__init__.py +365 -202
  312. jaclang/vendor/cattrs/gen/_generics.py +41 -5
  313. jaclang/vendor/cattrs/gen/_lc.py +3 -2
  314. jaclang/vendor/cattrs/gen/_shared.py +39 -32
  315. jaclang/vendor/cattrs/gen/typeddicts.py +75 -88
  316. jaclang/vendor/cattrs/preconf/__init__.py +20 -0
  317. jaclang/vendor/cattrs/preconf/bson.py +7 -8
  318. jaclang/vendor/cattrs/preconf/cbor2.py +3 -0
  319. jaclang/vendor/cattrs/preconf/json.py +8 -4
  320. jaclang/vendor/cattrs/preconf/msgpack.py +3 -0
  321. jaclang/vendor/cattrs/preconf/msgspec.py +185 -0
  322. jaclang/vendor/cattrs/preconf/orjson.py +20 -7
  323. jaclang/vendor/cattrs/preconf/pyyaml.py +15 -3
  324. jaclang/vendor/cattrs/preconf/tomlkit.py +3 -1
  325. jaclang/vendor/cattrs/preconf/ujson.py +3 -0
  326. jaclang/vendor/cattrs/strategies/__init__.py +1 -0
  327. jaclang/vendor/cattrs/strategies/_class_methods.py +1 -1
  328. jaclang/vendor/cattrs/strategies/_subclasses.py +43 -29
  329. jaclang/vendor/cattrs/strategies/_unions.py +47 -24
  330. jaclang/vendor/cattrs/v.py +1 -0
  331. jaclang/vendor/cattrs-24.1.3.dist-info/INSTALLER +1 -0
  332. jaclang/vendor/cattrs-24.1.3.dist-info/METADATA +161 -0
  333. jaclang/vendor/cattrs-24.1.3.dist-info/RECORD +96 -0
  334. jaclang/vendor/{cattrs-23.2.3.dist-info → cattrs-24.1.3.dist-info}/WHEEL +1 -1
  335. jaclang/vendor/lark/__init__.py +38 -38
  336. jaclang/vendor/lark/__pyinstaller/__init__.py +6 -6
  337. jaclang/vendor/lark/__pyinstaller/hook-lark.py +14 -14
  338. jaclang/vendor/lark/ast_utils.py +59 -59
  339. jaclang/vendor/lark/common.py +86 -89
  340. jaclang/vendor/lark/exceptions.py +292 -292
  341. jaclang/vendor/lark/grammar.py +130 -130
  342. jaclang/vendor/lark/grammars/common.lark +59 -59
  343. jaclang/vendor/lark/grammars/lark.lark +62 -62
  344. jaclang/vendor/lark/grammars/python.lark +302 -302
  345. jaclang/vendor/lark/grammars/unicode.lark +7 -7
  346. jaclang/vendor/lark/indenter.py +143 -112
  347. jaclang/vendor/lark/lark.py +658 -661
  348. jaclang/vendor/lark/lexer.py +678 -678
  349. jaclang/vendor/lark/load_grammar.py +1428 -1428
  350. jaclang/vendor/lark/parse_tree_builder.py +391 -391
  351. jaclang/vendor/lark/parser_frontends.py +257 -257
  352. jaclang/vendor/lark/parsers/cyk.py +340 -340
  353. jaclang/vendor/lark/parsers/earley.py +317 -308
  354. jaclang/vendor/lark/parsers/earley_common.py +42 -42
  355. jaclang/vendor/lark/parsers/earley_forest.py +802 -810
  356. jaclang/vendor/lark/parsers/grammar_analysis.py +203 -203
  357. jaclang/vendor/lark/parsers/lalr_analysis.py +332 -332
  358. jaclang/vendor/lark/parsers/lalr_interactive_parser.py +158 -157
  359. jaclang/vendor/lark/parsers/lalr_parser.py +122 -122
  360. jaclang/vendor/lark/parsers/lalr_parser_state.py +110 -110
  361. jaclang/vendor/lark/parsers/xearley.py +165 -165
  362. jaclang/vendor/lark/reconstruct.py +107 -107
  363. jaclang/vendor/lark/tools/__init__.py +70 -71
  364. jaclang/vendor/lark/tools/nearley.py +202 -202
  365. jaclang/vendor/lark/tools/serialize.py +32 -32
  366. jaclang/vendor/lark/tools/standalone.py +196 -196
  367. jaclang/vendor/lark/tree.py +267 -272
  368. jaclang/vendor/lark/tree_matcher.py +186 -186
  369. jaclang/vendor/lark/utils.py +346 -361
  370. jaclang/vendor/lark/visitors.py +596 -593
  371. jaclang/vendor/lark-1.2.2.dist-info/INSTALLER +1 -0
  372. jaclang/vendor/{lark-1.1.9.dist-info → lark-1.2.2.dist-info}/METADATA +48 -47
  373. jaclang/vendor/lark-1.2.2.dist-info/RECORD +83 -0
  374. jaclang/vendor/{mypy_extensions-1.0.0.dist-info → lark-1.2.2.dist-info}/WHEEL +1 -1
  375. jaclang/vendor/{lark-1.1.9.dist-info → lark-1.2.2.dist-info/licenses}/LICENSE +18 -18
  376. jaclang/vendor/lsprotocol-2023.0.1.dist-info/INSTALLER +1 -0
  377. jaclang/vendor/lsprotocol-2023.0.1.dist-info/METADATA +2 -1
  378. jaclang/vendor/lsprotocol-2023.0.1.dist-info/RECORD +17 -10
  379. jaclang/vendor/lsprotocol-2023.0.1.dist-info/WHEEL +1 -1
  380. jaclang/vendor/pluggy/_version.py +7 -2
  381. jaclang/vendor/pluggy-1.5.0.dist-info/INSTALLER +1 -0
  382. jaclang/vendor/pluggy-1.5.0.dist-info/METADATA +6 -5
  383. jaclang/vendor/pluggy-1.5.0.dist-info/RECORD +24 -14
  384. jaclang/vendor/pluggy-1.5.0.dist-info/WHEEL +1 -1
  385. jaclang/vendor/pygls-1.3.1.dist-info/INSTALLER +1 -0
  386. jaclang/vendor/pygls-1.3.1.dist-info/METADATA +2 -2
  387. jaclang/vendor/pygls-1.3.1.dist-info/RECORD +45 -24
  388. jaclang/vendor/pygls-1.3.1.dist-info/WHEEL +1 -1
  389. {jaclang-0.7.34.dist-info → jaclang-0.8.1.dist-info}/METADATA +2 -1
  390. jaclang-0.8.1.dist-info/RECORD +568 -0
  391. {jaclang-0.7.34.dist-info → jaclang-0.8.1.dist-info}/WHEEL +1 -1
  392. jaclang/compiler/.gitignore +0 -1
  393. jaclang/compiler/compile.py +0 -119
  394. jaclang/compiler/passes/main/access_modifier_pass.py +0 -130
  395. jaclang/compiler/passes/main/fuse_typeinfo_pass.py +0 -656
  396. jaclang/compiler/passes/main/py_collect_dep_pass.py +0 -78
  397. jaclang/compiler/passes/main/pyout_pass.py +0 -86
  398. jaclang/compiler/passes/main/registry_pass.py +0 -156
  399. jaclang/compiler/passes/main/schedules.py +0 -47
  400. jaclang/compiler/passes/main/sub_node_tab_pass.py +0 -36
  401. jaclang/compiler/passes/main/tests/fixtures/registry.jac +0 -36
  402. jaclang/compiler/passes/main/tests/test_decl_def_match_pass.py +0 -114
  403. jaclang/compiler/passes/main/tests/test_registry_pass.py +0 -31
  404. jaclang/compiler/passes/main/tests/test_type_check_pass.py +0 -91
  405. jaclang/compiler/passes/main/tests/test_typeinfo_pass.py +0 -29
  406. jaclang/compiler/passes/main/type_check_pass.py +0 -128
  407. jaclang/compiler/passes/tool/schedules.py +0 -18
  408. jaclang/compiler/passes/tool/tests/fixtures/genai/essay_review.jac +0 -36
  409. jaclang/compiler/passes/tool/tests/fixtures/genai/expert_answer.jac +0 -17
  410. jaclang/compiler/passes/tool/tests/fixtures/genai/joke_gen.jac +0 -32
  411. jaclang/compiler/passes/tool/tests/fixtures/genai/odd_word_out.jac +0 -27
  412. jaclang/compiler/passes/tool/tests/fixtures/genai/personality_finder.jac +0 -35
  413. jaclang/compiler/passes/tool/tests/fixtures/genai/text_to_type.jac +0 -25
  414. jaclang/compiler/passes/tool/tests/fixtures/genai/translator.jac +0 -13
  415. jaclang/compiler/passes/tool/tests/fixtures/genai/wikipedia.jac +0 -63
  416. jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/architype_test.jac +0 -13
  417. jaclang/compiler/passes/utils/mypy_ast_build.py +0 -940
  418. jaclang/compiler/py_info.py +0 -22
  419. jaclang/compiler/semtable.py +0 -159
  420. jaclang/compiler/symtable.py +0 -297
  421. jaclang/langserve/engine.py +0 -541
  422. jaclang/langserve/sem_manager.py +0 -379
  423. jaclang/langserve/server.py +0 -176
  424. jaclang/langserve/tests/session.py +0 -255
  425. jaclang/langserve/utils.py +0 -458
  426. jaclang/plugin/__init__.py +0 -7
  427. jaclang/plugin/builtin.py +0 -57
  428. jaclang/plugin/default.py +0 -1443
  429. jaclang/plugin/feature.py +0 -574
  430. jaclang/plugin/plugin.md +0 -471
  431. jaclang/plugin/spec.py +0 -536
  432. jaclang/plugin/tests/fixtures/impl_match_impl.jac +0 -3
  433. jaclang/plugin/tests/test_features.py +0 -56
  434. jaclang/runtimelib/context.py +0 -191
  435. jaclang/tests/fixtures/builtin_dotgen.jac +0 -42
  436. jaclang/tests/fixtures/create_dynamic_architype.jac +0 -35
  437. jaclang/tests/fixtures/dynamic_architype.jac +0 -34
  438. jaclang/tests/fixtures/impl_grab.impl.jac +0 -5
  439. jaclang/tests/fixtures/mtest.impl.jac +0 -6
  440. jaclang/tests/fixtures/registry.jac +0 -58
  441. jaclang/tests/fixtures/semstr.jac +0 -30
  442. jaclang/tests/main.jac +0 -2
  443. jaclang/utils/profiler.py +0 -62
  444. jaclang/vendor/attrs-23.2.0.dist-info/RECORD +0 -35
  445. jaclang/vendor/cattrs-23.2.3.dist-info/METADATA +0 -221
  446. jaclang/vendor/cattrs-23.2.3.dist-info/RECORD +0 -48
  447. jaclang/vendor/lark-1.1.9.dist-info/RECORD +0 -46
  448. jaclang/vendor/lark-1.1.9.dist-info/WHEEL +0 -5
  449. jaclang/vendor/mypy/__init__.py +0 -1
  450. jaclang/vendor/mypy/__main__.py +0 -37
  451. jaclang/vendor/mypy/api.py +0 -94
  452. jaclang/vendor/mypy/applytype.py +0 -172
  453. jaclang/vendor/mypy/argmap.py +0 -268
  454. jaclang/vendor/mypy/binder.py +0 -538
  455. jaclang/vendor/mypy/bogus_type.py +0 -27
  456. jaclang/vendor/mypy/build.py +0 -3562
  457. jaclang/vendor/mypy/checker.py +0 -8445
  458. jaclang/vendor/mypy/checkexpr.py +0 -6623
  459. jaclang/vendor/mypy/checkmember.py +0 -1363
  460. jaclang/vendor/mypy/checkpattern.py +0 -801
  461. jaclang/vendor/mypy/checkstrformat.py +0 -1109
  462. jaclang/vendor/mypy/config_parser.py +0 -670
  463. jaclang/vendor/mypy/constant_fold.py +0 -187
  464. jaclang/vendor/mypy/constraints.py +0 -1636
  465. jaclang/vendor/mypy/copytype.py +0 -133
  466. jaclang/vendor/mypy/defaults.py +0 -46
  467. jaclang/vendor/mypy/dmypy/__main__.py +0 -6
  468. jaclang/vendor/mypy/dmypy/client.py +0 -749
  469. jaclang/vendor/mypy/dmypy_os.py +0 -42
  470. jaclang/vendor/mypy/dmypy_server.py +0 -1107
  471. jaclang/vendor/mypy/dmypy_util.py +0 -117
  472. jaclang/vendor/mypy/erasetype.py +0 -278
  473. jaclang/vendor/mypy/errorcodes.py +0 -291
  474. jaclang/vendor/mypy/errors.py +0 -1280
  475. jaclang/vendor/mypy/evalexpr.py +0 -205
  476. jaclang/vendor/mypy/expandtype.py +0 -524
  477. jaclang/vendor/mypy/exprtotype.py +0 -209
  478. jaclang/vendor/mypy/fastparse.py +0 -2147
  479. jaclang/vendor/mypy/find_sources.py +0 -243
  480. jaclang/vendor/mypy/fixup.py +0 -428
  481. jaclang/vendor/mypy/freetree.py +0 -23
  482. jaclang/vendor/mypy/fscache.py +0 -309
  483. jaclang/vendor/mypy/fswatcher.py +0 -106
  484. jaclang/vendor/mypy/gclogger.py +0 -47
  485. jaclang/vendor/mypy/git.py +0 -34
  486. jaclang/vendor/mypy/graph_utils.py +0 -112
  487. jaclang/vendor/mypy/indirection.py +0 -121
  488. jaclang/vendor/mypy/infer.py +0 -75
  489. jaclang/vendor/mypy/inspections.py +0 -627
  490. jaclang/vendor/mypy/ipc.py +0 -310
  491. jaclang/vendor/mypy/join.py +0 -871
  492. jaclang/vendor/mypy/literals.py +0 -306
  493. jaclang/vendor/mypy/lookup.py +0 -61
  494. jaclang/vendor/mypy/main.py +0 -1574
  495. jaclang/vendor/mypy/maptype.py +0 -106
  496. jaclang/vendor/mypy/meet.py +0 -1140
  497. jaclang/vendor/mypy/memprofile.py +0 -121
  498. jaclang/vendor/mypy/message_registry.py +0 -329
  499. jaclang/vendor/mypy/messages.py +0 -3186
  500. jaclang/vendor/mypy/metastore.py +0 -225
  501. jaclang/vendor/mypy/mixedtraverser.py +0 -112
  502. jaclang/vendor/mypy/modulefinder.py +0 -875
  503. jaclang/vendor/mypy/moduleinspect.py +0 -184
  504. jaclang/vendor/mypy/mro.py +0 -62
  505. jaclang/vendor/mypy/nodes.py +0 -4115
  506. jaclang/vendor/mypy/operators.py +0 -126
  507. jaclang/vendor/mypy/options.py +0 -556
  508. jaclang/vendor/mypy/parse.py +0 -30
  509. jaclang/vendor/mypy/partially_defined.py +0 -675
  510. jaclang/vendor/mypy/patterns.py +0 -150
  511. jaclang/vendor/mypy/plugin.py +0 -901
  512. jaclang/vendor/mypy/plugins/attrs.py +0 -1166
  513. jaclang/vendor/mypy/plugins/common.py +0 -440
  514. jaclang/vendor/mypy/plugins/ctypes.py +0 -245
  515. jaclang/vendor/mypy/plugins/dataclasses.py +0 -1108
  516. jaclang/vendor/mypy/plugins/default.py +0 -531
  517. jaclang/vendor/mypy/plugins/enums.py +0 -259
  518. jaclang/vendor/mypy/plugins/functools.py +0 -104
  519. jaclang/vendor/mypy/plugins/proper_plugin.py +0 -175
  520. jaclang/vendor/mypy/plugins/singledispatch.py +0 -224
  521. jaclang/vendor/mypy/py.typed +0 -1
  522. jaclang/vendor/mypy/pyinfo.py +0 -78
  523. jaclang/vendor/mypy/reachability.py +0 -362
  524. jaclang/vendor/mypy/refinfo.py +0 -92
  525. jaclang/vendor/mypy/renaming.py +0 -568
  526. jaclang/vendor/mypy/report.py +0 -924
  527. jaclang/vendor/mypy/scope.py +0 -125
  528. jaclang/vendor/mypy/semanal.py +0 -7187
  529. jaclang/vendor/mypy/semanal_classprop.py +0 -187
  530. jaclang/vendor/mypy/semanal_enum.py +0 -253
  531. jaclang/vendor/mypy/semanal_infer.py +0 -128
  532. jaclang/vendor/mypy/semanal_main.py +0 -511
  533. jaclang/vendor/mypy/semanal_namedtuple.py +0 -670
  534. jaclang/vendor/mypy/semanal_newtype.py +0 -273
  535. jaclang/vendor/mypy/semanal_pass1.py +0 -156
  536. jaclang/vendor/mypy/semanal_shared.py +0 -490
  537. jaclang/vendor/mypy/semanal_typeargs.py +0 -265
  538. jaclang/vendor/mypy/semanal_typeddict.py +0 -575
  539. jaclang/vendor/mypy/server/astdiff.py +0 -518
  540. jaclang/vendor/mypy/server/astmerge.py +0 -562
  541. jaclang/vendor/mypy/server/aststrip.py +0 -281
  542. jaclang/vendor/mypy/server/deps.py +0 -1137
  543. jaclang/vendor/mypy/server/mergecheck.py +0 -83
  544. jaclang/vendor/mypy/server/objgraph.py +0 -101
  545. jaclang/vendor/mypy/server/subexpr.py +0 -198
  546. jaclang/vendor/mypy/server/target.py +0 -11
  547. jaclang/vendor/mypy/server/trigger.py +0 -26
  548. jaclang/vendor/mypy/server/update.py +0 -1339
  549. jaclang/vendor/mypy/sharedparse.py +0 -112
  550. jaclang/vendor/mypy/solve.py +0 -562
  551. jaclang/vendor/mypy/split_namespace.py +0 -35
  552. jaclang/vendor/mypy/state.py +0 -28
  553. jaclang/vendor/mypy/stats.py +0 -489
  554. jaclang/vendor/mypy/strconv.py +0 -641
  555. jaclang/vendor/mypy/stubdoc.py +0 -491
  556. jaclang/vendor/mypy/stubgen.py +0 -1886
  557. jaclang/vendor/mypy/stubgenc.py +0 -993
  558. jaclang/vendor/mypy/stubinfo.py +0 -173
  559. jaclang/vendor/mypy/stubtest.py +0 -2079
  560. jaclang/vendor/mypy/stubutil.py +0 -834
  561. jaclang/vendor/mypy/subtypes.py +0 -1980
  562. jaclang/vendor/mypy/suggestions.py +0 -1046
  563. jaclang/vendor/mypy/test/config.py +0 -28
  564. jaclang/vendor/mypy/test/data.py +0 -821
  565. jaclang/vendor/mypy/test/helpers.py +0 -476
  566. jaclang/vendor/mypy/test/meta/_pytest.py +0 -72
  567. jaclang/vendor/mypy/test/meta/test_diff_helper.py +0 -47
  568. jaclang/vendor/mypy/test/meta/test_parse_data.py +0 -73
  569. jaclang/vendor/mypy/test/meta/test_update_data.py +0 -135
  570. jaclang/vendor/mypy/test/test_find_sources.py +0 -376
  571. jaclang/vendor/mypy/test/test_ref_info.py +0 -45
  572. jaclang/vendor/mypy/test/testapi.py +0 -45
  573. jaclang/vendor/mypy/test/testargs.py +0 -77
  574. jaclang/vendor/mypy/test/testcheck.py +0 -322
  575. jaclang/vendor/mypy/test/testcmdline.py +0 -152
  576. jaclang/vendor/mypy/test/testconstraints.py +0 -134
  577. jaclang/vendor/mypy/test/testdaemon.py +0 -132
  578. jaclang/vendor/mypy/test/testdeps.py +0 -77
  579. jaclang/vendor/mypy/test/testdiff.py +0 -67
  580. jaclang/vendor/mypy/test/testerrorstream.py +0 -46
  581. jaclang/vendor/mypy/test/testfinegrained.py +0 -438
  582. jaclang/vendor/mypy/test/testfinegrainedcache.py +0 -18
  583. jaclang/vendor/mypy/test/testformatter.py +0 -85
  584. jaclang/vendor/mypy/test/testfscache.py +0 -101
  585. jaclang/vendor/mypy/test/testgraph.py +0 -83
  586. jaclang/vendor/mypy/test/testinfer.py +0 -373
  587. jaclang/vendor/mypy/test/testipc.py +0 -119
  588. jaclang/vendor/mypy/test/testmerge.py +0 -238
  589. jaclang/vendor/mypy/test/testmodulefinder.py +0 -278
  590. jaclang/vendor/mypy/test/testmypyc.py +0 -14
  591. jaclang/vendor/mypy/test/testparse.py +0 -107
  592. jaclang/vendor/mypy/test/testpep561.py +0 -211
  593. jaclang/vendor/mypy/test/testpythoneval.py +0 -117
  594. jaclang/vendor/mypy/test/testreports.py +0 -55
  595. jaclang/vendor/mypy/test/testsemanal.py +0 -209
  596. jaclang/vendor/mypy/test/testsolve.py +0 -285
  597. jaclang/vendor/mypy/test/teststubgen.py +0 -1412
  598. jaclang/vendor/mypy/test/teststubinfo.py +0 -12
  599. jaclang/vendor/mypy/test/teststubtest.py +0 -2492
  600. jaclang/vendor/mypy/test/testsubtypes.py +0 -303
  601. jaclang/vendor/mypy/test/testtransform.py +0 -64
  602. jaclang/vendor/mypy/test/testtypegen.py +0 -83
  603. jaclang/vendor/mypy/test/testtypes.py +0 -1551
  604. jaclang/vendor/mypy/test/testutil.py +0 -111
  605. jaclang/vendor/mypy/test/typefixture.py +0 -415
  606. jaclang/vendor/mypy/test/update_data.py +0 -87
  607. jaclang/vendor/mypy/test/visitors.py +0 -63
  608. jaclang/vendor/mypy/traverser.py +0 -961
  609. jaclang/vendor/mypy/treetransform.py +0 -800
  610. jaclang/vendor/mypy/tvar_scope.py +0 -169
  611. jaclang/vendor/mypy/type_visitor.py +0 -564
  612. jaclang/vendor/mypy/typeanal.py +0 -2596
  613. jaclang/vendor/mypy/typeops.py +0 -1082
  614. jaclang/vendor/mypy/types.py +0 -3708
  615. jaclang/vendor/mypy/types_utils.py +0 -166
  616. jaclang/vendor/mypy/typeshed/LICENSE +0 -237
  617. jaclang/vendor/mypy/typeshed/stdlib/VERSIONS +0 -309
  618. jaclang/vendor/mypy/typeshed/stdlib/__future__.pyi +0 -36
  619. jaclang/vendor/mypy/typeshed/stdlib/__main__.pyi +0 -3
  620. jaclang/vendor/mypy/typeshed/stdlib/_ast.pyi +0 -591
  621. jaclang/vendor/mypy/typeshed/stdlib/_bisect.pyi +0 -84
  622. jaclang/vendor/mypy/typeshed/stdlib/_bootlocale.pyi +0 -1
  623. jaclang/vendor/mypy/typeshed/stdlib/_codecs.pyi +0 -133
  624. jaclang/vendor/mypy/typeshed/stdlib/_collections_abc.pyi +0 -94
  625. jaclang/vendor/mypy/typeshed/stdlib/_compat_pickle.pyi +0 -8
  626. jaclang/vendor/mypy/typeshed/stdlib/_compression.pyi +0 -25
  627. jaclang/vendor/mypy/typeshed/stdlib/_csv.pyi +0 -90
  628. jaclang/vendor/mypy/typeshed/stdlib/_ctypes.pyi +0 -207
  629. jaclang/vendor/mypy/typeshed/stdlib/_curses.pyi +0 -566
  630. jaclang/vendor/mypy/typeshed/stdlib/_decimal.pyi +0 -281
  631. jaclang/vendor/mypy/typeshed/stdlib/_dummy_thread.pyi +0 -33
  632. jaclang/vendor/mypy/typeshed/stdlib/_dummy_threading.pyi +0 -164
  633. jaclang/vendor/mypy/typeshed/stdlib/_heapq.pyi +0 -11
  634. jaclang/vendor/mypy/typeshed/stdlib/_imp.pyi +0 -28
  635. jaclang/vendor/mypy/typeshed/stdlib/_json.pyi +0 -49
  636. jaclang/vendor/mypy/typeshed/stdlib/_locale.pyi +0 -100
  637. jaclang/vendor/mypy/typeshed/stdlib/_lsprof.pyi +0 -35
  638. jaclang/vendor/mypy/typeshed/stdlib/_markupbase.pyi +0 -16
  639. jaclang/vendor/mypy/typeshed/stdlib/_msi.pyi +0 -92
  640. jaclang/vendor/mypy/typeshed/stdlib/_operator.pyi +0 -147
  641. jaclang/vendor/mypy/typeshed/stdlib/_osx_support.pyi +0 -34
  642. jaclang/vendor/mypy/typeshed/stdlib/_posixsubprocess.pyi +0 -33
  643. jaclang/vendor/mypy/typeshed/stdlib/_py_abc.pyi +0 -14
  644. jaclang/vendor/mypy/typeshed/stdlib/_pydecimal.pyi +0 -43
  645. jaclang/vendor/mypy/typeshed/stdlib/_random.pyi +0 -12
  646. jaclang/vendor/mypy/typeshed/stdlib/_sitebuiltins.pyi +0 -16
  647. jaclang/vendor/mypy/typeshed/stdlib/_socket.pyi +0 -803
  648. jaclang/vendor/mypy/typeshed/stdlib/_stat.pyi +0 -103
  649. jaclang/vendor/mypy/typeshed/stdlib/_thread.pyi +0 -59
  650. jaclang/vendor/mypy/typeshed/stdlib/_threading_local.pyi +0 -17
  651. jaclang/vendor/mypy/typeshed/stdlib/_tkinter.pyi +0 -121
  652. jaclang/vendor/mypy/typeshed/stdlib/_tracemalloc.pyi +0 -17
  653. jaclang/vendor/mypy/typeshed/stdlib/_typeshed/__init__.pyi +0 -347
  654. jaclang/vendor/mypy/typeshed/stdlib/_typeshed/dbapi.pyi +0 -37
  655. jaclang/vendor/mypy/typeshed/stdlib/_typeshed/wsgi.pyi +0 -44
  656. jaclang/vendor/mypy/typeshed/stdlib/_typeshed/xml.pyi +0 -9
  657. jaclang/vendor/mypy/typeshed/stdlib/_warnings.pyi +0 -55
  658. jaclang/vendor/mypy/typeshed/stdlib/_weakref.pyi +0 -41
  659. jaclang/vendor/mypy/typeshed/stdlib/_weakrefset.pyi +0 -51
  660. jaclang/vendor/mypy/typeshed/stdlib/_winapi.pyi +0 -255
  661. jaclang/vendor/mypy/typeshed/stdlib/abc.pyi +0 -51
  662. jaclang/vendor/mypy/typeshed/stdlib/aifc.pyi +0 -91
  663. jaclang/vendor/mypy/typeshed/stdlib/antigravity.pyi +0 -3
  664. jaclang/vendor/mypy/typeshed/stdlib/argparse.pyi +0 -595
  665. jaclang/vendor/mypy/typeshed/stdlib/array.pyi +0 -92
  666. jaclang/vendor/mypy/typeshed/stdlib/ast.pyi +0 -277
  667. jaclang/vendor/mypy/typeshed/stdlib/asynchat.pyi +0 -21
  668. jaclang/vendor/mypy/typeshed/stdlib/asyncio/__init__.pyi +0 -41
  669. jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_events.pyi +0 -440
  670. jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_futures.pyi +0 -19
  671. jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_subprocess.pyi +0 -63
  672. jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_tasks.pyi +0 -9
  673. jaclang/vendor/mypy/typeshed/stdlib/asyncio/constants.pyi +0 -20
  674. jaclang/vendor/mypy/typeshed/stdlib/asyncio/coroutines.pyi +0 -26
  675. jaclang/vendor/mypy/typeshed/stdlib/asyncio/events.pyi +0 -580
  676. jaclang/vendor/mypy/typeshed/stdlib/asyncio/exceptions.pyi +0 -43
  677. jaclang/vendor/mypy/typeshed/stdlib/asyncio/format_helpers.pyi +0 -20
  678. jaclang/vendor/mypy/typeshed/stdlib/asyncio/futures.pyi +0 -57
  679. jaclang/vendor/mypy/typeshed/stdlib/asyncio/locks.pyi +0 -121
  680. jaclang/vendor/mypy/typeshed/stdlib/asyncio/log.pyi +0 -3
  681. jaclang/vendor/mypy/typeshed/stdlib/asyncio/mixins.pyi +0 -9
  682. jaclang/vendor/mypy/typeshed/stdlib/asyncio/proactor_events.pyi +0 -64
  683. jaclang/vendor/mypy/typeshed/stdlib/asyncio/protocols.pyi +0 -34
  684. jaclang/vendor/mypy/typeshed/stdlib/asyncio/queues.pyi +0 -47
  685. jaclang/vendor/mypy/typeshed/stdlib/asyncio/runners.pyi +0 -32
  686. jaclang/vendor/mypy/typeshed/stdlib/asyncio/selector_events.pyi +0 -8
  687. jaclang/vendor/mypy/typeshed/stdlib/asyncio/sslproto.pyi +0 -165
  688. jaclang/vendor/mypy/typeshed/stdlib/asyncio/staggered.pyi +0 -10
  689. jaclang/vendor/mypy/typeshed/stdlib/asyncio/streams.pyi +0 -153
  690. jaclang/vendor/mypy/typeshed/stdlib/asyncio/subprocess.pyi +0 -229
  691. jaclang/vendor/mypy/typeshed/stdlib/asyncio/taskgroups.pyi +0 -25
  692. jaclang/vendor/mypy/typeshed/stdlib/asyncio/tasks.pyi +0 -497
  693. jaclang/vendor/mypy/typeshed/stdlib/asyncio/threads.pyi +0 -9
  694. jaclang/vendor/mypy/typeshed/stdlib/asyncio/timeouts.pyi +0 -19
  695. jaclang/vendor/mypy/typeshed/stdlib/asyncio/transports.pyi +0 -47
  696. jaclang/vendor/mypy/typeshed/stdlib/asyncio/trsock.pyi +0 -94
  697. jaclang/vendor/mypy/typeshed/stdlib/asyncio/unix_events.pyi +0 -196
  698. jaclang/vendor/mypy/typeshed/stdlib/asyncio/windows_events.pyi +0 -85
  699. jaclang/vendor/mypy/typeshed/stdlib/asyncio/windows_utils.pyi +0 -49
  700. jaclang/vendor/mypy/typeshed/stdlib/asyncore.pyi +0 -90
  701. jaclang/vendor/mypy/typeshed/stdlib/atexit.pyi +0 -12
  702. jaclang/vendor/mypy/typeshed/stdlib/audioop.pyi +0 -43
  703. jaclang/vendor/mypy/typeshed/stdlib/base64.pyi +0 -59
  704. jaclang/vendor/mypy/typeshed/stdlib/bdb.pyi +0 -102
  705. jaclang/vendor/mypy/typeshed/stdlib/binascii.pyi +0 -36
  706. jaclang/vendor/mypy/typeshed/stdlib/binhex.pyi +0 -45
  707. jaclang/vendor/mypy/typeshed/stdlib/bisect.pyi +0 -4
  708. jaclang/vendor/mypy/typeshed/stdlib/builtins.pyi +0 -1936
  709. jaclang/vendor/mypy/typeshed/stdlib/bz2.pyi +0 -146
  710. jaclang/vendor/mypy/typeshed/stdlib/cProfile.pyi +0 -31
  711. jaclang/vendor/mypy/typeshed/stdlib/calendar.pyi +0 -208
  712. jaclang/vendor/mypy/typeshed/stdlib/cgi.pyi +0 -118
  713. jaclang/vendor/mypy/typeshed/stdlib/cgitb.pyi +0 -32
  714. jaclang/vendor/mypy/typeshed/stdlib/chunk.pyi +0 -20
  715. jaclang/vendor/mypy/typeshed/stdlib/cmath.pyi +0 -36
  716. jaclang/vendor/mypy/typeshed/stdlib/cmd.pyi +0 -45
  717. jaclang/vendor/mypy/typeshed/stdlib/code.pyi +0 -33
  718. jaclang/vendor/mypy/typeshed/stdlib/codecs.pyi +0 -285
  719. jaclang/vendor/mypy/typeshed/stdlib/codeop.pyi +0 -13
  720. jaclang/vendor/mypy/typeshed/stdlib/collections/__init__.pyi +0 -485
  721. jaclang/vendor/mypy/typeshed/stdlib/collections/abc.pyi +0 -2
  722. jaclang/vendor/mypy/typeshed/stdlib/colorsys.pyi +0 -13
  723. jaclang/vendor/mypy/typeshed/stdlib/compileall.pyi +0 -111
  724. jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/__init__.pyi +0 -32
  725. jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/_base.pyi +0 -126
  726. jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/process.pyi +0 -233
  727. jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/thread.pyi +0 -80
  728. jaclang/vendor/mypy/typeshed/stdlib/configparser.pyi +0 -313
  729. jaclang/vendor/mypy/typeshed/stdlib/contextlib.pyi +0 -208
  730. jaclang/vendor/mypy/typeshed/stdlib/contextvars.pyi +0 -63
  731. jaclang/vendor/mypy/typeshed/stdlib/copy.pyi +0 -16
  732. jaclang/vendor/mypy/typeshed/stdlib/copyreg.pyi +0 -21
  733. jaclang/vendor/mypy/typeshed/stdlib/crypt.pyi +0 -12
  734. jaclang/vendor/mypy/typeshed/stdlib/csv.pyi +0 -147
  735. jaclang/vendor/mypy/typeshed/stdlib/ctypes/__init__.pyi +0 -187
  736. jaclang/vendor/mypy/typeshed/stdlib/ctypes/_endian.pyi +0 -19
  737. jaclang/vendor/mypy/typeshed/stdlib/ctypes/util.pyi +0 -6
  738. jaclang/vendor/mypy/typeshed/stdlib/ctypes/wintypes.pyi +0 -298
  739. jaclang/vendor/mypy/typeshed/stdlib/curses/__init__.pyi +0 -22
  740. jaclang/vendor/mypy/typeshed/stdlib/curses/ascii.pyi +0 -62
  741. jaclang/vendor/mypy/typeshed/stdlib/curses/has_key.pyi +0 -1
  742. jaclang/vendor/mypy/typeshed/stdlib/curses/panel.pyi +0 -22
  743. jaclang/vendor/mypy/typeshed/stdlib/curses/textpad.pyi +0 -11
  744. jaclang/vendor/mypy/typeshed/stdlib/dataclasses.pyi +0 -315
  745. jaclang/vendor/mypy/typeshed/stdlib/datetime.pyi +0 -295
  746. jaclang/vendor/mypy/typeshed/stdlib/dbm/__init__.pyi +0 -95
  747. jaclang/vendor/mypy/typeshed/stdlib/dbm/dumb.pyi +0 -31
  748. jaclang/vendor/mypy/typeshed/stdlib/dbm/gnu.pyi +0 -41
  749. jaclang/vendor/mypy/typeshed/stdlib/dbm/ndbm.pyi +0 -37
  750. jaclang/vendor/mypy/typeshed/stdlib/decimal.pyi +0 -2
  751. jaclang/vendor/mypy/typeshed/stdlib/difflib.pyi +0 -140
  752. jaclang/vendor/mypy/typeshed/stdlib/dis.pyi +0 -144
  753. jaclang/vendor/mypy/typeshed/stdlib/distutils/__init__.pyi +0 -5
  754. jaclang/vendor/mypy/typeshed/stdlib/distutils/archive_util.pyi +0 -20
  755. jaclang/vendor/mypy/typeshed/stdlib/distutils/bcppcompiler.pyi +0 -3
  756. jaclang/vendor/mypy/typeshed/stdlib/distutils/ccompiler.pyi +0 -152
  757. jaclang/vendor/mypy/typeshed/stdlib/distutils/cmd.pyi +0 -66
  758. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist.pyi +0 -25
  759. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_dumb.pyi +0 -21
  760. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_msi.pyi +0 -45
  761. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_rpm.pyi +0 -52
  762. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_wininst.pyi +0 -16
  763. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build.pyi +0 -31
  764. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_clib.pyi +0 -27
  765. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_ext.pyi +0 -50
  766. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_py.pyi +0 -44
  767. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_scripts.pyi +0 -24
  768. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/check.pyi +0 -39
  769. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/clean.pyi +0 -17
  770. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/config.pyi +0 -83
  771. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install.pyi +0 -63
  772. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_data.pyi +0 -19
  773. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_egg_info.pyi +0 -18
  774. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_headers.pyi +0 -16
  775. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_lib.pyi +0 -25
  776. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_scripts.pyi +0 -18
  777. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/register.pyi +0 -18
  778. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/sdist.pyi +0 -42
  779. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/upload.pyi +0 -17
  780. jaclang/vendor/mypy/typeshed/stdlib/distutils/config.pyi +0 -17
  781. jaclang/vendor/mypy/typeshed/stdlib/distutils/core.pyi +0 -57
  782. jaclang/vendor/mypy/typeshed/stdlib/distutils/cygwinccompiler.pyi +0 -20
  783. jaclang/vendor/mypy/typeshed/stdlib/distutils/debug.pyi +0 -1
  784. jaclang/vendor/mypy/typeshed/stdlib/distutils/dep_util.pyi +0 -3
  785. jaclang/vendor/mypy/typeshed/stdlib/distutils/dir_util.pyi +0 -13
  786. jaclang/vendor/mypy/typeshed/stdlib/distutils/dist.pyi +0 -146
  787. jaclang/vendor/mypy/typeshed/stdlib/distutils/errors.pyi +0 -19
  788. jaclang/vendor/mypy/typeshed/stdlib/distutils/extension.pyi +0 -36
  789. jaclang/vendor/mypy/typeshed/stdlib/distutils/fancy_getopt.pyi +0 -34
  790. jaclang/vendor/mypy/typeshed/stdlib/distutils/file_util.pyi +0 -14
  791. jaclang/vendor/mypy/typeshed/stdlib/distutils/filelist.pyi +0 -50
  792. jaclang/vendor/mypy/typeshed/stdlib/distutils/log.pyi +0 -25
  793. jaclang/vendor/mypy/typeshed/stdlib/distutils/msvccompiler.pyi +0 -3
  794. jaclang/vendor/mypy/typeshed/stdlib/distutils/spawn.pyi +0 -2
  795. jaclang/vendor/mypy/typeshed/stdlib/distutils/sysconfig.pyi +0 -31
  796. jaclang/vendor/mypy/typeshed/stdlib/distutils/text_file.pyi +0 -21
  797. jaclang/vendor/mypy/typeshed/stdlib/distutils/unixccompiler.pyi +0 -3
  798. jaclang/vendor/mypy/typeshed/stdlib/distutils/util.pyi +0 -46
  799. jaclang/vendor/mypy/typeshed/stdlib/distutils/version.pyi +0 -36
  800. jaclang/vendor/mypy/typeshed/stdlib/doctest.pyi +0 -248
  801. jaclang/vendor/mypy/typeshed/stdlib/dummy_threading.pyi +0 -2
  802. jaclang/vendor/mypy/typeshed/stdlib/email/__init__.pyi +0 -29
  803. jaclang/vendor/mypy/typeshed/stdlib/email/_header_value_parser.pyi +0 -392
  804. jaclang/vendor/mypy/typeshed/stdlib/email/_policybase.pyi +0 -51
  805. jaclang/vendor/mypy/typeshed/stdlib/email/base64mime.pyi +0 -13
  806. jaclang/vendor/mypy/typeshed/stdlib/email/charset.pyi +0 -34
  807. jaclang/vendor/mypy/typeshed/stdlib/email/contentmanager.pyi +0 -11
  808. jaclang/vendor/mypy/typeshed/stdlib/email/encoders.pyi +0 -8
  809. jaclang/vendor/mypy/typeshed/stdlib/email/errors.pyi +0 -39
  810. jaclang/vendor/mypy/typeshed/stdlib/email/feedparser.pyi +0 -23
  811. jaclang/vendor/mypy/typeshed/stdlib/email/generator.pyi +0 -40
  812. jaclang/vendor/mypy/typeshed/stdlib/email/header.pyi +0 -31
  813. jaclang/vendor/mypy/typeshed/stdlib/email/headerregistry.pyi +0 -178
  814. jaclang/vendor/mypy/typeshed/stdlib/email/iterators.pyi +0 -12
  815. jaclang/vendor/mypy/typeshed/stdlib/email/message.pyi +0 -165
  816. jaclang/vendor/mypy/typeshed/stdlib/email/mime/application.pyi +0 -17
  817. jaclang/vendor/mypy/typeshed/stdlib/email/mime/audio.pyi +0 -17
  818. jaclang/vendor/mypy/typeshed/stdlib/email/mime/base.pyi +0 -8
  819. jaclang/vendor/mypy/typeshed/stdlib/email/mime/image.pyi +0 -17
  820. jaclang/vendor/mypy/typeshed/stdlib/email/mime/message.pyi +0 -8
  821. jaclang/vendor/mypy/typeshed/stdlib/email/mime/multipart.pyi +0 -18
  822. jaclang/vendor/mypy/typeshed/stdlib/email/mime/nonmultipart.pyi +0 -5
  823. jaclang/vendor/mypy/typeshed/stdlib/email/mime/text.pyi +0 -9
  824. jaclang/vendor/mypy/typeshed/stdlib/email/parser.pyi +0 -26
  825. jaclang/vendor/mypy/typeshed/stdlib/email/policy.pyi +0 -38
  826. jaclang/vendor/mypy/typeshed/stdlib/email/quoprimime.pyi +0 -28
  827. jaclang/vendor/mypy/typeshed/stdlib/email/utils.pyi +0 -70
  828. jaclang/vendor/mypy/typeshed/stdlib/encodings/__init__.pyi +0 -10
  829. jaclang/vendor/mypy/typeshed/stdlib/encodings/utf_8.pyi +0 -21
  830. jaclang/vendor/mypy/typeshed/stdlib/encodings/utf_8_sig.pyi +0 -22
  831. jaclang/vendor/mypy/typeshed/stdlib/ensurepip/__init__.pyi +0 -12
  832. jaclang/vendor/mypy/typeshed/stdlib/enum.pyi +0 -320
  833. jaclang/vendor/mypy/typeshed/stdlib/errno.pyi +0 -222
  834. jaclang/vendor/mypy/typeshed/stdlib/faulthandler.pyi +0 -13
  835. jaclang/vendor/mypy/typeshed/stdlib/fcntl.pyi +0 -127
  836. jaclang/vendor/mypy/typeshed/stdlib/filecmp.pyi +0 -57
  837. jaclang/vendor/mypy/typeshed/stdlib/fileinput.pyi +0 -213
  838. jaclang/vendor/mypy/typeshed/stdlib/fnmatch.pyi +0 -9
  839. jaclang/vendor/mypy/typeshed/stdlib/formatter.pyi +0 -88
  840. jaclang/vendor/mypy/typeshed/stdlib/fractions.pyi +0 -150
  841. jaclang/vendor/mypy/typeshed/stdlib/ftplib.pyi +0 -178
  842. jaclang/vendor/mypy/typeshed/stdlib/functools.pyi +0 -213
  843. jaclang/vendor/mypy/typeshed/stdlib/gc.pyi +0 -37
  844. jaclang/vendor/mypy/typeshed/stdlib/genericpath.pyi +0 -52
  845. jaclang/vendor/mypy/typeshed/stdlib/getopt.pyi +0 -11
  846. jaclang/vendor/mypy/typeshed/stdlib/getpass.pyi +0 -8
  847. jaclang/vendor/mypy/typeshed/stdlib/gettext.pyi +0 -169
  848. jaclang/vendor/mypy/typeshed/stdlib/glob.pyi +0 -42
  849. jaclang/vendor/mypy/typeshed/stdlib/graphlib.pyi +0 -28
  850. jaclang/vendor/mypy/typeshed/stdlib/grp.pyi +0 -22
  851. jaclang/vendor/mypy/typeshed/stdlib/gzip.pyi +0 -160
  852. jaclang/vendor/mypy/typeshed/stdlib/hashlib.pyi +0 -167
  853. jaclang/vendor/mypy/typeshed/stdlib/heapq.pyi +0 -17
  854. jaclang/vendor/mypy/typeshed/stdlib/hmac.pyi +0 -38
  855. jaclang/vendor/mypy/typeshed/stdlib/html/__init__.pyi +0 -6
  856. jaclang/vendor/mypy/typeshed/stdlib/html/entities.pyi +0 -6
  857. jaclang/vendor/mypy/typeshed/stdlib/html/parser.pyi +0 -34
  858. jaclang/vendor/mypy/typeshed/stdlib/http/__init__.pyi +0 -105
  859. jaclang/vendor/mypy/typeshed/stdlib/http/client.pyi +0 -259
  860. jaclang/vendor/mypy/typeshed/stdlib/http/cookiejar.pyi +0 -159
  861. jaclang/vendor/mypy/typeshed/stdlib/http/cookies.pyi +0 -60
  862. jaclang/vendor/mypy/typeshed/stdlib/http/server.pyi +0 -83
  863. jaclang/vendor/mypy/typeshed/stdlib/imaplib.pyi +0 -168
  864. jaclang/vendor/mypy/typeshed/stdlib/imghdr.pyi +0 -17
  865. jaclang/vendor/mypy/typeshed/stdlib/imp.pyi +0 -62
  866. jaclang/vendor/mypy/typeshed/stdlib/importlib/__init__.pyi +0 -24
  867. jaclang/vendor/mypy/typeshed/stdlib/importlib/_abc.pyi +0 -15
  868. jaclang/vendor/mypy/typeshed/stdlib/importlib/abc.pyi +0 -172
  869. jaclang/vendor/mypy/typeshed/stdlib/importlib/machinery.pyi +0 -179
  870. jaclang/vendor/mypy/typeshed/stdlib/importlib/metadata/__init__.pyi +0 -285
  871. jaclang/vendor/mypy/typeshed/stdlib/importlib/metadata/_meta.pyi +0 -49
  872. jaclang/vendor/mypy/typeshed/stdlib/importlib/readers.pyi +0 -68
  873. jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/__init__.pyi +0 -46
  874. jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/abc.pyi +0 -12
  875. jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/readers.pyi +0 -14
  876. jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/simple.pyi +0 -56
  877. jaclang/vendor/mypy/typeshed/stdlib/importlib/simple.pyi +0 -11
  878. jaclang/vendor/mypy/typeshed/stdlib/importlib/util.pyi +0 -43
  879. jaclang/vendor/mypy/typeshed/stdlib/inspect.pyi +0 -632
  880. jaclang/vendor/mypy/typeshed/stdlib/io.pyi +0 -238
  881. jaclang/vendor/mypy/typeshed/stdlib/ipaddress.pyi +0 -208
  882. jaclang/vendor/mypy/typeshed/stdlib/itertools.pyi +0 -273
  883. jaclang/vendor/mypy/typeshed/stdlib/json/__init__.pyi +0 -61
  884. jaclang/vendor/mypy/typeshed/stdlib/json/decoder.pyi +0 -32
  885. jaclang/vendor/mypy/typeshed/stdlib/json/encoder.pyi +0 -40
  886. jaclang/vendor/mypy/typeshed/stdlib/json/tool.pyi +0 -1
  887. jaclang/vendor/mypy/typeshed/stdlib/keyword.pyi +0 -21
  888. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/btm_matcher.pyi +0 -28
  889. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixer_base.pyi +0 -42
  890. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_apply.pyi +0 -8
  891. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_asserts.pyi +0 -10
  892. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_basestring.pyi +0 -8
  893. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_buffer.pyi +0 -8
  894. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_dict.pyi +0 -16
  895. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_except.pyi +0 -14
  896. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_exec.pyi +0 -8
  897. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_execfile.pyi +0 -8
  898. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_exitfunc.pyi +0 -13
  899. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_filter.pyi +0 -9
  900. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_funcattrs.pyi +0 -8
  901. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_future.pyi +0 -8
  902. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_getcwdu.pyi +0 -8
  903. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_has_key.pyi +0 -8
  904. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_idioms.pyi +0 -15
  905. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_import.pyi +0 -16
  906. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_imports.pyi +0 -21
  907. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_imports2.pyi +0 -6
  908. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_input.pyi +0 -11
  909. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_intern.pyi +0 -9
  910. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_isinstance.pyi +0 -8
  911. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_itertools.pyi +0 -9
  912. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_itertools_imports.pyi +0 -7
  913. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_long.pyi +0 -7
  914. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_map.pyi +0 -9
  915. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_metaclass.pyi +0 -17
  916. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_methodattrs.pyi +0 -10
  917. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_ne.pyi +0 -8
  918. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_next.pyi +0 -19
  919. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_nonzero.pyi +0 -8
  920. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_numliterals.pyi +0 -8
  921. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_operator.pyi +0 -12
  922. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_paren.pyi +0 -8
  923. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_print.pyi +0 -12
  924. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_raise.pyi +0 -8
  925. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_raw_input.pyi +0 -8
  926. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_reduce.pyi +0 -8
  927. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_reload.pyi +0 -9
  928. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_renames.pyi +0 -17
  929. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_repr.pyi +0 -8
  930. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_set_literal.pyi +0 -7
  931. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_standarderror.pyi +0 -8
  932. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_sys_exc.pyi +0 -9
  933. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_throw.pyi +0 -8
  934. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_tuple_params.pyi +0 -17
  935. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_types.pyi +0 -8
  936. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_unicode.pyi +0 -12
  937. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_urllib.pyi +0 -15
  938. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_ws_comma.pyi +0 -12
  939. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_xrange.pyi +0 -20
  940. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_xreadlines.pyi +0 -8
  941. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_zip.pyi +0 -9
  942. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/main.pyi +0 -42
  943. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/__init__.pyi +0 -9
  944. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/driver.pyi +0 -27
  945. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/grammar.pyi +0 -24
  946. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/literals.pyi +0 -7
  947. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/parse.pyi +0 -30
  948. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/pgen.pyi +0 -50
  949. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/token.pyi +0 -67
  950. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/tokenize.pyi +0 -96
  951. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pygram.pyi +0 -114
  952. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pytree.pyi +0 -117
  953. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/refactor.pyi +0 -82
  954. jaclang/vendor/mypy/typeshed/stdlib/linecache.pyi +0 -23
  955. jaclang/vendor/mypy/typeshed/stdlib/locale.pyi +0 -152
  956. jaclang/vendor/mypy/typeshed/stdlib/logging/__init__.pyi +0 -658
  957. jaclang/vendor/mypy/typeshed/stdlib/logging/config.pyi +0 -134
  958. jaclang/vendor/mypy/typeshed/stdlib/logging/handlers.pyi +0 -275
  959. jaclang/vendor/mypy/typeshed/stdlib/lzma.pyi +0 -197
  960. jaclang/vendor/mypy/typeshed/stdlib/mailbox.pyi +0 -256
  961. jaclang/vendor/mypy/typeshed/stdlib/mailcap.pyi +0 -11
  962. jaclang/vendor/mypy/typeshed/stdlib/marshal.pyi +0 -33
  963. jaclang/vendor/mypy/typeshed/stdlib/math.pyi +0 -125
  964. jaclang/vendor/mypy/typeshed/stdlib/mimetypes.pyi +0 -46
  965. jaclang/vendor/mypy/typeshed/stdlib/mmap.pyi +0 -113
  966. jaclang/vendor/mypy/typeshed/stdlib/modulefinder.pyi +0 -66
  967. jaclang/vendor/mypy/typeshed/stdlib/msilib/__init__.pyi +0 -177
  968. jaclang/vendor/mypy/typeshed/stdlib/msilib/schema.pyi +0 -94
  969. jaclang/vendor/mypy/typeshed/stdlib/msilib/sequence.pyi +0 -13
  970. jaclang/vendor/mypy/typeshed/stdlib/msilib/text.pyi +0 -7
  971. jaclang/vendor/mypy/typeshed/stdlib/msvcrt.pyi +0 -32
  972. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/__init__.pyi +0 -90
  973. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/connection.pyi +0 -75
  974. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/context.pyi +0 -189
  975. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/dummy/__init__.pyi +0 -77
  976. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/dummy/connection.pyi +0 -39
  977. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/forkserver.pyi +0 -31
  978. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/heap.pyi +0 -36
  979. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/managers.pyi +0 -212
  980. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/pool.pyi +0 -103
  981. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_fork.pyi +0 -23
  982. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_forkserver.pyi +0 -16
  983. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_spawn_posix.pyi +0 -20
  984. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_spawn_win32.pyi +0 -30
  985. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/process.pyi +0 -39
  986. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/queues.pyi +0 -41
  987. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/reduction.pyi +0 -90
  988. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/resource_sharer.pyi +0 -20
  989. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/resource_tracker.pyi +0 -18
  990. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/shared_memory.pyi +0 -40
  991. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/sharedctypes.pyi +0 -107
  992. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/spawn.pyi +0 -32
  993. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/synchronize.pyi +0 -54
  994. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/util.pyi +0 -98
  995. jaclang/vendor/mypy/typeshed/stdlib/netrc.pyi +0 -23
  996. jaclang/vendor/mypy/typeshed/stdlib/nis.pyi +0 -9
  997. jaclang/vendor/mypy/typeshed/stdlib/nntplib.pyi +0 -125
  998. jaclang/vendor/mypy/typeshed/stdlib/nt.pyi +0 -111
  999. jaclang/vendor/mypy/typeshed/stdlib/ntpath.pyi +0 -119
  1000. jaclang/vendor/mypy/typeshed/stdlib/nturl2path.pyi +0 -2
  1001. jaclang/vendor/mypy/typeshed/stdlib/numbers.pyi +0 -209
  1002. jaclang/vendor/mypy/typeshed/stdlib/opcode.pyi +0 -59
  1003. jaclang/vendor/mypy/typeshed/stdlib/operator.pyi +0 -110
  1004. jaclang/vendor/mypy/typeshed/stdlib/optparse.pyi +0 -255
  1005. jaclang/vendor/mypy/typeshed/stdlib/os/__init__.pyi +0 -1157
  1006. jaclang/vendor/mypy/typeshed/stdlib/os/path.pyi +0 -8
  1007. jaclang/vendor/mypy/typeshed/stdlib/ossaudiodev.pyi +0 -131
  1008. jaclang/vendor/mypy/typeshed/stdlib/parser.pyi +0 -24
  1009. jaclang/vendor/mypy/typeshed/stdlib/pathlib.pyi +0 -232
  1010. jaclang/vendor/mypy/typeshed/stdlib/pdb.pyi +0 -181
  1011. jaclang/vendor/mypy/typeshed/stdlib/pickle.pyi +0 -271
  1012. jaclang/vendor/mypy/typeshed/stdlib/pickletools.pyi +0 -167
  1013. jaclang/vendor/mypy/typeshed/stdlib/pipes.pyi +0 -16
  1014. jaclang/vendor/mypy/typeshed/stdlib/pkgutil.pyi +0 -53
  1015. jaclang/vendor/mypy/typeshed/stdlib/platform.pyi +0 -42
  1016. jaclang/vendor/mypy/typeshed/stdlib/plistlib.pyi +0 -113
  1017. jaclang/vendor/mypy/typeshed/stdlib/poplib.pyi +0 -71
  1018. jaclang/vendor/mypy/typeshed/stdlib/posix.pyi +0 -361
  1019. jaclang/vendor/mypy/typeshed/stdlib/posixpath.pyi +0 -161
  1020. jaclang/vendor/mypy/typeshed/stdlib/pprint.pyi +0 -112
  1021. jaclang/vendor/mypy/typeshed/stdlib/profile.pyi +0 -31
  1022. jaclang/vendor/mypy/typeshed/stdlib/pstats.pyi +0 -80
  1023. jaclang/vendor/mypy/typeshed/stdlib/pty.pyi +0 -19
  1024. jaclang/vendor/mypy/typeshed/stdlib/pwd.pyi +0 -28
  1025. jaclang/vendor/mypy/typeshed/stdlib/py_compile.pyi +0 -34
  1026. jaclang/vendor/mypy/typeshed/stdlib/pyclbr.pyi +0 -74
  1027. jaclang/vendor/mypy/typeshed/stdlib/pydoc.pyi +0 -261
  1028. jaclang/vendor/mypy/typeshed/stdlib/pydoc_data/__init__.pyi +0 -0
  1029. jaclang/vendor/mypy/typeshed/stdlib/pydoc_data/topics.pyi +0 -1
  1030. jaclang/vendor/mypy/typeshed/stdlib/pyexpat/__init__.pyi +0 -85
  1031. jaclang/vendor/mypy/typeshed/stdlib/pyexpat/errors.pyi +0 -49
  1032. jaclang/vendor/mypy/typeshed/stdlib/pyexpat/model.pyi +0 -11
  1033. jaclang/vendor/mypy/typeshed/stdlib/queue.pyi +0 -66
  1034. jaclang/vendor/mypy/typeshed/stdlib/quopri.pyi +0 -11
  1035. jaclang/vendor/mypy/typeshed/stdlib/random.pyi +0 -138
  1036. jaclang/vendor/mypy/typeshed/stdlib/re.pyi +0 -290
  1037. jaclang/vendor/mypy/typeshed/stdlib/readline.pyi +0 -36
  1038. jaclang/vendor/mypy/typeshed/stdlib/reprlib.pyi +0 -65
  1039. jaclang/vendor/mypy/typeshed/stdlib/resource.pyi +0 -94
  1040. jaclang/vendor/mypy/typeshed/stdlib/rlcompleter.pyi +0 -9
  1041. jaclang/vendor/mypy/typeshed/stdlib/runpy.pyi +0 -24
  1042. jaclang/vendor/mypy/typeshed/stdlib/sched.pyi +0 -42
  1043. jaclang/vendor/mypy/typeshed/stdlib/secrets.pyi +0 -15
  1044. jaclang/vendor/mypy/typeshed/stdlib/select.pyi +0 -155
  1045. jaclang/vendor/mypy/typeshed/stdlib/selectors.pyi +0 -67
  1046. jaclang/vendor/mypy/typeshed/stdlib/shelve.pyi +0 -46
  1047. jaclang/vendor/mypy/typeshed/stdlib/shlex.pyi +0 -63
  1048. jaclang/vendor/mypy/typeshed/stdlib/shutil.pyi +0 -185
  1049. jaclang/vendor/mypy/typeshed/stdlib/signal.pyi +0 -188
  1050. jaclang/vendor/mypy/typeshed/stdlib/site.pyi +0 -27
  1051. jaclang/vendor/mypy/typeshed/stdlib/smtpd.pyi +0 -91
  1052. jaclang/vendor/mypy/typeshed/stdlib/smtplib.pyi +0 -204
  1053. jaclang/vendor/mypy/typeshed/stdlib/sndhdr.pyi +0 -14
  1054. jaclang/vendor/mypy/typeshed/stdlib/socket.pyi +0 -825
  1055. jaclang/vendor/mypy/typeshed/stdlib/socketserver.pyi +0 -168
  1056. jaclang/vendor/mypy/typeshed/stdlib/spwd.pyi +0 -41
  1057. jaclang/vendor/mypy/typeshed/stdlib/sqlite3/__init__.pyi +0 -1
  1058. jaclang/vendor/mypy/typeshed/stdlib/sqlite3/dbapi2.pyi +0 -551
  1059. jaclang/vendor/mypy/typeshed/stdlib/sre_compile.pyi +0 -11
  1060. jaclang/vendor/mypy/typeshed/stdlib/sre_constants.pyi +0 -130
  1061. jaclang/vendor/mypy/typeshed/stdlib/sre_parse.pyi +0 -104
  1062. jaclang/vendor/mypy/typeshed/stdlib/ssl.pyi +0 -537
  1063. jaclang/vendor/mypy/typeshed/stdlib/stat.pyi +0 -1
  1064. jaclang/vendor/mypy/typeshed/stdlib/statistics.pyi +0 -132
  1065. jaclang/vendor/mypy/typeshed/stdlib/string.pyi +0 -83
  1066. jaclang/vendor/mypy/typeshed/stdlib/stringprep.pyi +0 -27
  1067. jaclang/vendor/mypy/typeshed/stdlib/struct.pyi +0 -26
  1068. jaclang/vendor/mypy/typeshed/stdlib/subprocess.pyi +0 -2615
  1069. jaclang/vendor/mypy/typeshed/stdlib/sunau.pyi +0 -86
  1070. jaclang/vendor/mypy/typeshed/stdlib/symbol.pyi +0 -93
  1071. jaclang/vendor/mypy/typeshed/stdlib/symtable.pyi +0 -58
  1072. jaclang/vendor/mypy/typeshed/stdlib/sys/__init__.pyi +0 -373
  1073. jaclang/vendor/mypy/typeshed/stdlib/sys/_monitoring.pyi +0 -52
  1074. jaclang/vendor/mypy/typeshed/stdlib/sysconfig.pyi +0 -48
  1075. jaclang/vendor/mypy/typeshed/stdlib/syslog.pyi +0 -46
  1076. jaclang/vendor/mypy/typeshed/stdlib/tabnanny.pyi +0 -16
  1077. jaclang/vendor/mypy/typeshed/stdlib/tarfile.pyi +0 -441
  1078. jaclang/vendor/mypy/typeshed/stdlib/telnetlib.pyi +0 -122
  1079. jaclang/vendor/mypy/typeshed/stdlib/tempfile.pyi +0 -477
  1080. jaclang/vendor/mypy/typeshed/stdlib/termios.pyi +0 -267
  1081. jaclang/vendor/mypy/typeshed/stdlib/textwrap.pyi +0 -103
  1082. jaclang/vendor/mypy/typeshed/stdlib/this.pyi +0 -2
  1083. jaclang/vendor/mypy/typeshed/stdlib/threading.pyi +0 -187
  1084. jaclang/vendor/mypy/typeshed/stdlib/time.pyi +0 -108
  1085. jaclang/vendor/mypy/typeshed/stdlib/timeit.pyi +0 -32
  1086. jaclang/vendor/mypy/typeshed/stdlib/tkinter/__init__.pyi +0 -3654
  1087. jaclang/vendor/mypy/typeshed/stdlib/tkinter/colorchooser.pyi +0 -20
  1088. jaclang/vendor/mypy/typeshed/stdlib/tkinter/commondialog.pyi +0 -14
  1089. jaclang/vendor/mypy/typeshed/stdlib/tkinter/constants.pyi +0 -80
  1090. jaclang/vendor/mypy/typeshed/stdlib/tkinter/dialog.pyi +0 -16
  1091. jaclang/vendor/mypy/typeshed/stdlib/tkinter/dnd.pyi +0 -20
  1092. jaclang/vendor/mypy/typeshed/stdlib/tkinter/filedialog.pyi +0 -151
  1093. jaclang/vendor/mypy/typeshed/stdlib/tkinter/font.pyi +0 -116
  1094. jaclang/vendor/mypy/typeshed/stdlib/tkinter/messagebox.pyi +0 -44
  1095. jaclang/vendor/mypy/typeshed/stdlib/tkinter/scrolledtext.pyi +0 -9
  1096. jaclang/vendor/mypy/typeshed/stdlib/tkinter/simpledialog.pyi +0 -54
  1097. jaclang/vendor/mypy/typeshed/stdlib/tkinter/tix.pyi +0 -299
  1098. jaclang/vendor/mypy/typeshed/stdlib/tkinter/ttk.pyi +0 -1204
  1099. jaclang/vendor/mypy/typeshed/stdlib/token.pyi +0 -159
  1100. jaclang/vendor/mypy/typeshed/stdlib/tokenize.pyi +0 -177
  1101. jaclang/vendor/mypy/typeshed/stdlib/tomllib.pyi +0 -10
  1102. jaclang/vendor/mypy/typeshed/stdlib/trace.pyi +0 -79
  1103. jaclang/vendor/mypy/typeshed/stdlib/traceback.pyi +0 -262
  1104. jaclang/vendor/mypy/typeshed/stdlib/tracemalloc.pyi +0 -124
  1105. jaclang/vendor/mypy/typeshed/stdlib/tty.pyi +0 -30
  1106. jaclang/vendor/mypy/typeshed/stdlib/turtle.pyi +0 -713
  1107. jaclang/vendor/mypy/typeshed/stdlib/types.pyi +0 -614
  1108. jaclang/vendor/mypy/typeshed/stdlib/typing.pyi +0 -976
  1109. jaclang/vendor/mypy/typeshed/stdlib/typing_extensions.pyi +0 -509
  1110. jaclang/vendor/mypy/typeshed/stdlib/unicodedata.pyi +0 -73
  1111. jaclang/vendor/mypy/typeshed/stdlib/unittest/__init__.pyi +0 -67
  1112. jaclang/vendor/mypy/typeshed/stdlib/unittest/_log.pyi +0 -27
  1113. jaclang/vendor/mypy/typeshed/stdlib/unittest/async_case.pyi +0 -21
  1114. jaclang/vendor/mypy/typeshed/stdlib/unittest/case.pyi +0 -342
  1115. jaclang/vendor/mypy/typeshed/stdlib/unittest/loader.pyi +0 -51
  1116. jaclang/vendor/mypy/typeshed/stdlib/unittest/main.pyi +0 -69
  1117. jaclang/vendor/mypy/typeshed/stdlib/unittest/mock.pyi +0 -430
  1118. jaclang/vendor/mypy/typeshed/stdlib/unittest/result.pyi +0 -47
  1119. jaclang/vendor/mypy/typeshed/stdlib/unittest/runner.pyi +0 -72
  1120. jaclang/vendor/mypy/typeshed/stdlib/unittest/signals.pyi +0 -15
  1121. jaclang/vendor/mypy/typeshed/stdlib/unittest/suite.pyi +0 -22
  1122. jaclang/vendor/mypy/typeshed/stdlib/unittest/util.pyi +0 -23
  1123. jaclang/vendor/mypy/typeshed/stdlib/urllib/__init__.pyi +0 -0
  1124. jaclang/vendor/mypy/typeshed/stdlib/urllib/error.pyi +0 -23
  1125. jaclang/vendor/mypy/typeshed/stdlib/urllib/parse.pyi +0 -210
  1126. jaclang/vendor/mypy/typeshed/stdlib/urllib/request.pyi +0 -400
  1127. jaclang/vendor/mypy/typeshed/stdlib/urllib/response.pyi +0 -43
  1128. jaclang/vendor/mypy/typeshed/stdlib/urllib/robotparser.pyi +0 -20
  1129. jaclang/vendor/mypy/typeshed/stdlib/uu.pyi +0 -13
  1130. jaclang/vendor/mypy/typeshed/stdlib/uuid.pyi +0 -100
  1131. jaclang/vendor/mypy/typeshed/stdlib/warnings.pyi +0 -112
  1132. jaclang/vendor/mypy/typeshed/stdlib/wave.pyi +0 -85
  1133. jaclang/vendor/mypy/typeshed/stdlib/weakref.pyi +0 -149
  1134. jaclang/vendor/mypy/typeshed/stdlib/webbrowser.pyi +0 -74
  1135. jaclang/vendor/mypy/typeshed/stdlib/winreg.pyi +0 -132
  1136. jaclang/vendor/mypy/typeshed/stdlib/winsound.pyi +0 -28
  1137. jaclang/vendor/mypy/typeshed/stdlib/wsgiref/__init__.pyi +0 -0
  1138. jaclang/vendor/mypy/typeshed/stdlib/wsgiref/handlers.pyi +0 -91
  1139. jaclang/vendor/mypy/typeshed/stdlib/wsgiref/headers.pyi +0 -26
  1140. jaclang/vendor/mypy/typeshed/stdlib/wsgiref/simple_server.pyi +0 -37
  1141. jaclang/vendor/mypy/typeshed/stdlib/wsgiref/types.pyi +0 -32
  1142. jaclang/vendor/mypy/typeshed/stdlib/wsgiref/util.pyi +0 -24
  1143. jaclang/vendor/mypy/typeshed/stdlib/wsgiref/validate.pyi +0 -50
  1144. jaclang/vendor/mypy/typeshed/stdlib/xdrlib.pyi +0 -57
  1145. jaclang/vendor/mypy/typeshed/stdlib/xml/__init__.pyi +0 -1
  1146. jaclang/vendor/mypy/typeshed/stdlib/xml/dom/NodeFilter.pyi +0 -19
  1147. jaclang/vendor/mypy/typeshed/stdlib/xml/dom/__init__.pyi +0 -69
  1148. jaclang/vendor/mypy/typeshed/stdlib/xml/dom/domreg.pyi +0 -8
  1149. jaclang/vendor/mypy/typeshed/stdlib/xml/dom/expatbuilder.pyi +0 -100
  1150. jaclang/vendor/mypy/typeshed/stdlib/xml/dom/minicompat.pyi +0 -22
  1151. jaclang/vendor/mypy/typeshed/stdlib/xml/dom/minidom.pyi +0 -404
  1152. jaclang/vendor/mypy/typeshed/stdlib/xml/dom/pulldom.pyi +0 -94
  1153. jaclang/vendor/mypy/typeshed/stdlib/xml/dom/xmlbuilder.pyi +0 -108
  1154. jaclang/vendor/mypy/typeshed/stdlib/xml/etree/ElementInclude.pyi +0 -28
  1155. jaclang/vendor/mypy/typeshed/stdlib/xml/etree/ElementPath.pyi +0 -34
  1156. jaclang/vendor/mypy/typeshed/stdlib/xml/etree/ElementTree.pyi +0 -327
  1157. jaclang/vendor/mypy/typeshed/stdlib/xml/etree/__init__.pyi +0 -0
  1158. jaclang/vendor/mypy/typeshed/stdlib/xml/etree/cElementTree.pyi +0 -1
  1159. jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/__init__.pyi +0 -1
  1160. jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/expat/__init__.pyi +0 -1
  1161. jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/expat/errors.pyi +0 -1
  1162. jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/expat/model.pyi +0 -1
  1163. jaclang/vendor/mypy/typeshed/stdlib/xml/sax/__init__.pyi +0 -25
  1164. jaclang/vendor/mypy/typeshed/stdlib/xml/sax/_exceptions.pyi +0 -19
  1165. jaclang/vendor/mypy/typeshed/stdlib/xml/sax/handler.pyi +0 -55
  1166. jaclang/vendor/mypy/typeshed/stdlib/xml/sax/saxutils.pyi +0 -60
  1167. jaclang/vendor/mypy/typeshed/stdlib/xml/sax/xmlreader.pyi +0 -87
  1168. jaclang/vendor/mypy/typeshed/stdlib/xmlrpc/__init__.pyi +0 -0
  1169. jaclang/vendor/mypy/typeshed/stdlib/xmlrpc/client.pyi +0 -296
  1170. jaclang/vendor/mypy/typeshed/stdlib/xmlrpc/server.pyi +0 -143
  1171. jaclang/vendor/mypy/typeshed/stdlib/xxlimited.pyi +0 -22
  1172. jaclang/vendor/mypy/typeshed/stdlib/zipapp.pyi +0 -20
  1173. jaclang/vendor/mypy/typeshed/stdlib/zipfile/__init__.pyi +0 -306
  1174. jaclang/vendor/mypy/typeshed/stdlib/zipfile/_path.pyi +0 -95
  1175. jaclang/vendor/mypy/typeshed/stdlib/zipimport.pyi +0 -32
  1176. jaclang/vendor/mypy/typeshed/stdlib/zlib.pyi +0 -56
  1177. jaclang/vendor/mypy/typeshed/stdlib/zoneinfo/__init__.pyi +0 -38
  1178. jaclang/vendor/mypy/typeshed/stubs/mypy-extensions/mypy_extensions.pyi +0 -218
  1179. jaclang/vendor/mypy/typestate.py +0 -323
  1180. jaclang/vendor/mypy/typetraverser.py +0 -148
  1181. jaclang/vendor/mypy/typevars.py +0 -93
  1182. jaclang/vendor/mypy/typevartuples.py +0 -32
  1183. jaclang/vendor/mypy/util.py +0 -869
  1184. jaclang/vendor/mypy/version.py +0 -1
  1185. jaclang/vendor/mypy/visitor.py +0 -621
  1186. jaclang/vendor/mypy/xml/mypy-html.css +0 -104
  1187. jaclang/vendor/mypy/xml/mypy-html.xslt +0 -81
  1188. jaclang/vendor/mypy/xml/mypy-txt.xslt +0 -100
  1189. jaclang/vendor/mypy/xml/mypy.xsd +0 -50
  1190. jaclang/vendor/mypy-1.10.0.dist-info/LICENSE +0 -229
  1191. jaclang/vendor/mypy-1.10.0.dist-info/METADATA +0 -48
  1192. jaclang/vendor/mypy-1.10.0.dist-info/RECORD +0 -1241
  1193. jaclang/vendor/mypy-1.10.0.dist-info/WHEEL +0 -6
  1194. jaclang/vendor/mypy-1.10.0.dist-info/entry_points.txt +0 -6
  1195. jaclang/vendor/mypy-1.10.0.dist-info/top_level.txt +0 -3
  1196. jaclang/vendor/mypy_extensions-1.0.0.dist-info/LICENSE +0 -27
  1197. jaclang/vendor/mypy_extensions-1.0.0.dist-info/METADATA +0 -29
  1198. jaclang/vendor/mypy_extensions-1.0.0.dist-info/RECORD +0 -6
  1199. jaclang/vendor/mypy_extensions-1.0.0.dist-info/top_level.txt +0 -1
  1200. jaclang/vendor/mypy_extensions.py +0 -213
  1201. jaclang/vendor/mypyc/README.md +0 -133
  1202. jaclang/vendor/mypyc/__init__.py +0 -0
  1203. jaclang/vendor/mypyc/__main__.py +0 -57
  1204. jaclang/vendor/mypyc/analysis/__init__.py +0 -0
  1205. jaclang/vendor/mypyc/analysis/attrdefined.py +0 -436
  1206. jaclang/vendor/mypyc/analysis/blockfreq.py +0 -32
  1207. jaclang/vendor/mypyc/analysis/dataflow.py +0 -628
  1208. jaclang/vendor/mypyc/analysis/ircheck.py +0 -433
  1209. jaclang/vendor/mypyc/analysis/selfleaks.py +0 -211
  1210. jaclang/vendor/mypyc/build.py +0 -616
  1211. jaclang/vendor/mypyc/codegen/__init__.py +0 -0
  1212. jaclang/vendor/mypyc/codegen/cstring.py +0 -54
  1213. jaclang/vendor/mypyc/codegen/emit.py +0 -1193
  1214. jaclang/vendor/mypyc/codegen/emitclass.py +0 -1060
  1215. jaclang/vendor/mypyc/codegen/emitfunc.py +0 -852
  1216. jaclang/vendor/mypyc/codegen/emitmodule.py +0 -1136
  1217. jaclang/vendor/mypyc/codegen/emitwrapper.py +0 -979
  1218. jaclang/vendor/mypyc/codegen/literals.py +0 -302
  1219. jaclang/vendor/mypyc/common.py +0 -136
  1220. jaclang/vendor/mypyc/crash.py +0 -31
  1221. jaclang/vendor/mypyc/doc/Makefile +0 -20
  1222. jaclang/vendor/mypyc/doc/bool_operations.rst +0 -27
  1223. jaclang/vendor/mypyc/doc/compilation_units.rst +0 -20
  1224. jaclang/vendor/mypyc/doc/conf.py +0 -59
  1225. jaclang/vendor/mypyc/doc/cpython-timings.md +0 -25
  1226. jaclang/vendor/mypyc/doc/dev-intro.md +0 -548
  1227. jaclang/vendor/mypyc/doc/dict_operations.rst +0 -59
  1228. jaclang/vendor/mypyc/doc/differences_from_python.rst +0 -332
  1229. jaclang/vendor/mypyc/doc/float_operations.rst +0 -50
  1230. jaclang/vendor/mypyc/doc/future.md +0 -42
  1231. jaclang/vendor/mypyc/doc/getting_started.rst +0 -240
  1232. jaclang/vendor/mypyc/doc/index.rst +0 -61
  1233. jaclang/vendor/mypyc/doc/int_operations.rst +0 -162
  1234. jaclang/vendor/mypyc/doc/introduction.rst +0 -150
  1235. jaclang/vendor/mypyc/doc/list_operations.rst +0 -65
  1236. jaclang/vendor/mypyc/doc/make.bat +0 -35
  1237. jaclang/vendor/mypyc/doc/native_classes.rst +0 -206
  1238. jaclang/vendor/mypyc/doc/native_operations.rst +0 -55
  1239. jaclang/vendor/mypyc/doc/performance_tips_and_tricks.rst +0 -244
  1240. jaclang/vendor/mypyc/doc/set_operations.rst +0 -47
  1241. jaclang/vendor/mypyc/doc/str_operations.rst +0 -35
  1242. jaclang/vendor/mypyc/doc/tuple_operations.rst +0 -33
  1243. jaclang/vendor/mypyc/doc/using_type_annotations.rst +0 -398
  1244. jaclang/vendor/mypyc/errors.py +0 -29
  1245. jaclang/vendor/mypyc/external/googletest/LICENSE +0 -28
  1246. jaclang/vendor/mypyc/external/googletest/README.md +0 -280
  1247. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-death-test.h +0 -294
  1248. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-message.h +0 -250
  1249. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-param-test.h +0 -1444
  1250. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-param-test.h.pump +0 -510
  1251. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-printers.h +0 -993
  1252. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-spi.h +0 -232
  1253. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-test-part.h +0 -179
  1254. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-typed-test.h +0 -263
  1255. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest.h +0 -2236
  1256. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest_pred_impl.h +0 -358
  1257. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest_prod.h +0 -58
  1258. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/custom/gtest-port.h +0 -69
  1259. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/custom/gtest-printers.h +0 -42
  1260. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/custom/gtest.h +0 -41
  1261. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-death-test-internal.h +0 -319
  1262. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-filepath.h +0 -206
  1263. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-internal.h +0 -1238
  1264. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-linked_ptr.h +0 -243
  1265. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-param-util-generated.h +0 -5146
  1266. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +0 -286
  1267. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-param-util.h +0 -731
  1268. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-port-arch.h +0 -93
  1269. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-port.h +0 -2560
  1270. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-string.h +0 -167
  1271. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-tuple.h +0 -1020
  1272. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-tuple.h.pump +0 -347
  1273. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-type-util.h +0 -3331
  1274. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-type-util.h.pump +0 -297
  1275. jaclang/vendor/mypyc/external/googletest/make/Makefile +0 -61
  1276. jaclang/vendor/mypyc/external/googletest/src/gtest-all.cc +0 -48
  1277. jaclang/vendor/mypyc/external/googletest/src/gtest-death-test.cc +0 -1342
  1278. jaclang/vendor/mypyc/external/googletest/src/gtest-filepath.cc +0 -387
  1279. jaclang/vendor/mypyc/external/googletest/src/gtest-internal-inl.h +0 -1183
  1280. jaclang/vendor/mypyc/external/googletest/src/gtest-port.cc +0 -1259
  1281. jaclang/vendor/mypyc/external/googletest/src/gtest-printers.cc +0 -373
  1282. jaclang/vendor/mypyc/external/googletest/src/gtest-test-part.cc +0 -110
  1283. jaclang/vendor/mypyc/external/googletest/src/gtest-typed-test.cc +0 -118
  1284. jaclang/vendor/mypyc/external/googletest/src/gtest.cc +0 -5388
  1285. jaclang/vendor/mypyc/external/googletest/src/gtest_main.cc +0 -38
  1286. jaclang/vendor/mypyc/ir/__init__.py +0 -0
  1287. jaclang/vendor/mypyc/ir/class_ir.py +0 -499
  1288. jaclang/vendor/mypyc/ir/func_ir.py +0 -370
  1289. jaclang/vendor/mypyc/ir/module_ir.py +0 -88
  1290. jaclang/vendor/mypyc/ir/ops.py +0 -1727
  1291. jaclang/vendor/mypyc/ir/pprint.py +0 -516
  1292. jaclang/vendor/mypyc/ir/rtypes.py +0 -1038
  1293. jaclang/vendor/mypyc/irbuild/__init__.py +0 -0
  1294. jaclang/vendor/mypyc/irbuild/ast_helpers.py +0 -123
  1295. jaclang/vendor/mypyc/irbuild/builder.py +0 -1394
  1296. jaclang/vendor/mypyc/irbuild/callable_class.py +0 -173
  1297. jaclang/vendor/mypyc/irbuild/classdef.py +0 -850
  1298. jaclang/vendor/mypyc/irbuild/constant_fold.py +0 -95
  1299. jaclang/vendor/mypyc/irbuild/context.py +0 -186
  1300. jaclang/vendor/mypyc/irbuild/env_class.py +0 -223
  1301. jaclang/vendor/mypyc/irbuild/expression.py +0 -1070
  1302. jaclang/vendor/mypyc/irbuild/for_helpers.py +0 -1075
  1303. jaclang/vendor/mypyc/irbuild/format_str_tokenizer.py +0 -250
  1304. jaclang/vendor/mypyc/irbuild/function.py +0 -1088
  1305. jaclang/vendor/mypyc/irbuild/generator.py +0 -346
  1306. jaclang/vendor/mypyc/irbuild/ll_builder.py +0 -2389
  1307. jaclang/vendor/mypyc/irbuild/main.py +0 -153
  1308. jaclang/vendor/mypyc/irbuild/mapper.py +0 -221
  1309. jaclang/vendor/mypyc/irbuild/match.py +0 -355
  1310. jaclang/vendor/mypyc/irbuild/nonlocalcontrol.py +0 -197
  1311. jaclang/vendor/mypyc/irbuild/prebuildvisitor.py +0 -203
  1312. jaclang/vendor/mypyc/irbuild/prepare.py +0 -609
  1313. jaclang/vendor/mypyc/irbuild/specialize.py +0 -822
  1314. jaclang/vendor/mypyc/irbuild/statement.py +0 -1017
  1315. jaclang/vendor/mypyc/irbuild/targets.py +0 -57
  1316. jaclang/vendor/mypyc/irbuild/util.py +0 -189
  1317. jaclang/vendor/mypyc/irbuild/visitor.py +0 -401
  1318. jaclang/vendor/mypyc/irbuild/vtable.py +0 -82
  1319. jaclang/vendor/mypyc/lib-rt/CPy.h +0 -638
  1320. jaclang/vendor/mypyc/lib-rt/bytes_ops.c +0 -143
  1321. jaclang/vendor/mypyc/lib-rt/dict_ops.c +0 -446
  1322. jaclang/vendor/mypyc/lib-rt/exc_ops.c +0 -259
  1323. jaclang/vendor/mypyc/lib-rt/float_ops.c +0 -192
  1324. jaclang/vendor/mypyc/lib-rt/generic_ops.c +0 -64
  1325. jaclang/vendor/mypyc/lib-rt/getargs.c +0 -450
  1326. jaclang/vendor/mypyc/lib-rt/getargsfast.c +0 -569
  1327. jaclang/vendor/mypyc/lib-rt/init.c +0 -13
  1328. jaclang/vendor/mypyc/lib-rt/int_ops.c +0 -803
  1329. jaclang/vendor/mypyc/lib-rt/list_ops.c +0 -335
  1330. jaclang/vendor/mypyc/lib-rt/misc_ops.c +0 -942
  1331. jaclang/vendor/mypyc/lib-rt/module_shim.tmpl +0 -18
  1332. jaclang/vendor/mypyc/lib-rt/mypyc_util.h +0 -118
  1333. jaclang/vendor/mypyc/lib-rt/pythoncapi_compat.h +0 -497
  1334. jaclang/vendor/mypyc/lib-rt/pythonsupport.h +0 -533
  1335. jaclang/vendor/mypyc/lib-rt/set_ops.c +0 -17
  1336. jaclang/vendor/mypyc/lib-rt/setup.py +0 -70
  1337. jaclang/vendor/mypyc/lib-rt/str_ops.c +0 -241
  1338. jaclang/vendor/mypyc/lib-rt/test_capi.cc +0 -585
  1339. jaclang/vendor/mypyc/lib-rt/tuple_ops.c +0 -61
  1340. jaclang/vendor/mypyc/lower/__init__.py +0 -0
  1341. jaclang/vendor/mypyc/lower/int_ops.py +0 -113
  1342. jaclang/vendor/mypyc/lower/list_ops.py +0 -45
  1343. jaclang/vendor/mypyc/lower/misc_ops.py +0 -12
  1344. jaclang/vendor/mypyc/lower/registry.py +0 -26
  1345. jaclang/vendor/mypyc/namegen.py +0 -115
  1346. jaclang/vendor/mypyc/options.py +0 -32
  1347. jaclang/vendor/mypyc/primitives/__init__.py +0 -0
  1348. jaclang/vendor/mypyc/primitives/bytes_ops.py +0 -101
  1349. jaclang/vendor/mypyc/primitives/dict_ops.py +0 -325
  1350. jaclang/vendor/mypyc/primitives/exc_ops.py +0 -101
  1351. jaclang/vendor/mypyc/primitives/float_ops.py +0 -168
  1352. jaclang/vendor/mypyc/primitives/generic_ops.py +0 -384
  1353. jaclang/vendor/mypyc/primitives/int_ops.py +0 -303
  1354. jaclang/vendor/mypyc/primitives/list_ops.py +0 -310
  1355. jaclang/vendor/mypyc/primitives/misc_ops.py +0 -267
  1356. jaclang/vendor/mypyc/primitives/registry.py +0 -360
  1357. jaclang/vendor/mypyc/primitives/set_ops.py +0 -121
  1358. jaclang/vendor/mypyc/primitives/str_ops.py +0 -229
  1359. jaclang/vendor/mypyc/primitives/tuple_ops.py +0 -83
  1360. jaclang/vendor/mypyc/rt_subtype.py +0 -77
  1361. jaclang/vendor/mypyc/sametype.py +0 -83
  1362. jaclang/vendor/mypyc/subtype.py +0 -88
  1363. jaclang/vendor/mypyc/test/__init__.py +0 -0
  1364. jaclang/vendor/mypyc/test/config.py +0 -13
  1365. jaclang/vendor/mypyc/test/test_alwaysdefined.py +0 -46
  1366. jaclang/vendor/mypyc/test/test_analysis.py +0 -77
  1367. jaclang/vendor/mypyc/test/test_cheader.py +0 -53
  1368. jaclang/vendor/mypyc/test/test_commandline.py +0 -82
  1369. jaclang/vendor/mypyc/test/test_emit.py +0 -69
  1370. jaclang/vendor/mypyc/test/test_emitclass.py +0 -35
  1371. jaclang/vendor/mypyc/test/test_emitfunc.py +0 -928
  1372. jaclang/vendor/mypyc/test/test_emitwrapper.py +0 -60
  1373. jaclang/vendor/mypyc/test/test_exceptions.py +0 -56
  1374. jaclang/vendor/mypyc/test/test_external.py +0 -49
  1375. jaclang/vendor/mypyc/test/test_irbuild.py +0 -87
  1376. jaclang/vendor/mypyc/test/test_ircheck.py +0 -199
  1377. jaclang/vendor/mypyc/test/test_literals.py +0 -90
  1378. jaclang/vendor/mypyc/test/test_lowering.py +0 -56
  1379. jaclang/vendor/mypyc/test/test_namegen.py +0 -48
  1380. jaclang/vendor/mypyc/test/test_optimizations.py +0 -68
  1381. jaclang/vendor/mypyc/test/test_pprint.py +0 -42
  1382. jaclang/vendor/mypyc/test/test_rarray.py +0 -48
  1383. jaclang/vendor/mypyc/test/test_refcount.py +0 -59
  1384. jaclang/vendor/mypyc/test/test_run.py +0 -426
  1385. jaclang/vendor/mypyc/test/test_serialization.py +0 -108
  1386. jaclang/vendor/mypyc/test/test_struct.py +0 -112
  1387. jaclang/vendor/mypyc/test/test_tuplename.py +0 -33
  1388. jaclang/vendor/mypyc/test/test_typeops.py +0 -97
  1389. jaclang/vendor/mypyc/test/testutil.py +0 -283
  1390. jaclang/vendor/mypyc/test-data/alwaysdefined.test +0 -732
  1391. jaclang/vendor/mypyc/test-data/analysis.test +0 -470
  1392. jaclang/vendor/mypyc/test-data/commandline.test +0 -245
  1393. jaclang/vendor/mypyc/test-data/driver/driver.py +0 -48
  1394. jaclang/vendor/mypyc/test-data/exceptions-freq.test +0 -125
  1395. jaclang/vendor/mypyc/test-data/exceptions.test +0 -699
  1396. jaclang/vendor/mypyc/test-data/fixtures/ir.py +0 -373
  1397. jaclang/vendor/mypyc/test-data/fixtures/testutil.py +0 -103
  1398. jaclang/vendor/mypyc/test-data/fixtures/typing-full.pyi +0 -169
  1399. jaclang/vendor/mypyc/test-data/irbuild-any.test +0 -236
  1400. jaclang/vendor/mypyc/test-data/irbuild-basic.test +0 -3399
  1401. jaclang/vendor/mypyc/test-data/irbuild-bool.test +0 -424
  1402. jaclang/vendor/mypyc/test-data/irbuild-bytes.test +0 -181
  1403. jaclang/vendor/mypyc/test-data/irbuild-classes.test +0 -1302
  1404. jaclang/vendor/mypyc/test-data/irbuild-constant-fold.test +0 -480
  1405. jaclang/vendor/mypyc/test-data/irbuild-dict.test +0 -584
  1406. jaclang/vendor/mypyc/test-data/irbuild-dunders.test +0 -215
  1407. jaclang/vendor/mypyc/test-data/irbuild-float.test +0 -497
  1408. jaclang/vendor/mypyc/test-data/irbuild-generics.test +0 -150
  1409. jaclang/vendor/mypyc/test-data/irbuild-glue-methods.test +0 -437
  1410. jaclang/vendor/mypyc/test-data/irbuild-i16.test +0 -526
  1411. jaclang/vendor/mypyc/test-data/irbuild-i32.test +0 -598
  1412. jaclang/vendor/mypyc/test-data/irbuild-i64.test +0 -2144
  1413. jaclang/vendor/mypyc/test-data/irbuild-int.test +0 -194
  1414. jaclang/vendor/mypyc/test-data/irbuild-isinstance.test +0 -109
  1415. jaclang/vendor/mypyc/test-data/irbuild-lists.test +0 -513
  1416. jaclang/vendor/mypyc/test-data/irbuild-match.test +0 -1717
  1417. jaclang/vendor/mypyc/test-data/irbuild-math.test +0 -64
  1418. jaclang/vendor/mypyc/test-data/irbuild-nested.test +0 -807
  1419. jaclang/vendor/mypyc/test-data/irbuild-optional.test +0 -536
  1420. jaclang/vendor/mypyc/test-data/irbuild-set.test +0 -806
  1421. jaclang/vendor/mypyc/test-data/irbuild-singledispatch.test +0 -257
  1422. jaclang/vendor/mypyc/test-data/irbuild-statements.test +0 -1060
  1423. jaclang/vendor/mypyc/test-data/irbuild-str.test +0 -312
  1424. jaclang/vendor/mypyc/test-data/irbuild-strip-asserts.test +0 -12
  1425. jaclang/vendor/mypyc/test-data/irbuild-try.test +0 -523
  1426. jaclang/vendor/mypyc/test-data/irbuild-tuple.test +0 -386
  1427. jaclang/vendor/mypyc/test-data/irbuild-u8.test +0 -543
  1428. jaclang/vendor/mypyc/test-data/irbuild-unreachable.test +0 -241
  1429. jaclang/vendor/mypyc/test-data/irbuild-vectorcall.test +0 -153
  1430. jaclang/vendor/mypyc/test-data/lowering-int.test +0 -377
  1431. jaclang/vendor/mypyc/test-data/lowering-list.test +0 -33
  1432. jaclang/vendor/mypyc/test-data/opt-copy-propagation.test +0 -400
  1433. jaclang/vendor/mypyc/test-data/opt-flag-elimination.test +0 -296
  1434. jaclang/vendor/mypyc/test-data/refcount.test +0 -1482
  1435. jaclang/vendor/mypyc/test-data/run-async.test +0 -173
  1436. jaclang/vendor/mypyc/test-data/run-attrs.test +0 -318
  1437. jaclang/vendor/mypyc/test-data/run-bench.test +0 -196
  1438. jaclang/vendor/mypyc/test-data/run-bools.test +0 -229
  1439. jaclang/vendor/mypyc/test-data/run-bytes.test +0 -302
  1440. jaclang/vendor/mypyc/test-data/run-classes.test +0 -2505
  1441. jaclang/vendor/mypyc/test-data/run-dicts.test +0 -334
  1442. jaclang/vendor/mypyc/test-data/run-dunders.test +0 -945
  1443. jaclang/vendor/mypyc/test-data/run-exceptions.test +0 -448
  1444. jaclang/vendor/mypyc/test-data/run-floats.test +0 -516
  1445. jaclang/vendor/mypyc/test-data/run-functions.test +0 -1310
  1446. jaclang/vendor/mypyc/test-data/run-generators.test +0 -682
  1447. jaclang/vendor/mypyc/test-data/run-i16.test +0 -338
  1448. jaclang/vendor/mypyc/test-data/run-i32.test +0 -336
  1449. jaclang/vendor/mypyc/test-data/run-i64.test +0 -1519
  1450. jaclang/vendor/mypyc/test-data/run-imports.test +0 -265
  1451. jaclang/vendor/mypyc/test-data/run-integers.test +0 -540
  1452. jaclang/vendor/mypyc/test-data/run-lists.test +0 -411
  1453. jaclang/vendor/mypyc/test-data/run-loops.test +0 -485
  1454. jaclang/vendor/mypyc/test-data/run-match.test +0 -283
  1455. jaclang/vendor/mypyc/test-data/run-math.test +0 -106
  1456. jaclang/vendor/mypyc/test-data/run-misc.test +0 -1170
  1457. jaclang/vendor/mypyc/test-data/run-multimodule.test +0 -887
  1458. jaclang/vendor/mypyc/test-data/run-mypy-sim.test +0 -138
  1459. jaclang/vendor/mypyc/test-data/run-primitives.test +0 -375
  1460. jaclang/vendor/mypyc/test-data/run-python37.test +0 -159
  1461. jaclang/vendor/mypyc/test-data/run-python38.test +0 -88
  1462. jaclang/vendor/mypyc/test-data/run-sets.test +0 -150
  1463. jaclang/vendor/mypyc/test-data/run-singledispatch.test +0 -698
  1464. jaclang/vendor/mypyc/test-data/run-strings.test +0 -641
  1465. jaclang/vendor/mypyc/test-data/run-traits.test +0 -411
  1466. jaclang/vendor/mypyc/test-data/run-tuples.test +0 -258
  1467. jaclang/vendor/mypyc/test-data/run-u8.test +0 -303
  1468. jaclang/vendor/mypyc/transform/__init__.py +0 -0
  1469. jaclang/vendor/mypyc/transform/copy_propagation.py +0 -94
  1470. jaclang/vendor/mypyc/transform/exceptions.py +0 -182
  1471. jaclang/vendor/mypyc/transform/flag_elimination.py +0 -108
  1472. jaclang/vendor/mypyc/transform/ir_transform.py +0 -368
  1473. jaclang/vendor/mypyc/transform/lower.py +0 -33
  1474. jaclang/vendor/mypyc/transform/refcount.py +0 -294
  1475. jaclang/vendor/mypyc/transform/uninit.py +0 -190
  1476. jaclang/vendor/typing_extensions-4.12.2.dist-info/LICENSE +0 -279
  1477. jaclang/vendor/typing_extensions-4.12.2.dist-info/METADATA +0 -67
  1478. jaclang/vendor/typing_extensions-4.12.2.dist-info/RECORD +0 -5
  1479. jaclang/vendor/typing_extensions-4.12.2.dist-info/WHEEL +0 -4
  1480. jaclang/vendor/typing_extensions.py +0 -3641
  1481. jaclang-0.7.34.dist-info/RECORD +0 -1563
  1482. /jaclang/{vendor/mypy/dmypy → compiler/larkparse}/__init__.py +0 -0
  1483. /jaclang/{tests → compiler/passes/main/tests}/fixtures/access_checker.jac +0 -0
  1484. /jaclang/langserve/{__init__.py → __init__.jac} +0 -0
  1485. /jaclang/{vendor/mypy/plugins/__init__.py → langserve/tests/fixtures/deep_check_crash.jac} +0 -0
  1486. /jaclang/{vendor/mypy/server/__init__.py → langserve/tests/server_test/code_test.py} +0 -0
  1487. /jaclang/{plugin → runtimelib}/tests/__init__.py +0 -0
  1488. /jaclang/{vendor/mypy/test → tests}/__init__.py +0 -0
  1489. /jaclang/{vendor/mypy/test/meta → tests/fixtures}/__init__.py +0 -0
  1490. /jaclang/tests/fixtures/{architype_def_bug.jac → archetype_def_bug.jac} +0 -0
  1491. /jaclang/vendor/{mypy/typeshed/stdlib/concurrent/__init__.pyi → attrs-25.3.0.dist-info/REQUESTED} +0 -0
  1492. /jaclang/vendor/{attrs-23.2.0.dist-info → attrs-25.3.0.dist-info}/licenses/LICENSE +0 -0
  1493. /jaclang/vendor/{mypy/typeshed/stdlib/distutils/command/__init__.pyi → cattrs-24.1.3.dist-info/REQUESTED} +0 -0
  1494. /jaclang/vendor/{cattrs-23.2.3.dist-info → cattrs-24.1.3.dist-info}/licenses/LICENSE +0 -0
  1495. /jaclang/vendor/{mypy/typeshed/stdlib/distutils/command/bdist_packager.pyi → lark-1.2.2.dist-info/REQUESTED} +0 -0
  1496. /jaclang/vendor/{lark-1.1.9.dist-info → lark-1.2.2.dist-info}/entry_points.txt +0 -0
  1497. /jaclang/vendor/{lark-1.1.9.dist-info → lark-1.2.2.dist-info}/top_level.txt +0 -0
  1498. /jaclang/vendor/{mypy/typeshed/stdlib/email/mime/__init__.pyi → lsprotocol-2023.0.1.dist-info/REQUESTED} +0 -0
  1499. /jaclang/vendor/lsprotocol-2023.0.1.dist-info/{LICENSE → licenses/LICENSE} +0 -0
  1500. /jaclang/vendor/{mypy/typeshed/stdlib/lib2to3/__init__.pyi → pluggy-1.5.0.dist-info/REQUESTED} +0 -0
  1501. /jaclang/vendor/pluggy-1.5.0.dist-info/{LICENSE → licenses/LICENSE} +0 -0
  1502. /jaclang/vendor/{mypy/typeshed/stdlib/lib2to3/fixes/__init__.pyi → pygls-1.3.1.dist-info/REQUESTED} +0 -0
  1503. {jaclang-0.7.34.dist-info → jaclang-0.8.1.dist-info}/entry_points.txt +0 -0
@@ -1,2596 +0,0 @@
1
- """Semantic analysis of types"""
2
-
3
- from __future__ import annotations
4
-
5
- import itertools
6
- from contextlib import contextmanager
7
- from typing import Callable, Final, Iterable, Iterator, List, Sequence, Tuple, TypeVar
8
- from typing_extensions import Protocol
9
-
10
- from mypy import errorcodes as codes, message_registry, nodes
11
- from mypy.errorcodes import ErrorCode
12
- from mypy.expandtype import expand_type
13
- from mypy.messages import MessageBuilder, format_type_bare, quote_type_string, wrong_type_arg_count
14
- from mypy.nodes import (
15
- ARG_NAMED,
16
- ARG_NAMED_OPT,
17
- ARG_OPT,
18
- ARG_POS,
19
- ARG_STAR,
20
- ARG_STAR2,
21
- SYMBOL_FUNCBASE_TYPES,
22
- ArgKind,
23
- Context,
24
- Decorator,
25
- MypyFile,
26
- ParamSpecExpr,
27
- PlaceholderNode,
28
- SymbolTableNode,
29
- TypeAlias,
30
- TypeInfo,
31
- TypeVarExpr,
32
- TypeVarLikeExpr,
33
- TypeVarTupleExpr,
34
- Var,
35
- check_arg_kinds,
36
- check_arg_names,
37
- get_nongen_builtins,
38
- )
39
- from mypy.options import Options
40
- from mypy.plugin import AnalyzeTypeContext, Plugin, TypeAnalyzerPluginInterface
41
- from mypy.semanal_shared import (
42
- SemanticAnalyzerCoreInterface,
43
- SemanticAnalyzerInterface,
44
- paramspec_args,
45
- paramspec_kwargs,
46
- )
47
- from mypy.state import state
48
- from mypy.tvar_scope import TypeVarLikeScope
49
- from mypy.types import (
50
- ANNOTATED_TYPE_NAMES,
51
- ANY_STRATEGY,
52
- FINAL_TYPE_NAMES,
53
- LITERAL_TYPE_NAMES,
54
- NEVER_NAMES,
55
- TYPE_ALIAS_NAMES,
56
- AnyType,
57
- BoolTypeQuery,
58
- CallableArgument,
59
- CallableType,
60
- DeletedType,
61
- EllipsisType,
62
- ErasedType,
63
- Instance,
64
- LiteralType,
65
- NoneType,
66
- Overloaded,
67
- Parameters,
68
- ParamSpecFlavor,
69
- ParamSpecType,
70
- PartialType,
71
- PlaceholderType,
72
- ProperType,
73
- RawExpressionType,
74
- RequiredType,
75
- SyntheticTypeVisitor,
76
- TrivialSyntheticTypeTranslator,
77
- TupleType,
78
- Type,
79
- TypeAliasType,
80
- TypedDictType,
81
- TypeList,
82
- TypeOfAny,
83
- TypeQuery,
84
- TypeType,
85
- TypeVarId,
86
- TypeVarLikeType,
87
- TypeVarTupleType,
88
- TypeVarType,
89
- UnboundType,
90
- UninhabitedType,
91
- UnionType,
92
- UnpackType,
93
- callable_with_ellipsis,
94
- find_unpack_in_list,
95
- flatten_nested_tuples,
96
- flatten_nested_unions,
97
- get_proper_type,
98
- has_type_vars,
99
- )
100
- from mypy.types_utils import is_bad_type_type_item
101
- from mypy.typevars import fill_typevars
102
-
103
- T = TypeVar("T")
104
-
105
- type_constructors: Final = {
106
- "typing.Callable",
107
- "typing.Optional",
108
- "typing.Tuple",
109
- "typing.Type",
110
- "typing.Union",
111
- *LITERAL_TYPE_NAMES,
112
- *ANNOTATED_TYPE_NAMES,
113
- }
114
-
115
- ARG_KINDS_BY_CONSTRUCTOR: Final = {
116
- "mypy_extensions.Arg": ARG_POS,
117
- "mypy_extensions.DefaultArg": ARG_OPT,
118
- "mypy_extensions.NamedArg": ARG_NAMED,
119
- "mypy_extensions.DefaultNamedArg": ARG_NAMED_OPT,
120
- "mypy_extensions.VarArg": ARG_STAR,
121
- "mypy_extensions.KwArg": ARG_STAR2,
122
- }
123
-
124
- GENERIC_STUB_NOT_AT_RUNTIME_TYPES: Final = {
125
- "queue.Queue",
126
- "builtins._PathLike",
127
- "asyncio.futures.Future",
128
- }
129
-
130
- SELF_TYPE_NAMES: Final = {"typing.Self", "typing_extensions.Self"}
131
-
132
-
133
- def analyze_type_alias(
134
- type: Type,
135
- api: SemanticAnalyzerCoreInterface,
136
- tvar_scope: TypeVarLikeScope,
137
- plugin: Plugin,
138
- options: Options,
139
- is_typeshed_stub: bool,
140
- allow_placeholder: bool = False,
141
- in_dynamic_func: bool = False,
142
- global_scope: bool = True,
143
- allowed_alias_tvars: list[TypeVarLikeType] | None = None,
144
- alias_type_params_names: list[str] | None = None,
145
- ) -> tuple[Type, set[str]]:
146
- """Analyze r.h.s. of a (potential) type alias definition.
147
-
148
- If `node` is valid as a type alias rvalue, return the resulting type and a set of
149
- full names of type aliases it depends on (directly or indirectly).
150
- 'node' must have been semantically analyzed.
151
- """
152
- analyzer = TypeAnalyser(
153
- api,
154
- tvar_scope,
155
- plugin,
156
- options,
157
- is_typeshed_stub,
158
- defining_alias=True,
159
- allow_placeholder=allow_placeholder,
160
- prohibit_self_type="type alias target",
161
- allowed_alias_tvars=allowed_alias_tvars,
162
- alias_type_params_names=alias_type_params_names,
163
- )
164
- analyzer.in_dynamic_func = in_dynamic_func
165
- analyzer.global_scope = global_scope
166
- res = type.accept(analyzer)
167
- return res, analyzer.aliases_used
168
-
169
-
170
- def no_subscript_builtin_alias(name: str, propose_alt: bool = True) -> str:
171
- class_name = name.split(".")[-1]
172
- msg = f'"{class_name}" is not subscriptable'
173
- # This should never be called if the python_version is 3.9 or newer
174
- nongen_builtins = get_nongen_builtins((3, 8))
175
- replacement = nongen_builtins[name]
176
- if replacement and propose_alt:
177
- msg += f', use "{replacement}" instead'
178
- return msg
179
-
180
-
181
- class TypeAnalyser(SyntheticTypeVisitor[Type], TypeAnalyzerPluginInterface):
182
- """Semantic analyzer for types.
183
-
184
- Converts unbound types into bound types. This is a no-op for already
185
- bound types.
186
-
187
- If an incomplete reference is encountered, this does a defer. The
188
- caller never needs to defer.
189
- """
190
-
191
- # Is this called from an untyped function definition?
192
- in_dynamic_func: bool = False
193
- # Is this called from global scope?
194
- global_scope: bool = True
195
-
196
- def __init__(
197
- self,
198
- api: SemanticAnalyzerCoreInterface,
199
- tvar_scope: TypeVarLikeScope,
200
- plugin: Plugin,
201
- options: Options,
202
- is_typeshed_stub: bool,
203
- *,
204
- defining_alias: bool = False,
205
- allow_tuple_literal: bool = False,
206
- allow_unbound_tvars: bool = False,
207
- allow_placeholder: bool = False,
208
- allow_required: bool = False,
209
- allow_param_spec_literals: bool = False,
210
- allow_unpack: bool = False,
211
- report_invalid_types: bool = True,
212
- prohibit_self_type: str | None = None,
213
- allowed_alias_tvars: list[TypeVarLikeType] | None = None,
214
- allow_type_any: bool = False,
215
- alias_type_params_names: list[str] | None = None,
216
- ) -> None:
217
- self.api = api
218
- self.fail_func = api.fail
219
- self.note_func = api.note
220
- self.tvar_scope = tvar_scope
221
- # Are we analysing a type alias definition rvalue?
222
- self.defining_alias = defining_alias
223
- self.allow_tuple_literal = allow_tuple_literal
224
- # Positive if we are analyzing arguments of another (outer) type
225
- self.nesting_level = 0
226
- # Should we allow new type syntax when targeting older Python versions
227
- # like 'list[int]' or 'X | Y' (allowed in stubs and with `__future__` import)?
228
- self.always_allow_new_syntax = self.api.is_stub_file or self.api.is_future_flag_set(
229
- "annotations"
230
- )
231
- # Should we accept unbound type variables? This is currently used for class bases,
232
- # and alias right hand sides (before they are analyzed as type aliases).
233
- self.allow_unbound_tvars = allow_unbound_tvars
234
- if allowed_alias_tvars is None:
235
- allowed_alias_tvars = []
236
- self.allowed_alias_tvars = allowed_alias_tvars
237
- self.alias_type_params_names = alias_type_params_names
238
- # If false, record incomplete ref if we generate PlaceholderType.
239
- self.allow_placeholder = allow_placeholder
240
- # Are we in a context where Required[] is allowed?
241
- self.allow_required = allow_required
242
- # Are we in a context where ParamSpec literals are allowed?
243
- self.allow_param_spec_literals = allow_param_spec_literals
244
- # Are we in context where literal "..." specifically is allowed?
245
- self.allow_ellipsis = False
246
- # Should we report an error whenever we encounter a RawExpressionType outside
247
- # of a Literal context: e.g. whenever we encounter an invalid type? Normally,
248
- # we want to report an error, but the caller may want to do more specialized
249
- # error handling.
250
- self.report_invalid_types = report_invalid_types
251
- self.plugin = plugin
252
- self.options = options
253
- self.is_typeshed_stub = is_typeshed_stub
254
- # Names of type aliases encountered while analysing a type will be collected here.
255
- self.aliases_used: set[str] = set()
256
- self.prohibit_self_type = prohibit_self_type
257
- # Allow variables typed as Type[Any] and type (useful for base classes).
258
- self.allow_type_any = allow_type_any
259
- self.allow_type_var_tuple = False
260
- self.allow_unpack = allow_unpack
261
-
262
- def lookup_qualified(
263
- self, name: str, ctx: Context, suppress_errors: bool = False
264
- ) -> SymbolTableNode | None:
265
- return self.api.lookup_qualified(name, ctx, suppress_errors)
266
-
267
- def lookup_fully_qualified(self, name: str) -> SymbolTableNode:
268
- return self.api.lookup_fully_qualified(name)
269
-
270
- def visit_unbound_type(self, t: UnboundType, defining_literal: bool = False) -> Type:
271
- typ = self.visit_unbound_type_nonoptional(t, defining_literal)
272
- if t.optional:
273
- # We don't need to worry about double-wrapping Optionals or
274
- # wrapping Anys: Union simplification will take care of that.
275
- return make_optional_type(typ)
276
- return typ
277
-
278
- def not_declared_in_type_params(self, tvar_name: str) -> bool:
279
- return (
280
- self.alias_type_params_names is not None
281
- and tvar_name not in self.alias_type_params_names
282
- )
283
-
284
- def visit_unbound_type_nonoptional(self, t: UnboundType, defining_literal: bool) -> Type:
285
- sym = self.lookup_qualified(t.name, t)
286
- if sym is not None:
287
- node = sym.node
288
- if isinstance(node, PlaceholderNode):
289
- if node.becomes_typeinfo:
290
- # Reference to placeholder type.
291
- if self.api.final_iteration:
292
- self.cannot_resolve_type(t)
293
- return AnyType(TypeOfAny.from_error)
294
- elif self.allow_placeholder:
295
- self.api.defer()
296
- else:
297
- self.api.record_incomplete_ref()
298
- # Always allow ParamSpec for placeholders, if they are actually not valid,
299
- # they will be reported later, after we resolve placeholders.
300
- return PlaceholderType(
301
- node.fullname,
302
- self.anal_array(
303
- t.args,
304
- allow_param_spec=True,
305
- allow_param_spec_literals=True,
306
- allow_unpack=True,
307
- ),
308
- t.line,
309
- )
310
- else:
311
- if self.api.final_iteration:
312
- self.cannot_resolve_type(t)
313
- return AnyType(TypeOfAny.from_error)
314
- else:
315
- # Reference to an unknown placeholder node.
316
- self.api.record_incomplete_ref()
317
- return AnyType(TypeOfAny.special_form)
318
- if node is None:
319
- self.fail(f"Internal error (node is None, kind={sym.kind})", t)
320
- return AnyType(TypeOfAny.special_form)
321
- fullname = node.fullname
322
- hook = self.plugin.get_type_analyze_hook(fullname)
323
- if hook is not None:
324
- return hook(AnalyzeTypeContext(t, t, self))
325
- if (
326
- fullname in get_nongen_builtins(self.options.python_version)
327
- and t.args
328
- and not self.always_allow_new_syntax
329
- ):
330
- self.fail(
331
- no_subscript_builtin_alias(fullname, propose_alt=not self.defining_alias), t
332
- )
333
- tvar_def = self.tvar_scope.get_binding(sym)
334
- if isinstance(sym.node, ParamSpecExpr):
335
- if tvar_def is None:
336
- if self.allow_unbound_tvars:
337
- return t
338
- if self.defining_alias and self.not_declared_in_type_params(t.name):
339
- msg = f'ParamSpec "{t.name}" is not included in type_params'
340
- else:
341
- msg = f'ParamSpec "{t.name}" is unbound'
342
- self.fail(msg, t, code=codes.VALID_TYPE)
343
- return AnyType(TypeOfAny.from_error)
344
- assert isinstance(tvar_def, ParamSpecType)
345
- if len(t.args) > 0:
346
- self.fail(
347
- f'ParamSpec "{t.name}" used with arguments', t, code=codes.VALID_TYPE
348
- )
349
- # Change the line number
350
- return ParamSpecType(
351
- tvar_def.name,
352
- tvar_def.fullname,
353
- tvar_def.id,
354
- tvar_def.flavor,
355
- tvar_def.upper_bound,
356
- tvar_def.default,
357
- line=t.line,
358
- column=t.column,
359
- )
360
- if (
361
- isinstance(sym.node, TypeVarExpr)
362
- and self.defining_alias
363
- and not defining_literal
364
- and (tvar_def is None or tvar_def not in self.allowed_alias_tvars)
365
- ):
366
- if self.not_declared_in_type_params(t.name):
367
- msg = f'Type variable "{t.name}" is not included in type_params'
368
- else:
369
- msg = f'Can\'t use bound type variable "{t.name}" to define generic alias'
370
- self.fail(msg, t, code=codes.VALID_TYPE)
371
- return AnyType(TypeOfAny.from_error)
372
- if isinstance(sym.node, TypeVarExpr) and tvar_def is not None:
373
- assert isinstance(tvar_def, TypeVarType)
374
- if len(t.args) > 0:
375
- self.fail(
376
- f'Type variable "{t.name}" used with arguments', t, code=codes.VALID_TYPE
377
- )
378
- # Change the line number
379
- return tvar_def.copy_modified(line=t.line, column=t.column)
380
- if isinstance(sym.node, TypeVarTupleExpr) and (
381
- tvar_def is not None
382
- and self.defining_alias
383
- and tvar_def not in self.allowed_alias_tvars
384
- ):
385
- if self.not_declared_in_type_params(t.name):
386
- msg = f'Type variable "{t.name}" is not included in type_params'
387
- else:
388
- msg = f'Can\'t use bound type variable "{t.name}" to define generic alias'
389
- self.fail(msg, t, code=codes.VALID_TYPE)
390
- return AnyType(TypeOfAny.from_error)
391
- if isinstance(sym.node, TypeVarTupleExpr):
392
- if tvar_def is None:
393
- if self.allow_unbound_tvars:
394
- return t
395
- if self.defining_alias and self.not_declared_in_type_params(t.name):
396
- msg = f'TypeVarTuple "{t.name}" is not included in type_params'
397
- else:
398
- msg = f'TypeVarTuple "{t.name}" is unbound'
399
- self.fail(msg, t, code=codes.VALID_TYPE)
400
- return AnyType(TypeOfAny.from_error)
401
- assert isinstance(tvar_def, TypeVarTupleType)
402
- if not self.allow_type_var_tuple:
403
- self.fail(
404
- f'TypeVarTuple "{t.name}" is only valid with an unpack',
405
- t,
406
- code=codes.VALID_TYPE,
407
- )
408
- return AnyType(TypeOfAny.from_error)
409
- if len(t.args) > 0:
410
- self.fail(
411
- f'Type variable "{t.name}" used with arguments', t, code=codes.VALID_TYPE
412
- )
413
-
414
- # Change the line number
415
- return TypeVarTupleType(
416
- tvar_def.name,
417
- tvar_def.fullname,
418
- tvar_def.id,
419
- tvar_def.upper_bound,
420
- sym.node.tuple_fallback,
421
- tvar_def.default,
422
- line=t.line,
423
- column=t.column,
424
- )
425
- special = self.try_analyze_special_unbound_type(t, fullname)
426
- if special is not None:
427
- return special
428
- if isinstance(node, TypeAlias):
429
- self.aliases_used.add(fullname)
430
- an_args = self.anal_array(
431
- t.args,
432
- allow_param_spec=True,
433
- allow_param_spec_literals=node.has_param_spec_type,
434
- allow_unpack=True, # Fixed length unpacks can be used for non-variadic aliases.
435
- )
436
- if node.has_param_spec_type and len(node.alias_tvars) == 1:
437
- an_args = self.pack_paramspec_args(an_args)
438
-
439
- disallow_any = self.options.disallow_any_generics and not self.is_typeshed_stub
440
- res = instantiate_type_alias(
441
- node,
442
- an_args,
443
- self.fail,
444
- node.no_args,
445
- t,
446
- self.options,
447
- unexpanded_type=t,
448
- disallow_any=disallow_any,
449
- empty_tuple_index=t.empty_tuple_index,
450
- )
451
- # The only case where instantiate_type_alias() can return an incorrect instance is
452
- # when it is top-level instance, so no need to recurse.
453
- if (
454
- isinstance(res, ProperType)
455
- and isinstance(res, Instance)
456
- and not (self.defining_alias and self.nesting_level == 0)
457
- and not validate_instance(res, self.fail, t.empty_tuple_index)
458
- ):
459
- fix_instance(
460
- res,
461
- self.fail,
462
- self.note,
463
- disallow_any=disallow_any,
464
- options=self.options,
465
- use_generic_error=True,
466
- unexpanded_type=t,
467
- )
468
- if node.eager:
469
- res = get_proper_type(res)
470
- return res
471
- elif isinstance(node, TypeInfo):
472
- return self.analyze_type_with_type_info(node, t.args, t, t.empty_tuple_index)
473
- elif node.fullname in TYPE_ALIAS_NAMES:
474
- return AnyType(TypeOfAny.special_form)
475
- # Concatenate is an operator, no need for a proper type
476
- elif node.fullname in ("typing_extensions.Concatenate", "typing.Concatenate"):
477
- # We check the return type further up the stack for valid use locations
478
- return self.apply_concatenate_operator(t)
479
- else:
480
- return self.analyze_unbound_type_without_type_info(t, sym, defining_literal)
481
- else: # sym is None
482
- return AnyType(TypeOfAny.special_form)
483
-
484
- def pack_paramspec_args(self, an_args: Sequence[Type]) -> list[Type]:
485
- # "Aesthetic" ParamSpec literals for single ParamSpec: C[int, str] -> C[[int, str]].
486
- # These do not support mypy_extensions VarArgs, etc. as they were already analyzed
487
- # TODO: should these be re-analyzed to get rid of this inconsistency?
488
- count = len(an_args)
489
- if count == 0:
490
- return []
491
- if count == 1 and isinstance(get_proper_type(an_args[0]), AnyType):
492
- # Single Any is interpreted as ..., rather that a single argument with Any type.
493
- # I didn't find this in the PEP, but it sounds reasonable.
494
- return list(an_args)
495
- if any(isinstance(a, (Parameters, ParamSpecType)) for a in an_args):
496
- if len(an_args) > 1:
497
- first_wrong = next(
498
- arg for arg in an_args if isinstance(arg, (Parameters, ParamSpecType))
499
- )
500
- self.fail(
501
- "Nested parameter specifications are not allowed",
502
- first_wrong,
503
- code=codes.VALID_TYPE,
504
- )
505
- return [AnyType(TypeOfAny.from_error)]
506
- return list(an_args)
507
- first = an_args[0]
508
- return [
509
- Parameters(
510
- an_args, [ARG_POS] * count, [None] * count, line=first.line, column=first.column
511
- )
512
- ]
513
-
514
- def cannot_resolve_type(self, t: UnboundType) -> None:
515
- # TODO: Move error message generation to messages.py. We'd first
516
- # need access to MessageBuilder here. Also move the similar
517
- # message generation logic in semanal.py.
518
- self.api.fail(f'Cannot resolve name "{t.name}" (possible cyclic definition)', t)
519
- if self.api.is_func_scope():
520
- self.note("Recursive types are not allowed at function scope", t)
521
-
522
- def apply_concatenate_operator(self, t: UnboundType) -> Type:
523
- if len(t.args) == 0:
524
- self.api.fail("Concatenate needs type arguments", t, code=codes.VALID_TYPE)
525
- return AnyType(TypeOfAny.from_error)
526
-
527
- # Last argument has to be ParamSpec or Ellipsis.
528
- ps = self.anal_type(t.args[-1], allow_param_spec=True, allow_ellipsis=True)
529
- if not isinstance(ps, (ParamSpecType, Parameters)):
530
- if isinstance(ps, UnboundType) and self.allow_unbound_tvars:
531
- sym = self.lookup_qualified(ps.name, t)
532
- if sym is not None and isinstance(sym.node, ParamSpecExpr):
533
- return ps
534
- self.api.fail(
535
- "The last parameter to Concatenate needs to be a ParamSpec",
536
- t,
537
- code=codes.VALID_TYPE,
538
- )
539
- return AnyType(TypeOfAny.from_error)
540
- elif isinstance(ps, ParamSpecType) and ps.prefix.arg_types:
541
- self.api.fail("Nested Concatenates are invalid", t, code=codes.VALID_TYPE)
542
-
543
- args = self.anal_array(t.args[:-1])
544
- pre = ps.prefix if isinstance(ps, ParamSpecType) else ps
545
-
546
- # mypy can't infer this :(
547
- names: list[str | None] = [None] * len(args)
548
-
549
- pre = Parameters(
550
- args + pre.arg_types,
551
- [ARG_POS] * len(args) + pre.arg_kinds,
552
- names + pre.arg_names,
553
- line=t.line,
554
- column=t.column,
555
- )
556
- return ps.copy_modified(prefix=pre) if isinstance(ps, ParamSpecType) else pre
557
-
558
- def try_analyze_special_unbound_type(self, t: UnboundType, fullname: str) -> Type | None:
559
- """Bind special type that is recognized through magic name such as 'typing.Any'.
560
-
561
- Return the bound type if successful, and return None if the type is a normal type.
562
- """
563
- if fullname == "builtins.None":
564
- return NoneType()
565
- elif fullname == "typing.Any" or fullname == "builtins.Any":
566
- return AnyType(TypeOfAny.explicit, line=t.line, column=t.column)
567
- elif fullname in FINAL_TYPE_NAMES:
568
- self.fail(
569
- "Final can be only used as an outermost qualifier in a variable annotation",
570
- t,
571
- code=codes.VALID_TYPE,
572
- )
573
- return AnyType(TypeOfAny.from_error)
574
- elif fullname == "typing.Tuple" or (
575
- fullname == "builtins.tuple"
576
- and (self.always_allow_new_syntax or self.options.python_version >= (3, 9))
577
- ):
578
- # Tuple is special because it is involved in builtin import cycle
579
- # and may be not ready when used.
580
- sym = self.api.lookup_fully_qualified_or_none("builtins.tuple")
581
- if not sym or isinstance(sym.node, PlaceholderNode):
582
- if self.api.is_incomplete_namespace("builtins"):
583
- self.api.record_incomplete_ref()
584
- else:
585
- self.fail('Name "tuple" is not defined', t)
586
- return AnyType(TypeOfAny.special_form)
587
- if len(t.args) == 0 and not t.empty_tuple_index:
588
- # Bare 'Tuple' is same as 'tuple'
589
- any_type = self.get_omitted_any(t)
590
- return self.named_type("builtins.tuple", [any_type], line=t.line, column=t.column)
591
- if len(t.args) == 2 and isinstance(t.args[1], EllipsisType):
592
- # Tuple[T, ...] (uniform, variable-length tuple)
593
- instance = self.named_type("builtins.tuple", [self.anal_type(t.args[0])])
594
- instance.line = t.line
595
- return instance
596
- return self.tuple_type(
597
- self.anal_array(t.args, allow_unpack=True), line=t.line, column=t.column
598
- )
599
- elif fullname == "typing.Union":
600
- items = self.anal_array(t.args)
601
- return UnionType.make_union(items)
602
- elif fullname == "typing.Optional":
603
- if len(t.args) != 1:
604
- self.fail(
605
- "Optional[...] must have exactly one type argument", t, code=codes.VALID_TYPE
606
- )
607
- return AnyType(TypeOfAny.from_error)
608
- item = self.anal_type(t.args[0])
609
- return make_optional_type(item)
610
- elif fullname == "typing.Callable":
611
- return self.analyze_callable_type(t)
612
- elif fullname == "typing.Type" or (
613
- fullname == "builtins.type"
614
- and (self.always_allow_new_syntax or self.options.python_version >= (3, 9))
615
- ):
616
- if len(t.args) == 0:
617
- if fullname == "typing.Type":
618
- any_type = self.get_omitted_any(t)
619
- return TypeType(any_type, line=t.line, column=t.column)
620
- else:
621
- # To prevent assignment of 'builtins.type' inferred as 'builtins.object'
622
- # See https://github.com/python/mypy/issues/9476 for more information
623
- return None
624
- if len(t.args) != 1:
625
- type_str = "Type[...]" if fullname == "typing.Type" else "type[...]"
626
- self.fail(
627
- type_str + " must have exactly one type argument", t, code=codes.VALID_TYPE
628
- )
629
- item = self.anal_type(t.args[0])
630
- if is_bad_type_type_item(item):
631
- self.fail("Type[...] can't contain another Type[...]", t, code=codes.VALID_TYPE)
632
- item = AnyType(TypeOfAny.from_error)
633
- return TypeType.make_normalized(item, line=t.line, column=t.column)
634
- elif fullname == "typing.ClassVar":
635
- if self.nesting_level > 0:
636
- self.fail(
637
- "Invalid type: ClassVar nested inside other type", t, code=codes.VALID_TYPE
638
- )
639
- if len(t.args) == 0:
640
- return AnyType(TypeOfAny.from_omitted_generics, line=t.line, column=t.column)
641
- if len(t.args) != 1:
642
- self.fail(
643
- "ClassVar[...] must have at most one type argument", t, code=codes.VALID_TYPE
644
- )
645
- return AnyType(TypeOfAny.from_error)
646
- return self.anal_type(t.args[0])
647
- elif fullname in NEVER_NAMES:
648
- return UninhabitedType(is_noreturn=True)
649
- elif fullname in LITERAL_TYPE_NAMES:
650
- return self.analyze_literal_type(t)
651
- elif fullname in ANNOTATED_TYPE_NAMES:
652
- if len(t.args) < 2:
653
- self.fail(
654
- "Annotated[...] must have exactly one type argument"
655
- " and at least one annotation",
656
- t,
657
- code=codes.VALID_TYPE,
658
- )
659
- return AnyType(TypeOfAny.from_error)
660
- return self.anal_type(t.args[0])
661
- elif fullname in ("typing_extensions.Required", "typing.Required"):
662
- if not self.allow_required:
663
- self.fail(
664
- "Required[] can be only used in a TypedDict definition",
665
- t,
666
- code=codes.VALID_TYPE,
667
- )
668
- return AnyType(TypeOfAny.from_error)
669
- if len(t.args) != 1:
670
- self.fail(
671
- "Required[] must have exactly one type argument", t, code=codes.VALID_TYPE
672
- )
673
- return AnyType(TypeOfAny.from_error)
674
- return RequiredType(self.anal_type(t.args[0]), required=True)
675
- elif fullname in ("typing_extensions.NotRequired", "typing.NotRequired"):
676
- if not self.allow_required:
677
- self.fail(
678
- "NotRequired[] can be only used in a TypedDict definition",
679
- t,
680
- code=codes.VALID_TYPE,
681
- )
682
- return AnyType(TypeOfAny.from_error)
683
- if len(t.args) != 1:
684
- self.fail(
685
- "NotRequired[] must have exactly one type argument", t, code=codes.VALID_TYPE
686
- )
687
- return AnyType(TypeOfAny.from_error)
688
- return RequiredType(self.anal_type(t.args[0]), required=False)
689
- elif (
690
- self.anal_type_guard_arg(t, fullname) is not None
691
- or self.anal_type_is_arg(t, fullname) is not None
692
- ):
693
- # In most contexts, TypeGuard[...] acts as an alias for bool (ignoring its args)
694
- return self.named_type("builtins.bool")
695
- elif fullname in ("typing.Unpack", "typing_extensions.Unpack"):
696
- if len(t.args) != 1:
697
- self.fail("Unpack[...] requires exactly one type argument", t)
698
- return AnyType(TypeOfAny.from_error)
699
- if not self.allow_unpack:
700
- self.fail(message_registry.INVALID_UNPACK_POSITION, t, code=codes.VALID_TYPE)
701
- return AnyType(TypeOfAny.from_error)
702
- self.allow_type_var_tuple = True
703
- result = UnpackType(self.anal_type(t.args[0]), line=t.line, column=t.column)
704
- self.allow_type_var_tuple = False
705
- return result
706
- elif fullname in SELF_TYPE_NAMES:
707
- if t.args:
708
- self.fail("Self type cannot have type arguments", t)
709
- if self.prohibit_self_type is not None:
710
- self.fail(f"Self type cannot be used in {self.prohibit_self_type}", t)
711
- return AnyType(TypeOfAny.from_error)
712
- if self.api.type is None:
713
- self.fail("Self type is only allowed in annotations within class definition", t)
714
- return AnyType(TypeOfAny.from_error)
715
- if self.api.type.has_base("builtins.type"):
716
- self.fail("Self type cannot be used in a metaclass", t)
717
- if self.api.type.self_type is not None:
718
- if self.api.type.is_final:
719
- return fill_typevars(self.api.type)
720
- return self.api.type.self_type.copy_modified(line=t.line, column=t.column)
721
- # TODO: verify this is unreachable and replace with an assert?
722
- self.fail("Unexpected Self type", t)
723
- return AnyType(TypeOfAny.from_error)
724
- return None
725
-
726
- def get_omitted_any(self, typ: Type, fullname: str | None = None) -> AnyType:
727
- disallow_any = not self.is_typeshed_stub and self.options.disallow_any_generics
728
- return get_omitted_any(disallow_any, self.fail, self.note, typ, self.options, fullname)
729
-
730
- def analyze_type_with_type_info(
731
- self, info: TypeInfo, args: Sequence[Type], ctx: Context, empty_tuple_index: bool
732
- ) -> Type:
733
- """Bind unbound type when were able to find target TypeInfo.
734
-
735
- This handles simple cases like 'int', 'modname.UserClass[str]', etc.
736
- """
737
-
738
- if len(args) > 0 and info.fullname == "builtins.tuple":
739
- fallback = Instance(info, [AnyType(TypeOfAny.special_form)], ctx.line)
740
- return TupleType(self.anal_array(args, allow_unpack=True), fallback, ctx.line)
741
-
742
- # Analyze arguments and (usually) construct Instance type. The
743
- # number of type arguments and their values are
744
- # checked only later, since we do not always know the
745
- # valid count at this point. Thus we may construct an
746
- # Instance with an invalid number of type arguments.
747
- #
748
- # We allow ParamSpec literals based on a heuristic: it will be
749
- # checked later anyways but the error message may be worse.
750
- instance = Instance(
751
- info,
752
- self.anal_array(
753
- args,
754
- allow_param_spec=True,
755
- allow_param_spec_literals=info.has_param_spec_type,
756
- allow_unpack=True, # Fixed length tuples can be used for non-variadic types.
757
- ),
758
- ctx.line,
759
- ctx.column,
760
- )
761
- if len(info.type_vars) == 1 and info.has_param_spec_type:
762
- instance.args = tuple(self.pack_paramspec_args(instance.args))
763
-
764
- # Check type argument count.
765
- instance.args = tuple(flatten_nested_tuples(instance.args))
766
- if not (self.defining_alias and self.nesting_level == 0) and not validate_instance(
767
- instance, self.fail, empty_tuple_index
768
- ):
769
- fix_instance(
770
- instance,
771
- self.fail,
772
- self.note,
773
- disallow_any=self.options.disallow_any_generics and not self.is_typeshed_stub,
774
- options=self.options,
775
- )
776
-
777
- tup = info.tuple_type
778
- if tup is not None:
779
- # The class has a Tuple[...] base class so it will be
780
- # represented as a tuple type.
781
- if info.special_alias:
782
- return instantiate_type_alias(
783
- info.special_alias,
784
- # TODO: should we allow NamedTuples generic in ParamSpec?
785
- self.anal_array(args, allow_unpack=True),
786
- self.fail,
787
- False,
788
- ctx,
789
- self.options,
790
- use_standard_error=True,
791
- )
792
- return tup.copy_modified(
793
- items=self.anal_array(tup.items, allow_unpack=True), fallback=instance
794
- )
795
- td = info.typeddict_type
796
- if td is not None:
797
- # The class has a TypedDict[...] base class so it will be
798
- # represented as a typeddict type.
799
- if info.special_alias:
800
- return instantiate_type_alias(
801
- info.special_alias,
802
- # TODO: should we allow TypedDicts generic in ParamSpec?
803
- self.anal_array(args, allow_unpack=True),
804
- self.fail,
805
- False,
806
- ctx,
807
- self.options,
808
- use_standard_error=True,
809
- )
810
- # Create a named TypedDictType
811
- return td.copy_modified(
812
- item_types=self.anal_array(list(td.items.values())), fallback=instance
813
- )
814
-
815
- if info.fullname == "types.NoneType":
816
- self.fail(
817
- "NoneType should not be used as a type, please use None instead",
818
- ctx,
819
- code=codes.VALID_TYPE,
820
- )
821
- return NoneType(ctx.line, ctx.column)
822
-
823
- return instance
824
-
825
- def analyze_unbound_type_without_type_info(
826
- self, t: UnboundType, sym: SymbolTableNode, defining_literal: bool
827
- ) -> Type:
828
- """Figure out what an unbound type that doesn't refer to a TypeInfo node means.
829
-
830
- This is something unusual. We try our best to find out what it is.
831
- """
832
- name = sym.fullname
833
- if name is None:
834
- assert sym.node is not None
835
- name = sym.node.name
836
- # Option 1:
837
- # Something with an Any type -- make it an alias for Any in a type
838
- # context. This is slightly problematic as it allows using the type 'Any'
839
- # as a base class -- however, this will fail soon at runtime so the problem
840
- # is pretty minor.
841
- if isinstance(sym.node, Var):
842
- typ = get_proper_type(sym.node.type)
843
- if isinstance(typ, AnyType):
844
- return AnyType(
845
- TypeOfAny.from_unimported_type, missing_import_name=typ.missing_import_name
846
- )
847
- elif self.allow_type_any:
848
- if isinstance(typ, Instance) and typ.type.fullname == "builtins.type":
849
- return AnyType(TypeOfAny.special_form)
850
- if isinstance(typ, TypeType) and isinstance(typ.item, AnyType):
851
- return AnyType(TypeOfAny.from_another_any, source_any=typ.item)
852
- # Option 2:
853
- # Unbound type variable. Currently these may be still valid,
854
- # for example when defining a generic type alias.
855
- unbound_tvar = (
856
- isinstance(sym.node, (TypeVarExpr, TypeVarTupleExpr))
857
- and self.tvar_scope.get_binding(sym) is None
858
- )
859
- if self.allow_unbound_tvars and unbound_tvar:
860
- return t
861
-
862
- # Option 3:
863
- # Enum value. Note: we only want to return a LiteralType when
864
- # we're using this enum value specifically within context of
865
- # a "Literal[...]" type. So, if `defining_literal` is not set,
866
- # we bail out early with an error.
867
- #
868
- # If, in the distant future, we decide to permit things like
869
- # `def foo(x: Color.RED) -> None: ...`, we can remove that
870
- # check entirely.
871
- if isinstance(sym.node, Var) and sym.node.info and sym.node.info.is_enum:
872
- value = sym.node.name
873
- base_enum_short_name = sym.node.info.name
874
- if not defining_literal:
875
- msg = message_registry.INVALID_TYPE_RAW_ENUM_VALUE.format(
876
- base_enum_short_name, value
877
- )
878
- self.fail(msg.value, t, code=msg.code)
879
- return AnyType(TypeOfAny.from_error)
880
- return LiteralType(
881
- value=value,
882
- fallback=Instance(sym.node.info, [], line=t.line, column=t.column),
883
- line=t.line,
884
- column=t.column,
885
- )
886
-
887
- # None of the above options worked. We parse the args (if there are any)
888
- # to make sure there are no remaining semanal-only types, then give up.
889
- t = t.copy_modified(args=self.anal_array(t.args))
890
- # TODO: Move this message building logic to messages.py.
891
- notes: list[str] = []
892
- if isinstance(sym.node, Var):
893
- notes.append(
894
- "See https://mypy.readthedocs.io/en/"
895
- "stable/common_issues.html#variables-vs-type-aliases"
896
- )
897
- message = 'Variable "{}" is not valid as a type'
898
- elif isinstance(sym.node, (SYMBOL_FUNCBASE_TYPES, Decorator)):
899
- message = 'Function "{}" is not valid as a type'
900
- if name == "builtins.any":
901
- notes.append('Perhaps you meant "typing.Any" instead of "any"?')
902
- elif name == "builtins.callable":
903
- notes.append('Perhaps you meant "typing.Callable" instead of "callable"?')
904
- else:
905
- notes.append('Perhaps you need "Callable[...]" or a callback protocol?')
906
- elif isinstance(sym.node, MypyFile):
907
- message = 'Module "{}" is not valid as a type'
908
- notes.append("Perhaps you meant to use a protocol matching the module structure?")
909
- elif unbound_tvar:
910
- message = 'Type variable "{}" is unbound'
911
- short = name.split(".")[-1]
912
- notes.append(
913
- (
914
- '(Hint: Use "Generic[{}]" or "Protocol[{}]" base class'
915
- ' to bind "{}" inside a class)'
916
- ).format(short, short, short)
917
- )
918
- notes.append(
919
- '(Hint: Use "{}" in function signature to bind "{}"'
920
- " inside a function)".format(short, short)
921
- )
922
- else:
923
- message = 'Cannot interpret reference "{}" as a type'
924
- if not defining_literal:
925
- # Literal check already gives a custom error. Avoid duplicating errors.
926
- self.fail(message.format(name), t, code=codes.VALID_TYPE)
927
- for note in notes:
928
- self.note(note, t, code=codes.VALID_TYPE)
929
-
930
- # TODO: Would it be better to always return Any instead of UnboundType
931
- # in case of an error? On one hand, UnboundType has a name so error messages
932
- # are more detailed, on the other hand, some of them may be bogus,
933
- # see https://github.com/python/mypy/issues/4987.
934
- return t
935
-
936
- def visit_any(self, t: AnyType) -> Type:
937
- return t
938
-
939
- def visit_none_type(self, t: NoneType) -> Type:
940
- return t
941
-
942
- def visit_uninhabited_type(self, t: UninhabitedType) -> Type:
943
- return t
944
-
945
- def visit_erased_type(self, t: ErasedType) -> Type:
946
- # This type should exist only temporarily during type inference
947
- assert False, "Internal error: Unexpected erased type"
948
-
949
- def visit_deleted_type(self, t: DeletedType) -> Type:
950
- return t
951
-
952
- def visit_type_list(self, t: TypeList) -> Type:
953
- # Parameters literal (Z[[int, str, Whatever]])
954
- if self.allow_param_spec_literals:
955
- params = self.analyze_callable_args(t)
956
- if params:
957
- ts, kinds, names = params
958
- # bind these types
959
- return Parameters(self.anal_array(ts), kinds, names, line=t.line, column=t.column)
960
- else:
961
- return AnyType(TypeOfAny.from_error)
962
- else:
963
- self.fail(
964
- 'Bracketed expression "[...]" is not valid as a type', t, code=codes.VALID_TYPE
965
- )
966
- if len(t.items) == 1:
967
- self.note('Did you mean "List[...]"?', t)
968
- return AnyType(TypeOfAny.from_error)
969
-
970
- def visit_callable_argument(self, t: CallableArgument) -> Type:
971
- self.fail("Invalid type", t, code=codes.VALID_TYPE)
972
- return AnyType(TypeOfAny.from_error)
973
-
974
- def visit_instance(self, t: Instance) -> Type:
975
- return t
976
-
977
- def visit_type_alias_type(self, t: TypeAliasType) -> Type:
978
- # TODO: should we do something here?
979
- return t
980
-
981
- def visit_type_var(self, t: TypeVarType) -> Type:
982
- return t
983
-
984
- def visit_param_spec(self, t: ParamSpecType) -> Type:
985
- return t
986
-
987
- def visit_type_var_tuple(self, t: TypeVarTupleType) -> Type:
988
- return t
989
-
990
- def visit_unpack_type(self, t: UnpackType) -> Type:
991
- if not self.allow_unpack:
992
- self.fail(message_registry.INVALID_UNPACK_POSITION, t.type, code=codes.VALID_TYPE)
993
- return AnyType(TypeOfAny.from_error)
994
- self.allow_type_var_tuple = True
995
- result = UnpackType(self.anal_type(t.type), from_star_syntax=t.from_star_syntax)
996
- self.allow_type_var_tuple = False
997
- return result
998
-
999
- def visit_parameters(self, t: Parameters) -> Type:
1000
- raise NotImplementedError("ParamSpec literals cannot have unbound TypeVars")
1001
-
1002
- def visit_callable_type(self, t: CallableType, nested: bool = True) -> Type:
1003
- # Every Callable can bind its own type variables, if they're not in the outer scope
1004
- with self.tvar_scope_frame():
1005
- unpacked_kwargs = False
1006
- if self.defining_alias:
1007
- variables = t.variables
1008
- else:
1009
- variables, _ = self.bind_function_type_variables(t, t)
1010
- type_guard = self.anal_type_guard(t.ret_type)
1011
- type_is = self.anal_type_is(t.ret_type)
1012
- arg_kinds = t.arg_kinds
1013
- if len(arg_kinds) >= 2 and arg_kinds[-2] == ARG_STAR and arg_kinds[-1] == ARG_STAR2:
1014
- arg_types = self.anal_array(t.arg_types[:-2], nested=nested) + [
1015
- self.anal_star_arg_type(t.arg_types[-2], ARG_STAR, nested=nested),
1016
- self.anal_star_arg_type(t.arg_types[-1], ARG_STAR2, nested=nested),
1017
- ]
1018
- # If nested is True, it means we are analyzing a Callable[...] type, rather
1019
- # than a function definition type. We need to "unpack" ** TypedDict annotation
1020
- # here (for function definitions it is done in semanal).
1021
- if nested and isinstance(arg_types[-1], UnpackType):
1022
- # TODO: it would be better to avoid this get_proper_type() call.
1023
- unpacked = get_proper_type(arg_types[-1].type)
1024
- if isinstance(unpacked, TypedDictType):
1025
- arg_types[-1] = unpacked
1026
- unpacked_kwargs = True
1027
- arg_types = self.check_unpacks_in_list(arg_types)
1028
- else:
1029
- star_index = None
1030
- if ARG_STAR in arg_kinds:
1031
- star_index = arg_kinds.index(ARG_STAR)
1032
- star2_index = None
1033
- if ARG_STAR2 in arg_kinds:
1034
- star2_index = arg_kinds.index(ARG_STAR2)
1035
- arg_types = []
1036
- for i, ut in enumerate(t.arg_types):
1037
- at = self.anal_type(
1038
- ut, nested=nested, allow_unpack=i in (star_index, star2_index)
1039
- )
1040
- if nested and isinstance(at, UnpackType) and i == star_index:
1041
- # TODO: it would be better to avoid this get_proper_type() call.
1042
- p_at = get_proper_type(at.type)
1043
- if isinstance(p_at, TypedDictType) and not at.from_star_syntax:
1044
- # Automatically detect Unpack[Foo] in Callable as backwards
1045
- # compatible syntax for **Foo, if Foo is a TypedDict.
1046
- at = p_at
1047
- arg_kinds[i] = ARG_STAR2
1048
- unpacked_kwargs = True
1049
- arg_types.append(at)
1050
- if nested:
1051
- arg_types = self.check_unpacks_in_list(arg_types)
1052
- # If there were multiple (invalid) unpacks, the arg types list will become shorter,
1053
- # we need to trim the kinds/names as well to avoid crashes.
1054
- arg_kinds = t.arg_kinds[: len(arg_types)]
1055
- arg_names = t.arg_names[: len(arg_types)]
1056
-
1057
- ret = t.copy_modified(
1058
- arg_types=arg_types,
1059
- arg_kinds=arg_kinds,
1060
- arg_names=arg_names,
1061
- ret_type=self.anal_type(t.ret_type, nested=nested),
1062
- # If the fallback isn't filled in yet,
1063
- # its type will be the falsey FakeInfo
1064
- fallback=(t.fallback if t.fallback.type else self.named_type("builtins.function")),
1065
- variables=self.anal_var_defs(variables),
1066
- type_guard=type_guard,
1067
- type_is=type_is,
1068
- unpack_kwargs=unpacked_kwargs,
1069
- )
1070
- return ret
1071
-
1072
- def anal_type_guard(self, t: Type) -> Type | None:
1073
- if isinstance(t, UnboundType):
1074
- sym = self.lookup_qualified(t.name, t)
1075
- if sym is not None and sym.node is not None:
1076
- return self.anal_type_guard_arg(t, sym.node.fullname)
1077
- # TODO: What if it's an Instance? Then use t.type.fullname?
1078
- return None
1079
-
1080
- def anal_type_guard_arg(self, t: UnboundType, fullname: str) -> Type | None:
1081
- if fullname in ("typing_extensions.TypeGuard", "typing.TypeGuard"):
1082
- if len(t.args) != 1:
1083
- self.fail(
1084
- "TypeGuard must have exactly one type argument", t, code=codes.VALID_TYPE
1085
- )
1086
- return AnyType(TypeOfAny.from_error)
1087
- return self.anal_type(t.args[0])
1088
- return None
1089
-
1090
- def anal_type_is(self, t: Type) -> Type | None:
1091
- if isinstance(t, UnboundType):
1092
- sym = self.lookup_qualified(t.name, t)
1093
- if sym is not None and sym.node is not None:
1094
- return self.anal_type_is_arg(t, sym.node.fullname)
1095
- # TODO: What if it's an Instance? Then use t.type.fullname?
1096
- return None
1097
-
1098
- def anal_type_is_arg(self, t: UnboundType, fullname: str) -> Type | None:
1099
- if fullname in ("typing_extensions.TypeIs", "typing.TypeIs"):
1100
- if len(t.args) != 1:
1101
- self.fail("TypeIs must have exactly one type argument", t, code=codes.VALID_TYPE)
1102
- return AnyType(TypeOfAny.from_error)
1103
- return self.anal_type(t.args[0])
1104
- return None
1105
-
1106
- def anal_star_arg_type(self, t: Type, kind: ArgKind, nested: bool) -> Type:
1107
- """Analyze signature argument type for *args and **kwargs argument."""
1108
- if isinstance(t, UnboundType) and t.name and "." in t.name and not t.args:
1109
- components = t.name.split(".")
1110
- tvar_name = ".".join(components[:-1])
1111
- sym = self.lookup_qualified(tvar_name, t)
1112
- if sym is not None and isinstance(sym.node, ParamSpecExpr):
1113
- tvar_def = self.tvar_scope.get_binding(sym)
1114
- if isinstance(tvar_def, ParamSpecType):
1115
- if kind == ARG_STAR:
1116
- make_paramspec = paramspec_args
1117
- if components[-1] != "args":
1118
- self.fail(
1119
- f'Use "{tvar_name}.args" for variadic "*" parameter',
1120
- t,
1121
- code=codes.VALID_TYPE,
1122
- )
1123
- elif kind == ARG_STAR2:
1124
- make_paramspec = paramspec_kwargs
1125
- if components[-1] != "kwargs":
1126
- self.fail(
1127
- f'Use "{tvar_name}.kwargs" for variadic "**" parameter',
1128
- t,
1129
- code=codes.VALID_TYPE,
1130
- )
1131
- else:
1132
- assert False, kind
1133
- return make_paramspec(
1134
- tvar_def.name,
1135
- tvar_def.fullname,
1136
- tvar_def.id,
1137
- named_type_func=self.named_type,
1138
- line=t.line,
1139
- column=t.column,
1140
- )
1141
- return self.anal_type(t, nested=nested, allow_unpack=True)
1142
-
1143
- def visit_overloaded(self, t: Overloaded) -> Type:
1144
- # Overloaded types are manually constructed in semanal.py by analyzing the
1145
- # AST and combining together the Callable types this visitor converts.
1146
- #
1147
- # So if we're ever asked to reanalyze an Overloaded type, we know it's
1148
- # fine to just return it as-is.
1149
- return t
1150
-
1151
- def visit_tuple_type(self, t: TupleType) -> Type:
1152
- # Types such as (t1, t2, ...) only allowed in assignment statements. They'll
1153
- # generate errors elsewhere, and Tuple[t1, t2, ...] must be used instead.
1154
- if t.implicit and not self.allow_tuple_literal:
1155
- self.fail("Syntax error in type annotation", t, code=codes.SYNTAX)
1156
- if len(t.items) == 0:
1157
- self.note(
1158
- "Suggestion: Use Tuple[()] instead of () for an empty tuple, or "
1159
- "None for a function without a return value",
1160
- t,
1161
- code=codes.SYNTAX,
1162
- )
1163
- elif len(t.items) == 1:
1164
- self.note("Suggestion: Is there a spurious trailing comma?", t, code=codes.SYNTAX)
1165
- else:
1166
- self.note(
1167
- "Suggestion: Use Tuple[T1, ..., Tn] instead of (T1, ..., Tn)",
1168
- t,
1169
- code=codes.SYNTAX,
1170
- )
1171
- return AnyType(TypeOfAny.from_error)
1172
-
1173
- any_type = AnyType(TypeOfAny.special_form)
1174
- # If the fallback isn't filled in yet, its type will be the falsey FakeInfo
1175
- fallback = (
1176
- t.partial_fallback
1177
- if t.partial_fallback.type
1178
- else self.named_type("builtins.tuple", [any_type])
1179
- )
1180
- return TupleType(self.anal_array(t.items, allow_unpack=True), fallback, t.line)
1181
-
1182
- def visit_typeddict_type(self, t: TypedDictType) -> Type:
1183
- items = {
1184
- item_name: self.anal_type(item_type) for (item_name, item_type) in t.items.items()
1185
- }
1186
- return TypedDictType(items, set(t.required_keys), t.fallback)
1187
-
1188
- def visit_raw_expression_type(self, t: RawExpressionType) -> Type:
1189
- # We should never see a bare Literal. We synthesize these raw literals
1190
- # in the earlier stages of semantic analysis, but those
1191
- # "fake literals" should always be wrapped in an UnboundType
1192
- # corresponding to 'Literal'.
1193
- #
1194
- # Note: if at some point in the distant future, we decide to
1195
- # make signatures like "foo(x: 20) -> None" legal, we can change
1196
- # this method so it generates and returns an actual LiteralType
1197
- # instead.
1198
-
1199
- if self.report_invalid_types:
1200
- if t.base_type_name in ("builtins.int", "builtins.bool"):
1201
- # The only time it makes sense to use an int or bool is inside of
1202
- # a literal type.
1203
- msg = f"Invalid type: try using Literal[{repr(t.literal_value)}] instead?"
1204
- elif t.base_type_name in ("builtins.float", "builtins.complex"):
1205
- # We special-case warnings for floats and complex numbers.
1206
- msg = f"Invalid type: {t.simple_name()} literals cannot be used as a type"
1207
- else:
1208
- # And in all other cases, we default to a generic error message.
1209
- # Note: the reason why we use a generic error message for strings
1210
- # but not ints or bools is because whenever we see an out-of-place
1211
- # string, it's unclear if the user meant to construct a literal type
1212
- # or just misspelled a regular type. So we avoid guessing.
1213
- msg = "Invalid type comment or annotation"
1214
-
1215
- self.fail(msg, t, code=codes.VALID_TYPE)
1216
- if t.note is not None:
1217
- self.note(t.note, t, code=codes.VALID_TYPE)
1218
-
1219
- return AnyType(TypeOfAny.from_error, line=t.line, column=t.column)
1220
-
1221
- def visit_literal_type(self, t: LiteralType) -> Type:
1222
- return t
1223
-
1224
- def visit_union_type(self, t: UnionType) -> Type:
1225
- if (
1226
- t.uses_pep604_syntax is True
1227
- and t.is_evaluated is True
1228
- and not self.always_allow_new_syntax
1229
- and not self.options.python_version >= (3, 10)
1230
- ):
1231
- self.fail("X | Y syntax for unions requires Python 3.10", t, code=codes.SYNTAX)
1232
- return UnionType(self.anal_array(t.items), t.line)
1233
-
1234
- def visit_partial_type(self, t: PartialType) -> Type:
1235
- assert False, "Internal error: Unexpected partial type"
1236
-
1237
- def visit_ellipsis_type(self, t: EllipsisType) -> Type:
1238
- if self.allow_ellipsis or self.allow_param_spec_literals:
1239
- any_type = AnyType(TypeOfAny.explicit)
1240
- return Parameters(
1241
- [any_type, any_type], [ARG_STAR, ARG_STAR2], [None, None], is_ellipsis_args=True
1242
- )
1243
- else:
1244
- self.fail('Unexpected "..."', t)
1245
- return AnyType(TypeOfAny.from_error)
1246
-
1247
- def visit_type_type(self, t: TypeType) -> Type:
1248
- return TypeType.make_normalized(self.anal_type(t.item), line=t.line)
1249
-
1250
- def visit_placeholder_type(self, t: PlaceholderType) -> Type:
1251
- n = (
1252
- None
1253
- # No dot in fullname indicates we are at function scope, and recursive
1254
- # types are not supported there anyway, so we just give up.
1255
- if not t.fullname or "." not in t.fullname
1256
- else self.api.lookup_fully_qualified(t.fullname)
1257
- )
1258
- if not n or isinstance(n.node, PlaceholderNode):
1259
- self.api.defer() # Still incomplete
1260
- return t
1261
- else:
1262
- # TODO: Handle non-TypeInfo
1263
- assert isinstance(n.node, TypeInfo)
1264
- return self.analyze_type_with_type_info(n.node, t.args, t, False)
1265
-
1266
- def analyze_callable_args_for_paramspec(
1267
- self, callable_args: Type, ret_type: Type, fallback: Instance
1268
- ) -> CallableType | None:
1269
- """Construct a 'Callable[P, RET]', where P is ParamSpec, return None if we cannot."""
1270
- if not isinstance(callable_args, UnboundType):
1271
- return None
1272
- sym = self.lookup_qualified(callable_args.name, callable_args)
1273
- if sym is None:
1274
- return None
1275
- tvar_def = self.tvar_scope.get_binding(sym)
1276
- if not isinstance(tvar_def, ParamSpecType):
1277
- if (
1278
- tvar_def is None
1279
- and self.allow_unbound_tvars
1280
- and isinstance(sym.node, ParamSpecExpr)
1281
- ):
1282
- # We are analyzing this type in runtime context (e.g. as type application).
1283
- # If it is not valid as a type in this position an error will be given later.
1284
- return callable_with_ellipsis(
1285
- AnyType(TypeOfAny.explicit), ret_type=ret_type, fallback=fallback
1286
- )
1287
- return None
1288
- elif (
1289
- self.defining_alias
1290
- and self.not_declared_in_type_params(tvar_def.name)
1291
- and tvar_def not in self.allowed_alias_tvars
1292
- ):
1293
- self.fail(
1294
- f'ParamSpec "{tvar_def.name}" is not included in type_params',
1295
- callable_args,
1296
- code=codes.VALID_TYPE,
1297
- )
1298
- return callable_with_ellipsis(
1299
- AnyType(TypeOfAny.special_form), ret_type=ret_type, fallback=fallback
1300
- )
1301
-
1302
- return CallableType(
1303
- [
1304
- paramspec_args(
1305
- tvar_def.name, tvar_def.fullname, tvar_def.id, named_type_func=self.named_type
1306
- ),
1307
- paramspec_kwargs(
1308
- tvar_def.name, tvar_def.fullname, tvar_def.id, named_type_func=self.named_type
1309
- ),
1310
- ],
1311
- [nodes.ARG_STAR, nodes.ARG_STAR2],
1312
- [None, None],
1313
- ret_type=ret_type,
1314
- fallback=fallback,
1315
- )
1316
-
1317
- def analyze_callable_args_for_concatenate(
1318
- self, callable_args: Type, ret_type: Type, fallback: Instance
1319
- ) -> CallableType | AnyType | None:
1320
- """Construct a 'Callable[C, RET]', where C is Concatenate[..., P], returning None if we
1321
- cannot.
1322
- """
1323
- if not isinstance(callable_args, UnboundType):
1324
- return None
1325
- sym = self.lookup_qualified(callable_args.name, callable_args)
1326
- if sym is None:
1327
- return None
1328
- if sym.node is None:
1329
- return None
1330
- if sym.node.fullname not in ("typing_extensions.Concatenate", "typing.Concatenate"):
1331
- return None
1332
-
1333
- tvar_def = self.anal_type(callable_args, allow_param_spec=True)
1334
- if not isinstance(tvar_def, (ParamSpecType, Parameters)):
1335
- if self.allow_unbound_tvars and isinstance(tvar_def, UnboundType):
1336
- sym = self.lookup_qualified(tvar_def.name, callable_args)
1337
- if sym is not None and isinstance(sym.node, ParamSpecExpr):
1338
- # We are analyzing this type in runtime context (e.g. as type application).
1339
- # If it is not valid as a type in this position an error will be given later.
1340
- return callable_with_ellipsis(
1341
- AnyType(TypeOfAny.explicit), ret_type=ret_type, fallback=fallback
1342
- )
1343
- # Error was already given, so prevent further errors.
1344
- return AnyType(TypeOfAny.from_error)
1345
- if isinstance(tvar_def, Parameters):
1346
- # This comes from Concatenate[int, ...]
1347
- return CallableType(
1348
- arg_types=tvar_def.arg_types,
1349
- arg_names=tvar_def.arg_names,
1350
- arg_kinds=tvar_def.arg_kinds,
1351
- ret_type=ret_type,
1352
- fallback=fallback,
1353
- from_concatenate=True,
1354
- )
1355
-
1356
- # ick, CallableType should take ParamSpecType
1357
- prefix = tvar_def.prefix
1358
- # we don't set the prefix here as generic arguments will get updated at some point
1359
- # in the future. CallableType.param_spec() accounts for this.
1360
- return CallableType(
1361
- [
1362
- *prefix.arg_types,
1363
- paramspec_args(
1364
- tvar_def.name, tvar_def.fullname, tvar_def.id, named_type_func=self.named_type
1365
- ),
1366
- paramspec_kwargs(
1367
- tvar_def.name, tvar_def.fullname, tvar_def.id, named_type_func=self.named_type
1368
- ),
1369
- ],
1370
- [*prefix.arg_kinds, nodes.ARG_STAR, nodes.ARG_STAR2],
1371
- [*prefix.arg_names, None, None],
1372
- ret_type=ret_type,
1373
- fallback=fallback,
1374
- from_concatenate=True,
1375
- )
1376
-
1377
- def analyze_callable_type(self, t: UnboundType) -> Type:
1378
- fallback = self.named_type("builtins.function")
1379
- if len(t.args) == 0:
1380
- # Callable (bare). Treat as Callable[..., Any].
1381
- any_type = self.get_omitted_any(t)
1382
- ret = callable_with_ellipsis(any_type, any_type, fallback)
1383
- elif len(t.args) == 2:
1384
- callable_args = t.args[0]
1385
- ret_type = t.args[1]
1386
- if isinstance(callable_args, TypeList):
1387
- # Callable[[ARG, ...], RET] (ordinary callable type)
1388
- analyzed_args = self.analyze_callable_args(callable_args)
1389
- if analyzed_args is None:
1390
- return AnyType(TypeOfAny.from_error)
1391
- args, kinds, names = analyzed_args
1392
- ret = CallableType(args, kinds, names, ret_type=ret_type, fallback=fallback)
1393
- elif isinstance(callable_args, EllipsisType):
1394
- # Callable[..., RET] (with literal ellipsis; accept arbitrary arguments)
1395
- ret = callable_with_ellipsis(
1396
- AnyType(TypeOfAny.explicit), ret_type=ret_type, fallback=fallback
1397
- )
1398
- else:
1399
- # Callable[P, RET] (where P is ParamSpec)
1400
- with self.tvar_scope_frame():
1401
- # Temporarily bind ParamSpecs to allow code like this:
1402
- # my_fun: Callable[Q, Foo[Q]]
1403
- # We usually do this later in visit_callable_type(), but the analysis
1404
- # below happens at very early stage.
1405
- variables = []
1406
- for name, tvar_expr in self.find_type_var_likes(callable_args):
1407
- variables.append(self.tvar_scope.bind_new(name, tvar_expr))
1408
- maybe_ret = self.analyze_callable_args_for_paramspec(
1409
- callable_args, ret_type, fallback
1410
- ) or self.analyze_callable_args_for_concatenate(
1411
- callable_args, ret_type, fallback
1412
- )
1413
- if isinstance(maybe_ret, CallableType):
1414
- maybe_ret = maybe_ret.copy_modified(variables=variables)
1415
- if maybe_ret is None:
1416
- # Callable[?, RET] (where ? is something invalid)
1417
- self.fail(
1418
- "The first argument to Callable must be a "
1419
- 'list of types, parameter specification, or "..."',
1420
- t,
1421
- code=codes.VALID_TYPE,
1422
- )
1423
- self.note(
1424
- "See https://mypy.readthedocs.io/en/stable/kinds_of_types.html#callable-types-and-lambdas",
1425
- t,
1426
- )
1427
- return AnyType(TypeOfAny.from_error)
1428
- elif isinstance(maybe_ret, AnyType):
1429
- return maybe_ret
1430
- ret = maybe_ret
1431
- else:
1432
- if self.options.disallow_any_generics:
1433
- self.fail('Please use "Callable[[<parameters>], <return type>]"', t)
1434
- else:
1435
- self.fail('Please use "Callable[[<parameters>], <return type>]" or "Callable"', t)
1436
- return AnyType(TypeOfAny.from_error)
1437
- assert isinstance(ret, CallableType)
1438
- return ret.accept(self)
1439
-
1440
- def refers_to_full_names(self, arg: UnboundType, names: Sequence[str]) -> bool:
1441
- sym = self.lookup_qualified(arg.name, arg)
1442
- if sym is not None:
1443
- if sym.fullname in names:
1444
- return True
1445
- return False
1446
-
1447
- def analyze_callable_args(
1448
- self, arglist: TypeList
1449
- ) -> tuple[list[Type], list[ArgKind], list[str | None]] | None:
1450
- args: list[Type] = []
1451
- kinds: list[ArgKind] = []
1452
- names: list[str | None] = []
1453
- seen_unpack = False
1454
- unpack_types: list[Type] = []
1455
- invalid_unpacks: list[Type] = []
1456
- second_unpack_last = False
1457
- for i, arg in enumerate(arglist.items):
1458
- if isinstance(arg, CallableArgument):
1459
- args.append(arg.typ)
1460
- names.append(arg.name)
1461
- if arg.constructor is None:
1462
- return None
1463
- found = self.lookup_qualified(arg.constructor, arg)
1464
- if found is None:
1465
- # Looking it up already put an error message in
1466
- return None
1467
- elif found.fullname not in ARG_KINDS_BY_CONSTRUCTOR:
1468
- self.fail(f'Invalid argument constructor "{found.fullname}"', arg)
1469
- return None
1470
- else:
1471
- assert found.fullname is not None
1472
- kind = ARG_KINDS_BY_CONSTRUCTOR[found.fullname]
1473
- kinds.append(kind)
1474
- if arg.name is not None and kind.is_star():
1475
- self.fail(f"{arg.constructor} arguments should not have names", arg)
1476
- return None
1477
- elif (
1478
- isinstance(arg, UnboundType)
1479
- and self.refers_to_full_names(arg, ("typing_extensions.Unpack", "typing.Unpack"))
1480
- or isinstance(arg, UnpackType)
1481
- ):
1482
- if seen_unpack:
1483
- # Multiple unpacks, preserve them, so we can give an error later.
1484
- if i == len(arglist.items) - 1 and not invalid_unpacks:
1485
- # Special case: if there are just two unpacks, and the second one appears
1486
- # as last type argument, it can be still valid, if the second unpacked type
1487
- # is a TypedDict. This should be checked by the caller.
1488
- second_unpack_last = True
1489
- invalid_unpacks.append(arg)
1490
- continue
1491
- seen_unpack = True
1492
- unpack_types.append(arg)
1493
- else:
1494
- if seen_unpack:
1495
- unpack_types.append(arg)
1496
- else:
1497
- args.append(arg)
1498
- kinds.append(ARG_POS)
1499
- names.append(None)
1500
- if seen_unpack:
1501
- if len(unpack_types) == 1:
1502
- args.append(unpack_types[0])
1503
- else:
1504
- first = unpack_types[0]
1505
- if isinstance(first, UnpackType):
1506
- # UnpackType doesn't have its own line/column numbers,
1507
- # so use the unpacked type for error messages.
1508
- first = first.type
1509
- args.append(
1510
- UnpackType(self.tuple_type(unpack_types, line=first.line, column=first.column))
1511
- )
1512
- kinds.append(ARG_STAR)
1513
- names.append(None)
1514
- for arg in invalid_unpacks:
1515
- args.append(arg)
1516
- kinds.append(ARG_STAR2 if second_unpack_last else ARG_STAR)
1517
- names.append(None)
1518
- # Note that arglist below is only used for error context.
1519
- check_arg_names(names, [arglist] * len(args), self.fail, "Callable")
1520
- check_arg_kinds(kinds, [arglist] * len(args), self.fail)
1521
- return args, kinds, names
1522
-
1523
- def analyze_literal_type(self, t: UnboundType) -> Type:
1524
- if len(t.args) == 0:
1525
- self.fail("Literal[...] must have at least one parameter", t, code=codes.VALID_TYPE)
1526
- return AnyType(TypeOfAny.from_error)
1527
-
1528
- output: list[Type] = []
1529
- for i, arg in enumerate(t.args):
1530
- analyzed_types = self.analyze_literal_param(i + 1, arg, t)
1531
- if analyzed_types is None:
1532
- return AnyType(TypeOfAny.from_error)
1533
- else:
1534
- output.extend(analyzed_types)
1535
- return UnionType.make_union(output, line=t.line)
1536
-
1537
- def analyze_literal_param(self, idx: int, arg: Type, ctx: Context) -> list[Type] | None:
1538
- # This UnboundType was originally defined as a string.
1539
- if isinstance(arg, UnboundType) and arg.original_str_expr is not None:
1540
- assert arg.original_str_fallback is not None
1541
- return [
1542
- LiteralType(
1543
- value=arg.original_str_expr,
1544
- fallback=self.named_type(arg.original_str_fallback),
1545
- line=arg.line,
1546
- column=arg.column,
1547
- )
1548
- ]
1549
-
1550
- # If arg is an UnboundType that was *not* originally defined as
1551
- # a string, try expanding it in case it's a type alias or something.
1552
- if isinstance(arg, UnboundType):
1553
- self.nesting_level += 1
1554
- try:
1555
- arg = self.visit_unbound_type(arg, defining_literal=True)
1556
- finally:
1557
- self.nesting_level -= 1
1558
-
1559
- # Literal[...] cannot contain Any. Give up and add an error message
1560
- # (if we haven't already).
1561
- arg = get_proper_type(arg)
1562
- if isinstance(arg, AnyType):
1563
- # Note: We can encounter Literals containing 'Any' under three circumstances:
1564
- #
1565
- # 1. If the user attempts use an explicit Any as a parameter
1566
- # 2. If the user is trying to use an enum value imported from a module with
1567
- # no type hints, giving it an implicit type of 'Any'
1568
- # 3. If there's some other underlying problem with the parameter.
1569
- #
1570
- # We report an error in only the first two cases. In the third case, we assume
1571
- # some other region of the code has already reported a more relevant error.
1572
- #
1573
- # TODO: Once we start adding support for enums, make sure we report a custom
1574
- # error for case 2 as well.
1575
- if arg.type_of_any not in (TypeOfAny.from_error, TypeOfAny.special_form):
1576
- self.fail(
1577
- f'Parameter {idx} of Literal[...] cannot be of type "Any"',
1578
- ctx,
1579
- code=codes.VALID_TYPE,
1580
- )
1581
- return None
1582
- elif isinstance(arg, RawExpressionType):
1583
- # A raw literal. Convert it directly into a literal if we can.
1584
- if arg.literal_value is None:
1585
- name = arg.simple_name()
1586
- if name in ("float", "complex"):
1587
- msg = f'Parameter {idx} of Literal[...] cannot be of type "{name}"'
1588
- else:
1589
- msg = "Invalid type: Literal[...] cannot contain arbitrary expressions"
1590
- self.fail(msg, ctx, code=codes.VALID_TYPE)
1591
- # Note: we deliberately ignore arg.note here: the extra info might normally be
1592
- # helpful, but it generally won't make sense in the context of a Literal[...].
1593
- return None
1594
-
1595
- # Remap bytes and unicode into the appropriate type for the correct Python version
1596
- fallback = self.named_type(arg.base_type_name)
1597
- assert isinstance(fallback, Instance)
1598
- return [LiteralType(arg.literal_value, fallback, line=arg.line, column=arg.column)]
1599
- elif isinstance(arg, (NoneType, LiteralType)):
1600
- # Types that we can just add directly to the literal/potential union of literals.
1601
- return [arg]
1602
- elif isinstance(arg, Instance) and arg.last_known_value is not None:
1603
- # Types generated from declarations like "var: Final = 4".
1604
- return [arg.last_known_value]
1605
- elif isinstance(arg, UnionType):
1606
- out = []
1607
- for union_arg in arg.items:
1608
- union_result = self.analyze_literal_param(idx, union_arg, ctx)
1609
- if union_result is None:
1610
- return None
1611
- out.extend(union_result)
1612
- return out
1613
- else:
1614
- self.fail(f"Parameter {idx} of Literal[...] is invalid", ctx, code=codes.VALID_TYPE)
1615
- return None
1616
-
1617
- def analyze_type(self, t: Type) -> Type:
1618
- return t.accept(self)
1619
-
1620
- def fail(self, msg: str, ctx: Context, *, code: ErrorCode | None = None) -> None:
1621
- self.fail_func(msg, ctx, code=code)
1622
-
1623
- def note(self, msg: str, ctx: Context, *, code: ErrorCode | None = None) -> None:
1624
- self.note_func(msg, ctx, code=code)
1625
-
1626
- @contextmanager
1627
- def tvar_scope_frame(self) -> Iterator[None]:
1628
- old_scope = self.tvar_scope
1629
- self.tvar_scope = self.tvar_scope.method_frame()
1630
- yield
1631
- self.tvar_scope = old_scope
1632
-
1633
- def find_type_var_likes(self, t: Type) -> TypeVarLikeList:
1634
- visitor = FindTypeVarVisitor(self.api, self.tvar_scope)
1635
- t.accept(visitor)
1636
- return visitor.type_var_likes
1637
-
1638
- def infer_type_variables(
1639
- self, type: CallableType
1640
- ) -> tuple[list[tuple[str, TypeVarLikeExpr]], bool]:
1641
- """Infer type variables from a callable.
1642
-
1643
- Return tuple with these items:
1644
- - list of unique type variables referred to in a callable
1645
- - whether there is a reference to the Self type
1646
- """
1647
- visitor = FindTypeVarVisitor(self.api, self.tvar_scope)
1648
- for arg in type.arg_types:
1649
- arg.accept(visitor)
1650
-
1651
- # When finding type variables in the return type of a function, don't
1652
- # look inside Callable types. Type variables only appearing in
1653
- # functions in the return type belong to those functions, not the
1654
- # function we're currently analyzing.
1655
- visitor.include_callables = False
1656
- type.ret_type.accept(visitor)
1657
-
1658
- return visitor.type_var_likes, visitor.has_self_type
1659
-
1660
- def bind_function_type_variables(
1661
- self, fun_type: CallableType, defn: Context
1662
- ) -> tuple[Sequence[TypeVarLikeType], bool]:
1663
- """Find the type variables of the function type and bind them in our tvar_scope"""
1664
- has_self_type = False
1665
- if fun_type.variables:
1666
- defs = []
1667
- for var in fun_type.variables:
1668
- if self.api.type and self.api.type.self_type and var == self.api.type.self_type:
1669
- has_self_type = True
1670
- continue
1671
- var_node = self.lookup_qualified(var.name, defn)
1672
- assert var_node, "Binding for function type variable not found within function"
1673
- var_expr = var_node.node
1674
- assert isinstance(var_expr, TypeVarLikeExpr)
1675
- binding = self.tvar_scope.bind_new(var.name, var_expr)
1676
- defs.append(binding)
1677
- return defs, has_self_type
1678
- typevars, has_self_type = self.infer_type_variables(fun_type)
1679
- # Do not define a new type variable if already defined in scope.
1680
- typevars = [
1681
- (name, tvar) for name, tvar in typevars if not self.is_defined_type_var(name, defn)
1682
- ]
1683
- defs = []
1684
- for name, tvar in typevars:
1685
- if not self.tvar_scope.allow_binding(tvar.fullname):
1686
- self.fail(
1687
- f'Type variable "{name}" is bound by an outer class',
1688
- defn,
1689
- code=codes.VALID_TYPE,
1690
- )
1691
- binding = self.tvar_scope.bind_new(name, tvar)
1692
- defs.append(binding)
1693
-
1694
- return defs, has_self_type
1695
-
1696
- def is_defined_type_var(self, tvar: str, context: Context) -> bool:
1697
- tvar_node = self.lookup_qualified(tvar, context)
1698
- if not tvar_node:
1699
- return False
1700
- return self.tvar_scope.get_binding(tvar_node) is not None
1701
-
1702
- def anal_array(
1703
- self,
1704
- a: Iterable[Type],
1705
- nested: bool = True,
1706
- *,
1707
- allow_param_spec: bool = False,
1708
- allow_param_spec_literals: bool = False,
1709
- allow_unpack: bool = False,
1710
- ) -> list[Type]:
1711
- old_allow_param_spec_literals = self.allow_param_spec_literals
1712
- self.allow_param_spec_literals = allow_param_spec_literals
1713
- res: list[Type] = []
1714
- for t in a:
1715
- res.append(
1716
- self.anal_type(
1717
- t, nested, allow_param_spec=allow_param_spec, allow_unpack=allow_unpack
1718
- )
1719
- )
1720
- self.allow_param_spec_literals = old_allow_param_spec_literals
1721
- return self.check_unpacks_in_list(res)
1722
-
1723
- def anal_type(
1724
- self,
1725
- t: Type,
1726
- nested: bool = True,
1727
- *,
1728
- allow_param_spec: bool = False,
1729
- allow_unpack: bool = False,
1730
- allow_ellipsis: bool = False,
1731
- ) -> Type:
1732
- if nested:
1733
- self.nesting_level += 1
1734
- old_allow_required = self.allow_required
1735
- self.allow_required = False
1736
- old_allow_ellipsis = self.allow_ellipsis
1737
- self.allow_ellipsis = allow_ellipsis
1738
- old_allow_unpack = self.allow_unpack
1739
- self.allow_unpack = allow_unpack
1740
- try:
1741
- analyzed = t.accept(self)
1742
- finally:
1743
- if nested:
1744
- self.nesting_level -= 1
1745
- self.allow_required = old_allow_required
1746
- self.allow_ellipsis = old_allow_ellipsis
1747
- self.allow_unpack = old_allow_unpack
1748
- if (
1749
- not allow_param_spec
1750
- and isinstance(analyzed, ParamSpecType)
1751
- and analyzed.flavor == ParamSpecFlavor.BARE
1752
- ):
1753
- if analyzed.prefix.arg_types:
1754
- self.fail("Invalid location for Concatenate", t, code=codes.VALID_TYPE)
1755
- self.note("You can use Concatenate as the first argument to Callable", t)
1756
- analyzed = AnyType(TypeOfAny.from_error)
1757
- else:
1758
- self.fail(
1759
- f'Invalid location for ParamSpec "{analyzed.name}"', t, code=codes.VALID_TYPE
1760
- )
1761
- self.note(
1762
- "You can use ParamSpec as the first argument to Callable, e.g., "
1763
- "'Callable[{}, int]'".format(analyzed.name),
1764
- t,
1765
- )
1766
- analyzed = AnyType(TypeOfAny.from_error)
1767
- return analyzed
1768
-
1769
- def anal_var_def(self, var_def: TypeVarLikeType) -> TypeVarLikeType:
1770
- if isinstance(var_def, TypeVarType):
1771
- return TypeVarType(
1772
- name=var_def.name,
1773
- fullname=var_def.fullname,
1774
- id=var_def.id.raw_id,
1775
- values=self.anal_array(var_def.values),
1776
- upper_bound=var_def.upper_bound.accept(self),
1777
- default=var_def.default.accept(self),
1778
- variance=var_def.variance,
1779
- line=var_def.line,
1780
- column=var_def.column,
1781
- )
1782
- else:
1783
- return var_def
1784
-
1785
- def anal_var_defs(self, var_defs: Sequence[TypeVarLikeType]) -> list[TypeVarLikeType]:
1786
- return [self.anal_var_def(vd) for vd in var_defs]
1787
-
1788
- def named_type(
1789
- self,
1790
- fully_qualified_name: str,
1791
- args: list[Type] | None = None,
1792
- line: int = -1,
1793
- column: int = -1,
1794
- ) -> Instance:
1795
- node = self.lookup_fully_qualified(fully_qualified_name)
1796
- assert isinstance(node.node, TypeInfo)
1797
- any_type = AnyType(TypeOfAny.special_form)
1798
- if args is not None:
1799
- args = self.check_unpacks_in_list(args)
1800
- return Instance(
1801
- node.node, args or [any_type] * len(node.node.defn.type_vars), line=line, column=column
1802
- )
1803
-
1804
- def check_unpacks_in_list(self, items: list[Type]) -> list[Type]:
1805
- new_items: list[Type] = []
1806
- num_unpacks = 0
1807
- final_unpack = None
1808
- for item in items:
1809
- # TODO: handle forward references here, they appear as Unpack[Any].
1810
- if isinstance(item, UnpackType) and not isinstance(
1811
- get_proper_type(item.type), TupleType
1812
- ):
1813
- if not num_unpacks:
1814
- new_items.append(item)
1815
- num_unpacks += 1
1816
- final_unpack = item
1817
- else:
1818
- new_items.append(item)
1819
-
1820
- if num_unpacks > 1:
1821
- assert final_unpack is not None
1822
- self.fail("More than one Unpack in a type is not allowed", final_unpack)
1823
- return new_items
1824
-
1825
- def tuple_type(self, items: list[Type], line: int, column: int) -> TupleType:
1826
- any_type = AnyType(TypeOfAny.special_form)
1827
- return TupleType(
1828
- items, fallback=self.named_type("builtins.tuple", [any_type]), line=line, column=column
1829
- )
1830
-
1831
-
1832
- TypeVarLikeList = List[Tuple[str, TypeVarLikeExpr]]
1833
-
1834
-
1835
- class MsgCallback(Protocol):
1836
- def __call__(self, __msg: str, __ctx: Context, *, code: ErrorCode | None = None) -> None: ...
1837
-
1838
-
1839
- def get_omitted_any(
1840
- disallow_any: bool,
1841
- fail: MsgCallback,
1842
- note: MsgCallback,
1843
- orig_type: Type,
1844
- options: Options,
1845
- fullname: str | None = None,
1846
- unexpanded_type: Type | None = None,
1847
- ) -> AnyType:
1848
- if disallow_any:
1849
- nongen_builtins = get_nongen_builtins(options.python_version)
1850
- if fullname in nongen_builtins:
1851
- typ = orig_type
1852
- # We use a dedicated error message for builtin generics (as the most common case).
1853
- alternative = nongen_builtins[fullname]
1854
- fail(
1855
- message_registry.IMPLICIT_GENERIC_ANY_BUILTIN.format(alternative),
1856
- typ,
1857
- code=codes.TYPE_ARG,
1858
- )
1859
- else:
1860
- typ = unexpanded_type or orig_type
1861
- type_str = typ.name if isinstance(typ, UnboundType) else format_type_bare(typ, options)
1862
-
1863
- fail(
1864
- message_registry.BARE_GENERIC.format(quote_type_string(type_str)),
1865
- typ,
1866
- code=codes.TYPE_ARG,
1867
- )
1868
- base_type = get_proper_type(orig_type)
1869
- base_fullname = (
1870
- base_type.type.fullname if isinstance(base_type, Instance) else fullname
1871
- )
1872
- # Ideally, we'd check whether the type is quoted or `from __future__ annotations`
1873
- # is set before issuing this note
1874
- if (
1875
- options.python_version < (3, 9)
1876
- and base_fullname in GENERIC_STUB_NOT_AT_RUNTIME_TYPES
1877
- ):
1878
- # Recommend `from __future__ import annotations` or to put type in quotes
1879
- # (string literal escaping) for classes not generic at runtime
1880
- note(
1881
- "Subscripting classes that are not generic at runtime may require "
1882
- "escaping, see https://mypy.readthedocs.io/en/stable/runtime_troubles.html"
1883
- "#not-generic-runtime",
1884
- typ,
1885
- code=codes.TYPE_ARG,
1886
- )
1887
-
1888
- any_type = AnyType(TypeOfAny.from_error, line=typ.line, column=typ.column)
1889
- else:
1890
- any_type = AnyType(
1891
- TypeOfAny.from_omitted_generics, line=orig_type.line, column=orig_type.column
1892
- )
1893
- return any_type
1894
-
1895
-
1896
- def fix_type_var_tuple_argument(t: Instance) -> None:
1897
- if t.type.has_type_var_tuple_type:
1898
- args = list(t.args)
1899
- assert t.type.type_var_tuple_prefix is not None
1900
- tvt = t.type.defn.type_vars[t.type.type_var_tuple_prefix]
1901
- assert isinstance(tvt, TypeVarTupleType)
1902
- args[t.type.type_var_tuple_prefix] = UnpackType(
1903
- Instance(tvt.tuple_fallback.type, [args[t.type.type_var_tuple_prefix]])
1904
- )
1905
- t.args = tuple(args)
1906
-
1907
-
1908
- def fix_instance(
1909
- t: Instance,
1910
- fail: MsgCallback,
1911
- note: MsgCallback,
1912
- disallow_any: bool,
1913
- options: Options,
1914
- use_generic_error: bool = False,
1915
- unexpanded_type: Type | None = None,
1916
- ) -> None:
1917
- """Fix a malformed instance by replacing all type arguments with TypeVar default or Any.
1918
-
1919
- Also emit a suitable error if this is not due to implicit Any's.
1920
- """
1921
- arg_count = len(t.args)
1922
- min_tv_count = sum(not tv.has_default() for tv in t.type.defn.type_vars)
1923
- max_tv_count = len(t.type.type_vars)
1924
- if arg_count < min_tv_count or arg_count > max_tv_count:
1925
- # Don't use existing args if arg_count doesn't match
1926
- if arg_count > max_tv_count:
1927
- # Already wrong arg count error, don't emit missing type parameters error as well.
1928
- disallow_any = False
1929
- t.args = ()
1930
- arg_count = 0
1931
-
1932
- args: list[Type] = [*(t.args[:max_tv_count])]
1933
- any_type: AnyType | None = None
1934
- env: dict[TypeVarId, Type] = {}
1935
-
1936
- for tv, arg in itertools.zip_longest(t.type.defn.type_vars, t.args, fillvalue=None):
1937
- if tv is None:
1938
- continue
1939
- if arg is None:
1940
- if tv.has_default():
1941
- arg = tv.default
1942
- else:
1943
- if any_type is None:
1944
- fullname = None if use_generic_error else t.type.fullname
1945
- any_type = get_omitted_any(
1946
- disallow_any, fail, note, t, options, fullname, unexpanded_type
1947
- )
1948
- arg = any_type
1949
- args.append(arg)
1950
- env[tv.id] = arg
1951
- t.args = tuple(args)
1952
- fix_type_var_tuple_argument(t)
1953
- if not t.type.has_type_var_tuple_type:
1954
- with state.strict_optional_set(options.strict_optional):
1955
- fixed = expand_type(t, env)
1956
- assert isinstance(fixed, Instance)
1957
- t.args = fixed.args
1958
-
1959
-
1960
- def instantiate_type_alias(
1961
- node: TypeAlias,
1962
- args: list[Type],
1963
- fail: MsgCallback,
1964
- no_args: bool,
1965
- ctx: Context,
1966
- options: Options,
1967
- *,
1968
- unexpanded_type: Type | None = None,
1969
- disallow_any: bool = False,
1970
- use_standard_error: bool = False,
1971
- empty_tuple_index: bool = False,
1972
- ) -> Type:
1973
- """Create an instance of a (generic) type alias from alias node and type arguments.
1974
-
1975
- We are following the rules outlined in TypeAlias docstring.
1976
- Here:
1977
- node: type alias node (definition)
1978
- args: type arguments (types to be substituted in place of type variables
1979
- when expanding the alias)
1980
- fail: error reporter callback
1981
- no_args: whether original definition used a bare generic `A = List`
1982
- ctx: context where expansion happens
1983
- unexpanded_type, disallow_any, use_standard_error: used to customize error messages
1984
- """
1985
- # Type aliases are special, since they can be expanded during semantic analysis,
1986
- # so we need to normalize them as soon as possible.
1987
- # TODO: can this cause an infinite recursion?
1988
- args = flatten_nested_tuples(args)
1989
- if any(unknown_unpack(a) for a in args):
1990
- # This type is not ready to be validated, because of unknown total count.
1991
- # Note that we keep the kind of Any for consistency.
1992
- return set_any_tvars(node, [], ctx.line, ctx.column, options, special_form=True)
1993
-
1994
- max_tv_count = len(node.alias_tvars)
1995
- act_len = len(args)
1996
- if (
1997
- max_tv_count > 0
1998
- and act_len == 0
1999
- and not (empty_tuple_index and node.tvar_tuple_index is not None)
2000
- ):
2001
- # Interpret bare Alias same as normal generic, i.e., Alias[Any, Any, ...]
2002
- return set_any_tvars(
2003
- node,
2004
- args,
2005
- ctx.line,
2006
- ctx.column,
2007
- options,
2008
- disallow_any=disallow_any,
2009
- fail=fail,
2010
- unexpanded_type=unexpanded_type,
2011
- )
2012
- if max_tv_count == 0 and act_len == 0:
2013
- if no_args:
2014
- assert isinstance(node.target, Instance) # type: ignore[misc]
2015
- # Note: this is the only case where we use an eager expansion. See more info about
2016
- # no_args aliases like L = List in the docstring for TypeAlias class.
2017
- return Instance(node.target.type, [], line=ctx.line, column=ctx.column)
2018
- return TypeAliasType(node, [], line=ctx.line, column=ctx.column)
2019
- if (
2020
- max_tv_count == 0
2021
- and act_len > 0
2022
- and isinstance(node.target, Instance) # type: ignore[misc]
2023
- and no_args
2024
- ):
2025
- tp = Instance(node.target.type, args)
2026
- tp.line = ctx.line
2027
- tp.column = ctx.column
2028
- return tp
2029
- if node.tvar_tuple_index is None:
2030
- if any(isinstance(a, UnpackType) for a in args):
2031
- # A variadic unpack in fixed size alias (fixed unpacks must be flattened by the caller)
2032
- fail(message_registry.INVALID_UNPACK_POSITION, ctx, code=codes.VALID_TYPE)
2033
- return set_any_tvars(node, [], ctx.line, ctx.column, options, from_error=True)
2034
- min_tv_count = sum(not tv.has_default() for tv in node.alias_tvars)
2035
- fill_typevars = act_len != max_tv_count
2036
- correct = min_tv_count <= act_len <= max_tv_count
2037
- else:
2038
- min_tv_count = sum(
2039
- not tv.has_default() and not isinstance(tv, TypeVarTupleType)
2040
- for tv in node.alias_tvars
2041
- )
2042
- correct = act_len >= min_tv_count
2043
- for a in args:
2044
- if isinstance(a, UnpackType):
2045
- unpacked = get_proper_type(a.type)
2046
- if isinstance(unpacked, Instance) and unpacked.type.fullname == "builtins.tuple":
2047
- # Variadic tuple is always correct.
2048
- correct = True
2049
- fill_typevars = not correct
2050
- if fill_typevars:
2051
- if not correct:
2052
- if use_standard_error:
2053
- # This is used if type alias is an internal representation of another type,
2054
- # for example a generic TypedDict or NamedTuple.
2055
- msg = wrong_type_arg_count(max_tv_count, max_tv_count, str(act_len), node.name)
2056
- else:
2057
- if node.tvar_tuple_index is not None:
2058
- msg = (
2059
- "Bad number of arguments for type alias,"
2060
- f" expected at least {min_tv_count}, given {act_len}"
2061
- )
2062
- elif min_tv_count != max_tv_count:
2063
- msg = (
2064
- "Bad number of arguments for type alias,"
2065
- f" expected between {min_tv_count} and {max_tv_count}, given {act_len}"
2066
- )
2067
- else:
2068
- msg = (
2069
- "Bad number of arguments for type alias,"
2070
- f" expected {min_tv_count}, given {act_len}"
2071
- )
2072
- fail(msg, ctx, code=codes.TYPE_ARG)
2073
- args = []
2074
- return set_any_tvars(node, args, ctx.line, ctx.column, options, from_error=True)
2075
- elif node.tvar_tuple_index is not None:
2076
- # We also need to check if we are not performing a type variable tuple split.
2077
- unpack = find_unpack_in_list(args)
2078
- if unpack is not None:
2079
- unpack_arg = args[unpack]
2080
- assert isinstance(unpack_arg, UnpackType)
2081
- if isinstance(unpack_arg.type, TypeVarTupleType):
2082
- exp_prefix = node.tvar_tuple_index
2083
- act_prefix = unpack
2084
- exp_suffix = len(node.alias_tvars) - node.tvar_tuple_index - 1
2085
- act_suffix = len(args) - unpack - 1
2086
- if act_prefix < exp_prefix or act_suffix < exp_suffix:
2087
- fail("TypeVarTuple cannot be split", ctx, code=codes.TYPE_ARG)
2088
- return set_any_tvars(node, [], ctx.line, ctx.column, options, from_error=True)
2089
- # TODO: we need to check args validity w.r.t alias.alias_tvars.
2090
- # Otherwise invalid instantiations will be allowed in runtime context.
2091
- # Note: in type context, these will be still caught by semanal_typeargs.
2092
- typ = TypeAliasType(node, args, ctx.line, ctx.column)
2093
- assert typ.alias is not None
2094
- # HACK: Implement FlexibleAlias[T, typ] by expanding it to typ here.
2095
- if (
2096
- isinstance(typ.alias.target, Instance) # type: ignore[misc]
2097
- and typ.alias.target.type.fullname == "mypy_extensions.FlexibleAlias"
2098
- ):
2099
- exp = get_proper_type(typ)
2100
- assert isinstance(exp, Instance)
2101
- return exp.args[-1]
2102
- return typ
2103
-
2104
-
2105
- def set_any_tvars(
2106
- node: TypeAlias,
2107
- args: list[Type],
2108
- newline: int,
2109
- newcolumn: int,
2110
- options: Options,
2111
- *,
2112
- from_error: bool = False,
2113
- disallow_any: bool = False,
2114
- special_form: bool = False,
2115
- fail: MsgCallback | None = None,
2116
- unexpanded_type: Type | None = None,
2117
- ) -> TypeAliasType:
2118
- if from_error or disallow_any:
2119
- type_of_any = TypeOfAny.from_error
2120
- elif special_form:
2121
- type_of_any = TypeOfAny.special_form
2122
- else:
2123
- type_of_any = TypeOfAny.from_omitted_generics
2124
- any_type = AnyType(type_of_any, line=newline, column=newcolumn)
2125
-
2126
- env: dict[TypeVarId, Type] = {}
2127
- used_any_type = False
2128
- has_type_var_tuple_type = False
2129
- for tv, arg in itertools.zip_longest(node.alias_tvars, args, fillvalue=None):
2130
- if tv is None:
2131
- continue
2132
- if arg is None:
2133
- if tv.has_default():
2134
- arg = tv.default
2135
- else:
2136
- arg = any_type
2137
- used_any_type = True
2138
- if isinstance(tv, TypeVarTupleType):
2139
- # TODO Handle TypeVarTuple defaults
2140
- has_type_var_tuple_type = True
2141
- arg = UnpackType(Instance(tv.tuple_fallback.type, [any_type]))
2142
- args.append(arg)
2143
- env[tv.id] = arg
2144
- t = TypeAliasType(node, args, newline, newcolumn)
2145
- if not has_type_var_tuple_type:
2146
- fixed = expand_type(t, env)
2147
- assert isinstance(fixed, TypeAliasType)
2148
- t.args = fixed.args
2149
-
2150
- if used_any_type and disallow_any and node.alias_tvars:
2151
- assert fail is not None
2152
- if unexpanded_type:
2153
- type_str = (
2154
- unexpanded_type.name
2155
- if isinstance(unexpanded_type, UnboundType)
2156
- else format_type_bare(unexpanded_type, options)
2157
- )
2158
- else:
2159
- type_str = node.name
2160
-
2161
- fail(
2162
- message_registry.BARE_GENERIC.format(quote_type_string(type_str)),
2163
- Context(newline, newcolumn),
2164
- code=codes.TYPE_ARG,
2165
- )
2166
- return t
2167
-
2168
-
2169
- def flatten_tvars(lists: list[list[T]]) -> list[T]:
2170
- result: list[T] = []
2171
- for lst in lists:
2172
- for item in lst:
2173
- if item not in result:
2174
- result.append(item)
2175
- return result
2176
-
2177
-
2178
- class DivergingAliasDetector(TrivialSyntheticTypeTranslator):
2179
- """See docstring of detect_diverging_alias() for details."""
2180
-
2181
- # TODO: this doesn't really need to be a translator, but we don't have a trivial visitor.
2182
- def __init__(
2183
- self,
2184
- seen_nodes: set[TypeAlias],
2185
- lookup: Callable[[str, Context], SymbolTableNode | None],
2186
- scope: TypeVarLikeScope,
2187
- ) -> None:
2188
- self.seen_nodes = seen_nodes
2189
- self.lookup = lookup
2190
- self.scope = scope
2191
- self.diverging = False
2192
-
2193
- def visit_type_alias_type(self, t: TypeAliasType) -> Type:
2194
- assert t.alias is not None, f"Unfixed type alias {t.type_ref}"
2195
- if t.alias in self.seen_nodes:
2196
- for arg in t.args:
2197
- if not (
2198
- isinstance(arg, TypeVarLikeType)
2199
- or isinstance(arg, UnpackType)
2200
- and isinstance(arg.type, TypeVarLikeType)
2201
- ) and has_type_vars(arg):
2202
- self.diverging = True
2203
- return t
2204
- # All clear for this expansion chain.
2205
- return t
2206
- new_nodes = self.seen_nodes | {t.alias}
2207
- visitor = DivergingAliasDetector(new_nodes, self.lookup, self.scope)
2208
- _ = get_proper_type(t).accept(visitor)
2209
- if visitor.diverging:
2210
- self.diverging = True
2211
- return t
2212
-
2213
-
2214
- def detect_diverging_alias(
2215
- node: TypeAlias,
2216
- target: Type,
2217
- lookup: Callable[[str, Context], SymbolTableNode | None],
2218
- scope: TypeVarLikeScope,
2219
- ) -> bool:
2220
- """This detects type aliases that will diverge during type checking.
2221
-
2222
- For example F = Something[..., F[List[T]]]. At each expansion step this will produce
2223
- *new* type aliases: e.g. F[List[int]], F[List[List[int]]], etc. So we can't detect
2224
- recursion. It is a known problem in the literature, recursive aliases and generic types
2225
- don't always go well together. It looks like there is no known systematic solution yet.
2226
-
2227
- # TODO: should we handle such aliases using type_recursion counter and some large limit?
2228
- They may be handy in rare cases, e.g. to express a union of non-mixed nested lists:
2229
- Nested = Union[T, Nested[List[T]]] ~> Union[T, List[T], List[List[T]], ...]
2230
- """
2231
- visitor = DivergingAliasDetector({node}, lookup, scope)
2232
- _ = target.accept(visitor)
2233
- return visitor.diverging
2234
-
2235
-
2236
- def check_for_explicit_any(
2237
- typ: Type | None,
2238
- options: Options,
2239
- is_typeshed_stub: bool,
2240
- msg: MessageBuilder,
2241
- context: Context,
2242
- ) -> None:
2243
- if options.disallow_any_explicit and not is_typeshed_stub and typ and has_explicit_any(typ):
2244
- msg.explicit_any(context)
2245
-
2246
-
2247
- def has_explicit_any(t: Type) -> bool:
2248
- """
2249
- Whether this type is or type it contains is an Any coming from explicit type annotation
2250
- """
2251
- return t.accept(HasExplicitAny())
2252
-
2253
-
2254
- class HasExplicitAny(TypeQuery[bool]):
2255
- def __init__(self) -> None:
2256
- super().__init__(any)
2257
-
2258
- def visit_any(self, t: AnyType) -> bool:
2259
- return t.type_of_any == TypeOfAny.explicit
2260
-
2261
- def visit_typeddict_type(self, t: TypedDictType) -> bool:
2262
- # typeddict is checked during TypedDict declaration, so don't typecheck it here.
2263
- return False
2264
-
2265
-
2266
- def has_any_from_unimported_type(t: Type) -> bool:
2267
- """Return true if this type is Any because an import was not followed.
2268
-
2269
- If type t is such Any type or has type arguments that contain such Any type
2270
- this function will return true.
2271
- """
2272
- return t.accept(HasAnyFromUnimportedType())
2273
-
2274
-
2275
- class HasAnyFromUnimportedType(BoolTypeQuery):
2276
- def __init__(self) -> None:
2277
- super().__init__(ANY_STRATEGY)
2278
-
2279
- def visit_any(self, t: AnyType) -> bool:
2280
- return t.type_of_any == TypeOfAny.from_unimported_type
2281
-
2282
- def visit_typeddict_type(self, t: TypedDictType) -> bool:
2283
- # typeddict is checked during TypedDict declaration, so don't typecheck it here
2284
- return False
2285
-
2286
-
2287
- def collect_all_inner_types(t: Type) -> list[Type]:
2288
- """
2289
- Return all types that `t` contains
2290
- """
2291
- return t.accept(CollectAllInnerTypesQuery())
2292
-
2293
-
2294
- class CollectAllInnerTypesQuery(TypeQuery[List[Type]]):
2295
- def __init__(self) -> None:
2296
- super().__init__(self.combine_lists_strategy)
2297
-
2298
- def query_types(self, types: Iterable[Type]) -> list[Type]:
2299
- return self.strategy([t.accept(self) for t in types]) + list(types)
2300
-
2301
- @classmethod
2302
- def combine_lists_strategy(cls, it: Iterable[list[Type]]) -> list[Type]:
2303
- return list(itertools.chain.from_iterable(it))
2304
-
2305
-
2306
- def make_optional_type(t: Type) -> Type:
2307
- """Return the type corresponding to Optional[t].
2308
-
2309
- Note that we can't use normal union simplification, since this function
2310
- is called during semantic analysis and simplification only works during
2311
- type checking.
2312
- """
2313
- p_t = get_proper_type(t)
2314
- if isinstance(p_t, NoneType):
2315
- return t
2316
- elif isinstance(p_t, UnionType):
2317
- # Eagerly expanding aliases is not safe during semantic analysis.
2318
- items = [
2319
- item
2320
- for item in flatten_nested_unions(p_t.items, handle_type_alias_type=False)
2321
- if not isinstance(get_proper_type(item), NoneType)
2322
- ]
2323
- return UnionType(items + [NoneType()], t.line, t.column)
2324
- else:
2325
- return UnionType([t, NoneType()], t.line, t.column)
2326
-
2327
-
2328
- def validate_instance(t: Instance, fail: MsgCallback, empty_tuple_index: bool) -> bool:
2329
- """Check if this is a well-formed instance with respect to argument count/positions."""
2330
- # TODO: combine logic with instantiate_type_alias().
2331
- if any(unknown_unpack(a) for a in t.args):
2332
- # This type is not ready to be validated, because of unknown total count.
2333
- # TODO: is it OK to fill with TypeOfAny.from_error instead of special form?
2334
- return False
2335
- if t.type.has_type_var_tuple_type:
2336
- min_tv_count = sum(
2337
- not tv.has_default() and not isinstance(tv, TypeVarTupleType)
2338
- for tv in t.type.defn.type_vars
2339
- )
2340
- correct = len(t.args) >= min_tv_count
2341
- if any(
2342
- isinstance(a, UnpackType) and isinstance(get_proper_type(a.type), Instance)
2343
- for a in t.args
2344
- ):
2345
- correct = True
2346
- if not t.args:
2347
- if not (empty_tuple_index and len(t.type.type_vars) == 1):
2348
- # The Any arguments should be set by the caller.
2349
- return False
2350
- elif not correct:
2351
- fail(
2352
- f"Bad number of arguments, expected: at least {min_tv_count}, given: {len(t.args)}",
2353
- t,
2354
- code=codes.TYPE_ARG,
2355
- )
2356
- return False
2357
- else:
2358
- # We also need to check if we are not performing a type variable tuple split.
2359
- unpack = find_unpack_in_list(t.args)
2360
- if unpack is not None:
2361
- unpack_arg = t.args[unpack]
2362
- assert isinstance(unpack_arg, UnpackType)
2363
- if isinstance(unpack_arg.type, TypeVarTupleType):
2364
- assert t.type.type_var_tuple_prefix is not None
2365
- assert t.type.type_var_tuple_suffix is not None
2366
- exp_prefix = t.type.type_var_tuple_prefix
2367
- act_prefix = unpack
2368
- exp_suffix = t.type.type_var_tuple_suffix
2369
- act_suffix = len(t.args) - unpack - 1
2370
- if act_prefix < exp_prefix or act_suffix < exp_suffix:
2371
- fail("TypeVarTuple cannot be split", t, code=codes.TYPE_ARG)
2372
- return False
2373
- elif any(isinstance(a, UnpackType) for a in t.args):
2374
- # A variadic unpack in fixed size instance (fixed unpacks must be flattened by the caller)
2375
- fail(message_registry.INVALID_UNPACK_POSITION, t, code=codes.VALID_TYPE)
2376
- t.args = ()
2377
- return False
2378
- elif len(t.args) != len(t.type.type_vars):
2379
- # Invalid number of type parameters.
2380
- arg_count = len(t.args)
2381
- min_tv_count = sum(not tv.has_default() for tv in t.type.defn.type_vars)
2382
- max_tv_count = len(t.type.type_vars)
2383
- if arg_count and (arg_count < min_tv_count or arg_count > max_tv_count):
2384
- fail(
2385
- wrong_type_arg_count(min_tv_count, max_tv_count, str(arg_count), t.type.name),
2386
- t,
2387
- code=codes.TYPE_ARG,
2388
- )
2389
- t.invalid = True
2390
- return False
2391
- return True
2392
-
2393
-
2394
- def find_self_type(typ: Type, lookup: Callable[[str], SymbolTableNode | None]) -> bool:
2395
- return typ.accept(HasSelfType(lookup))
2396
-
2397
-
2398
- class HasSelfType(BoolTypeQuery):
2399
- def __init__(self, lookup: Callable[[str], SymbolTableNode | None]) -> None:
2400
- self.lookup = lookup
2401
- super().__init__(ANY_STRATEGY)
2402
-
2403
- def visit_unbound_type(self, t: UnboundType) -> bool:
2404
- sym = self.lookup(t.name)
2405
- if sym and sym.fullname in SELF_TYPE_NAMES:
2406
- return True
2407
- return super().visit_unbound_type(t)
2408
-
2409
-
2410
- def unknown_unpack(t: Type) -> bool:
2411
- """Check if a given type is an unpack of an unknown type.
2412
-
2413
- Unfortunately, there is no robust way to distinguish forward references from
2414
- genuine undefined names here. But this worked well so far, although it looks
2415
- quite fragile.
2416
- """
2417
- if isinstance(t, UnpackType):
2418
- unpacked = get_proper_type(t.type)
2419
- if isinstance(unpacked, AnyType) and unpacked.type_of_any == TypeOfAny.special_form:
2420
- return True
2421
- return False
2422
-
2423
-
2424
- class FindTypeVarVisitor(SyntheticTypeVisitor[None]):
2425
- """Type visitor that looks for type variable types and self types."""
2426
-
2427
- def __init__(self, api: SemanticAnalyzerCoreInterface, scope: TypeVarLikeScope) -> None:
2428
- self.api = api
2429
- self.scope = scope
2430
- self.type_var_likes: list[tuple[str, TypeVarLikeExpr]] = []
2431
- self.has_self_type = False
2432
- self.seen_aliases: set[TypeAliasType] | None = None
2433
- self.include_callables = True
2434
-
2435
- def _seems_like_callable(self, type: UnboundType) -> bool:
2436
- if not type.args:
2437
- return False
2438
- return isinstance(type.args[0], (EllipsisType, TypeList, ParamSpecType))
2439
-
2440
- def visit_unbound_type(self, t: UnboundType) -> None:
2441
- name = t.name
2442
- node = None
2443
-
2444
- # Special case P.args and P.kwargs for ParamSpecs only.
2445
- if name.endswith("args"):
2446
- if name.endswith((".args", ".kwargs")):
2447
- base = ".".join(name.split(".")[:-1])
2448
- n = self.api.lookup_qualified(base, t)
2449
- if n is not None and isinstance(n.node, ParamSpecExpr):
2450
- node = n
2451
- name = base
2452
- if node is None:
2453
- node = self.api.lookup_qualified(name, t)
2454
- if node and node.fullname in SELF_TYPE_NAMES:
2455
- self.has_self_type = True
2456
- if (
2457
- node
2458
- and isinstance(node.node, TypeVarLikeExpr)
2459
- and self.scope.get_binding(node) is None
2460
- ):
2461
- if (name, node.node) not in self.type_var_likes:
2462
- self.type_var_likes.append((name, node.node))
2463
- elif not self.include_callables and self._seems_like_callable(t):
2464
- if find_self_type(
2465
- t, lambda name: self.api.lookup_qualified(name, t, suppress_errors=True)
2466
- ):
2467
- self.has_self_type = True
2468
- return
2469
- elif node and node.fullname in LITERAL_TYPE_NAMES:
2470
- return
2471
- elif node and node.fullname in ANNOTATED_TYPE_NAMES and t.args:
2472
- # Don't query the second argument to Annotated for TypeVars
2473
- self.process_types([t.args[0]])
2474
- elif t.args:
2475
- self.process_types(t.args)
2476
-
2477
- def visit_type_list(self, t: TypeList) -> None:
2478
- self.process_types(t.items)
2479
-
2480
- def visit_callable_argument(self, t: CallableArgument) -> None:
2481
- t.typ.accept(self)
2482
-
2483
- def visit_any(self, t: AnyType) -> None:
2484
- pass
2485
-
2486
- def visit_uninhabited_type(self, t: UninhabitedType) -> None:
2487
- pass
2488
-
2489
- def visit_none_type(self, t: NoneType) -> None:
2490
- pass
2491
-
2492
- def visit_erased_type(self, t: ErasedType) -> None:
2493
- pass
2494
-
2495
- def visit_deleted_type(self, t: DeletedType) -> None:
2496
- pass
2497
-
2498
- def visit_type_var(self, t: TypeVarType) -> None:
2499
- self.process_types([t.upper_bound, t.default] + t.values)
2500
-
2501
- def visit_param_spec(self, t: ParamSpecType) -> None:
2502
- self.process_types([t.upper_bound, t.default])
2503
-
2504
- def visit_type_var_tuple(self, t: TypeVarTupleType) -> None:
2505
- self.process_types([t.upper_bound, t.default])
2506
-
2507
- def visit_unpack_type(self, t: UnpackType) -> None:
2508
- self.process_types([t.type])
2509
-
2510
- def visit_parameters(self, t: Parameters) -> None:
2511
- self.process_types(t.arg_types)
2512
-
2513
- def visit_partial_type(self, t: PartialType) -> None:
2514
- pass
2515
-
2516
- def visit_instance(self, t: Instance) -> None:
2517
- self.process_types(t.args)
2518
-
2519
- def visit_callable_type(self, t: CallableType) -> None:
2520
- # FIX generics
2521
- self.process_types(t.arg_types)
2522
- t.ret_type.accept(self)
2523
-
2524
- def visit_tuple_type(self, t: TupleType) -> None:
2525
- self.process_types(t.items)
2526
-
2527
- def visit_typeddict_type(self, t: TypedDictType) -> None:
2528
- self.process_types(list(t.items.values()))
2529
-
2530
- def visit_raw_expression_type(self, t: RawExpressionType) -> None:
2531
- pass
2532
-
2533
- def visit_literal_type(self, t: LiteralType) -> None:
2534
- pass
2535
-
2536
- def visit_union_type(self, t: UnionType) -> None:
2537
- self.process_types(t.items)
2538
-
2539
- def visit_overloaded(self, t: Overloaded) -> None:
2540
- self.process_types(t.items) # type: ignore[arg-type]
2541
-
2542
- def visit_type_type(self, t: TypeType) -> None:
2543
- t.item.accept(self)
2544
-
2545
- def visit_ellipsis_type(self, t: EllipsisType) -> None:
2546
- pass
2547
-
2548
- def visit_placeholder_type(self, t: PlaceholderType) -> None:
2549
- return self.process_types(t.args)
2550
-
2551
- def visit_type_alias_type(self, t: TypeAliasType) -> None:
2552
- # Skip type aliases in already visited types to avoid infinite recursion.
2553
- if self.seen_aliases is None:
2554
- self.seen_aliases = set()
2555
- elif t in self.seen_aliases:
2556
- return
2557
- self.seen_aliases.add(t)
2558
- self.process_types(t.args)
2559
-
2560
- def process_types(self, types: list[Type] | tuple[Type, ...]) -> None:
2561
- # Redundant type check helps mypyc.
2562
- if isinstance(types, list):
2563
- for t in types:
2564
- t.accept(self)
2565
- else:
2566
- for t in types:
2567
- t.accept(self)
2568
-
2569
-
2570
- class TypeVarDefaultTranslator(TrivialSyntheticTypeTranslator):
2571
- """Type translate visitor that replaces UnboundTypes with in-scope TypeVars."""
2572
-
2573
- def __init__(
2574
- self, api: SemanticAnalyzerInterface, tvar_expr_name: str, context: Context
2575
- ) -> None:
2576
- self.api = api
2577
- self.tvar_expr_name = tvar_expr_name
2578
- self.context = context
2579
-
2580
- def visit_unbound_type(self, t: UnboundType) -> Type:
2581
- sym = self.api.lookup_qualified(t.name, t, suppress_errors=True)
2582
- if sym is not None:
2583
- if type_var := self.api.tvar_scope.get_binding(sym):
2584
- return type_var
2585
- if isinstance(sym.node, TypeVarLikeExpr):
2586
- self.api.fail(
2587
- f'Type parameter "{self.tvar_expr_name}" has a default type '
2588
- "that refers to one or more type variables that are out of scope",
2589
- self.context,
2590
- )
2591
- return AnyType(TypeOfAny.from_error)
2592
- return super().visit_unbound_type(t)
2593
-
2594
- def visit_type_alias_type(self, t: TypeAliasType) -> Type:
2595
- # TypeAliasTypes are analyzed separately already, just return it
2596
- return t