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,4115 +0,0 @@
1
- """Abstract syntax tree node classes (i.e. parse tree)."""
2
-
3
- from __future__ import annotations
4
-
5
- import os
6
- from abc import abstractmethod
7
- from collections import defaultdict
8
- from enum import Enum, unique
9
- from typing import (
10
- TYPE_CHECKING,
11
- Any,
12
- Callable,
13
- Dict,
14
- Final,
15
- Iterator,
16
- List,
17
- Optional,
18
- Sequence,
19
- Tuple,
20
- TypeVar,
21
- Union,
22
- cast,
23
- )
24
- from typing_extensions import TypeAlias as _TypeAlias, TypeGuard
25
-
26
- from mypy_extensions import trait
27
-
28
- import mypy.strconv
29
- from mypy.options import Options
30
- from mypy.util import is_typeshed_file, short_type
31
- from mypy.visitor import ExpressionVisitor, NodeVisitor, StatementVisitor
32
-
33
- if TYPE_CHECKING:
34
- from mypy.patterns import Pattern
35
-
36
-
37
- class Context:
38
- """Base type for objects that are valid as error message locations."""
39
-
40
- __slots__ = ("line", "column", "end_line", "end_column")
41
-
42
- def __init__(self, line: int = -1, column: int = -1) -> None:
43
- self.line = line
44
- self.column = column
45
- self.end_line: int | None = None
46
- self.end_column: int | None = None
47
-
48
- def set_line(
49
- self,
50
- target: Context | int,
51
- column: int | None = None,
52
- end_line: int | None = None,
53
- end_column: int | None = None,
54
- ) -> None:
55
- """If target is a node, pull line (and column) information
56
- into this node. If column is specified, this will override any column
57
- information coming from a node.
58
- """
59
- if isinstance(target, int):
60
- self.line = target
61
- else:
62
- self.line = target.line
63
- self.column = target.column
64
- self.end_line = target.end_line
65
- self.end_column = target.end_column
66
-
67
- if column is not None:
68
- self.column = column
69
-
70
- if end_line is not None:
71
- self.end_line = end_line
72
-
73
- if end_column is not None:
74
- self.end_column = end_column
75
-
76
-
77
- if TYPE_CHECKING:
78
- # break import cycle only needed for mypy
79
- import mypy.types
80
-
81
-
82
- T = TypeVar("T")
83
-
84
- JsonDict: _TypeAlias = Dict[str, Any]
85
-
86
-
87
- # Symbol table node kinds
88
- #
89
- # TODO rename to use more descriptive names
90
-
91
- LDEF: Final = 0
92
- GDEF: Final = 1
93
- MDEF: Final = 2
94
-
95
- # Placeholder for a name imported via 'from ... import'. Second phase of
96
- # semantic will replace this the actual imported reference. This is
97
- # needed so that we can detect whether a name has been imported during
98
- # XXX what?
99
- UNBOUND_IMPORTED: Final = 3
100
-
101
- # RevealExpr node kinds
102
- REVEAL_TYPE: Final = 0
103
- REVEAL_LOCALS: Final = 1
104
-
105
- LITERAL_YES: Final = 2
106
- LITERAL_TYPE: Final = 1
107
- LITERAL_NO: Final = 0
108
-
109
- node_kinds: Final = {LDEF: "Ldef", GDEF: "Gdef", MDEF: "Mdef", UNBOUND_IMPORTED: "UnboundImported"}
110
- inverse_node_kinds: Final = {_kind: _name for _name, _kind in node_kinds.items()}
111
-
112
-
113
- implicit_module_attrs: Final = {
114
- "__name__": "__builtins__.str",
115
- "__doc__": None, # depends on Python version, see semanal.py
116
- "__path__": None, # depends on if the module is a package
117
- "__file__": "__builtins__.str",
118
- "__package__": "__builtins__.str",
119
- "__annotations__": None, # dict[str, Any] bounded in add_implicit_module_attrs()
120
- }
121
-
122
-
123
- # These aliases exist because built-in class objects are not subscriptable.
124
- # For example `list[int]` fails at runtime. Instead List[int] should be used.
125
- type_aliases: Final = {
126
- "typing.List": "builtins.list",
127
- "typing.Dict": "builtins.dict",
128
- "typing.Set": "builtins.set",
129
- "typing.FrozenSet": "builtins.frozenset",
130
- "typing.ChainMap": "collections.ChainMap",
131
- "typing.Counter": "collections.Counter",
132
- "typing.DefaultDict": "collections.defaultdict",
133
- "typing.Deque": "collections.deque",
134
- "typing.OrderedDict": "collections.OrderedDict",
135
- # HACK: a lie in lieu of actual support for PEP 675
136
- "typing.LiteralString": "builtins.str",
137
- }
138
-
139
- # This keeps track of the oldest supported Python version where the corresponding
140
- # alias source is available.
141
- type_aliases_source_versions: Final = {"typing.LiteralString": (3, 11)}
142
-
143
- # This keeps track of aliases in `typing_extensions`, which we treat specially.
144
- typing_extensions_aliases: Final = {
145
- # See: https://github.com/python/mypy/issues/11528
146
- "typing_extensions.OrderedDict": "collections.OrderedDict",
147
- # HACK: a lie in lieu of actual support for PEP 675
148
- "typing_extensions.LiteralString": "builtins.str",
149
- }
150
-
151
- reverse_builtin_aliases: Final = {
152
- "builtins.list": "typing.List",
153
- "builtins.dict": "typing.Dict",
154
- "builtins.set": "typing.Set",
155
- "builtins.frozenset": "typing.FrozenSet",
156
- }
157
-
158
- _nongen_builtins: Final = {"builtins.tuple": "typing.Tuple", "builtins.enumerate": ""}
159
- _nongen_builtins.update((name, alias) for alias, name in type_aliases.items())
160
- # Drop OrderedDict from this for backward compatibility
161
- del _nongen_builtins["collections.OrderedDict"]
162
- # HACK: consequence of hackily treating LiteralString as an alias for str
163
- del _nongen_builtins["builtins.str"]
164
-
165
-
166
- def get_nongen_builtins(python_version: tuple[int, int]) -> dict[str, str]:
167
- # After 3.9 with pep585 generic builtins are allowed
168
- return _nongen_builtins if python_version < (3, 9) else {}
169
-
170
-
171
- RUNTIME_PROTOCOL_DECOS: Final = (
172
- "typing.runtime_checkable",
173
- "typing_extensions.runtime",
174
- "typing_extensions.runtime_checkable",
175
- )
176
-
177
-
178
- class Node(Context):
179
- """Common base class for all non-type parse tree nodes."""
180
-
181
- __slots__ = ()
182
-
183
- def __str__(self) -> str:
184
- ans = self.accept(mypy.strconv.StrConv(options=Options()))
185
- if ans is None:
186
- return repr(self)
187
- return ans
188
-
189
- def str_with_options(self, options: Options) -> str:
190
- ans = self.accept(mypy.strconv.StrConv(options=options))
191
- assert ans
192
- return ans
193
-
194
- def accept(self, visitor: NodeVisitor[T]) -> T:
195
- raise RuntimeError("Not implemented", type(self))
196
-
197
-
198
- @trait
199
- class Statement(Node):
200
- """A statement node."""
201
-
202
- __slots__ = ()
203
-
204
- def accept(self, visitor: StatementVisitor[T]) -> T:
205
- raise RuntimeError("Not implemented", type(self))
206
-
207
-
208
- @trait
209
- class Expression(Node):
210
- """An expression node."""
211
-
212
- __slots__ = ()
213
-
214
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
215
- raise RuntimeError("Not implemented", type(self))
216
-
217
-
218
- class FakeExpression(Expression):
219
- """A dummy expression.
220
-
221
- We need a dummy expression in one place, and can't instantiate Expression
222
- because it is a trait and mypyc barfs.
223
- """
224
-
225
- __slots__ = ()
226
-
227
-
228
- # TODO:
229
- # Lvalue = Union['NameExpr', 'MemberExpr', 'IndexExpr', 'SuperExpr', 'StarExpr'
230
- # 'TupleExpr']; see #1783.
231
- Lvalue: _TypeAlias = Expression
232
-
233
-
234
- @trait
235
- class SymbolNode(Node):
236
- """Nodes that can be stored in a symbol table."""
237
-
238
- __slots__ = ()
239
-
240
- @property
241
- @abstractmethod
242
- def name(self) -> str:
243
- pass
244
-
245
- # Fully qualified name
246
- @property
247
- @abstractmethod
248
- def fullname(self) -> str:
249
- pass
250
-
251
- @abstractmethod
252
- def serialize(self) -> JsonDict:
253
- pass
254
-
255
- @classmethod
256
- def deserialize(cls, data: JsonDict) -> SymbolNode:
257
- classname = data[".class"]
258
- method = deserialize_map.get(classname)
259
- if method is not None:
260
- return method(data)
261
- raise NotImplementedError(f"unexpected .class {classname}")
262
-
263
-
264
- # Items: fullname, related symbol table node, surrounding type (if any)
265
- Definition: _TypeAlias = Tuple[str, "SymbolTableNode", Optional["TypeInfo"]]
266
-
267
-
268
- class MypyFile(SymbolNode):
269
- """The abstract syntax tree of a single source file."""
270
-
271
- __slots__ = (
272
- "_fullname",
273
- "path",
274
- "defs",
275
- "alias_deps",
276
- "is_bom",
277
- "names",
278
- "imports",
279
- "ignored_lines",
280
- "skipped_lines",
281
- "is_stub",
282
- "is_cache_skeleton",
283
- "is_partial_stub_package",
284
- "plugin_deps",
285
- "future_import_flags",
286
- "_is_typeshed_file",
287
- )
288
-
289
- __match_args__ = ("name", "path", "defs")
290
-
291
- # Fully qualified module name
292
- _fullname: str
293
- # Path to the file (empty string if not known)
294
- path: str
295
- # Top-level definitions and statements
296
- defs: list[Statement]
297
- # Type alias dependencies as mapping from target to set of alias full names
298
- alias_deps: defaultdict[str, set[str]]
299
- # Is there a UTF-8 BOM at the start?
300
- is_bom: bool
301
- names: SymbolTable
302
- # All import nodes within the file (also ones within functions etc.)
303
- imports: list[ImportBase]
304
- # Lines on which to ignore certain errors when checking.
305
- # If the value is empty, ignore all errors; otherwise, the list contains all
306
- # error codes to ignore.
307
- ignored_lines: dict[int, list[str]]
308
- # Lines that were skipped during semantic analysis e.g. due to ALWAYS_FALSE, MYPY_FALSE,
309
- # or platform/version checks. Those lines would not be type-checked.
310
- skipped_lines: set[int]
311
- # Is this file represented by a stub file (.pyi)?
312
- is_stub: bool
313
- # Is this loaded from the cache and thus missing the actual body of the file?
314
- is_cache_skeleton: bool
315
- # Does this represent an __init__.pyi stub with a module __getattr__
316
- # (i.e. a partial stub package), for such packages we suppress any missing
317
- # module errors in addition to missing attribute errors.
318
- is_partial_stub_package: bool
319
- # Plugin-created dependencies
320
- plugin_deps: dict[str, set[str]]
321
- # Future imports defined in this file. Populated during semantic analysis.
322
- future_import_flags: set[str]
323
- _is_typeshed_file: bool | None
324
-
325
- def __init__(
326
- self,
327
- defs: list[Statement],
328
- imports: list[ImportBase],
329
- is_bom: bool = False,
330
- ignored_lines: dict[int, list[str]] | None = None,
331
- ) -> None:
332
- super().__init__()
333
- self.defs = defs
334
- self.line = 1 # Dummy line number
335
- self.column = 0 # Dummy column
336
- self.imports = imports
337
- self.is_bom = is_bom
338
- self.alias_deps = defaultdict(set)
339
- self.plugin_deps = {}
340
- if ignored_lines:
341
- self.ignored_lines = ignored_lines
342
- else:
343
- self.ignored_lines = {}
344
- self.skipped_lines = set()
345
-
346
- self.path = ""
347
- self.is_stub = False
348
- self.is_cache_skeleton = False
349
- self.is_partial_stub_package = False
350
- self.future_import_flags = set()
351
- self._is_typeshed_file = None
352
-
353
- def local_definitions(self) -> Iterator[Definition]:
354
- """Return all definitions within the module (including nested).
355
-
356
- This doesn't include imported definitions.
357
- """
358
- return local_definitions(self.names, self.fullname)
359
-
360
- @property
361
- def name(self) -> str:
362
- return "" if not self._fullname else self._fullname.split(".")[-1]
363
-
364
- @property
365
- def fullname(self) -> str:
366
- return self._fullname
367
-
368
- def accept(self, visitor: NodeVisitor[T]) -> T:
369
- return visitor.visit_mypy_file(self)
370
-
371
- def is_package_init_file(self) -> bool:
372
- return len(self.path) != 0 and os.path.basename(self.path).startswith("__init__.")
373
-
374
- def is_future_flag_set(self, flag: str) -> bool:
375
- return flag in self.future_import_flags
376
-
377
- def is_typeshed_file(self, options: Options) -> bool:
378
- # Cache result since this is called a lot
379
- if self._is_typeshed_file is None:
380
- self._is_typeshed_file = is_typeshed_file(options.abs_custom_typeshed_dir, self.path)
381
- return self._is_typeshed_file
382
-
383
- def serialize(self) -> JsonDict:
384
- return {
385
- ".class": "MypyFile",
386
- "_fullname": self._fullname,
387
- "names": self.names.serialize(self._fullname),
388
- "is_stub": self.is_stub,
389
- "path": self.path,
390
- "is_partial_stub_package": self.is_partial_stub_package,
391
- "future_import_flags": list(self.future_import_flags),
392
- }
393
-
394
- @classmethod
395
- def deserialize(cls, data: JsonDict) -> MypyFile:
396
- assert data[".class"] == "MypyFile", data
397
- tree = MypyFile([], [])
398
- tree._fullname = data["_fullname"]
399
- tree.names = SymbolTable.deserialize(data["names"])
400
- tree.is_stub = data["is_stub"]
401
- tree.path = data["path"]
402
- tree.is_partial_stub_package = data["is_partial_stub_package"]
403
- tree.is_cache_skeleton = True
404
- tree.future_import_flags = set(data["future_import_flags"])
405
- return tree
406
-
407
-
408
- class ImportBase(Statement):
409
- """Base class for all import statements."""
410
-
411
- __slots__ = ("is_unreachable", "is_top_level", "is_mypy_only", "assignments")
412
-
413
- is_unreachable: bool # Set by semanal.SemanticAnalyzerPass1 if inside `if False` etc.
414
- is_top_level: bool # Ditto if outside any class or def
415
- is_mypy_only: bool # Ditto if inside `if TYPE_CHECKING` or `if MYPY`
416
-
417
- # If an import replaces existing definitions, we construct dummy assignment
418
- # statements that assign the imported names to the names in the current scope,
419
- # for type checking purposes. Example:
420
- #
421
- # x = 1
422
- # from m import x <-- add assignment representing "x = m.x"
423
- assignments: list[AssignmentStmt]
424
-
425
- def __init__(self) -> None:
426
- super().__init__()
427
- self.assignments = []
428
- self.is_unreachable = False
429
- self.is_top_level = False
430
- self.is_mypy_only = False
431
-
432
-
433
- class Import(ImportBase):
434
- """import m [as n]"""
435
-
436
- __slots__ = ("ids",)
437
-
438
- __match_args__ = ("ids",)
439
-
440
- ids: list[tuple[str, str | None]] # (module id, as id)
441
-
442
- def __init__(self, ids: list[tuple[str, str | None]]) -> None:
443
- super().__init__()
444
- self.ids = ids
445
-
446
- def accept(self, visitor: StatementVisitor[T]) -> T:
447
- return visitor.visit_import(self)
448
-
449
-
450
- class ImportFrom(ImportBase):
451
- """from m import x [as y], ..."""
452
-
453
- __slots__ = ("id", "names", "relative")
454
-
455
- __match_args__ = ("id", "names", "relative")
456
-
457
- id: str
458
- relative: int
459
- names: list[tuple[str, str | None]] # Tuples (name, as name)
460
-
461
- def __init__(self, id: str, relative: int, names: list[tuple[str, str | None]]) -> None:
462
- super().__init__()
463
- self.id = id
464
- self.names = names
465
- self.relative = relative
466
-
467
- def accept(self, visitor: StatementVisitor[T]) -> T:
468
- return visitor.visit_import_from(self)
469
-
470
-
471
- class ImportAll(ImportBase):
472
- """from m import *"""
473
-
474
- __slots__ = ("id", "relative")
475
-
476
- __match_args__ = ("id", "relative")
477
-
478
- id: str
479
- relative: int
480
-
481
- def __init__(self, id: str, relative: int) -> None:
482
- super().__init__()
483
- self.id = id
484
- self.relative = relative
485
-
486
- def accept(self, visitor: StatementVisitor[T]) -> T:
487
- return visitor.visit_import_all(self)
488
-
489
-
490
- FUNCBASE_FLAGS: Final = ["is_property", "is_class", "is_static", "is_final"]
491
-
492
-
493
- class FuncBase(Node):
494
- """Abstract base class for function-like nodes.
495
-
496
- N.B: Although this has SymbolNode subclasses (FuncDef,
497
- OverloadedFuncDef), avoid calling isinstance(..., FuncBase) on
498
- something that is typed as SymbolNode. This is to work around
499
- mypy bug #3603, in which mypy doesn't understand multiple
500
- inheritance very well, and will assume that a SymbolNode
501
- cannot be a FuncBase.
502
-
503
- Instead, test against SYMBOL_FUNCBASE_TYPES, which enumerates
504
- SymbolNode subclasses that are also FuncBase subclasses.
505
- """
506
-
507
- __slots__ = (
508
- "type",
509
- "unanalyzed_type",
510
- "info",
511
- "is_property",
512
- "is_class", # Uses "@classmethod" (explicit or implicit)
513
- "is_static", # Uses "@staticmethod" (explicit or implicit)
514
- "is_final", # Uses "@final"
515
- "is_explicit_override", # Uses "@override"
516
- "is_type_check_only", # Uses "@type_check_only"
517
- "_fullname",
518
- )
519
-
520
- def __init__(self) -> None:
521
- super().__init__()
522
- # Type signature. This is usually CallableType or Overloaded, but it can be
523
- # something else for decorated functions.
524
- self.type: mypy.types.ProperType | None = None
525
- # Original, not semantically analyzed type (used for reprocessing)
526
- self.unanalyzed_type: mypy.types.ProperType | None = None
527
- # If method, reference to TypeInfo
528
- self.info = FUNC_NO_INFO
529
- self.is_property = False
530
- self.is_class = False
531
- self.is_static = False
532
- self.is_final = False
533
- self.is_explicit_override = False
534
- self.is_type_check_only = False
535
- # Name with module prefix
536
- self._fullname = ""
537
-
538
- @property
539
- @abstractmethod
540
- def name(self) -> str:
541
- pass
542
-
543
- @property
544
- def fullname(self) -> str:
545
- return self._fullname
546
-
547
-
548
- OverloadPart: _TypeAlias = Union["FuncDef", "Decorator"]
549
-
550
-
551
- class OverloadedFuncDef(FuncBase, SymbolNode, Statement):
552
- """A logical node representing all the variants of a multi-declaration function.
553
-
554
- A multi-declaration function is often an @overload, but can also be a
555
- @property with a setter and a/or a deleter.
556
-
557
- This node has no explicit representation in the source program.
558
- Overloaded variants must be consecutive in the source file.
559
- """
560
-
561
- __slots__ = ("items", "unanalyzed_items", "impl")
562
-
563
- items: list[OverloadPart]
564
- unanalyzed_items: list[OverloadPart]
565
- impl: OverloadPart | None
566
-
567
- def __init__(self, items: list[OverloadPart]) -> None:
568
- super().__init__()
569
- self.items = items
570
- self.unanalyzed_items = items.copy()
571
- self.impl = None
572
- if items:
573
- # TODO: figure out how to reliably set end position (we don't know the impl here).
574
- self.set_line(items[0].line, items[0].column)
575
-
576
- @property
577
- def name(self) -> str:
578
- if self.items:
579
- return self.items[0].name
580
- else:
581
- # This may happen for malformed overload
582
- assert self.impl is not None
583
- return self.impl.name
584
-
585
- def accept(self, visitor: StatementVisitor[T]) -> T:
586
- return visitor.visit_overloaded_func_def(self)
587
-
588
- def serialize(self) -> JsonDict:
589
- return {
590
- ".class": "OverloadedFuncDef",
591
- "items": [i.serialize() for i in self.items],
592
- "type": None if self.type is None else self.type.serialize(),
593
- "fullname": self._fullname,
594
- "impl": None if self.impl is None else self.impl.serialize(),
595
- "flags": get_flags(self, FUNCBASE_FLAGS),
596
- }
597
-
598
- @classmethod
599
- def deserialize(cls, data: JsonDict) -> OverloadedFuncDef:
600
- assert data[".class"] == "OverloadedFuncDef"
601
- res = OverloadedFuncDef(
602
- [cast(OverloadPart, SymbolNode.deserialize(d)) for d in data["items"]]
603
- )
604
- if data.get("impl") is not None:
605
- res.impl = cast(OverloadPart, SymbolNode.deserialize(data["impl"]))
606
- # set line for empty overload items, as not set in __init__
607
- if len(res.items) > 0:
608
- res.set_line(res.impl.line)
609
- if data.get("type") is not None:
610
- typ = mypy.types.deserialize_type(data["type"])
611
- assert isinstance(typ, mypy.types.ProperType)
612
- res.type = typ
613
- res._fullname = data["fullname"]
614
- set_flags(res, data["flags"])
615
- # NOTE: res.info will be set in the fixup phase.
616
- return res
617
-
618
-
619
- class Argument(Node):
620
- """A single argument in a FuncItem."""
621
-
622
- __slots__ = ("variable", "type_annotation", "initializer", "kind", "pos_only")
623
-
624
- __match_args__ = ("variable", "type_annotation", "initializer", "kind", "pos_only")
625
-
626
- def __init__(
627
- self,
628
- variable: Var,
629
- type_annotation: mypy.types.Type | None,
630
- initializer: Expression | None,
631
- kind: ArgKind,
632
- pos_only: bool = False,
633
- ) -> None:
634
- super().__init__()
635
- self.variable = variable
636
- self.type_annotation = type_annotation
637
- self.initializer = initializer
638
- self.kind = kind # must be an ARG_* constant
639
- self.pos_only = pos_only
640
-
641
- def set_line(
642
- self,
643
- target: Context | int,
644
- column: int | None = None,
645
- end_line: int | None = None,
646
- end_column: int | None = None,
647
- ) -> None:
648
- super().set_line(target, column, end_line, end_column)
649
-
650
- if self.initializer and self.initializer.line < 0:
651
- self.initializer.set_line(self.line, self.column, self.end_line, self.end_column)
652
-
653
- self.variable.set_line(self.line, self.column, self.end_line, self.end_column)
654
-
655
-
656
- FUNCITEM_FLAGS: Final = FUNCBASE_FLAGS + [
657
- "is_overload",
658
- "is_generator",
659
- "is_coroutine",
660
- "is_async_generator",
661
- "is_awaitable_coroutine",
662
- ]
663
-
664
-
665
- class FuncItem(FuncBase):
666
- """Base class for nodes usable as overloaded function items."""
667
-
668
- __slots__ = (
669
- "arguments", # Note that can be unset if deserialized (type is a lie!)
670
- "arg_names", # Names of arguments
671
- "arg_kinds", # Kinds of arguments
672
- "min_args", # Minimum number of arguments
673
- "max_pos", # Maximum number of positional arguments, -1 if no explicit
674
- # limit (*args not included)
675
- "body", # Body of the function
676
- "is_overload", # Is this an overload variant of function with more than
677
- # one overload variant?
678
- "is_generator", # Contains a yield statement?
679
- "is_coroutine", # Defined using 'async def' syntax?
680
- "is_async_generator", # Is an async def generator?
681
- "is_awaitable_coroutine", # Decorated with '@{typing,asyncio}.coroutine'?
682
- "expanded", # Variants of function with type variables with values expanded
683
- )
684
-
685
- __deletable__ = ("arguments", "max_pos", "min_args")
686
-
687
- def __init__(
688
- self,
689
- arguments: list[Argument] | None = None,
690
- body: Block | None = None,
691
- typ: mypy.types.FunctionLike | None = None,
692
- ) -> None:
693
- super().__init__()
694
- self.arguments = arguments or []
695
- self.arg_names = [None if arg.pos_only else arg.variable.name for arg in self.arguments]
696
- self.arg_kinds: list[ArgKind] = [arg.kind for arg in self.arguments]
697
- self.max_pos: int = self.arg_kinds.count(ARG_POS) + self.arg_kinds.count(ARG_OPT)
698
- self.body: Block = body or Block([])
699
- self.type = typ
700
- self.unanalyzed_type = typ
701
- self.is_overload: bool = False
702
- self.is_generator: bool = False
703
- self.is_coroutine: bool = False
704
- self.is_async_generator: bool = False
705
- self.is_awaitable_coroutine: bool = False
706
- self.expanded: list[FuncItem] = []
707
-
708
- self.min_args = 0
709
- for i in range(len(self.arguments)):
710
- if self.arguments[i] is None and i < self.max_fixed_argc():
711
- self.min_args = i + 1
712
-
713
- def max_fixed_argc(self) -> int:
714
- return self.max_pos
715
-
716
- def is_dynamic(self) -> bool:
717
- return self.type is None
718
-
719
-
720
- FUNCDEF_FLAGS: Final = FUNCITEM_FLAGS + [
721
- "is_decorated",
722
- "is_conditional",
723
- "is_trivial_body",
724
- "is_mypy_only",
725
- ]
726
-
727
- # Abstract status of a function
728
- NOT_ABSTRACT: Final = 0
729
- # Explicitly abstract (with @abstractmethod or overload without implementation)
730
- IS_ABSTRACT: Final = 1
731
- # Implicitly abstract: used for functions with trivial bodies defined in Protocols
732
- IMPLICITLY_ABSTRACT: Final = 2
733
-
734
-
735
- class FuncDef(FuncItem, SymbolNode, Statement):
736
- """Function definition.
737
-
738
- This is a non-lambda function defined using 'def'.
739
- """
740
-
741
- __slots__ = (
742
- "_name",
743
- "is_decorated",
744
- "is_conditional",
745
- "abstract_status",
746
- "original_def",
747
- "deco_line",
748
- "is_trivial_body",
749
- "is_mypy_only",
750
- # Present only when a function is decorated with @typing.datasclass_transform or similar
751
- "dataclass_transform_spec",
752
- "docstring",
753
- )
754
-
755
- __match_args__ = ("name", "arguments", "type", "body")
756
-
757
- # Note that all __init__ args must have default values
758
- def __init__(
759
- self,
760
- name: str = "", # Function name
761
- arguments: list[Argument] | None = None,
762
- body: Block | None = None,
763
- typ: mypy.types.FunctionLike | None = None,
764
- ) -> None:
765
- super().__init__(arguments, body, typ)
766
- self._name = name
767
- self.is_decorated = False
768
- self.is_conditional = False # Defined conditionally (within block)?
769
- self.abstract_status = NOT_ABSTRACT
770
- # Is this an abstract method with trivial body?
771
- # Such methods can't be called via super().
772
- self.is_trivial_body = False
773
- # Original conditional definition
774
- self.original_def: None | FuncDef | Var | Decorator = None
775
- # Used for error reporting (to keep backward compatibility with pre-3.8)
776
- self.deco_line: int | None = None
777
- # Definitions that appear in if TYPE_CHECKING are marked with this flag.
778
- self.is_mypy_only = False
779
- self.dataclass_transform_spec: DataclassTransformSpec | None = None
780
- self.docstring: str | None = None
781
-
782
- @property
783
- def name(self) -> str:
784
- return self._name
785
-
786
- def accept(self, visitor: StatementVisitor[T]) -> T:
787
- return visitor.visit_func_def(self)
788
-
789
- def serialize(self) -> JsonDict:
790
- # We're deliberating omitting arguments and storing only arg_names and
791
- # arg_kinds for space-saving reasons (arguments is not used in later
792
- # stages of mypy).
793
- # TODO: After a FuncDef is deserialized, the only time we use `arg_names`
794
- # and `arg_kinds` is when `type` is None and we need to infer a type. Can
795
- # we store the inferred type ahead of time?
796
- return {
797
- ".class": "FuncDef",
798
- "name": self._name,
799
- "fullname": self._fullname,
800
- "arg_names": self.arg_names,
801
- "arg_kinds": [int(x.value) for x in self.arg_kinds],
802
- "type": None if self.type is None else self.type.serialize(),
803
- "flags": get_flags(self, FUNCDEF_FLAGS),
804
- "abstract_status": self.abstract_status,
805
- # TODO: Do we need expanded, original_def?
806
- "dataclass_transform_spec": (
807
- None
808
- if self.dataclass_transform_spec is None
809
- else self.dataclass_transform_spec.serialize()
810
- ),
811
- }
812
-
813
- @classmethod
814
- def deserialize(cls, data: JsonDict) -> FuncDef:
815
- assert data[".class"] == "FuncDef"
816
- body = Block([])
817
- ret = FuncDef(
818
- data["name"],
819
- [],
820
- body,
821
- (
822
- None
823
- if data["type"] is None
824
- else cast(mypy.types.FunctionLike, mypy.types.deserialize_type(data["type"]))
825
- ),
826
- )
827
- ret._fullname = data["fullname"]
828
- set_flags(ret, data["flags"])
829
- # NOTE: ret.info is set in the fixup phase.
830
- ret.arg_names = data["arg_names"]
831
- ret.arg_kinds = [ArgKind(x) for x in data["arg_kinds"]]
832
- ret.abstract_status = data["abstract_status"]
833
- ret.dataclass_transform_spec = (
834
- DataclassTransformSpec.deserialize(data["dataclass_transform_spec"])
835
- if data["dataclass_transform_spec"] is not None
836
- else None
837
- )
838
- # Leave these uninitialized so that future uses will trigger an error
839
- del ret.arguments
840
- del ret.max_pos
841
- del ret.min_args
842
- return ret
843
-
844
-
845
- # All types that are both SymbolNodes and FuncBases. See the FuncBase
846
- # docstring for the rationale.
847
- SYMBOL_FUNCBASE_TYPES = (OverloadedFuncDef, FuncDef)
848
-
849
-
850
- class Decorator(SymbolNode, Statement):
851
- """A decorated function.
852
-
853
- A single Decorator object can include any number of function decorators.
854
- """
855
-
856
- __slots__ = ("func", "decorators", "original_decorators", "var", "is_overload")
857
-
858
- __match_args__ = ("decorators", "var", "func")
859
-
860
- func: FuncDef # Decorated function
861
- decorators: list[Expression] # Decorators (may be empty)
862
- # Some decorators are removed by semanal, keep the original here.
863
- original_decorators: list[Expression]
864
- # TODO: This is mostly used for the type; consider replacing with a 'type' attribute
865
- var: Var # Represents the decorated function obj
866
- is_overload: bool
867
-
868
- def __init__(self, func: FuncDef, decorators: list[Expression], var: Var) -> None:
869
- super().__init__()
870
- self.func = func
871
- self.decorators = decorators
872
- self.original_decorators = decorators.copy()
873
- self.var = var
874
- self.is_overload = False
875
-
876
- @property
877
- def name(self) -> str:
878
- return self.func.name
879
-
880
- @property
881
- def fullname(self) -> str:
882
- return self.func.fullname
883
-
884
- @property
885
- def is_final(self) -> bool:
886
- return self.func.is_final
887
-
888
- @property
889
- def info(self) -> TypeInfo:
890
- return self.func.info
891
-
892
- @property
893
- def type(self) -> mypy.types.Type | None:
894
- return self.var.type
895
-
896
- def accept(self, visitor: StatementVisitor[T]) -> T:
897
- return visitor.visit_decorator(self)
898
-
899
- def serialize(self) -> JsonDict:
900
- return {
901
- ".class": "Decorator",
902
- "func": self.func.serialize(),
903
- "var": self.var.serialize(),
904
- "is_overload": self.is_overload,
905
- }
906
-
907
- @classmethod
908
- def deserialize(cls, data: JsonDict) -> Decorator:
909
- assert data[".class"] == "Decorator"
910
- dec = Decorator(FuncDef.deserialize(data["func"]), [], Var.deserialize(data["var"]))
911
- dec.is_overload = data["is_overload"]
912
- return dec
913
-
914
-
915
- VAR_FLAGS: Final = [
916
- "is_self",
917
- "is_cls",
918
- "is_initialized_in_class",
919
- "is_staticmethod",
920
- "is_classmethod",
921
- "is_property",
922
- "is_settable_property",
923
- "is_suppressed_import",
924
- "is_classvar",
925
- "is_abstract_var",
926
- "is_final",
927
- "final_unset_in_class",
928
- "final_set_in_init",
929
- "explicit_self_type",
930
- "is_ready",
931
- "is_inferred",
932
- "invalid_partial_type",
933
- "from_module_getattr",
934
- "has_explicit_value",
935
- "allow_incompatible_override",
936
- ]
937
-
938
-
939
- class Var(SymbolNode):
940
- """A variable.
941
-
942
- It can refer to global/local variable or a data attribute.
943
- """
944
-
945
- __slots__ = (
946
- "_name",
947
- "_fullname",
948
- "info",
949
- "type",
950
- "final_value",
951
- "is_self",
952
- "is_cls",
953
- "is_ready",
954
- "is_inferred",
955
- "is_initialized_in_class",
956
- "is_staticmethod",
957
- "is_classmethod",
958
- "is_property",
959
- "is_settable_property",
960
- "is_classvar",
961
- "is_abstract_var",
962
- "is_final",
963
- "final_unset_in_class",
964
- "final_set_in_init",
965
- "is_suppressed_import",
966
- "explicit_self_type",
967
- "from_module_getattr",
968
- "has_explicit_value",
969
- "allow_incompatible_override",
970
- "invalid_partial_type",
971
- )
972
-
973
- __match_args__ = ("name", "type", "final_value")
974
-
975
- def __init__(self, name: str, type: mypy.types.Type | None = None) -> None:
976
- super().__init__()
977
- self._name = name # Name without module prefix
978
- # TODO: Should be Optional[str]
979
- self._fullname = "" # Name with module prefix
980
- # TODO: Should be Optional[TypeInfo]
981
- self.info = VAR_NO_INFO
982
- self.type: mypy.types.Type | None = type # Declared or inferred type, or None
983
- # Is this the first argument to an ordinary method (usually "self")?
984
- self.is_self = False
985
- # Is this the first argument to a classmethod (typically "cls")?
986
- self.is_cls = False
987
- self.is_ready = True # If inferred, is the inferred type available?
988
- self.is_inferred = self.type is None
989
- # Is this initialized explicitly to a non-None value in class body?
990
- self.is_initialized_in_class = False
991
- self.is_staticmethod = False
992
- self.is_classmethod = False
993
- self.is_property = False
994
- self.is_settable_property = False
995
- self.is_classvar = False
996
- self.is_abstract_var = False
997
- # Set to true when this variable refers to a module we were unable to
998
- # parse for some reason (eg a silenced module)
999
- self.is_suppressed_import = False
1000
- # Was this "variable" (rather a constant) defined as Final[...]?
1001
- self.is_final = False
1002
- # If constant value is a simple literal,
1003
- # store the literal value (unboxed) for the benefit of
1004
- # tools like mypyc.
1005
- self.final_value: int | float | complex | bool | str | None = None
1006
- # Where the value was set (only for class attributes)
1007
- self.final_unset_in_class = False
1008
- self.final_set_in_init = False
1009
- # This is True for a variable that was declared on self with an explicit type:
1010
- # class C:
1011
- # def __init__(self) -> None:
1012
- # self.x: int
1013
- # This case is important because this defines a new Var, even if there is one
1014
- # present in a superclass (without explicit type this doesn't create a new Var).
1015
- # See SemanticAnalyzer.analyze_member_lvalue() for details.
1016
- self.explicit_self_type = False
1017
- # If True, this is an implicit Var created due to module-level __getattr__.
1018
- self.from_module_getattr = False
1019
- # Var can be created with an explicit value `a = 1` or without one `a: int`,
1020
- # we need a way to tell which one is which.
1021
- self.has_explicit_value = False
1022
- # If True, subclasses can override this with an incompatible type.
1023
- self.allow_incompatible_override = False
1024
- # If True, this means we didn't manage to infer full type and fall back to
1025
- # something like list[Any]. We may decide to not use such types as context.
1026
- self.invalid_partial_type = False
1027
-
1028
- @property
1029
- def name(self) -> str:
1030
- return self._name
1031
-
1032
- @property
1033
- def fullname(self) -> str:
1034
- return self._fullname
1035
-
1036
- def accept(self, visitor: NodeVisitor[T]) -> T:
1037
- return visitor.visit_var(self)
1038
-
1039
- def serialize(self) -> JsonDict:
1040
- # TODO: Leave default values out?
1041
- # NOTE: Sometimes self.is_ready is False here, but we don't care.
1042
- data: JsonDict = {
1043
- ".class": "Var",
1044
- "name": self._name,
1045
- "fullname": self._fullname,
1046
- "type": None if self.type is None else self.type.serialize(),
1047
- "flags": get_flags(self, VAR_FLAGS),
1048
- }
1049
- if self.final_value is not None:
1050
- data["final_value"] = self.final_value
1051
- return data
1052
-
1053
- @classmethod
1054
- def deserialize(cls, data: JsonDict) -> Var:
1055
- assert data[".class"] == "Var"
1056
- name = data["name"]
1057
- type = None if data["type"] is None else mypy.types.deserialize_type(data["type"])
1058
- v = Var(name, type)
1059
- v.is_ready = False # Override True default set in __init__
1060
- v._fullname = data["fullname"]
1061
- set_flags(v, data["flags"])
1062
- v.final_value = data.get("final_value")
1063
- return v
1064
-
1065
-
1066
- class ClassDef(Statement):
1067
- """Class definition"""
1068
-
1069
- __slots__ = (
1070
- "name",
1071
- "_fullname",
1072
- "defs",
1073
- "type_vars",
1074
- "base_type_exprs",
1075
- "removed_base_type_exprs",
1076
- "info",
1077
- "metaclass",
1078
- "decorators",
1079
- "keywords",
1080
- "analyzed",
1081
- "has_incompatible_baseclass",
1082
- "deco_line",
1083
- "docstring",
1084
- "removed_statements",
1085
- )
1086
-
1087
- __match_args__ = ("name", "defs")
1088
-
1089
- name: str # Name of the class without module prefix
1090
- _fullname: str # Fully qualified name of the class
1091
- defs: Block
1092
- type_vars: list[mypy.types.TypeVarLikeType]
1093
- # Base class expressions (not semantically analyzed -- can be arbitrary expressions)
1094
- base_type_exprs: list[Expression]
1095
- # Special base classes like Generic[...] get moved here during semantic analysis
1096
- removed_base_type_exprs: list[Expression]
1097
- info: TypeInfo # Related TypeInfo
1098
- metaclass: Expression | None
1099
- decorators: list[Expression]
1100
- keywords: dict[str, Expression]
1101
- analyzed: Expression | None
1102
- has_incompatible_baseclass: bool
1103
- # Used by special forms like NamedTuple and TypedDict to store invalid statements
1104
- removed_statements: list[Statement]
1105
-
1106
- def __init__(
1107
- self,
1108
- name: str,
1109
- defs: Block,
1110
- type_vars: list[mypy.types.TypeVarLikeType] | None = None,
1111
- base_type_exprs: list[Expression] | None = None,
1112
- metaclass: Expression | None = None,
1113
- keywords: list[tuple[str, Expression]] | None = None,
1114
- ) -> None:
1115
- super().__init__()
1116
- self.name = name
1117
- self._fullname = ""
1118
- self.defs = defs
1119
- self.type_vars = type_vars or []
1120
- self.base_type_exprs = base_type_exprs or []
1121
- self.removed_base_type_exprs = []
1122
- self.info = CLASSDEF_NO_INFO
1123
- self.metaclass = metaclass
1124
- self.decorators = []
1125
- self.keywords = dict(keywords) if keywords else {}
1126
- self.analyzed = None
1127
- self.has_incompatible_baseclass = False
1128
- # Used for error reporting (to keep backwad compatibility with pre-3.8)
1129
- self.deco_line: int | None = None
1130
- self.docstring: str | None = None
1131
- self.removed_statements = []
1132
-
1133
- @property
1134
- def fullname(self) -> str:
1135
- return self._fullname
1136
-
1137
- @fullname.setter
1138
- def fullname(self, v: str) -> None:
1139
- self._fullname = v
1140
-
1141
- def accept(self, visitor: StatementVisitor[T]) -> T:
1142
- return visitor.visit_class_def(self)
1143
-
1144
- def is_generic(self) -> bool:
1145
- return self.info.is_generic()
1146
-
1147
- def serialize(self) -> JsonDict:
1148
- # Not serialized: defs, base_type_exprs, metaclass, decorators,
1149
- # analyzed (for named tuples etc.)
1150
- return {
1151
- ".class": "ClassDef",
1152
- "name": self.name,
1153
- "fullname": self.fullname,
1154
- "type_vars": [v.serialize() for v in self.type_vars],
1155
- }
1156
-
1157
- @classmethod
1158
- def deserialize(cls, data: JsonDict) -> ClassDef:
1159
- assert data[".class"] == "ClassDef"
1160
- res = ClassDef(
1161
- data["name"],
1162
- Block([]),
1163
- # https://github.com/python/mypy/issues/12257
1164
- [
1165
- cast(mypy.types.TypeVarLikeType, mypy.types.deserialize_type(v))
1166
- for v in data["type_vars"]
1167
- ],
1168
- )
1169
- res.fullname = data["fullname"]
1170
- return res
1171
-
1172
-
1173
- class GlobalDecl(Statement):
1174
- """Declaration global x, y, ..."""
1175
-
1176
- __slots__ = ("names",)
1177
-
1178
- __match_args__ = ("names",)
1179
-
1180
- names: list[str]
1181
-
1182
- def __init__(self, names: list[str]) -> None:
1183
- super().__init__()
1184
- self.names = names
1185
-
1186
- def accept(self, visitor: StatementVisitor[T]) -> T:
1187
- return visitor.visit_global_decl(self)
1188
-
1189
-
1190
- class NonlocalDecl(Statement):
1191
- """Declaration nonlocal x, y, ..."""
1192
-
1193
- __slots__ = ("names",)
1194
-
1195
- __match_args__ = ("names",)
1196
-
1197
- names: list[str]
1198
-
1199
- def __init__(self, names: list[str]) -> None:
1200
- super().__init__()
1201
- self.names = names
1202
-
1203
- def accept(self, visitor: StatementVisitor[T]) -> T:
1204
- return visitor.visit_nonlocal_decl(self)
1205
-
1206
-
1207
- class Block(Statement):
1208
- __slots__ = ("body", "is_unreachable")
1209
-
1210
- __match_args__ = ("body", "is_unreachable")
1211
-
1212
- def __init__(self, body: list[Statement]) -> None:
1213
- super().__init__()
1214
- self.body = body
1215
- # True if we can determine that this block is not executed during semantic
1216
- # analysis. For example, this applies to blocks that are protected by
1217
- # something like "if PY3:" when using Python 2. However, some code is
1218
- # only considered unreachable during type checking and this is not true
1219
- # in those cases.
1220
- self.is_unreachable = False
1221
-
1222
- def accept(self, visitor: StatementVisitor[T]) -> T:
1223
- return visitor.visit_block(self)
1224
-
1225
-
1226
- # Statements
1227
-
1228
-
1229
- class ExpressionStmt(Statement):
1230
- """An expression as a statement, such as print(s)."""
1231
-
1232
- __slots__ = ("expr",)
1233
-
1234
- __match_args__ = ("expr",)
1235
-
1236
- expr: Expression
1237
-
1238
- def __init__(self, expr: Expression) -> None:
1239
- super().__init__()
1240
- self.expr = expr
1241
-
1242
- def accept(self, visitor: StatementVisitor[T]) -> T:
1243
- return visitor.visit_expression_stmt(self)
1244
-
1245
-
1246
- class AssignmentStmt(Statement):
1247
- """Assignment statement.
1248
-
1249
- The same node class is used for single assignment, multiple assignment
1250
- (e.g. x, y = z) and chained assignment (e.g. x = y = z), assignments
1251
- that define new names, and assignments with explicit types ("# type: t"
1252
- or "x: t [= ...]").
1253
-
1254
- An lvalue can be NameExpr, TupleExpr, ListExpr, MemberExpr, or IndexExpr.
1255
- """
1256
-
1257
- __slots__ = (
1258
- "lvalues",
1259
- "rvalue",
1260
- "type",
1261
- "unanalyzed_type",
1262
- "new_syntax",
1263
- "is_alias_def",
1264
- "is_final_def",
1265
- "invalid_recursive_alias",
1266
- )
1267
-
1268
- __match_args__ = ("lvalues", "rvalues", "type")
1269
-
1270
- lvalues: list[Lvalue]
1271
- # This is a TempNode if and only if no rvalue (x: t).
1272
- rvalue: Expression
1273
- # Declared type in a comment, may be None.
1274
- type: mypy.types.Type | None
1275
- # Original, not semantically analyzed type in annotation (used for reprocessing)
1276
- unanalyzed_type: mypy.types.Type | None
1277
- # This indicates usage of PEP 526 type annotation syntax in assignment.
1278
- new_syntax: bool
1279
- # Does this assignment define a type alias?
1280
- is_alias_def: bool
1281
- # Is this a final definition?
1282
- # Final attributes can't be re-assigned once set, and can't be overridden
1283
- # in a subclass. This flag is not set if an attempted declaration was found to
1284
- # be invalid during semantic analysis. It is still set to `True` if
1285
- # a final declaration overrides another final declaration (this is checked
1286
- # during type checking when MROs are known).
1287
- is_final_def: bool
1288
- # Stop further processing of this assignment, to prevent flipping back and forth
1289
- # during semantic analysis passes.
1290
- invalid_recursive_alias: bool
1291
-
1292
- def __init__(
1293
- self,
1294
- lvalues: list[Lvalue],
1295
- rvalue: Expression,
1296
- type: mypy.types.Type | None = None,
1297
- new_syntax: bool = False,
1298
- ) -> None:
1299
- super().__init__()
1300
- self.lvalues = lvalues
1301
- self.rvalue = rvalue
1302
- self.type = type
1303
- self.unanalyzed_type = type
1304
- self.new_syntax = new_syntax
1305
- self.is_alias_def = False
1306
- self.is_final_def = False
1307
- self.invalid_recursive_alias = False
1308
-
1309
- def accept(self, visitor: StatementVisitor[T]) -> T:
1310
- return visitor.visit_assignment_stmt(self)
1311
-
1312
-
1313
- class OperatorAssignmentStmt(Statement):
1314
- """Operator assignment statement such as x += 1"""
1315
-
1316
- __slots__ = ("op", "lvalue", "rvalue")
1317
-
1318
- __match_args__ = ("lvalue", "op", "rvalue")
1319
-
1320
- op: str # TODO: Enum?
1321
- lvalue: Lvalue
1322
- rvalue: Expression
1323
-
1324
- def __init__(self, op: str, lvalue: Lvalue, rvalue: Expression) -> None:
1325
- super().__init__()
1326
- self.op = op
1327
- self.lvalue = lvalue
1328
- self.rvalue = rvalue
1329
-
1330
- def accept(self, visitor: StatementVisitor[T]) -> T:
1331
- return visitor.visit_operator_assignment_stmt(self)
1332
-
1333
-
1334
- class WhileStmt(Statement):
1335
- __slots__ = ("expr", "body", "else_body")
1336
-
1337
- __match_args__ = ("expr", "body", "else_body")
1338
-
1339
- expr: Expression
1340
- body: Block
1341
- else_body: Block | None
1342
-
1343
- def __init__(self, expr: Expression, body: Block, else_body: Block | None) -> None:
1344
- super().__init__()
1345
- self.expr = expr
1346
- self.body = body
1347
- self.else_body = else_body
1348
-
1349
- def accept(self, visitor: StatementVisitor[T]) -> T:
1350
- return visitor.visit_while_stmt(self)
1351
-
1352
-
1353
- class ForStmt(Statement):
1354
- __slots__ = (
1355
- "index",
1356
- "index_type",
1357
- "unanalyzed_index_type",
1358
- "inferred_item_type",
1359
- "inferred_iterator_type",
1360
- "expr",
1361
- "body",
1362
- "else_body",
1363
- "is_async",
1364
- )
1365
-
1366
- __match_args__ = ("index", "index_type", "expr", "body", "else_body")
1367
-
1368
- # Index variables
1369
- index: Lvalue
1370
- # Type given by type comments for index, can be None
1371
- index_type: mypy.types.Type | None
1372
- # Original, not semantically analyzed type in annotation (used for reprocessing)
1373
- unanalyzed_index_type: mypy.types.Type | None
1374
- # Inferred iterable item type
1375
- inferred_item_type: mypy.types.Type | None
1376
- # Inferred iterator type
1377
- inferred_iterator_type: mypy.types.Type | None
1378
- # Expression to iterate
1379
- expr: Expression
1380
- body: Block
1381
- else_body: Block | None
1382
- is_async: bool # True if `async for ...` (PEP 492, Python 3.5)
1383
-
1384
- def __init__(
1385
- self,
1386
- index: Lvalue,
1387
- expr: Expression,
1388
- body: Block,
1389
- else_body: Block | None,
1390
- index_type: mypy.types.Type | None = None,
1391
- ) -> None:
1392
- super().__init__()
1393
- self.index = index
1394
- self.index_type = index_type
1395
- self.unanalyzed_index_type = index_type
1396
- self.inferred_item_type = None
1397
- self.inferred_iterator_type = None
1398
- self.expr = expr
1399
- self.body = body
1400
- self.else_body = else_body
1401
- self.is_async = False
1402
-
1403
- def accept(self, visitor: StatementVisitor[T]) -> T:
1404
- return visitor.visit_for_stmt(self)
1405
-
1406
-
1407
- class ReturnStmt(Statement):
1408
- __slots__ = ("expr",)
1409
-
1410
- __match_args__ = ("expr",)
1411
-
1412
- expr: Expression | None
1413
-
1414
- def __init__(self, expr: Expression | None) -> None:
1415
- super().__init__()
1416
- self.expr = expr
1417
-
1418
- def accept(self, visitor: StatementVisitor[T]) -> T:
1419
- return visitor.visit_return_stmt(self)
1420
-
1421
-
1422
- class AssertStmt(Statement):
1423
- __slots__ = ("expr", "msg")
1424
-
1425
- __match_args__ = ("expr", "msg")
1426
-
1427
- expr: Expression
1428
- msg: Expression | None
1429
-
1430
- def __init__(self, expr: Expression, msg: Expression | None = None) -> None:
1431
- super().__init__()
1432
- self.expr = expr
1433
- self.msg = msg
1434
-
1435
- def accept(self, visitor: StatementVisitor[T]) -> T:
1436
- return visitor.visit_assert_stmt(self)
1437
-
1438
-
1439
- class DelStmt(Statement):
1440
- __slots__ = ("expr",)
1441
-
1442
- __match_args__ = ("expr",)
1443
-
1444
- expr: Lvalue
1445
-
1446
- def __init__(self, expr: Lvalue) -> None:
1447
- super().__init__()
1448
- self.expr = expr
1449
-
1450
- def accept(self, visitor: StatementVisitor[T]) -> T:
1451
- return visitor.visit_del_stmt(self)
1452
-
1453
-
1454
- class BreakStmt(Statement):
1455
- __slots__ = ()
1456
-
1457
- def accept(self, visitor: StatementVisitor[T]) -> T:
1458
- return visitor.visit_break_stmt(self)
1459
-
1460
-
1461
- class ContinueStmt(Statement):
1462
- __slots__ = ()
1463
-
1464
- def accept(self, visitor: StatementVisitor[T]) -> T:
1465
- return visitor.visit_continue_stmt(self)
1466
-
1467
-
1468
- class PassStmt(Statement):
1469
- __slots__ = ()
1470
-
1471
- def accept(self, visitor: StatementVisitor[T]) -> T:
1472
- return visitor.visit_pass_stmt(self)
1473
-
1474
-
1475
- class IfStmt(Statement):
1476
- __slots__ = ("expr", "body", "else_body")
1477
-
1478
- __match_args__ = ("expr", "body", "else_body")
1479
-
1480
- expr: list[Expression]
1481
- body: list[Block]
1482
- else_body: Block | None
1483
-
1484
- def __init__(self, expr: list[Expression], body: list[Block], else_body: Block | None) -> None:
1485
- super().__init__()
1486
- self.expr = expr
1487
- self.body = body
1488
- self.else_body = else_body
1489
-
1490
- def accept(self, visitor: StatementVisitor[T]) -> T:
1491
- return visitor.visit_if_stmt(self)
1492
-
1493
-
1494
- class RaiseStmt(Statement):
1495
- __slots__ = ("expr", "from_expr")
1496
-
1497
- __match_args__ = ("expr", "from_expr")
1498
-
1499
- # Plain 'raise' is a valid statement.
1500
- expr: Expression | None
1501
- from_expr: Expression | None
1502
-
1503
- def __init__(self, expr: Expression | None, from_expr: Expression | None) -> None:
1504
- super().__init__()
1505
- self.expr = expr
1506
- self.from_expr = from_expr
1507
-
1508
- def accept(self, visitor: StatementVisitor[T]) -> T:
1509
- return visitor.visit_raise_stmt(self)
1510
-
1511
-
1512
- class TryStmt(Statement):
1513
- __slots__ = ("body", "types", "vars", "handlers", "else_body", "finally_body", "is_star")
1514
-
1515
- __match_args__ = ("body", "types", "vars", "handlers", "else_body", "finally_body", "is_star")
1516
-
1517
- body: Block # Try body
1518
- # Plain 'except:' also possible
1519
- types: list[Expression | None] # Except type expressions
1520
- vars: list[NameExpr | None] # Except variable names
1521
- handlers: list[Block] # Except bodies
1522
- else_body: Block | None
1523
- finally_body: Block | None
1524
- # Whether this is try ... except* (added in Python 3.11)
1525
- is_star: bool
1526
-
1527
- def __init__(
1528
- self,
1529
- body: Block,
1530
- vars: list[NameExpr | None],
1531
- types: list[Expression | None],
1532
- handlers: list[Block],
1533
- else_body: Block | None,
1534
- finally_body: Block | None,
1535
- ) -> None:
1536
- super().__init__()
1537
- self.body = body
1538
- self.vars = vars
1539
- self.types = types
1540
- self.handlers = handlers
1541
- self.else_body = else_body
1542
- self.finally_body = finally_body
1543
- self.is_star = False
1544
-
1545
- def accept(self, visitor: StatementVisitor[T]) -> T:
1546
- return visitor.visit_try_stmt(self)
1547
-
1548
-
1549
- class WithStmt(Statement):
1550
- __slots__ = ("expr", "target", "unanalyzed_type", "analyzed_types", "body", "is_async")
1551
-
1552
- __match_args__ = ("expr", "target", "body")
1553
-
1554
- expr: list[Expression]
1555
- target: list[Lvalue | None]
1556
- # Type given by type comments for target, can be None
1557
- unanalyzed_type: mypy.types.Type | None
1558
- # Semantically analyzed types from type comment (TypeList type expanded)
1559
- analyzed_types: list[mypy.types.Type]
1560
- body: Block
1561
- is_async: bool # True if `async with ...` (PEP 492, Python 3.5)
1562
-
1563
- def __init__(
1564
- self,
1565
- expr: list[Expression],
1566
- target: list[Lvalue | None],
1567
- body: Block,
1568
- target_type: mypy.types.Type | None = None,
1569
- ) -> None:
1570
- super().__init__()
1571
- self.expr = expr
1572
- self.target = target
1573
- self.unanalyzed_type = target_type
1574
- self.analyzed_types = []
1575
- self.body = body
1576
- self.is_async = False
1577
-
1578
- def accept(self, visitor: StatementVisitor[T]) -> T:
1579
- return visitor.visit_with_stmt(self)
1580
-
1581
-
1582
- class MatchStmt(Statement):
1583
- __slots__ = ("subject", "patterns", "guards", "bodies")
1584
-
1585
- __match_args__ = ("subject", "patterns", "guards", "bodies")
1586
-
1587
- subject: Expression
1588
- patterns: list[Pattern]
1589
- guards: list[Expression | None]
1590
- bodies: list[Block]
1591
-
1592
- def __init__(
1593
- self,
1594
- subject: Expression,
1595
- patterns: list[Pattern],
1596
- guards: list[Expression | None],
1597
- bodies: list[Block],
1598
- ) -> None:
1599
- super().__init__()
1600
- assert len(patterns) == len(guards) == len(bodies)
1601
- self.subject = subject
1602
- self.patterns = patterns
1603
- self.guards = guards
1604
- self.bodies = bodies
1605
-
1606
- def accept(self, visitor: StatementVisitor[T]) -> T:
1607
- return visitor.visit_match_stmt(self)
1608
-
1609
-
1610
- # Expressions
1611
-
1612
-
1613
- class IntExpr(Expression):
1614
- """Integer literal"""
1615
-
1616
- __slots__ = ("value",)
1617
-
1618
- __match_args__ = ("value",)
1619
-
1620
- value: int # 0 by default
1621
-
1622
- def __init__(self, value: int) -> None:
1623
- super().__init__()
1624
- self.value = value
1625
-
1626
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
1627
- return visitor.visit_int_expr(self)
1628
-
1629
-
1630
- # How mypy uses StrExpr and BytesExpr:
1631
- #
1632
- # b'x' -> BytesExpr
1633
- # 'x', u'x' -> StrExpr
1634
-
1635
-
1636
- class StrExpr(Expression):
1637
- """String literal"""
1638
-
1639
- __slots__ = ("value",)
1640
-
1641
- __match_args__ = ("value",)
1642
-
1643
- value: str # '' by default
1644
-
1645
- def __init__(self, value: str) -> None:
1646
- super().__init__()
1647
- self.value = value
1648
-
1649
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
1650
- return visitor.visit_str_expr(self)
1651
-
1652
-
1653
- def is_StrExpr_list(seq: list[Expression]) -> TypeGuard[list[StrExpr]]:
1654
- return all(isinstance(item, StrExpr) for item in seq)
1655
-
1656
-
1657
- class BytesExpr(Expression):
1658
- """Bytes literal"""
1659
-
1660
- __slots__ = ("value",)
1661
-
1662
- __match_args__ = ("value",)
1663
-
1664
- # Note: we deliberately do NOT use bytes here because it ends up
1665
- # unnecessarily complicating a lot of the result logic. For example,
1666
- # we'd have to worry about converting the bytes into a format we can
1667
- # easily serialize/deserialize to and from JSON, would have to worry
1668
- # about turning the bytes into a human-readable representation in
1669
- # error messages...
1670
- #
1671
- # It's more convenient to just store the human-readable representation
1672
- # from the very start.
1673
- value: str
1674
-
1675
- def __init__(self, value: str) -> None:
1676
- super().__init__()
1677
- self.value = value
1678
-
1679
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
1680
- return visitor.visit_bytes_expr(self)
1681
-
1682
-
1683
- class FloatExpr(Expression):
1684
- """Float literal"""
1685
-
1686
- __slots__ = ("value",)
1687
-
1688
- __match_args__ = ("value",)
1689
-
1690
- value: float # 0.0 by default
1691
-
1692
- def __init__(self, value: float) -> None:
1693
- super().__init__()
1694
- self.value = value
1695
-
1696
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
1697
- return visitor.visit_float_expr(self)
1698
-
1699
-
1700
- class ComplexExpr(Expression):
1701
- """Complex literal"""
1702
-
1703
- __slots__ = ("value",)
1704
-
1705
- __match_args__ = ("value",)
1706
-
1707
- value: complex
1708
-
1709
- def __init__(self, value: complex) -> None:
1710
- super().__init__()
1711
- self.value = value
1712
-
1713
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
1714
- return visitor.visit_complex_expr(self)
1715
-
1716
-
1717
- class EllipsisExpr(Expression):
1718
- """Ellipsis (...)"""
1719
-
1720
- __slots__ = ()
1721
-
1722
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
1723
- return visitor.visit_ellipsis(self)
1724
-
1725
-
1726
- class StarExpr(Expression):
1727
- """Star expression"""
1728
-
1729
- __slots__ = ("expr", "valid")
1730
-
1731
- __match_args__ = ("expr", "valid")
1732
-
1733
- expr: Expression
1734
- valid: bool
1735
-
1736
- def __init__(self, expr: Expression) -> None:
1737
- super().__init__()
1738
- self.expr = expr
1739
-
1740
- # Whether this starred expression is used in a tuple/list and as lvalue
1741
- self.valid = False
1742
-
1743
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
1744
- return visitor.visit_star_expr(self)
1745
-
1746
-
1747
- class RefExpr(Expression):
1748
- """Abstract base class for name-like constructs"""
1749
-
1750
- __slots__ = (
1751
- "kind",
1752
- "node",
1753
- "_fullname",
1754
- "is_new_def",
1755
- "is_inferred_def",
1756
- "is_alias_rvalue",
1757
- "type_guard",
1758
- "type_is",
1759
- )
1760
-
1761
- def __init__(self) -> None:
1762
- super().__init__()
1763
- # LDEF/GDEF/MDEF/... (None if not available)
1764
- self.kind: int | None = None
1765
- # Var, FuncDef or TypeInfo that describes this
1766
- self.node: SymbolNode | None = None
1767
- # Fully qualified name (or name if not global)
1768
- self._fullname = ""
1769
- # Does this define a new name?
1770
- self.is_new_def = False
1771
- # Does this define a new name with inferred type?
1772
- #
1773
- # For members, after semantic analysis, this does not take base
1774
- # classes into consideration at all; the type checker deals with these.
1775
- self.is_inferred_def = False
1776
- # Is this expression appears as an rvalue of a valid type alias definition?
1777
- self.is_alias_rvalue = False
1778
- # Cache type guard from callable_type.type_guard
1779
- self.type_guard: mypy.types.Type | None = None
1780
- # And same for TypeIs
1781
- self.type_is: mypy.types.Type | None = None
1782
-
1783
- @property
1784
- def fullname(self) -> str:
1785
- return self._fullname
1786
-
1787
- @fullname.setter
1788
- def fullname(self, v: str) -> None:
1789
- self._fullname = v
1790
-
1791
-
1792
- class NameExpr(RefExpr):
1793
- """Name expression
1794
-
1795
- This refers to a local name, global name or a module.
1796
- """
1797
-
1798
- __slots__ = ("name", "is_special_form")
1799
-
1800
- __match_args__ = ("name", "node")
1801
-
1802
- def __init__(self, name: str) -> None:
1803
- super().__init__()
1804
- self.name = name # Name referred to
1805
- # Is this a l.h.s. of a special form assignment like typed dict or type variable?
1806
- self.is_special_form = False
1807
-
1808
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
1809
- return visitor.visit_name_expr(self)
1810
-
1811
- def serialize(self) -> JsonDict:
1812
- assert False, f"Serializing NameExpr: {self}"
1813
-
1814
-
1815
- class MemberExpr(RefExpr):
1816
- """Member access expression x.y"""
1817
-
1818
- __slots__ = ("expr", "name", "def_var")
1819
-
1820
- __match_args__ = ("expr", "name", "node")
1821
-
1822
- def __init__(self, expr: Expression, name: str) -> None:
1823
- super().__init__()
1824
- self.expr = expr
1825
- self.name = name
1826
- # The variable node related to a definition through 'self.x = <initializer>'.
1827
- # The nodes of other kinds of member expressions are resolved during type checking.
1828
- self.def_var: Var | None = None
1829
-
1830
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
1831
- return visitor.visit_member_expr(self)
1832
-
1833
-
1834
- # Kinds of arguments
1835
- @unique
1836
- class ArgKind(Enum):
1837
- # Positional argument
1838
- ARG_POS = 0
1839
- # Positional, optional argument (functions only, not calls)
1840
- ARG_OPT = 1
1841
- # *arg argument
1842
- ARG_STAR = 2
1843
- # Keyword argument x=y in call, or keyword-only function arg
1844
- ARG_NAMED = 3
1845
- # **arg argument
1846
- ARG_STAR2 = 4
1847
- # In an argument list, keyword-only and also optional
1848
- ARG_NAMED_OPT = 5
1849
-
1850
- def is_positional(self, star: bool = False) -> bool:
1851
- return self == ARG_POS or self == ARG_OPT or (star and self == ARG_STAR)
1852
-
1853
- def is_named(self, star: bool = False) -> bool:
1854
- return self == ARG_NAMED or self == ARG_NAMED_OPT or (star and self == ARG_STAR2)
1855
-
1856
- def is_required(self) -> bool:
1857
- return self == ARG_POS or self == ARG_NAMED
1858
-
1859
- def is_optional(self) -> bool:
1860
- return self == ARG_OPT or self == ARG_NAMED_OPT
1861
-
1862
- def is_star(self) -> bool:
1863
- return self == ARG_STAR or self == ARG_STAR2
1864
-
1865
-
1866
- ARG_POS: Final = ArgKind.ARG_POS
1867
- ARG_OPT: Final = ArgKind.ARG_OPT
1868
- ARG_STAR: Final = ArgKind.ARG_STAR
1869
- ARG_NAMED: Final = ArgKind.ARG_NAMED
1870
- ARG_STAR2: Final = ArgKind.ARG_STAR2
1871
- ARG_NAMED_OPT: Final = ArgKind.ARG_NAMED_OPT
1872
-
1873
-
1874
- class CallExpr(Expression):
1875
- """Call expression.
1876
-
1877
- This can also represent several special forms that are syntactically calls
1878
- such as cast(...) and None # type: ....
1879
- """
1880
-
1881
- __slots__ = ("callee", "args", "arg_kinds", "arg_names", "analyzed")
1882
-
1883
- __match_args__ = ("callee", "args", "arg_kinds", "arg_names")
1884
-
1885
- def __init__(
1886
- self,
1887
- callee: Expression,
1888
- args: list[Expression],
1889
- arg_kinds: list[ArgKind],
1890
- arg_names: list[str | None],
1891
- analyzed: Expression | None = None,
1892
- ) -> None:
1893
- super().__init__()
1894
- if not arg_names:
1895
- arg_names = [None] * len(args)
1896
-
1897
- self.callee = callee
1898
- self.args = args
1899
- self.arg_kinds = arg_kinds # ARG_ constants
1900
- # Each name can be None if not a keyword argument.
1901
- self.arg_names: list[str | None] = arg_names
1902
- # If not None, the node that represents the meaning of the CallExpr. For
1903
- # cast(...) this is a CastExpr.
1904
- self.analyzed = analyzed
1905
-
1906
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
1907
- return visitor.visit_call_expr(self)
1908
-
1909
-
1910
- class YieldFromExpr(Expression):
1911
- __slots__ = ("expr",)
1912
-
1913
- __match_args__ = ("expr",)
1914
-
1915
- expr: Expression
1916
-
1917
- def __init__(self, expr: Expression) -> None:
1918
- super().__init__()
1919
- self.expr = expr
1920
-
1921
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
1922
- return visitor.visit_yield_from_expr(self)
1923
-
1924
-
1925
- class YieldExpr(Expression):
1926
- __slots__ = ("expr",)
1927
-
1928
- __match_args__ = ("expr",)
1929
-
1930
- expr: Expression | None
1931
-
1932
- def __init__(self, expr: Expression | None) -> None:
1933
- super().__init__()
1934
- self.expr = expr
1935
-
1936
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
1937
- return visitor.visit_yield_expr(self)
1938
-
1939
-
1940
- class IndexExpr(Expression):
1941
- """Index expression x[y].
1942
-
1943
- Also wraps type application such as List[int] as a special form.
1944
- """
1945
-
1946
- __slots__ = ("base", "index", "method_type", "analyzed")
1947
-
1948
- __match_args__ = ("base", "index")
1949
-
1950
- base: Expression
1951
- index: Expression
1952
- # Inferred __getitem__ method type
1953
- method_type: mypy.types.Type | None
1954
- # If not None, this is actually semantically a type application
1955
- # Class[type, ...] or a type alias initializer.
1956
- analyzed: TypeApplication | TypeAliasExpr | None
1957
-
1958
- def __init__(self, base: Expression, index: Expression) -> None:
1959
- super().__init__()
1960
- self.base = base
1961
- self.index = index
1962
- self.method_type = None
1963
- self.analyzed = None
1964
-
1965
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
1966
- return visitor.visit_index_expr(self)
1967
-
1968
-
1969
- class UnaryExpr(Expression):
1970
- """Unary operation"""
1971
-
1972
- __slots__ = ("op", "expr", "method_type")
1973
-
1974
- __match_args__ = ("op", "expr")
1975
-
1976
- op: str # TODO: Enum?
1977
- expr: Expression
1978
- # Inferred operator method type
1979
- method_type: mypy.types.Type | None
1980
-
1981
- def __init__(self, op: str, expr: Expression) -> None:
1982
- super().__init__()
1983
- self.op = op
1984
- self.expr = expr
1985
- self.method_type = None
1986
-
1987
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
1988
- return visitor.visit_unary_expr(self)
1989
-
1990
-
1991
- class AssignmentExpr(Expression):
1992
- """Assignment expressions in Python 3.8+, like "a := 2"."""
1993
-
1994
- __slots__ = ("target", "value")
1995
-
1996
- __match_args__ = ("target", "value")
1997
-
1998
- def __init__(self, target: Expression, value: Expression) -> None:
1999
- super().__init__()
2000
- self.target = target
2001
- self.value = value
2002
-
2003
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2004
- return visitor.visit_assignment_expr(self)
2005
-
2006
-
2007
- class OpExpr(Expression):
2008
- """Binary operation.
2009
-
2010
- The dot (.), [] and comparison operators have more specific nodes.
2011
- """
2012
-
2013
- __slots__ = (
2014
- "op",
2015
- "left",
2016
- "right",
2017
- "method_type",
2018
- "right_always",
2019
- "right_unreachable",
2020
- "analyzed",
2021
- )
2022
-
2023
- __match_args__ = ("left", "op", "right")
2024
-
2025
- op: str # TODO: Enum?
2026
- left: Expression
2027
- right: Expression
2028
- # Inferred type for the operator method type (when relevant).
2029
- method_type: mypy.types.Type | None
2030
- # Per static analysis only: Is the right side going to be evaluated every time?
2031
- right_always: bool
2032
- # Per static analysis only: Is the right side unreachable?
2033
- right_unreachable: bool
2034
- # Used for expressions that represent a type "X | Y" in some contexts
2035
- analyzed: TypeAliasExpr | None
2036
-
2037
- def __init__(
2038
- self, op: str, left: Expression, right: Expression, analyzed: TypeAliasExpr | None = None
2039
- ) -> None:
2040
- super().__init__()
2041
- self.op = op
2042
- self.left = left
2043
- self.right = right
2044
- self.method_type = None
2045
- self.right_always = False
2046
- self.right_unreachable = False
2047
- self.analyzed = analyzed
2048
-
2049
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2050
- return visitor.visit_op_expr(self)
2051
-
2052
-
2053
- class ComparisonExpr(Expression):
2054
- """Comparison expression (e.g. a < b > c < d)."""
2055
-
2056
- __slots__ = ("operators", "operands", "method_types")
2057
-
2058
- __match_args__ = ("operands", "operators")
2059
-
2060
- operators: list[str]
2061
- operands: list[Expression]
2062
- # Inferred type for the operator methods (when relevant; None for 'is').
2063
- method_types: list[mypy.types.Type | None]
2064
-
2065
- def __init__(self, operators: list[str], operands: list[Expression]) -> None:
2066
- super().__init__()
2067
- self.operators = operators
2068
- self.operands = operands
2069
- self.method_types = []
2070
-
2071
- def pairwise(self) -> Iterator[tuple[str, Expression, Expression]]:
2072
- """If this comparison expr is "a < b is c == d", yields the sequence
2073
- ("<", a, b), ("is", b, c), ("==", c, d)
2074
- """
2075
- for i, operator in enumerate(self.operators):
2076
- yield operator, self.operands[i], self.operands[i + 1]
2077
-
2078
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2079
- return visitor.visit_comparison_expr(self)
2080
-
2081
-
2082
- class SliceExpr(Expression):
2083
- """Slice expression (e.g. 'x:y', 'x:', '::2' or ':').
2084
-
2085
- This is only valid as index in index expressions.
2086
- """
2087
-
2088
- __slots__ = ("begin_index", "end_index", "stride")
2089
-
2090
- __match_args__ = ("begin_index", "end_index", "stride")
2091
-
2092
- begin_index: Expression | None
2093
- end_index: Expression | None
2094
- stride: Expression | None
2095
-
2096
- def __init__(
2097
- self,
2098
- begin_index: Expression | None,
2099
- end_index: Expression | None,
2100
- stride: Expression | None,
2101
- ) -> None:
2102
- super().__init__()
2103
- self.begin_index = begin_index
2104
- self.end_index = end_index
2105
- self.stride = stride
2106
-
2107
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2108
- return visitor.visit_slice_expr(self)
2109
-
2110
-
2111
- class CastExpr(Expression):
2112
- """Cast expression cast(type, expr)."""
2113
-
2114
- __slots__ = ("expr", "type")
2115
-
2116
- __match_args__ = ("expr", "type")
2117
-
2118
- expr: Expression
2119
- type: mypy.types.Type
2120
-
2121
- def __init__(self, expr: Expression, typ: mypy.types.Type) -> None:
2122
- super().__init__()
2123
- self.expr = expr
2124
- self.type = typ
2125
-
2126
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2127
- return visitor.visit_cast_expr(self)
2128
-
2129
-
2130
- class AssertTypeExpr(Expression):
2131
- """Represents a typing.assert_type(expr, type) call."""
2132
-
2133
- __slots__ = ("expr", "type")
2134
-
2135
- __match_args__ = ("expr", "type")
2136
-
2137
- expr: Expression
2138
- type: mypy.types.Type
2139
-
2140
- def __init__(self, expr: Expression, typ: mypy.types.Type) -> None:
2141
- super().__init__()
2142
- self.expr = expr
2143
- self.type = typ
2144
-
2145
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2146
- return visitor.visit_assert_type_expr(self)
2147
-
2148
-
2149
- class RevealExpr(Expression):
2150
- """Reveal type expression reveal_type(expr) or reveal_locals() expression."""
2151
-
2152
- __slots__ = ("expr", "kind", "local_nodes", "is_imported")
2153
-
2154
- __match_args__ = ("expr", "kind", "local_nodes", "is_imported")
2155
-
2156
- expr: Expression | None
2157
- kind: int
2158
- local_nodes: list[Var] | None
2159
-
2160
- def __init__(
2161
- self,
2162
- kind: int,
2163
- expr: Expression | None = None,
2164
- local_nodes: list[Var] | None = None,
2165
- is_imported: bool = False,
2166
- ) -> None:
2167
- super().__init__()
2168
- self.expr = expr
2169
- self.kind = kind
2170
- self.local_nodes = local_nodes
2171
- self.is_imported = is_imported
2172
-
2173
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2174
- return visitor.visit_reveal_expr(self)
2175
-
2176
-
2177
- class SuperExpr(Expression):
2178
- """Expression super().name"""
2179
-
2180
- __slots__ = ("name", "info", "call")
2181
-
2182
- __match_args__ = ("name", "call", "info")
2183
-
2184
- name: str
2185
- info: TypeInfo | None # Type that contains this super expression
2186
- call: CallExpr # The expression super(...)
2187
-
2188
- def __init__(self, name: str, call: CallExpr) -> None:
2189
- super().__init__()
2190
- self.name = name
2191
- self.call = call
2192
- self.info = None
2193
-
2194
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2195
- return visitor.visit_super_expr(self)
2196
-
2197
-
2198
- class LambdaExpr(FuncItem, Expression):
2199
- """Lambda expression"""
2200
-
2201
- __match_args__ = ("arguments", "arg_names", "arg_kinds", "body")
2202
-
2203
- @property
2204
- def name(self) -> str:
2205
- return "<lambda>"
2206
-
2207
- def expr(self) -> Expression:
2208
- """Return the expression (the body) of the lambda."""
2209
- ret = self.body.body[-1]
2210
- assert isinstance(ret, ReturnStmt)
2211
- expr = ret.expr
2212
- assert expr is not None # lambda can't have empty body
2213
- return expr
2214
-
2215
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2216
- return visitor.visit_lambda_expr(self)
2217
-
2218
- def is_dynamic(self) -> bool:
2219
- return False
2220
-
2221
-
2222
- class ListExpr(Expression):
2223
- """List literal expression [...]."""
2224
-
2225
- __slots__ = ("items",)
2226
-
2227
- __match_args__ = ("items",)
2228
-
2229
- items: list[Expression]
2230
-
2231
- def __init__(self, items: list[Expression]) -> None:
2232
- super().__init__()
2233
- self.items = items
2234
-
2235
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2236
- return visitor.visit_list_expr(self)
2237
-
2238
-
2239
- class DictExpr(Expression):
2240
- """Dictionary literal expression {key: value, ...}."""
2241
-
2242
- __slots__ = ("items",)
2243
-
2244
- __match_args__ = ("items",)
2245
-
2246
- items: list[tuple[Expression | None, Expression]]
2247
-
2248
- def __init__(self, items: list[tuple[Expression | None, Expression]]) -> None:
2249
- super().__init__()
2250
- self.items = items
2251
-
2252
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2253
- return visitor.visit_dict_expr(self)
2254
-
2255
-
2256
- class TupleExpr(Expression):
2257
- """Tuple literal expression (..., ...)
2258
-
2259
- Also lvalue sequences (..., ...) and [..., ...]"""
2260
-
2261
- __slots__ = ("items",)
2262
-
2263
- __match_args__ = ("items",)
2264
-
2265
- items: list[Expression]
2266
-
2267
- def __init__(self, items: list[Expression]) -> None:
2268
- super().__init__()
2269
- self.items = items
2270
-
2271
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2272
- return visitor.visit_tuple_expr(self)
2273
-
2274
-
2275
- class SetExpr(Expression):
2276
- """Set literal expression {value, ...}."""
2277
-
2278
- __slots__ = ("items",)
2279
-
2280
- __match_args__ = ("items",)
2281
-
2282
- items: list[Expression]
2283
-
2284
- def __init__(self, items: list[Expression]) -> None:
2285
- super().__init__()
2286
- self.items = items
2287
-
2288
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2289
- return visitor.visit_set_expr(self)
2290
-
2291
-
2292
- class GeneratorExpr(Expression):
2293
- """Generator expression ... for ... in ... [ for ... in ... ] [ if ... ]."""
2294
-
2295
- __slots__ = ("left_expr", "sequences", "condlists", "is_async", "indices")
2296
-
2297
- __match_args__ = ("left_expr", "indices", "sequences", "condlists")
2298
-
2299
- left_expr: Expression
2300
- sequences: list[Expression]
2301
- condlists: list[list[Expression]]
2302
- is_async: list[bool]
2303
- indices: list[Lvalue]
2304
-
2305
- def __init__(
2306
- self,
2307
- left_expr: Expression,
2308
- indices: list[Lvalue],
2309
- sequences: list[Expression],
2310
- condlists: list[list[Expression]],
2311
- is_async: list[bool],
2312
- ) -> None:
2313
- super().__init__()
2314
- self.left_expr = left_expr
2315
- self.sequences = sequences
2316
- self.condlists = condlists
2317
- self.indices = indices
2318
- self.is_async = is_async
2319
-
2320
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2321
- return visitor.visit_generator_expr(self)
2322
-
2323
-
2324
- class ListComprehension(Expression):
2325
- """List comprehension (e.g. [x + 1 for x in a])"""
2326
-
2327
- __slots__ = ("generator",)
2328
-
2329
- __match_args__ = ("generator",)
2330
-
2331
- generator: GeneratorExpr
2332
-
2333
- def __init__(self, generator: GeneratorExpr) -> None:
2334
- super().__init__()
2335
- self.generator = generator
2336
-
2337
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2338
- return visitor.visit_list_comprehension(self)
2339
-
2340
-
2341
- class SetComprehension(Expression):
2342
- """Set comprehension (e.g. {x + 1 for x in a})"""
2343
-
2344
- __slots__ = ("generator",)
2345
-
2346
- __match_args__ = ("generator",)
2347
-
2348
- generator: GeneratorExpr
2349
-
2350
- def __init__(self, generator: GeneratorExpr) -> None:
2351
- super().__init__()
2352
- self.generator = generator
2353
-
2354
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2355
- return visitor.visit_set_comprehension(self)
2356
-
2357
-
2358
- class DictionaryComprehension(Expression):
2359
- """Dictionary comprehension (e.g. {k: v for k, v in a}"""
2360
-
2361
- __slots__ = ("key", "value", "sequences", "condlists", "is_async", "indices")
2362
-
2363
- __match_args__ = ("key", "value", "indices", "sequences", "condlists")
2364
-
2365
- key: Expression
2366
- value: Expression
2367
- sequences: list[Expression]
2368
- condlists: list[list[Expression]]
2369
- is_async: list[bool]
2370
- indices: list[Lvalue]
2371
-
2372
- def __init__(
2373
- self,
2374
- key: Expression,
2375
- value: Expression,
2376
- indices: list[Lvalue],
2377
- sequences: list[Expression],
2378
- condlists: list[list[Expression]],
2379
- is_async: list[bool],
2380
- ) -> None:
2381
- super().__init__()
2382
- self.key = key
2383
- self.value = value
2384
- self.sequences = sequences
2385
- self.condlists = condlists
2386
- self.indices = indices
2387
- self.is_async = is_async
2388
-
2389
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2390
- return visitor.visit_dictionary_comprehension(self)
2391
-
2392
-
2393
- class ConditionalExpr(Expression):
2394
- """Conditional expression (e.g. x if y else z)"""
2395
-
2396
- __slots__ = ("cond", "if_expr", "else_expr")
2397
-
2398
- __match_args__ = ("if_expr", "cond", "else_expr")
2399
-
2400
- cond: Expression
2401
- if_expr: Expression
2402
- else_expr: Expression
2403
-
2404
- def __init__(self, cond: Expression, if_expr: Expression, else_expr: Expression) -> None:
2405
- super().__init__()
2406
- self.cond = cond
2407
- self.if_expr = if_expr
2408
- self.else_expr = else_expr
2409
-
2410
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2411
- return visitor.visit_conditional_expr(self)
2412
-
2413
-
2414
- class TypeApplication(Expression):
2415
- """Type application expr[type, ...]"""
2416
-
2417
- __slots__ = ("expr", "types")
2418
-
2419
- __match_args__ = ("expr", "types")
2420
-
2421
- expr: Expression
2422
- types: list[mypy.types.Type]
2423
-
2424
- def __init__(self, expr: Expression, types: list[mypy.types.Type]) -> None:
2425
- super().__init__()
2426
- self.expr = expr
2427
- self.types = types
2428
-
2429
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2430
- return visitor.visit_type_application(self)
2431
-
2432
-
2433
- # Variance of a type variable. For example, T in the definition of
2434
- # List[T] is invariant, so List[int] is not a subtype of List[object],
2435
- # and also List[object] is not a subtype of List[int].
2436
- #
2437
- # The T in Iterable[T] is covariant, so Iterable[int] is a subtype of
2438
- # Iterable[object], but not vice versa.
2439
- #
2440
- # If T is contravariant in Foo[T], Foo[object] is a subtype of
2441
- # Foo[int], but not vice versa.
2442
- INVARIANT: Final = 0
2443
- COVARIANT: Final = 1
2444
- CONTRAVARIANT: Final = 2
2445
-
2446
-
2447
- class TypeVarLikeExpr(SymbolNode, Expression):
2448
- """Base class for TypeVarExpr, ParamSpecExpr and TypeVarTupleExpr.
2449
-
2450
- Note that they are constructed by the semantic analyzer.
2451
- """
2452
-
2453
- __slots__ = ("_name", "_fullname", "upper_bound", "default", "variance")
2454
-
2455
- _name: str
2456
- _fullname: str
2457
- # Upper bound: only subtypes of upper_bound are valid as values. By default
2458
- # this is 'object', meaning no restriction.
2459
- upper_bound: mypy.types.Type
2460
- # Default: used to resolve the TypeVar if the default is not explicitly given.
2461
- # By default this is 'AnyType(TypeOfAny.from_omitted_generics)'. See PEP 696.
2462
- default: mypy.types.Type
2463
- # Variance of the type variable. Invariant is the default.
2464
- # TypeVar(..., covariant=True) defines a covariant type variable.
2465
- # TypeVar(..., contravariant=True) defines a contravariant type
2466
- # variable.
2467
- variance: int
2468
-
2469
- def __init__(
2470
- self,
2471
- name: str,
2472
- fullname: str,
2473
- upper_bound: mypy.types.Type,
2474
- default: mypy.types.Type,
2475
- variance: int = INVARIANT,
2476
- ) -> None:
2477
- super().__init__()
2478
- self._name = name
2479
- self._fullname = fullname
2480
- self.upper_bound = upper_bound
2481
- self.default = default
2482
- self.variance = variance
2483
-
2484
- @property
2485
- def name(self) -> str:
2486
- return self._name
2487
-
2488
- @property
2489
- def fullname(self) -> str:
2490
- return self._fullname
2491
-
2492
-
2493
- class TypeVarExpr(TypeVarLikeExpr):
2494
- """Type variable expression TypeVar(...).
2495
-
2496
- This is also used to represent type variables in symbol tables.
2497
-
2498
- A type variable is not valid as a type unless bound in a TypeVarLikeScope.
2499
- That happens within:
2500
-
2501
- 1. a generic class that uses the type variable as a type argument or
2502
- 2. a generic function that refers to the type variable in its signature.
2503
- """
2504
-
2505
- __slots__ = ("values",)
2506
-
2507
- __match_args__ = ("name", "values", "upper_bound", "default")
2508
-
2509
- # Value restriction: only types in the list are valid as values. If the
2510
- # list is empty, there is no restriction.
2511
- values: list[mypy.types.Type]
2512
-
2513
- def __init__(
2514
- self,
2515
- name: str,
2516
- fullname: str,
2517
- values: list[mypy.types.Type],
2518
- upper_bound: mypy.types.Type,
2519
- default: mypy.types.Type,
2520
- variance: int = INVARIANT,
2521
- ) -> None:
2522
- super().__init__(name, fullname, upper_bound, default, variance)
2523
- self.values = values
2524
-
2525
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2526
- return visitor.visit_type_var_expr(self)
2527
-
2528
- def serialize(self) -> JsonDict:
2529
- return {
2530
- ".class": "TypeVarExpr",
2531
- "name": self._name,
2532
- "fullname": self._fullname,
2533
- "values": [t.serialize() for t in self.values],
2534
- "upper_bound": self.upper_bound.serialize(),
2535
- "default": self.default.serialize(),
2536
- "variance": self.variance,
2537
- }
2538
-
2539
- @classmethod
2540
- def deserialize(cls, data: JsonDict) -> TypeVarExpr:
2541
- assert data[".class"] == "TypeVarExpr"
2542
- return TypeVarExpr(
2543
- data["name"],
2544
- data["fullname"],
2545
- [mypy.types.deserialize_type(v) for v in data["values"]],
2546
- mypy.types.deserialize_type(data["upper_bound"]),
2547
- mypy.types.deserialize_type(data["default"]),
2548
- data["variance"],
2549
- )
2550
-
2551
-
2552
- class ParamSpecExpr(TypeVarLikeExpr):
2553
- __slots__ = ()
2554
-
2555
- __match_args__ = ("name", "upper_bound", "default")
2556
-
2557
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2558
- return visitor.visit_paramspec_expr(self)
2559
-
2560
- def serialize(self) -> JsonDict:
2561
- return {
2562
- ".class": "ParamSpecExpr",
2563
- "name": self._name,
2564
- "fullname": self._fullname,
2565
- "upper_bound": self.upper_bound.serialize(),
2566
- "default": self.default.serialize(),
2567
- "variance": self.variance,
2568
- }
2569
-
2570
- @classmethod
2571
- def deserialize(cls, data: JsonDict) -> ParamSpecExpr:
2572
- assert data[".class"] == "ParamSpecExpr"
2573
- return ParamSpecExpr(
2574
- data["name"],
2575
- data["fullname"],
2576
- mypy.types.deserialize_type(data["upper_bound"]),
2577
- mypy.types.deserialize_type(data["default"]),
2578
- data["variance"],
2579
- )
2580
-
2581
-
2582
- class TypeVarTupleExpr(TypeVarLikeExpr):
2583
- """Type variable tuple expression TypeVarTuple(...)."""
2584
-
2585
- __slots__ = "tuple_fallback"
2586
-
2587
- tuple_fallback: mypy.types.Instance
2588
-
2589
- __match_args__ = ("name", "upper_bound", "default")
2590
-
2591
- def __init__(
2592
- self,
2593
- name: str,
2594
- fullname: str,
2595
- upper_bound: mypy.types.Type,
2596
- tuple_fallback: mypy.types.Instance,
2597
- default: mypy.types.Type,
2598
- variance: int = INVARIANT,
2599
- ) -> None:
2600
- super().__init__(name, fullname, upper_bound, default, variance)
2601
- self.tuple_fallback = tuple_fallback
2602
-
2603
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2604
- return visitor.visit_type_var_tuple_expr(self)
2605
-
2606
- def serialize(self) -> JsonDict:
2607
- return {
2608
- ".class": "TypeVarTupleExpr",
2609
- "name": self._name,
2610
- "fullname": self._fullname,
2611
- "upper_bound": self.upper_bound.serialize(),
2612
- "tuple_fallback": self.tuple_fallback.serialize(),
2613
- "default": self.default.serialize(),
2614
- "variance": self.variance,
2615
- }
2616
-
2617
- @classmethod
2618
- def deserialize(cls, data: JsonDict) -> TypeVarTupleExpr:
2619
- assert data[".class"] == "TypeVarTupleExpr"
2620
- return TypeVarTupleExpr(
2621
- data["name"],
2622
- data["fullname"],
2623
- mypy.types.deserialize_type(data["upper_bound"]),
2624
- mypy.types.Instance.deserialize(data["tuple_fallback"]),
2625
- mypy.types.deserialize_type(data["default"]),
2626
- data["variance"],
2627
- )
2628
-
2629
-
2630
- class TypeAliasExpr(Expression):
2631
- """Type alias expression (rvalue)."""
2632
-
2633
- __slots__ = ("node",)
2634
-
2635
- __match_args__ = ("node",)
2636
-
2637
- node: TypeAlias
2638
-
2639
- def __init__(self, node: TypeAlias) -> None:
2640
- super().__init__()
2641
- self.node = node
2642
-
2643
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2644
- return visitor.visit_type_alias_expr(self)
2645
-
2646
-
2647
- class NamedTupleExpr(Expression):
2648
- """Named tuple expression namedtuple(...) or NamedTuple(...)."""
2649
-
2650
- __slots__ = ("info", "is_typed")
2651
-
2652
- __match_args__ = ("info",)
2653
-
2654
- # The class representation of this named tuple (its tuple_type attribute contains
2655
- # the tuple item types)
2656
- info: TypeInfo
2657
- is_typed: bool # whether this class was created with typing(_extensions).NamedTuple
2658
-
2659
- def __init__(self, info: TypeInfo, is_typed: bool = False) -> None:
2660
- super().__init__()
2661
- self.info = info
2662
- self.is_typed = is_typed
2663
-
2664
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2665
- return visitor.visit_namedtuple_expr(self)
2666
-
2667
-
2668
- class TypedDictExpr(Expression):
2669
- """Typed dict expression TypedDict(...)."""
2670
-
2671
- __slots__ = ("info",)
2672
-
2673
- __match_args__ = ("info",)
2674
-
2675
- # The class representation of this typed dict
2676
- info: TypeInfo
2677
-
2678
- def __init__(self, info: TypeInfo) -> None:
2679
- super().__init__()
2680
- self.info = info
2681
-
2682
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2683
- return visitor.visit_typeddict_expr(self)
2684
-
2685
-
2686
- class EnumCallExpr(Expression):
2687
- """Named tuple expression Enum('name', 'val1 val2 ...')."""
2688
-
2689
- __slots__ = ("info", "items", "values")
2690
-
2691
- __match_args__ = ("info", "items", "values")
2692
-
2693
- # The class representation of this enumerated type
2694
- info: TypeInfo
2695
- # The item names (for debugging)
2696
- items: list[str]
2697
- values: list[Expression | None]
2698
-
2699
- def __init__(self, info: TypeInfo, items: list[str], values: list[Expression | None]) -> None:
2700
- super().__init__()
2701
- self.info = info
2702
- self.items = items
2703
- self.values = values
2704
-
2705
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2706
- return visitor.visit_enum_call_expr(self)
2707
-
2708
-
2709
- class PromoteExpr(Expression):
2710
- """Ducktype class decorator expression _promote(...)."""
2711
-
2712
- __slots__ = ("type",)
2713
-
2714
- type: mypy.types.ProperType
2715
-
2716
- def __init__(self, type: mypy.types.ProperType) -> None:
2717
- super().__init__()
2718
- self.type = type
2719
-
2720
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2721
- return visitor.visit__promote_expr(self)
2722
-
2723
-
2724
- class NewTypeExpr(Expression):
2725
- """NewType expression NewType(...)."""
2726
-
2727
- __slots__ = ("name", "old_type", "info")
2728
-
2729
- __match_args__ = ("name", "old_type", "info")
2730
-
2731
- name: str
2732
- # The base type (the second argument to NewType)
2733
- old_type: mypy.types.Type | None
2734
- # The synthesized class representing the new type (inherits old_type)
2735
- info: TypeInfo | None
2736
-
2737
- def __init__(
2738
- self, name: str, old_type: mypy.types.Type | None, line: int, column: int
2739
- ) -> None:
2740
- super().__init__(line=line, column=column)
2741
- self.name = name
2742
- self.old_type = old_type
2743
- self.info = None
2744
-
2745
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2746
- return visitor.visit_newtype_expr(self)
2747
-
2748
-
2749
- class AwaitExpr(Expression):
2750
- """Await expression (await ...)."""
2751
-
2752
- __slots__ = ("expr",)
2753
-
2754
- __match_args__ = ("expr",)
2755
-
2756
- expr: Expression
2757
-
2758
- def __init__(self, expr: Expression) -> None:
2759
- super().__init__()
2760
- self.expr = expr
2761
-
2762
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2763
- return visitor.visit_await_expr(self)
2764
-
2765
-
2766
- # Constants
2767
-
2768
-
2769
- class TempNode(Expression):
2770
- """Temporary dummy node used during type checking.
2771
-
2772
- This node is not present in the original program; it is just an artifact
2773
- of the type checker implementation. It only represents an opaque node with
2774
- some fixed type.
2775
- """
2776
-
2777
- __slots__ = ("type", "no_rhs")
2778
-
2779
- type: mypy.types.Type
2780
- # Is this TempNode used to indicate absence of a right hand side in an annotated assignment?
2781
- # (e.g. for 'x: int' the rvalue is TempNode(AnyType(TypeOfAny.special_form), no_rhs=True))
2782
- no_rhs: bool
2783
-
2784
- def __init__(
2785
- self, typ: mypy.types.Type, no_rhs: bool = False, *, context: Context | None = None
2786
- ) -> None:
2787
- """Construct a dummy node; optionally borrow line/column from context object."""
2788
- super().__init__()
2789
- self.type = typ
2790
- self.no_rhs = no_rhs
2791
- if context is not None:
2792
- self.line = context.line
2793
- self.column = context.column
2794
-
2795
- def __repr__(self) -> str:
2796
- return "TempNode:%d(%s)" % (self.line, str(self.type))
2797
-
2798
- def accept(self, visitor: ExpressionVisitor[T]) -> T:
2799
- return visitor.visit_temp_node(self)
2800
-
2801
-
2802
- # Special attributes not collected as protocol members by Python 3.12
2803
- # See typing._SPECIAL_NAMES
2804
- EXCLUDED_PROTOCOL_ATTRIBUTES: Final = frozenset(
2805
- {
2806
- "__abstractmethods__",
2807
- "__annotations__",
2808
- "__dict__",
2809
- "__doc__",
2810
- "__init__",
2811
- "__module__",
2812
- "__new__",
2813
- "__slots__",
2814
- "__subclasshook__",
2815
- "__weakref__",
2816
- "__class_getitem__", # Since Python 3.9
2817
- }
2818
- )
2819
-
2820
-
2821
- class TypeInfo(SymbolNode):
2822
- """The type structure of a single class.
2823
-
2824
- Each TypeInfo corresponds one-to-one to a ClassDef, which
2825
- represents the AST of the class.
2826
-
2827
- In type-theory terms, this is a "type constructor", and if the
2828
- class is generic then it will be a type constructor of higher kind.
2829
- Where the class is used in an actual type, it's in the form of an
2830
- Instance, which amounts to a type application of the tycon to
2831
- the appropriate number of arguments.
2832
- """
2833
-
2834
- __slots__ = (
2835
- "_fullname",
2836
- "module_name",
2837
- "defn",
2838
- "mro",
2839
- "_mro_refs",
2840
- "bad_mro",
2841
- "is_final",
2842
- "declared_metaclass",
2843
- "metaclass_type",
2844
- "names",
2845
- "is_abstract",
2846
- "is_protocol",
2847
- "runtime_protocol",
2848
- "abstract_attributes",
2849
- "deletable_attributes",
2850
- "slots",
2851
- "assuming",
2852
- "assuming_proper",
2853
- "inferring",
2854
- "is_enum",
2855
- "fallback_to_any",
2856
- "meta_fallback_to_any",
2857
- "type_vars",
2858
- "has_param_spec_type",
2859
- "bases",
2860
- "_promote",
2861
- "tuple_type",
2862
- "special_alias",
2863
- "is_named_tuple",
2864
- "typeddict_type",
2865
- "is_newtype",
2866
- "is_intersection",
2867
- "metadata",
2868
- "alt_promote",
2869
- "has_type_var_tuple_type",
2870
- "type_var_tuple_prefix",
2871
- "type_var_tuple_suffix",
2872
- "self_type",
2873
- "dataclass_transform_spec",
2874
- "is_type_check_only",
2875
- )
2876
-
2877
- _fullname: str # Fully qualified name
2878
- # Fully qualified name for the module this type was defined in. This
2879
- # information is also in the fullname, but is harder to extract in the
2880
- # case of nested class definitions.
2881
- module_name: str
2882
- defn: ClassDef # Corresponding ClassDef
2883
- # Method Resolution Order: the order of looking up attributes. The first
2884
- # value always to refers to this class.
2885
- mro: list[TypeInfo]
2886
- # Used to stash the names of the mro classes temporarily between
2887
- # deserialization and fixup. See deserialize() for why.
2888
- _mro_refs: list[str] | None
2889
- bad_mro: bool # Could not construct full MRO
2890
- is_final: bool
2891
-
2892
- declared_metaclass: mypy.types.Instance | None
2893
- metaclass_type: mypy.types.Instance | None
2894
-
2895
- names: SymbolTable # Names defined directly in this type
2896
- is_abstract: bool # Does the class have any abstract attributes?
2897
- is_protocol: bool # Is this a protocol class?
2898
- runtime_protocol: bool # Does this protocol support isinstance checks?
2899
- # List of names of abstract attributes together with their abstract status.
2900
- # The abstract status must be one of `NOT_ABSTRACT`, `IS_ABSTRACT`, `IMPLICITLY_ABSTRACT`.
2901
- abstract_attributes: list[tuple[str, int]]
2902
- deletable_attributes: list[str] # Used by mypyc only
2903
- # Does this type have concrete `__slots__` defined?
2904
- # If class does not have `__slots__` defined then it is `None`,
2905
- # if it has empty `__slots__` then it is an empty set.
2906
- slots: set[str] | None
2907
-
2908
- # The attributes 'assuming' and 'assuming_proper' represent structural subtype matrices.
2909
- #
2910
- # In languages with structural subtyping, one can keep a global subtype matrix like this:
2911
- # . A B C .
2912
- # A 1 0 0
2913
- # B 1 1 1
2914
- # C 1 0 1
2915
- # .
2916
- # where 1 indicates that the type in corresponding row is a subtype of the type
2917
- # in corresponding column. This matrix typically starts filled with all 1's and
2918
- # a typechecker tries to "disprove" every subtyping relation using atomic (or nominal) types.
2919
- # However, we don't want to keep this huge global state. Instead, we keep the subtype
2920
- # information in the form of list of pairs (subtype, supertype) shared by all Instances
2921
- # with given supertype's TypeInfo. When we enter a subtype check we push a pair in this list
2922
- # thus assuming that we started with 1 in corresponding matrix element. Such algorithm allows
2923
- # to treat recursive and mutually recursive protocols and other kinds of complex situations.
2924
- #
2925
- # If concurrent/parallel type checking will be added in future,
2926
- # then there should be one matrix per thread/process to avoid false negatives
2927
- # during the type checking phase.
2928
- assuming: list[tuple[mypy.types.Instance, mypy.types.Instance]]
2929
- assuming_proper: list[tuple[mypy.types.Instance, mypy.types.Instance]]
2930
- # Ditto for temporary 'inferring' stack of recursive constraint inference.
2931
- # It contains Instances of protocol types that appeared as an argument to
2932
- # constraints.infer_constraints(). We need 'inferring' to avoid infinite recursion for
2933
- # recursive and mutually recursive protocols.
2934
- #
2935
- # We make 'assuming' and 'inferring' attributes here instead of passing they as kwargs,
2936
- # since this would require to pass them in many dozens of calls. In particular,
2937
- # there is a dependency infer_constraint -> is_subtype -> is_callable_subtype ->
2938
- # -> infer_constraints.
2939
- inferring: list[mypy.types.Instance]
2940
- # 'inferring' and 'assuming' can't be made sets, since we need to use
2941
- # is_same_type to correctly treat unions.
2942
-
2943
- # Classes inheriting from Enum shadow their true members with a __getattr__, so we
2944
- # have to treat them as a special case.
2945
- is_enum: bool
2946
- # If true, any unknown attributes should have type 'Any' instead
2947
- # of generating a type error. This would be true if there is a
2948
- # base class with type 'Any', but other use cases may be
2949
- # possible. This is similar to having __getattr__ that returns Any
2950
- # (and __setattr__), but without the __getattr__ method.
2951
- fallback_to_any: bool
2952
-
2953
- # Same as above but for cases where metaclass has type Any. This will suppress
2954
- # all attribute errors only for *class object* access.
2955
- meta_fallback_to_any: bool
2956
-
2957
- # Information related to type annotations.
2958
-
2959
- # Generic type variable names (full names)
2960
- type_vars: list[str]
2961
-
2962
- # Whether this class has a ParamSpec type variable
2963
- has_param_spec_type: bool
2964
-
2965
- # Direct base classes.
2966
- bases: list[mypy.types.Instance]
2967
-
2968
- # Another type which this type will be treated as a subtype of,
2969
- # even though it's not a subclass in Python. The non-standard
2970
- # `@_promote` decorator introduces this, and there are also
2971
- # several builtin examples, in particular `int` -> `float`.
2972
- _promote: list[mypy.types.ProperType]
2973
-
2974
- # This is used for promoting native integer types such as 'i64' to
2975
- # 'int'. (_promote is used for the other direction.) This only
2976
- # supports one-step promotions (e.g., i64 -> int, not
2977
- # i64 -> int -> float, and this isn't used to promote in joins.
2978
- #
2979
- # This results in some unintuitive results, such as that even
2980
- # though i64 is compatible with int and int is compatible with
2981
- # float, i64 is *not* compatible with float.
2982
- alt_promote: mypy.types.Instance | None
2983
-
2984
- # Representation of a Tuple[...] base class, if the class has any
2985
- # (e.g., for named tuples). If this is not None, the actual Type
2986
- # object used for this class is not an Instance but a TupleType;
2987
- # the corresponding Instance is set as the fallback type of the
2988
- # tuple type.
2989
- tuple_type: mypy.types.TupleType | None
2990
-
2991
- # Is this a named tuple type?
2992
- is_named_tuple: bool
2993
-
2994
- # If this class is defined by the TypedDict type constructor,
2995
- # then this is not None.
2996
- typeddict_type: mypy.types.TypedDictType | None
2997
-
2998
- # Is this a newtype type?
2999
- is_newtype: bool
3000
-
3001
- # Is this a synthesized intersection type?
3002
- is_intersection: bool
3003
-
3004
- # This is a dictionary that will be serialized and un-serialized as is.
3005
- # It is useful for plugins to add their data to save in the cache.
3006
- metadata: dict[str, JsonDict]
3007
-
3008
- # Store type alias representing this type (for named tuples and TypedDicts).
3009
- # Although definitions of these types are stored in symbol tables as TypeInfo,
3010
- # when a type analyzer will find them, it should construct a TupleType, or
3011
- # a TypedDict type. However, we can't use the plain types, since if the definition
3012
- # is recursive, this will create an actual recursive structure of types (i.e. as
3013
- # internal Python objects) causing infinite recursions everywhere during type checking.
3014
- # To overcome this, we create a TypeAlias node, that will point to these types.
3015
- # We store this node in the `special_alias` attribute, because it must be the same node
3016
- # in case we are doing multiple semantic analysis passes.
3017
- special_alias: TypeAlias | None
3018
-
3019
- # Shared type variable for typing.Self in this class (if used, otherwise None).
3020
- self_type: mypy.types.TypeVarType | None
3021
-
3022
- # Added if the corresponding class is directly decorated with `typing.dataclass_transform`
3023
- dataclass_transform_spec: DataclassTransformSpec | None
3024
-
3025
- # Is set to `True` when class is decorated with `@typing.type_check_only`
3026
- is_type_check_only: bool
3027
-
3028
- FLAGS: Final = [
3029
- "is_abstract",
3030
- "is_enum",
3031
- "fallback_to_any",
3032
- "meta_fallback_to_any",
3033
- "is_named_tuple",
3034
- "is_newtype",
3035
- "is_protocol",
3036
- "runtime_protocol",
3037
- "is_final",
3038
- "is_intersection",
3039
- ]
3040
-
3041
- def __init__(self, names: SymbolTable, defn: ClassDef, module_name: str) -> None:
3042
- """Initialize a TypeInfo."""
3043
- super().__init__()
3044
- self._fullname = defn.fullname
3045
- self.names = names
3046
- self.defn = defn
3047
- self.module_name = module_name
3048
- self.type_vars = []
3049
- self.has_param_spec_type = False
3050
- self.has_type_var_tuple_type = False
3051
- self.bases = []
3052
- self.mro = []
3053
- self._mro_refs = None
3054
- self.bad_mro = False
3055
- self.declared_metaclass = None
3056
- self.metaclass_type = None
3057
- self.is_abstract = False
3058
- self.abstract_attributes = []
3059
- self.deletable_attributes = []
3060
- self.slots = None
3061
- self.assuming = []
3062
- self.assuming_proper = []
3063
- self.inferring = []
3064
- self.is_protocol = False
3065
- self.runtime_protocol = False
3066
- self.type_var_tuple_prefix: int | None = None
3067
- self.type_var_tuple_suffix: int | None = None
3068
- self.add_type_vars()
3069
- self.is_final = False
3070
- self.is_enum = False
3071
- self.fallback_to_any = False
3072
- self.meta_fallback_to_any = False
3073
- self._promote = []
3074
- self.alt_promote = None
3075
- self.tuple_type = None
3076
- self.special_alias = None
3077
- self.is_named_tuple = False
3078
- self.typeddict_type = None
3079
- self.is_newtype = False
3080
- self.is_intersection = False
3081
- self.metadata = {}
3082
- self.self_type = None
3083
- self.dataclass_transform_spec = None
3084
- self.is_type_check_only = False
3085
-
3086
- def add_type_vars(self) -> None:
3087
- self.has_type_var_tuple_type = False
3088
- if self.defn.type_vars:
3089
- for i, vd in enumerate(self.defn.type_vars):
3090
- if isinstance(vd, mypy.types.ParamSpecType):
3091
- self.has_param_spec_type = True
3092
- if isinstance(vd, mypy.types.TypeVarTupleType):
3093
- assert not self.has_type_var_tuple_type
3094
- self.has_type_var_tuple_type = True
3095
- self.type_var_tuple_prefix = i
3096
- self.type_var_tuple_suffix = len(self.defn.type_vars) - i - 1
3097
- self.type_vars.append(vd.name)
3098
- assert not (
3099
- self.has_param_spec_type and self.has_type_var_tuple_type
3100
- ), "Mixing type var tuples and param specs not supported yet"
3101
-
3102
- @property
3103
- def name(self) -> str:
3104
- """Short name."""
3105
- return self.defn.name
3106
-
3107
- @property
3108
- def fullname(self) -> str:
3109
- return self._fullname
3110
-
3111
- def is_generic(self) -> bool:
3112
- """Is the type generic (i.e. does it have type variables)?"""
3113
- return len(self.type_vars) > 0
3114
-
3115
- def get(self, name: str) -> SymbolTableNode | None:
3116
- for cls in self.mro:
3117
- n = cls.names.get(name)
3118
- if n:
3119
- return n
3120
- return None
3121
-
3122
- def get_containing_type_info(self, name: str) -> TypeInfo | None:
3123
- for cls in self.mro:
3124
- if name in cls.names:
3125
- return cls
3126
- return None
3127
-
3128
- @property
3129
- def protocol_members(self) -> list[str]:
3130
- # Protocol members are names of all attributes/methods defined in a protocol
3131
- # and in all its supertypes (except for 'object').
3132
- members: set[str] = set()
3133
- assert self.mro, "This property can be only accessed after MRO is (re-)calculated"
3134
- for base in self.mro[:-1]: # we skip "object" since everyone implements it
3135
- if base.is_protocol:
3136
- for name, node in base.names.items():
3137
- if isinstance(node.node, (TypeAlias, TypeVarExpr, MypyFile)):
3138
- # These are auxiliary definitions (and type aliases are prohibited).
3139
- continue
3140
- if name in EXCLUDED_PROTOCOL_ATTRIBUTES:
3141
- continue
3142
- members.add(name)
3143
- return sorted(members)
3144
-
3145
- def __getitem__(self, name: str) -> SymbolTableNode:
3146
- n = self.get(name)
3147
- if n:
3148
- return n
3149
- else:
3150
- raise KeyError(name)
3151
-
3152
- def __repr__(self) -> str:
3153
- return f"<TypeInfo {self.fullname}>"
3154
-
3155
- def __bool__(self) -> bool:
3156
- # We defined this here instead of just overriding it in
3157
- # FakeInfo so that mypyc can generate a direct call instead of
3158
- # using the generic bool handling.
3159
- return not isinstance(self, FakeInfo)
3160
-
3161
- def has_readable_member(self, name: str) -> bool:
3162
- return self.get(name) is not None
3163
-
3164
- def get_method(self, name: str) -> FuncBase | Decorator | None:
3165
- for cls in self.mro:
3166
- if name in cls.names:
3167
- node = cls.names[name].node
3168
- if isinstance(node, FuncBase):
3169
- return node
3170
- elif isinstance(node, Decorator): # Two `if`s make `mypyc` happy
3171
- return node
3172
- else:
3173
- return None
3174
- return None
3175
-
3176
- def calculate_metaclass_type(self) -> mypy.types.Instance | None:
3177
- declared = self.declared_metaclass
3178
- if declared is not None and not declared.type.has_base("builtins.type"):
3179
- return declared
3180
- if self._fullname == "builtins.type":
3181
- return mypy.types.Instance(self, [])
3182
- candidates = [
3183
- s.declared_metaclass
3184
- for s in self.mro
3185
- if s.declared_metaclass is not None and s.declared_metaclass.type is not None
3186
- ]
3187
- for c in candidates:
3188
- if all(other.type in c.type.mro for other in candidates):
3189
- return c
3190
- return None
3191
-
3192
- def is_metaclass(self) -> bool:
3193
- return (
3194
- self.has_base("builtins.type")
3195
- or self.fullname == "abc.ABCMeta"
3196
- or self.fallback_to_any
3197
- )
3198
-
3199
- def has_base(self, fullname: str) -> bool:
3200
- """Return True if type has a base type with the specified name.
3201
-
3202
- This can be either via extension or via implementation.
3203
- """
3204
- for cls in self.mro:
3205
- if cls.fullname == fullname:
3206
- return True
3207
- return False
3208
-
3209
- def direct_base_classes(self) -> list[TypeInfo]:
3210
- """Return a direct base classes.
3211
-
3212
- Omit base classes of other base classes.
3213
- """
3214
- return [base.type for base in self.bases]
3215
-
3216
- def update_tuple_type(self, typ: mypy.types.TupleType) -> None:
3217
- """Update tuple_type and special_alias as needed."""
3218
- self.tuple_type = typ
3219
- alias = TypeAlias.from_tuple_type(self)
3220
- if not self.special_alias:
3221
- self.special_alias = alias
3222
- else:
3223
- self.special_alias.target = alias.target
3224
-
3225
- def update_typeddict_type(self, typ: mypy.types.TypedDictType) -> None:
3226
- """Update typeddict_type and special_alias as needed."""
3227
- self.typeddict_type = typ
3228
- alias = TypeAlias.from_typeddict_type(self)
3229
- if not self.special_alias:
3230
- self.special_alias = alias
3231
- else:
3232
- self.special_alias.target = alias.target
3233
-
3234
- def __str__(self) -> str:
3235
- """Return a string representation of the type.
3236
-
3237
- This includes the most important information about the type.
3238
- """
3239
- options = Options()
3240
- return self.dump(
3241
- str_conv=mypy.strconv.StrConv(options=options),
3242
- type_str_conv=mypy.types.TypeStrVisitor(options=options),
3243
- )
3244
-
3245
- def dump(
3246
- self, str_conv: mypy.strconv.StrConv, type_str_conv: mypy.types.TypeStrVisitor
3247
- ) -> str:
3248
- """Return a string dump of the contents of the TypeInfo."""
3249
-
3250
- base: str = ""
3251
-
3252
- def type_str(typ: mypy.types.Type) -> str:
3253
- return typ.accept(type_str_conv)
3254
-
3255
- head = "TypeInfo" + str_conv.format_id(self)
3256
- if self.bases:
3257
- base = f"Bases({', '.join(type_str(base) for base in self.bases)})"
3258
- mro = "Mro({})".format(
3259
- ", ".join(item.fullname + str_conv.format_id(item) for item in self.mro)
3260
- )
3261
- names = []
3262
- for name in sorted(self.names):
3263
- description = name + str_conv.format_id(self.names[name].node)
3264
- node = self.names[name].node
3265
- if isinstance(node, Var) and node.type:
3266
- description += f" ({type_str(node.type)})"
3267
- names.append(description)
3268
- items = [f"Name({self.fullname})", base, mro, ("Names", names)]
3269
- if self.declared_metaclass:
3270
- items.append(f"DeclaredMetaclass({type_str(self.declared_metaclass)})")
3271
- if self.metaclass_type:
3272
- items.append(f"MetaclassType({type_str(self.metaclass_type)})")
3273
- return mypy.strconv.dump_tagged(items, head, str_conv=str_conv)
3274
-
3275
- def serialize(self) -> JsonDict:
3276
- # NOTE: This is where all ClassDefs originate, so there shouldn't be duplicates.
3277
- data = {
3278
- ".class": "TypeInfo",
3279
- "module_name": self.module_name,
3280
- "fullname": self.fullname,
3281
- "names": self.names.serialize(self.fullname),
3282
- "defn": self.defn.serialize(),
3283
- "abstract_attributes": self.abstract_attributes,
3284
- "type_vars": self.type_vars,
3285
- "has_param_spec_type": self.has_param_spec_type,
3286
- "bases": [b.serialize() for b in self.bases],
3287
- "mro": [c.fullname for c in self.mro],
3288
- "_promote": [p.serialize() for p in self._promote],
3289
- "alt_promote": None if self.alt_promote is None else self.alt_promote.serialize(),
3290
- "declared_metaclass": (
3291
- None if self.declared_metaclass is None else self.declared_metaclass.serialize()
3292
- ),
3293
- "metaclass_type": (
3294
- None if self.metaclass_type is None else self.metaclass_type.serialize()
3295
- ),
3296
- "tuple_type": None if self.tuple_type is None else self.tuple_type.serialize(),
3297
- "typeddict_type": (
3298
- None if self.typeddict_type is None else self.typeddict_type.serialize()
3299
- ),
3300
- "flags": get_flags(self, TypeInfo.FLAGS),
3301
- "metadata": self.metadata,
3302
- "slots": sorted(self.slots) if self.slots is not None else None,
3303
- "deletable_attributes": self.deletable_attributes,
3304
- "self_type": self.self_type.serialize() if self.self_type is not None else None,
3305
- "dataclass_transform_spec": (
3306
- self.dataclass_transform_spec.serialize()
3307
- if self.dataclass_transform_spec is not None
3308
- else None
3309
- ),
3310
- }
3311
- return data
3312
-
3313
- @classmethod
3314
- def deserialize(cls, data: JsonDict) -> TypeInfo:
3315
- names = SymbolTable.deserialize(data["names"])
3316
- defn = ClassDef.deserialize(data["defn"])
3317
- module_name = data["module_name"]
3318
- ti = TypeInfo(names, defn, module_name)
3319
- ti._fullname = data["fullname"]
3320
- # TODO: Is there a reason to reconstruct ti.subtypes?
3321
- ti.abstract_attributes = [(attr[0], attr[1]) for attr in data["abstract_attributes"]]
3322
- ti.type_vars = data["type_vars"]
3323
- ti.has_param_spec_type = data["has_param_spec_type"]
3324
- ti.bases = [mypy.types.Instance.deserialize(b) for b in data["bases"]]
3325
- _promote = []
3326
- for p in data["_promote"]:
3327
- t = mypy.types.deserialize_type(p)
3328
- assert isinstance(t, mypy.types.ProperType)
3329
- _promote.append(t)
3330
- ti._promote = _promote
3331
- ti.alt_promote = (
3332
- None
3333
- if data["alt_promote"] is None
3334
- else mypy.types.Instance.deserialize(data["alt_promote"])
3335
- )
3336
- ti.declared_metaclass = (
3337
- None
3338
- if data["declared_metaclass"] is None
3339
- else mypy.types.Instance.deserialize(data["declared_metaclass"])
3340
- )
3341
- ti.metaclass_type = (
3342
- None
3343
- if data["metaclass_type"] is None
3344
- else mypy.types.Instance.deserialize(data["metaclass_type"])
3345
- )
3346
- # NOTE: ti.mro will be set in the fixup phase based on these
3347
- # names. The reason we need to store the mro instead of just
3348
- # recomputing it from base classes has to do with a subtle
3349
- # point about fine-grained incremental: the cache files might
3350
- # not be loaded until after a class in the mro has changed its
3351
- # bases, which causes the mro to change. If we recomputed our
3352
- # mro, we would compute the *new* mro, which leaves us with no
3353
- # way to detect that the mro has changed! Thus we need to make
3354
- # sure to load the original mro so that once the class is
3355
- # rechecked, it can tell that the mro has changed.
3356
- ti._mro_refs = data["mro"]
3357
- ti.tuple_type = (
3358
- None
3359
- if data["tuple_type"] is None
3360
- else mypy.types.TupleType.deserialize(data["tuple_type"])
3361
- )
3362
- ti.typeddict_type = (
3363
- None
3364
- if data["typeddict_type"] is None
3365
- else mypy.types.TypedDictType.deserialize(data["typeddict_type"])
3366
- )
3367
- ti.metadata = data["metadata"]
3368
- ti.slots = set(data["slots"]) if data["slots"] is not None else None
3369
- ti.deletable_attributes = data["deletable_attributes"]
3370
- set_flags(ti, data["flags"])
3371
- st = data["self_type"]
3372
- ti.self_type = mypy.types.TypeVarType.deserialize(st) if st is not None else None
3373
- if data.get("dataclass_transform_spec") is not None:
3374
- ti.dataclass_transform_spec = DataclassTransformSpec.deserialize(
3375
- data["dataclass_transform_spec"]
3376
- )
3377
- return ti
3378
-
3379
-
3380
- class FakeInfo(TypeInfo):
3381
- __slots__ = ("msg",)
3382
-
3383
- # types.py defines a single instance of this class, called types.NOT_READY.
3384
- # This instance is used as a temporary placeholder in the process of de-serialization
3385
- # of 'Instance' types. The de-serialization happens in two steps: In the first step,
3386
- # Instance.type is set to NOT_READY. In the second step (in fixup.py) it is replaced by
3387
- # an actual TypeInfo. If you see the assertion error below, then most probably something
3388
- # went wrong during the second step and an 'Instance' that raised this error was not fixed.
3389
- # Note:
3390
- # 'None' is not used as a dummy value for two reasons:
3391
- # 1. This will require around 80-100 asserts to make 'mypy --strict-optional mypy'
3392
- # pass cleanly.
3393
- # 2. If NOT_READY value is accidentally used somewhere, it will be obvious where the value
3394
- # is from, whereas a 'None' value could come from anywhere.
3395
- #
3396
- # Additionally, this serves as a more general-purpose placeholder
3397
- # for missing TypeInfos in a number of places where the excuses
3398
- # for not being Optional are a little weaker.
3399
- #
3400
- # TypeInfo defines a __bool__ method that returns False for FakeInfo
3401
- # so that it can be conveniently tested against in the same way that it
3402
- # would be if things were properly optional.
3403
- def __init__(self, msg: str) -> None:
3404
- self.msg = msg
3405
-
3406
- def __getattribute__(self, attr: str) -> type:
3407
- # Handle __class__ so that isinstance still works...
3408
- if attr == "__class__":
3409
- return object.__getattribute__(self, attr) # type: ignore[no-any-return]
3410
- raise AssertionError(object.__getattribute__(self, "msg"))
3411
-
3412
-
3413
- VAR_NO_INFO: Final[TypeInfo] = FakeInfo("Var is lacking info")
3414
- CLASSDEF_NO_INFO: Final[TypeInfo] = FakeInfo("ClassDef is lacking info")
3415
- FUNC_NO_INFO: Final[TypeInfo] = FakeInfo("FuncBase for non-methods lack info")
3416
-
3417
-
3418
- class TypeAlias(SymbolNode):
3419
- """
3420
- A symbol node representing a type alias.
3421
-
3422
- Type alias is a static concept, in contrast to variables with types
3423
- like Type[...]. Namely:
3424
- * type aliases
3425
- - can be used in type context (annotations)
3426
- - cannot be re-assigned
3427
- * variables with type Type[...]
3428
- - cannot be used in type context
3429
- - but can be re-assigned
3430
-
3431
- An alias can be defined only by an assignment to a name (not any other lvalues).
3432
-
3433
- Such assignment defines an alias by default. To define a variable,
3434
- an explicit Type[...] annotation is required. As an exception,
3435
- at non-global scope non-subscripted rvalue creates a variable even without
3436
- an annotation. This exception exists to accommodate the common use case of
3437
- class-valued attributes. See SemanticAnalyzerPass2.check_and_set_up_type_alias
3438
- for details.
3439
-
3440
- Aliases can be generic. We use bound type variables for generic aliases, similar
3441
- to classes. Essentially, type aliases work as macros that expand textually.
3442
- The definition and expansion rules are following:
3443
-
3444
- 1. An alias targeting a generic class without explicit variables act as
3445
- the given class (this doesn't apply to TypedDict, Tuple and Callable, which
3446
- are not proper classes but special type constructors):
3447
-
3448
- A = List
3449
- AA = List[Any]
3450
-
3451
- x: A # same as List[Any]
3452
- x: A[int] # same as List[int]
3453
-
3454
- x: AA # same as List[Any]
3455
- x: AA[int] # Error!
3456
-
3457
- C = Callable # Same as Callable[..., Any]
3458
- T = Tuple # Same as Tuple[Any, ...]
3459
-
3460
- 2. An alias using explicit type variables in its rvalue expects
3461
- replacements (type arguments) for these variables. If missing, they
3462
- are treated as Any, like for other generics:
3463
-
3464
- B = List[Tuple[T, T]]
3465
-
3466
- x: B # same as List[Tuple[Any, Any]]
3467
- x: B[int] # same as List[Tuple[int, int]]
3468
-
3469
- def f(x: B[T]) -> T: ... # without T, Any would be used here
3470
-
3471
- 3. An alias can be defined using another aliases. In the definition
3472
- rvalue the Any substitution doesn't happen for top level unsubscripted
3473
- generic classes:
3474
-
3475
- A = List
3476
- B = A # here A is expanded to List, _not_ List[Any],
3477
- # to match the Python runtime behaviour
3478
- x: B[int] # same as List[int]
3479
- C = List[A] # this expands to List[List[Any]]
3480
-
3481
- AA = List[T]
3482
- D = AA # here AA expands to List[Any]
3483
- x: D[int] # Error!
3484
-
3485
- Note: the fact that we support aliases like `A = List` means that the target
3486
- type will be initially an instance type with wrong number of type arguments.
3487
- Such instances are all fixed either during or after main semantic analysis passes.
3488
- We therefore store the difference between `List` and `List[Any]` rvalues (targets)
3489
- using the `no_args` flag. See also TypeAliasExpr.no_args.
3490
-
3491
- Meaning of other fields:
3492
-
3493
- target: The target type. For generic aliases contains bound type variables
3494
- as nested types (currently TypeVar and ParamSpec are supported).
3495
- _fullname: Qualified name of this type alias. This is used in particular
3496
- to track fine grained dependencies from aliases.
3497
- alias_tvars: Type variables used to define this alias.
3498
- normalized: Used to distinguish between `A = List`, and `A = list`. Both
3499
- are internally stored using `builtins.list` (because `typing.List` is
3500
- itself an alias), while the second cannot be subscripted because of
3501
- Python runtime limitation.
3502
- line and column: Line and column on the original alias definition.
3503
- eager: If True, immediately expand alias when referred to (useful for aliases
3504
- within functions that can't be looked up from the symbol table)
3505
- """
3506
-
3507
- __slots__ = (
3508
- "target",
3509
- "_fullname",
3510
- "alias_tvars",
3511
- "no_args",
3512
- "normalized",
3513
- "_is_recursive",
3514
- "eager",
3515
- "tvar_tuple_index",
3516
- )
3517
-
3518
- __match_args__ = ("name", "target", "alias_tvars", "no_args")
3519
-
3520
- def __init__(
3521
- self,
3522
- target: mypy.types.Type,
3523
- fullname: str,
3524
- line: int,
3525
- column: int,
3526
- *,
3527
- alias_tvars: list[mypy.types.TypeVarLikeType] | None = None,
3528
- no_args: bool = False,
3529
- normalized: bool = False,
3530
- eager: bool = False,
3531
- ) -> None:
3532
- self._fullname = fullname
3533
- self.target = target
3534
- if alias_tvars is None:
3535
- alias_tvars = []
3536
- self.alias_tvars = alias_tvars
3537
- self.no_args = no_args
3538
- self.normalized = normalized
3539
- # This attribute is manipulated by TypeAliasType. If non-None,
3540
- # it is the cached value.
3541
- self._is_recursive: bool | None = None
3542
- self.eager = eager
3543
- self.tvar_tuple_index = None
3544
- for i, t in enumerate(alias_tvars):
3545
- if isinstance(t, mypy.types.TypeVarTupleType):
3546
- self.tvar_tuple_index = i
3547
- super().__init__(line, column)
3548
-
3549
- @classmethod
3550
- def from_tuple_type(cls, info: TypeInfo) -> TypeAlias:
3551
- """Generate an alias to the tuple type described by a given TypeInfo.
3552
-
3553
- NOTE: this doesn't set type alias type variables (for generic tuple types),
3554
- they must be set by the caller (when fully analyzed).
3555
- """
3556
- assert info.tuple_type
3557
- # TODO: is it possible to refactor this to set the correct type vars here?
3558
- return TypeAlias(
3559
- info.tuple_type.copy_modified(
3560
- # Create an Instance similar to fill_typevars().
3561
- fallback=mypy.types.Instance(
3562
- info, mypy.types.type_vars_as_args(info.defn.type_vars)
3563
- )
3564
- ),
3565
- info.fullname,
3566
- info.line,
3567
- info.column,
3568
- )
3569
-
3570
- @classmethod
3571
- def from_typeddict_type(cls, info: TypeInfo) -> TypeAlias:
3572
- """Generate an alias to the TypedDict type described by a given TypeInfo.
3573
-
3574
- NOTE: this doesn't set type alias type variables (for generic TypedDicts),
3575
- they must be set by the caller (when fully analyzed).
3576
- """
3577
- assert info.typeddict_type
3578
- # TODO: is it possible to refactor this to set the correct type vars here?
3579
- return TypeAlias(
3580
- info.typeddict_type.copy_modified(
3581
- # Create an Instance similar to fill_typevars().
3582
- fallback=mypy.types.Instance(
3583
- info, mypy.types.type_vars_as_args(info.defn.type_vars)
3584
- )
3585
- ),
3586
- info.fullname,
3587
- info.line,
3588
- info.column,
3589
- )
3590
-
3591
- @property
3592
- def name(self) -> str:
3593
- return self._fullname.split(".")[-1]
3594
-
3595
- @property
3596
- def fullname(self) -> str:
3597
- return self._fullname
3598
-
3599
- @property
3600
- def has_param_spec_type(self) -> bool:
3601
- return any(isinstance(v, mypy.types.ParamSpecType) for v in self.alias_tvars)
3602
-
3603
- def serialize(self) -> JsonDict:
3604
- data: JsonDict = {
3605
- ".class": "TypeAlias",
3606
- "fullname": self._fullname,
3607
- "target": self.target.serialize(),
3608
- "alias_tvars": [v.serialize() for v in self.alias_tvars],
3609
- "no_args": self.no_args,
3610
- "normalized": self.normalized,
3611
- "line": self.line,
3612
- "column": self.column,
3613
- }
3614
- return data
3615
-
3616
- def accept(self, visitor: NodeVisitor[T]) -> T:
3617
- return visitor.visit_type_alias(self)
3618
-
3619
- @classmethod
3620
- def deserialize(cls, data: JsonDict) -> TypeAlias:
3621
- assert data[".class"] == "TypeAlias"
3622
- fullname = data["fullname"]
3623
- alias_tvars = [mypy.types.deserialize_type(v) for v in data["alias_tvars"]]
3624
- assert all(isinstance(t, mypy.types.TypeVarLikeType) for t in alias_tvars)
3625
- target = mypy.types.deserialize_type(data["target"])
3626
- no_args = data["no_args"]
3627
- normalized = data["normalized"]
3628
- line = data["line"]
3629
- column = data["column"]
3630
- return cls(
3631
- target,
3632
- fullname,
3633
- line,
3634
- column,
3635
- alias_tvars=cast(List[mypy.types.TypeVarLikeType], alias_tvars),
3636
- no_args=no_args,
3637
- normalized=normalized,
3638
- )
3639
-
3640
-
3641
- class PlaceholderNode(SymbolNode):
3642
- """Temporary symbol node that will later become a real SymbolNode.
3643
-
3644
- These are only present during semantic analysis when using the new
3645
- semantic analyzer. These are created if some essential dependencies
3646
- of a definition are not yet complete.
3647
-
3648
- A typical use is for names imported from a module which is still
3649
- incomplete (within an import cycle):
3650
-
3651
- from m import f # Initially may create PlaceholderNode
3652
-
3653
- This is particularly important if the imported shadows a name from
3654
- an enclosing scope or builtins:
3655
-
3656
- from m import int # Placeholder avoids mixups with builtins.int
3657
-
3658
- Another case where this is useful is when there is another definition
3659
- or assignment:
3660
-
3661
- from m import f
3662
- def f() -> None: ...
3663
-
3664
- In the above example, the presence of PlaceholderNode allows us to
3665
- handle the second definition as a redefinition.
3666
-
3667
- They are also used to create PlaceholderType instances for types
3668
- that refer to incomplete types. Example:
3669
-
3670
- class C(Sequence[C]): ...
3671
-
3672
- We create a PlaceholderNode (with becomes_typeinfo=True) for C so
3673
- that the type C in Sequence[C] can be bound.
3674
-
3675
- Attributes:
3676
-
3677
- fullname: Full name of the PlaceholderNode.
3678
- node: AST node that contains the definition that caused this to
3679
- be created. This is useful for tracking order of incomplete definitions
3680
- and for debugging.
3681
- becomes_typeinfo: If True, this refers something that could later
3682
- become a TypeInfo. It can't be used with type variables, in
3683
- particular, as this would cause issues with class type variable
3684
- detection.
3685
-
3686
- The long-term purpose of placeholder nodes/types is to evolve into
3687
- something that can support general recursive types.
3688
- """
3689
-
3690
- __slots__ = ("_fullname", "node", "becomes_typeinfo")
3691
-
3692
- def __init__(
3693
- self, fullname: str, node: Node, line: int, *, becomes_typeinfo: bool = False
3694
- ) -> None:
3695
- self._fullname = fullname
3696
- self.node = node
3697
- self.becomes_typeinfo = becomes_typeinfo
3698
- self.line = line
3699
-
3700
- @property
3701
- def name(self) -> str:
3702
- return self._fullname.split(".")[-1]
3703
-
3704
- @property
3705
- def fullname(self) -> str:
3706
- return self._fullname
3707
-
3708
- def serialize(self) -> JsonDict:
3709
- assert False, "PlaceholderNode can't be serialized"
3710
-
3711
- def accept(self, visitor: NodeVisitor[T]) -> T:
3712
- return visitor.visit_placeholder_node(self)
3713
-
3714
-
3715
- class SymbolTableNode:
3716
- """Description of a name binding in a symbol table.
3717
-
3718
- These are only used as values in module (global), function (local)
3719
- and class symbol tables (see SymbolTable). The name that is bound is
3720
- the key in SymbolTable.
3721
-
3722
- Symbol tables don't contain direct references to AST nodes primarily
3723
- because there can be multiple symbol table references to a single
3724
- AST node (due to imports and aliases), and different references can
3725
- behave differently. This class describes the unique properties of
3726
- each reference.
3727
-
3728
- The most fundamental attribute is 'node', which is the AST node that
3729
- the name refers to.
3730
-
3731
- The kind is usually one of LDEF, GDEF or MDEF, depending on the scope
3732
- of the definition. These three kinds can usually be used
3733
- interchangeably and the difference between local, global and class
3734
- scopes is mostly descriptive, with no semantic significance.
3735
- However, some tools that consume mypy ASTs may care about these so
3736
- they should be correct.
3737
-
3738
- Attributes:
3739
- node: AST node of definition. Among others, this can be one of
3740
- FuncDef, Var, TypeInfo, TypeVarExpr or MypyFile -- or None
3741
- for cross_ref that hasn't been fixed up yet.
3742
- kind: Kind of node. Possible values:
3743
- - LDEF: local definition
3744
- - GDEF: global (module-level) definition
3745
- - MDEF: class member definition
3746
- - UNBOUND_IMPORTED: temporary kind for imported names (we
3747
- don't know the final kind yet)
3748
- module_public: If False, this name won't be imported via
3749
- 'from <module> import *'. This has no effect on names within
3750
- classes.
3751
- module_hidden: If True, the name will be never exported (needed for
3752
- stub files)
3753
- cross_ref: For deserialized MypyFile nodes, the referenced module
3754
- name; for other nodes, optionally the name of the referenced object.
3755
- implicit: Was this defined by assignment to self attribute?
3756
- plugin_generated: Was this symbol generated by a plugin?
3757
- (And therefore needs to be removed in aststrip.)
3758
- no_serialize: Do not serialize this node if True. This is used to prevent
3759
- keys in the cache that refer to modules on which this file does not
3760
- depend. Currently this can happen if there is a module not in build
3761
- used e.g. like this:
3762
- import a.b.c # type: ignore
3763
- This will add a submodule symbol to parent module `a` symbol table,
3764
- but `a.b` is _not_ added as its dependency. Therefore, we should
3765
- not serialize these symbols as they may not be found during fixup
3766
- phase, instead they will be re-added during subsequent patch parents
3767
- phase.
3768
- TODO: Refactor build.py to make dependency tracking more transparent
3769
- and/or refactor look-up functions to not require parent patching.
3770
-
3771
- NOTE: No other attributes should be added to this class unless they
3772
- are shared by all node kinds.
3773
- """
3774
-
3775
- __slots__ = (
3776
- "kind",
3777
- "node",
3778
- "module_public",
3779
- "module_hidden",
3780
- "cross_ref",
3781
- "implicit",
3782
- "plugin_generated",
3783
- "no_serialize",
3784
- )
3785
-
3786
- def __init__(
3787
- self,
3788
- kind: int,
3789
- node: SymbolNode | None,
3790
- module_public: bool = True,
3791
- implicit: bool = False,
3792
- module_hidden: bool = False,
3793
- *,
3794
- plugin_generated: bool = False,
3795
- no_serialize: bool = False,
3796
- ) -> None:
3797
- self.kind = kind
3798
- self.node = node
3799
- self.module_public = module_public
3800
- self.implicit = implicit
3801
- self.module_hidden = module_hidden
3802
- self.cross_ref: str | None = None
3803
- self.plugin_generated = plugin_generated
3804
- self.no_serialize = no_serialize
3805
-
3806
- @property
3807
- def fullname(self) -> str | None:
3808
- if self.node is not None:
3809
- return self.node.fullname
3810
- else:
3811
- return None
3812
-
3813
- @property
3814
- def type(self) -> mypy.types.Type | None:
3815
- node = self.node
3816
- if isinstance(node, (Var, SYMBOL_FUNCBASE_TYPES)) and node.type is not None:
3817
- return node.type
3818
- elif isinstance(node, Decorator):
3819
- return node.var.type
3820
- else:
3821
- return None
3822
-
3823
- def copy(self) -> SymbolTableNode:
3824
- new = SymbolTableNode(
3825
- self.kind, self.node, self.module_public, self.implicit, self.module_hidden
3826
- )
3827
- new.cross_ref = self.cross_ref
3828
- return new
3829
-
3830
- def __str__(self) -> str:
3831
- s = f"{node_kinds[self.kind]}/{short_type(self.node)}"
3832
- if isinstance(self.node, SymbolNode):
3833
- s += f" ({self.node.fullname})"
3834
- # Include declared type of variables and functions.
3835
- if self.type is not None:
3836
- s += f" : {self.type}"
3837
- if self.cross_ref:
3838
- s += f" cross_ref:{self.cross_ref}"
3839
- return s
3840
-
3841
- def serialize(self, prefix: str, name: str) -> JsonDict:
3842
- """Serialize a SymbolTableNode.
3843
-
3844
- Args:
3845
- prefix: full name of the containing module or class; or None
3846
- name: name of this object relative to the containing object
3847
- """
3848
- data: JsonDict = {".class": "SymbolTableNode", "kind": node_kinds[self.kind]}
3849
- if self.module_hidden:
3850
- data["module_hidden"] = True
3851
- if not self.module_public:
3852
- data["module_public"] = False
3853
- if self.implicit:
3854
- data["implicit"] = True
3855
- if self.plugin_generated:
3856
- data["plugin_generated"] = True
3857
- if isinstance(self.node, MypyFile):
3858
- data["cross_ref"] = self.node.fullname
3859
- else:
3860
- assert self.node is not None, f"{prefix}:{name}"
3861
- if prefix is not None:
3862
- fullname = self.node.fullname
3863
- if (
3864
- "." in fullname
3865
- and fullname != prefix + "." + name
3866
- and not (isinstance(self.node, Var) and self.node.from_module_getattr)
3867
- ):
3868
- assert not isinstance(
3869
- self.node, PlaceholderNode
3870
- ), f"Definition of {fullname} is unexpectedly incomplete"
3871
- data["cross_ref"] = fullname
3872
- return data
3873
- data["node"] = self.node.serialize()
3874
- return data
3875
-
3876
- @classmethod
3877
- def deserialize(cls, data: JsonDict) -> SymbolTableNode:
3878
- assert data[".class"] == "SymbolTableNode"
3879
- kind = inverse_node_kinds[data["kind"]]
3880
- if "cross_ref" in data:
3881
- # This will be fixed up later.
3882
- stnode = SymbolTableNode(kind, None)
3883
- stnode.cross_ref = data["cross_ref"]
3884
- else:
3885
- assert "node" in data, data
3886
- node = SymbolNode.deserialize(data["node"])
3887
- stnode = SymbolTableNode(kind, node)
3888
- if "module_hidden" in data:
3889
- stnode.module_hidden = data["module_hidden"]
3890
- if "module_public" in data:
3891
- stnode.module_public = data["module_public"]
3892
- if "implicit" in data:
3893
- stnode.implicit = data["implicit"]
3894
- if "plugin_generated" in data:
3895
- stnode.plugin_generated = data["plugin_generated"]
3896
- return stnode
3897
-
3898
-
3899
- class SymbolTable(Dict[str, SymbolTableNode]):
3900
- """Static representation of a namespace dictionary.
3901
-
3902
- This is used for module, class and function namespaces.
3903
- """
3904
-
3905
- __slots__ = ()
3906
-
3907
- def __str__(self) -> str:
3908
- a: list[str] = []
3909
- for key, value in self.items():
3910
- # Filter out the implicit import of builtins.
3911
- if isinstance(value, SymbolTableNode):
3912
- if (
3913
- value.fullname != "builtins"
3914
- and (value.fullname or "").split(".")[-1] not in implicit_module_attrs
3915
- ):
3916
- a.append(" " + str(key) + " : " + str(value))
3917
- else:
3918
- a.append(" <invalid item>")
3919
- a = sorted(a)
3920
- a.insert(0, "SymbolTable(")
3921
- a[-1] += ")"
3922
- return "\n".join(a)
3923
-
3924
- def copy(self) -> SymbolTable:
3925
- return SymbolTable([(key, node.copy()) for key, node in self.items()])
3926
-
3927
- def serialize(self, fullname: str) -> JsonDict:
3928
- data: JsonDict = {".class": "SymbolTable"}
3929
- for key, value in self.items():
3930
- # Skip __builtins__: it's a reference to the builtins
3931
- # module that gets added to every module by
3932
- # SemanticAnalyzerPass2.visit_file(), but it shouldn't be
3933
- # accessed by users of the module.
3934
- if key == "__builtins__" or value.no_serialize:
3935
- continue
3936
- data[key] = value.serialize(fullname, key)
3937
- return data
3938
-
3939
- @classmethod
3940
- def deserialize(cls, data: JsonDict) -> SymbolTable:
3941
- assert data[".class"] == "SymbolTable"
3942
- st = SymbolTable()
3943
- for key, value in data.items():
3944
- if key != ".class":
3945
- st[key] = SymbolTableNode.deserialize(value)
3946
- return st
3947
-
3948
-
3949
- class DataclassTransformSpec:
3950
- """Specifies how a dataclass-like transform should be applied. The fields here are based on the
3951
- parameters accepted by `typing.dataclass_transform`."""
3952
-
3953
- __slots__ = (
3954
- "eq_default",
3955
- "order_default",
3956
- "kw_only_default",
3957
- "frozen_default",
3958
- "field_specifiers",
3959
- )
3960
-
3961
- def __init__(
3962
- self,
3963
- *,
3964
- eq_default: bool | None = None,
3965
- order_default: bool | None = None,
3966
- kw_only_default: bool | None = None,
3967
- field_specifiers: tuple[str, ...] | None = None,
3968
- # Specified outside of PEP 681:
3969
- # frozen_default was added to CPythonin https://github.com/python/cpython/pull/99958 citing
3970
- # positive discussion in typing-sig
3971
- frozen_default: bool | None = None,
3972
- ) -> None:
3973
- self.eq_default = eq_default if eq_default is not None else True
3974
- self.order_default = order_default if order_default is not None else False
3975
- self.kw_only_default = kw_only_default if kw_only_default is not None else False
3976
- self.frozen_default = frozen_default if frozen_default is not None else False
3977
- self.field_specifiers = field_specifiers if field_specifiers is not None else ()
3978
-
3979
- def serialize(self) -> JsonDict:
3980
- return {
3981
- "eq_default": self.eq_default,
3982
- "order_default": self.order_default,
3983
- "kw_only_default": self.kw_only_default,
3984
- "frozen_default": self.frozen_default,
3985
- "field_specifiers": list(self.field_specifiers),
3986
- }
3987
-
3988
- @classmethod
3989
- def deserialize(cls, data: JsonDict) -> DataclassTransformSpec:
3990
- return DataclassTransformSpec(
3991
- eq_default=data.get("eq_default"),
3992
- order_default=data.get("order_default"),
3993
- kw_only_default=data.get("kw_only_default"),
3994
- frozen_default=data.get("frozen_default"),
3995
- field_specifiers=tuple(data.get("field_specifiers", [])),
3996
- )
3997
-
3998
-
3999
- def get_flags(node: Node, names: list[str]) -> list[str]:
4000
- return [name for name in names if getattr(node, name)]
4001
-
4002
-
4003
- def set_flags(node: Node, flags: list[str]) -> None:
4004
- for name in flags:
4005
- setattr(node, name, True)
4006
-
4007
-
4008
- def get_member_expr_fullname(expr: MemberExpr) -> str | None:
4009
- """Return the qualified name representation of a member expression.
4010
-
4011
- Return a string of form foo.bar, foo.bar.baz, or similar, or None if the
4012
- argument cannot be represented in this form.
4013
- """
4014
- initial: str | None = None
4015
- if isinstance(expr.expr, NameExpr):
4016
- initial = expr.expr.name
4017
- elif isinstance(expr.expr, MemberExpr):
4018
- initial = get_member_expr_fullname(expr.expr)
4019
- else:
4020
- return None
4021
- return f"{initial}.{expr.name}"
4022
-
4023
-
4024
- deserialize_map: Final = {
4025
- key: obj.deserialize
4026
- for key, obj in globals().items()
4027
- if type(obj) is not FakeInfo
4028
- and isinstance(obj, type)
4029
- and issubclass(obj, SymbolNode)
4030
- and obj is not SymbolNode
4031
- }
4032
-
4033
-
4034
- def check_arg_kinds(
4035
- arg_kinds: list[ArgKind], nodes: list[T], fail: Callable[[str, T], None]
4036
- ) -> None:
4037
- is_var_arg = False
4038
- is_kw_arg = False
4039
- seen_named = False
4040
- seen_opt = False
4041
- for kind, node in zip(arg_kinds, nodes):
4042
- if kind == ARG_POS:
4043
- if is_var_arg or is_kw_arg or seen_named or seen_opt:
4044
- fail(
4045
- "Required positional args may not appear after default, named or var args",
4046
- node,
4047
- )
4048
- break
4049
- elif kind == ARG_OPT:
4050
- if is_var_arg or is_kw_arg or seen_named:
4051
- fail("Positional default args may not appear after named or var args", node)
4052
- break
4053
- seen_opt = True
4054
- elif kind == ARG_STAR:
4055
- if is_var_arg or is_kw_arg or seen_named:
4056
- fail("Var args may not appear after named or var args", node)
4057
- break
4058
- is_var_arg = True
4059
- elif kind == ARG_NAMED or kind == ARG_NAMED_OPT:
4060
- seen_named = True
4061
- if is_kw_arg:
4062
- fail("A **kwargs argument must be the last argument", node)
4063
- break
4064
- elif kind == ARG_STAR2:
4065
- if is_kw_arg:
4066
- fail("You may only have one **kwargs argument", node)
4067
- break
4068
- is_kw_arg = True
4069
-
4070
-
4071
- def check_arg_names(
4072
- names: Sequence[str | None],
4073
- nodes: list[T],
4074
- fail: Callable[[str, T], None],
4075
- description: str = "function definition",
4076
- ) -> None:
4077
- seen_names: set[str | None] = set()
4078
- for name, node in zip(names, nodes):
4079
- if name is not None and name in seen_names:
4080
- fail(f'Duplicate argument "{name}" in {description}', node)
4081
- break
4082
- seen_names.add(name)
4083
-
4084
-
4085
- def is_class_var(expr: NameExpr) -> bool:
4086
- """Return whether the expression is ClassVar[...]"""
4087
- if isinstance(expr.node, Var):
4088
- return expr.node.is_classvar
4089
- return False
4090
-
4091
-
4092
- def is_final_node(node: SymbolNode | None) -> bool:
4093
- """Check whether `node` corresponds to a final attribute."""
4094
- return isinstance(node, (Var, FuncDef, OverloadedFuncDef, Decorator)) and node.is_final
4095
-
4096
-
4097
- def local_definitions(
4098
- names: SymbolTable, name_prefix: str, info: TypeInfo | None = None
4099
- ) -> Iterator[Definition]:
4100
- """Iterate over local definitions (not imported) in a symbol table.
4101
-
4102
- Recursively iterate over class members and nested classes.
4103
- """
4104
- # TODO: What should the name be? Or maybe remove it?
4105
- for name, symnode in names.items():
4106
- shortname = name
4107
- if "-redef" in name:
4108
- # Restore original name from mangled name of multiply defined function
4109
- shortname = name.split("-redef")[0]
4110
- fullname = name_prefix + "." + shortname
4111
- node = symnode.node
4112
- if node and node.fullname == fullname:
4113
- yield fullname, symnode, info
4114
- if isinstance(node, TypeInfo):
4115
- yield from local_definitions(node.names, fullname, node)