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,3708 +0,0 @@
1
- """Classes for representing mypy types."""
2
-
3
- from __future__ import annotations
4
-
5
- import sys
6
- from abc import abstractmethod
7
- from typing import (
8
- TYPE_CHECKING,
9
- Any,
10
- ClassVar,
11
- Dict,
12
- Final,
13
- Iterable,
14
- NamedTuple,
15
- NewType,
16
- Sequence,
17
- TypeVar,
18
- Union,
19
- cast,
20
- )
21
- from typing_extensions import Self, TypeAlias as _TypeAlias, TypeGuard, overload
22
-
23
- import mypy.nodes
24
- from mypy.bogus_type import Bogus
25
- from mypy.nodes import (
26
- ARG_POS,
27
- ARG_STAR,
28
- ARG_STAR2,
29
- INVARIANT,
30
- ArgKind,
31
- FakeInfo,
32
- FuncDef,
33
- SymbolNode,
34
- )
35
- from mypy.options import Options
36
- from mypy.state import state
37
- from mypy.util import IdMapper
38
-
39
- T = TypeVar("T")
40
-
41
- JsonDict: _TypeAlias = Dict[str, Any]
42
-
43
- # The set of all valid expressions that can currently be contained
44
- # inside of a Literal[...].
45
- #
46
- # Literals can contain bytes and enum-values: we special-case both of these
47
- # and store the value as a string. We rely on the fallback type that's also
48
- # stored with the Literal to determine how a string is being used.
49
- #
50
- # TODO: confirm that we're happy with representing enums (and the
51
- # other types) in the manner described above.
52
- #
53
- # Note: if we change the set of types included below, we must also
54
- # make sure to audit the following methods:
55
- #
56
- # 1. types.LiteralType's serialize and deserialize methods: this method
57
- # needs to make sure it can convert the below types into JSON and back.
58
- #
59
- # 2. types.LiteralType's 'value_repr` method: this method is ultimately used
60
- # by TypeStrVisitor's visit_literal_type to generate a reasonable
61
- # repr-able output.
62
- #
63
- # 3. server.astdiff.SnapshotTypeVisitor's visit_literal_type_method: this
64
- # method assumes that the following types supports equality checks and
65
- # hashability.
66
- #
67
- # Note: Although "Literal[None]" is a valid type, we internally always convert
68
- # such a type directly into "None". So, "None" is not a valid parameter of
69
- # LiteralType and is omitted from this list.
70
- #
71
- # Note: Float values are only used internally. They are not accepted within
72
- # Literal[...].
73
- LiteralValue: _TypeAlias = Union[int, str, bool, float]
74
-
75
-
76
- # If we only import type_visitor in the middle of the file, mypy
77
- # breaks, and if we do it at the top, it breaks at runtime because of
78
- # import cycle issues, so we do it at the top while typechecking and
79
- # then again in the middle at runtime.
80
- # We should be able to remove this once we are switched to the new
81
- # semantic analyzer!
82
- if TYPE_CHECKING:
83
- from mypy.type_visitor import (
84
- SyntheticTypeVisitor as SyntheticTypeVisitor,
85
- TypeVisitor as TypeVisitor,
86
- )
87
-
88
- TYPE_VAR_LIKE_NAMES: Final = (
89
- "typing.TypeVar",
90
- "typing_extensions.TypeVar",
91
- "typing.ParamSpec",
92
- "typing_extensions.ParamSpec",
93
- "typing.TypeVarTuple",
94
- "typing_extensions.TypeVarTuple",
95
- )
96
-
97
- TYPED_NAMEDTUPLE_NAMES: Final = ("typing.NamedTuple", "typing_extensions.NamedTuple")
98
-
99
- # Supported names of TypedDict type constructors.
100
- TPDICT_NAMES: Final = (
101
- "typing.TypedDict",
102
- "typing_extensions.TypedDict",
103
- "mypy_extensions.TypedDict",
104
- )
105
-
106
- # Supported fallback instance type names for TypedDict types.
107
- TPDICT_FB_NAMES: Final = (
108
- "typing._TypedDict",
109
- "typing_extensions._TypedDict",
110
- "mypy_extensions._TypedDict",
111
- )
112
-
113
- # Supported names of Protocol base class.
114
- PROTOCOL_NAMES: Final = ("typing.Protocol", "typing_extensions.Protocol")
115
-
116
- # Supported TypeAlias names.
117
- TYPE_ALIAS_NAMES: Final = ("typing.TypeAlias", "typing_extensions.TypeAlias")
118
-
119
- # Supported Final type names.
120
- FINAL_TYPE_NAMES: Final = ("typing.Final", "typing_extensions.Final")
121
-
122
- # Supported @final decorator names.
123
- FINAL_DECORATOR_NAMES: Final = ("typing.final", "typing_extensions.final")
124
-
125
- # Supported @type_check_only names.
126
- TYPE_CHECK_ONLY_NAMES: Final = ("typing.type_check_only", "typing_extensions.type_check_only")
127
-
128
- # Supported Literal type names.
129
- LITERAL_TYPE_NAMES: Final = ("typing.Literal", "typing_extensions.Literal")
130
-
131
- # Supported Annotated type names.
132
- ANNOTATED_TYPE_NAMES: Final = ("typing.Annotated", "typing_extensions.Annotated")
133
-
134
- # Supported @deprecated type names
135
- DEPRECATED_TYPE_NAMES: Final = ("warnings.deprecated", "typing_extensions.deprecated")
136
-
137
- # We use this constant in various places when checking `tuple` subtyping:
138
- TUPLE_LIKE_INSTANCE_NAMES: Final = (
139
- "builtins.tuple",
140
- "typing.Iterable",
141
- "typing.Container",
142
- "typing.Sequence",
143
- "typing.Reversible",
144
- )
145
-
146
- IMPORTED_REVEAL_TYPE_NAMES: Final = ("typing.reveal_type", "typing_extensions.reveal_type")
147
- REVEAL_TYPE_NAMES: Final = ("builtins.reveal_type", *IMPORTED_REVEAL_TYPE_NAMES)
148
-
149
- ASSERT_TYPE_NAMES: Final = ("typing.assert_type", "typing_extensions.assert_type")
150
-
151
- OVERLOAD_NAMES: Final = ("typing.overload", "typing_extensions.overload")
152
-
153
- # Attributes that can optionally be defined in the body of a subclass of
154
- # enum.Enum but are removed from the class __dict__ by EnumMeta.
155
- ENUM_REMOVED_PROPS: Final = ("_ignore_", "_order_", "__order__")
156
-
157
- NEVER_NAMES: Final = (
158
- "typing.NoReturn",
159
- "typing_extensions.NoReturn",
160
- "mypy_extensions.NoReturn",
161
- "typing.Never",
162
- "typing_extensions.Never",
163
- )
164
-
165
- # Mypyc fixed-width native int types (compatible with builtins.int)
166
- MYPYC_NATIVE_INT_NAMES: Final = (
167
- "mypy_extensions.i64",
168
- "mypy_extensions.i32",
169
- "mypy_extensions.i16",
170
- "mypy_extensions.u8",
171
- )
172
-
173
- DATACLASS_TRANSFORM_NAMES: Final = (
174
- "typing.dataclass_transform",
175
- "typing_extensions.dataclass_transform",
176
- )
177
- # Supported @override decorator names.
178
- OVERRIDE_DECORATOR_NAMES: Final = ("typing.override", "typing_extensions.override")
179
-
180
- # A placeholder used for Bogus[...] parameters
181
- _dummy: Final[Any] = object()
182
-
183
- # A placeholder for int parameters
184
- _dummy_int: Final = -999999
185
-
186
-
187
- class TypeOfAny:
188
- """
189
- This class describes different types of Any. Each 'Any' can be of only one type at a time.
190
- """
191
-
192
- __slots__ = ()
193
-
194
- # Was this Any type inferred without a type annotation?
195
- unannotated: Final = 1
196
- # Does this Any come from an explicit type annotation?
197
- explicit: Final = 2
198
- # Does this come from an unfollowed import? See --disallow-any-unimported option
199
- from_unimported_type: Final = 3
200
- # Does this Any type come from omitted generics?
201
- from_omitted_generics: Final = 4
202
- # Does this Any come from an error?
203
- from_error: Final = 5
204
- # Is this a type that can't be represented in mypy's type system? For instance, type of
205
- # call to NewType(...). Even though these types aren't real Anys, we treat them as such.
206
- # Also used for variables named '_'.
207
- special_form: Final = 6
208
- # Does this Any come from interaction with another Any?
209
- from_another_any: Final = 7
210
- # Does this Any come from an implementation limitation/bug?
211
- implementation_artifact: Final = 8
212
- # Does this Any come from use in the suggestion engine? This is
213
- # used to ignore Anys inserted by the suggestion engine when
214
- # generating constraints.
215
- suggestion_engine: Final = 9
216
-
217
-
218
- def deserialize_type(data: JsonDict | str) -> Type:
219
- if isinstance(data, str):
220
- return Instance.deserialize(data)
221
- classname = data[".class"]
222
- method = deserialize_map.get(classname)
223
- if method is not None:
224
- return method(data)
225
- raise NotImplementedError(f"unexpected .class {classname}")
226
-
227
-
228
- class Type(mypy.nodes.Context):
229
- """Abstract base class for all types."""
230
-
231
- __slots__ = ("_can_be_true", "_can_be_false")
232
- # 'can_be_true' and 'can_be_false' mean whether the value of the
233
- # expression can be true or false in a boolean context. They are useful
234
- # when inferring the type of logic expressions like `x and y`.
235
- #
236
- # For example:
237
- # * the literal `False` can't be true while `True` can.
238
- # * a value with type `bool` can be true or false.
239
- # * `None` can't be true
240
- # * ...
241
-
242
- def __init__(self, line: int = -1, column: int = -1) -> None:
243
- super().__init__(line, column)
244
- # Value of these can be -1 (use the default, lazy init), 0 (false) or 1 (true)
245
- self._can_be_true = -1
246
- self._can_be_false = -1
247
-
248
- @property
249
- def can_be_true(self) -> bool:
250
- if self._can_be_true == -1: # Lazy init helps mypyc
251
- self._can_be_true = self.can_be_true_default()
252
- return bool(self._can_be_true)
253
-
254
- @can_be_true.setter
255
- def can_be_true(self, v: bool) -> None:
256
- self._can_be_true = v
257
-
258
- @property
259
- def can_be_false(self) -> bool:
260
- if self._can_be_false == -1: # Lazy init helps mypyc
261
- self._can_be_false = self.can_be_false_default()
262
- return bool(self._can_be_false)
263
-
264
- @can_be_false.setter
265
- def can_be_false(self, v: bool) -> None:
266
- self._can_be_false = v
267
-
268
- def can_be_true_default(self) -> bool:
269
- return True
270
-
271
- def can_be_false_default(self) -> bool:
272
- return True
273
-
274
- def accept(self, visitor: TypeVisitor[T]) -> T:
275
- raise RuntimeError("Not implemented", type(self))
276
-
277
- def __repr__(self) -> str:
278
- return self.accept(TypeStrVisitor(options=Options()))
279
-
280
- def str_with_options(self, options: Options) -> str:
281
- return self.accept(TypeStrVisitor(options=options))
282
-
283
- def serialize(self) -> JsonDict | str:
284
- raise NotImplementedError(f"Cannot serialize {self.__class__.__name__} instance")
285
-
286
- @classmethod
287
- def deserialize(cls, data: JsonDict) -> Type:
288
- raise NotImplementedError(f"Cannot deserialize {cls.__name__} instance")
289
-
290
- def is_singleton_type(self) -> bool:
291
- return False
292
-
293
-
294
- class TypeAliasType(Type):
295
- """A type alias to another type.
296
-
297
- To support recursive type aliases we don't immediately expand a type alias
298
- during semantic analysis, but create an instance of this type that records the target alias
299
- definition node (mypy.nodes.TypeAlias) and type arguments (for generic aliases).
300
-
301
- This is very similar to how TypeInfo vs Instance interact, where a recursive class-based
302
- structure like
303
- class Node:
304
- value: int
305
- children: List[Node]
306
- can be represented in a tree-like manner.
307
- """
308
-
309
- __slots__ = ("alias", "args", "type_ref")
310
-
311
- def __init__(
312
- self,
313
- alias: mypy.nodes.TypeAlias | None,
314
- args: list[Type],
315
- line: int = -1,
316
- column: int = -1,
317
- ) -> None:
318
- super().__init__(line, column)
319
- self.alias = alias
320
- self.args = args
321
- self.type_ref: str | None = None
322
-
323
- def _expand_once(self) -> Type:
324
- """Expand to the target type exactly once.
325
-
326
- This doesn't do full expansion, i.e. the result can contain another
327
- (or even this same) type alias. Use this internal helper only when really needed,
328
- its public wrapper mypy.types.get_proper_type() is preferred.
329
- """
330
- assert self.alias is not None
331
- if self.alias.no_args:
332
- # We know that no_args=True aliases like L = List must have an instance
333
- # as their target.
334
- assert isinstance(self.alias.target, Instance) # type: ignore[misc]
335
- return self.alias.target.copy_modified(args=self.args)
336
-
337
- # TODO: this logic duplicates the one in expand_type_by_instance().
338
- if self.alias.tvar_tuple_index is None:
339
- mapping = {v.id: s for (v, s) in zip(self.alias.alias_tvars, self.args)}
340
- else:
341
- prefix = self.alias.tvar_tuple_index
342
- suffix = len(self.alias.alias_tvars) - self.alias.tvar_tuple_index - 1
343
- start, middle, end = split_with_prefix_and_suffix(tuple(self.args), prefix, suffix)
344
- tvar = self.alias.alias_tvars[prefix]
345
- assert isinstance(tvar, TypeVarTupleType)
346
- mapping = {tvar.id: TupleType(list(middle), tvar.tuple_fallback)}
347
- for tvar, sub in zip(
348
- self.alias.alias_tvars[:prefix] + self.alias.alias_tvars[prefix + 1 :], start + end
349
- ):
350
- mapping[tvar.id] = sub
351
-
352
- new_tp = self.alias.target.accept(InstantiateAliasVisitor(mapping))
353
- new_tp.accept(LocationSetter(self.line, self.column))
354
- new_tp.line = self.line
355
- new_tp.column = self.column
356
- return new_tp
357
-
358
- def _partial_expansion(self, nothing_args: bool = False) -> tuple[ProperType, bool]:
359
- # Private method mostly for debugging and testing.
360
- unroller = UnrollAliasVisitor(set())
361
- if nothing_args:
362
- alias = self.copy_modified(args=[UninhabitedType()] * len(self.args))
363
- else:
364
- alias = self
365
- unrolled = alias.accept(unroller)
366
- assert isinstance(unrolled, ProperType)
367
- return unrolled, unroller.recursed
368
-
369
- def expand_all_if_possible(self, nothing_args: bool = False) -> ProperType | None:
370
- """Attempt a full expansion of the type alias (including nested aliases).
371
-
372
- If the expansion is not possible, i.e. the alias is (mutually-)recursive,
373
- return None. If nothing_args is True, replace all type arguments with an
374
- UninhabitedType() (used to detect recursively defined aliases).
375
- """
376
- unrolled, recursed = self._partial_expansion(nothing_args=nothing_args)
377
- if recursed:
378
- return None
379
- return unrolled
380
-
381
- @property
382
- def is_recursive(self) -> bool:
383
- """Whether this type alias is recursive.
384
-
385
- Note this doesn't check generic alias arguments, but only if this alias
386
- *definition* is recursive. The property value thus can be cached on the
387
- underlying TypeAlias node. If you want to include all nested types, use
388
- has_recursive_types() function.
389
- """
390
- assert self.alias is not None, "Unfixed type alias"
391
- is_recursive = self.alias._is_recursive
392
- if is_recursive is None:
393
- is_recursive = self.expand_all_if_possible(nothing_args=True) is None
394
- # We cache the value on the underlying TypeAlias node as an optimization,
395
- # since the value is the same for all instances of the same alias.
396
- self.alias._is_recursive = is_recursive
397
- return is_recursive
398
-
399
- def can_be_true_default(self) -> bool:
400
- if self.alias is not None:
401
- return self.alias.target.can_be_true
402
- return super().can_be_true_default()
403
-
404
- def can_be_false_default(self) -> bool:
405
- if self.alias is not None:
406
- return self.alias.target.can_be_false
407
- return super().can_be_false_default()
408
-
409
- def accept(self, visitor: TypeVisitor[T]) -> T:
410
- return visitor.visit_type_alias_type(self)
411
-
412
- def __hash__(self) -> int:
413
- return hash((self.alias, tuple(self.args)))
414
-
415
- def __eq__(self, other: object) -> bool:
416
- # Note: never use this to determine subtype relationships, use is_subtype().
417
- if not isinstance(other, TypeAliasType):
418
- return NotImplemented
419
- return self.alias == other.alias and self.args == other.args
420
-
421
- def serialize(self) -> JsonDict:
422
- assert self.alias is not None
423
- data: JsonDict = {
424
- ".class": "TypeAliasType",
425
- "type_ref": self.alias.fullname,
426
- "args": [arg.serialize() for arg in self.args],
427
- }
428
- return data
429
-
430
- @classmethod
431
- def deserialize(cls, data: JsonDict) -> TypeAliasType:
432
- assert data[".class"] == "TypeAliasType"
433
- args: list[Type] = []
434
- if "args" in data:
435
- args_list = data["args"]
436
- assert isinstance(args_list, list)
437
- args = [deserialize_type(arg) for arg in args_list]
438
- alias = TypeAliasType(None, args)
439
- alias.type_ref = data["type_ref"]
440
- return alias
441
-
442
- def copy_modified(self, *, args: list[Type] | None = None) -> TypeAliasType:
443
- return TypeAliasType(
444
- self.alias, args if args is not None else self.args.copy(), self.line, self.column
445
- )
446
-
447
-
448
- class TypeGuardedType(Type):
449
- """Only used by find_isinstance_check() etc."""
450
-
451
- __slots__ = ("type_guard",)
452
-
453
- def __init__(self, type_guard: Type) -> None:
454
- super().__init__(line=type_guard.line, column=type_guard.column)
455
- self.type_guard = type_guard
456
-
457
- def __repr__(self) -> str:
458
- return f"TypeGuard({self.type_guard})"
459
-
460
-
461
- class RequiredType(Type):
462
- """Required[T] or NotRequired[T]. Only usable at top-level of a TypedDict definition."""
463
-
464
- def __init__(self, item: Type, *, required: bool) -> None:
465
- super().__init__(line=item.line, column=item.column)
466
- self.item = item
467
- self.required = required
468
-
469
- def __repr__(self) -> str:
470
- if self.required:
471
- return f"Required[{self.item}]"
472
- else:
473
- return f"NotRequired[{self.item}]"
474
-
475
- def accept(self, visitor: TypeVisitor[T]) -> T:
476
- return self.item.accept(visitor)
477
-
478
-
479
- class ProperType(Type):
480
- """Not a type alias.
481
-
482
- Every type except TypeAliasType must inherit from this type.
483
- """
484
-
485
- __slots__ = ()
486
-
487
-
488
- class TypeVarId:
489
- # A type variable is uniquely identified by its raw id and meta level.
490
-
491
- # For plain variables (type parameters of generic classes and
492
- # functions) raw ids are allocated by semantic analysis, using
493
- # positive ids 1, 2, ... for generic class parameters and negative
494
- # ids -1, ... for generic function type arguments. A special value 0
495
- # is reserved for Self type variable (autogenerated). This convention
496
- # is only used to keep type variable ids distinct when allocating
497
- # them; the type checker makes no distinction between class and
498
- # function type variables.
499
-
500
- # Metavariables are allocated unique ids starting from 1.
501
- raw_id: int = 0
502
-
503
- # Level of the variable in type inference. Currently either 0 for
504
- # declared types, or 1 for type inference metavariables.
505
- meta_level: int = 0
506
-
507
- # Class variable used for allocating fresh ids for metavariables.
508
- next_raw_id: ClassVar[int] = 1
509
-
510
- # Fullname of class (or potentially function in the future) which
511
- # declares this type variable (not the fullname of the TypeVar
512
- # definition!), or ''
513
- namespace: str
514
-
515
- def __init__(self, raw_id: int, meta_level: int = 0, *, namespace: str = "") -> None:
516
- self.raw_id = raw_id
517
- self.meta_level = meta_level
518
- self.namespace = namespace
519
-
520
- @staticmethod
521
- def new(meta_level: int) -> TypeVarId:
522
- raw_id = TypeVarId.next_raw_id
523
- TypeVarId.next_raw_id += 1
524
- return TypeVarId(raw_id, meta_level)
525
-
526
- def __repr__(self) -> str:
527
- return self.raw_id.__repr__()
528
-
529
- def __eq__(self, other: object) -> bool:
530
- return (
531
- isinstance(other, TypeVarId)
532
- and self.raw_id == other.raw_id
533
- and self.meta_level == other.meta_level
534
- and self.namespace == other.namespace
535
- )
536
-
537
- def __ne__(self, other: object) -> bool:
538
- return not (self == other)
539
-
540
- def __hash__(self) -> int:
541
- return hash((self.raw_id, self.meta_level, self.namespace))
542
-
543
- def is_meta_var(self) -> bool:
544
- return self.meta_level > 0
545
-
546
-
547
- class TypeVarLikeType(ProperType):
548
- __slots__ = ("name", "fullname", "id", "upper_bound", "default")
549
-
550
- name: str # Name (may be qualified)
551
- fullname: str # Fully qualified name
552
- id: TypeVarId
553
- upper_bound: Type
554
- default: Type
555
-
556
- def __init__(
557
- self,
558
- name: str,
559
- fullname: str,
560
- id: TypeVarId | int,
561
- upper_bound: Type,
562
- default: Type,
563
- line: int = -1,
564
- column: int = -1,
565
- ) -> None:
566
- super().__init__(line, column)
567
- self.name = name
568
- self.fullname = fullname
569
- if isinstance(id, int):
570
- id = TypeVarId(id)
571
- self.id = id
572
- self.upper_bound = upper_bound
573
- self.default = default
574
-
575
- def serialize(self) -> JsonDict:
576
- raise NotImplementedError
577
-
578
- @classmethod
579
- def deserialize(cls, data: JsonDict) -> TypeVarLikeType:
580
- raise NotImplementedError
581
-
582
- def copy_modified(self, *, id: TypeVarId, **kwargs: Any) -> Self:
583
- raise NotImplementedError
584
-
585
- @classmethod
586
- def new_unification_variable(cls, old: Self) -> Self:
587
- new_id = TypeVarId.new(meta_level=1)
588
- return old.copy_modified(id=new_id)
589
-
590
- def has_default(self) -> bool:
591
- t = get_proper_type(self.default)
592
- return not (isinstance(t, AnyType) and t.type_of_any == TypeOfAny.from_omitted_generics)
593
-
594
-
595
- class TypeVarType(TypeVarLikeType):
596
- """Type that refers to a type variable."""
597
-
598
- __slots__ = ("values", "variance")
599
-
600
- values: list[Type] # Value restriction, empty list if no restriction
601
- variance: int
602
-
603
- def __init__(
604
- self,
605
- name: str,
606
- fullname: str,
607
- id: TypeVarId | int,
608
- values: list[Type],
609
- upper_bound: Type,
610
- default: Type,
611
- variance: int = INVARIANT,
612
- line: int = -1,
613
- column: int = -1,
614
- ) -> None:
615
- super().__init__(name, fullname, id, upper_bound, default, line, column)
616
- assert values is not None, "No restrictions must be represented by empty list"
617
- self.values = values
618
- self.variance = variance
619
-
620
- def copy_modified(
621
- self,
622
- *,
623
- values: Bogus[list[Type]] = _dummy,
624
- upper_bound: Bogus[Type] = _dummy,
625
- default: Bogus[Type] = _dummy,
626
- id: Bogus[TypeVarId | int] = _dummy,
627
- line: int = _dummy_int,
628
- column: int = _dummy_int,
629
- **kwargs: Any,
630
- ) -> TypeVarType:
631
- return TypeVarType(
632
- name=self.name,
633
- fullname=self.fullname,
634
- id=self.id if id is _dummy else id,
635
- values=self.values if values is _dummy else values,
636
- upper_bound=self.upper_bound if upper_bound is _dummy else upper_bound,
637
- default=self.default if default is _dummy else default,
638
- variance=self.variance,
639
- line=self.line if line == _dummy_int else line,
640
- column=self.column if column == _dummy_int else column,
641
- )
642
-
643
- def accept(self, visitor: TypeVisitor[T]) -> T:
644
- return visitor.visit_type_var(self)
645
-
646
- def __hash__(self) -> int:
647
- return hash((self.id, self.upper_bound, tuple(self.values)))
648
-
649
- def __eq__(self, other: object) -> bool:
650
- if not isinstance(other, TypeVarType):
651
- return NotImplemented
652
- return (
653
- self.id == other.id
654
- and self.upper_bound == other.upper_bound
655
- and self.values == other.values
656
- )
657
-
658
- def serialize(self) -> JsonDict:
659
- assert not self.id.is_meta_var()
660
- return {
661
- ".class": "TypeVarType",
662
- "name": self.name,
663
- "fullname": self.fullname,
664
- "id": self.id.raw_id,
665
- "namespace": self.id.namespace,
666
- "values": [v.serialize() for v in self.values],
667
- "upper_bound": self.upper_bound.serialize(),
668
- "default": self.default.serialize(),
669
- "variance": self.variance,
670
- }
671
-
672
- @classmethod
673
- def deserialize(cls, data: JsonDict) -> TypeVarType:
674
- assert data[".class"] == "TypeVarType"
675
- return TypeVarType(
676
- name=data["name"],
677
- fullname=data["fullname"],
678
- id=TypeVarId(data["id"], namespace=data["namespace"]),
679
- values=[deserialize_type(v) for v in data["values"]],
680
- upper_bound=deserialize_type(data["upper_bound"]),
681
- default=deserialize_type(data["default"]),
682
- variance=data["variance"],
683
- )
684
-
685
-
686
- class ParamSpecFlavor:
687
- # Simple ParamSpec reference such as "P"
688
- BARE: Final = 0
689
- # P.args
690
- ARGS: Final = 1
691
- # P.kwargs
692
- KWARGS: Final = 2
693
-
694
-
695
- class ParamSpecType(TypeVarLikeType):
696
- """Type that refers to a ParamSpec.
697
-
698
- A ParamSpec is a type variable that represents the parameter
699
- types, names and kinds of a callable (i.e., the signature without
700
- the return type).
701
-
702
- This can be one of these forms
703
- * P (ParamSpecFlavor.BARE)
704
- * P.args (ParamSpecFlavor.ARGS)
705
- * P.kwargs (ParamSpecFLavor.KWARGS)
706
-
707
- The upper_bound is really used as a fallback type -- it's shared
708
- with TypeVarType for simplicity. It can't be specified by the user
709
- and the value is directly derived from the flavor (currently
710
- always just 'object').
711
- """
712
-
713
- __slots__ = ("flavor", "prefix")
714
-
715
- flavor: int
716
- prefix: Parameters
717
-
718
- def __init__(
719
- self,
720
- name: str,
721
- fullname: str,
722
- id: TypeVarId | int,
723
- flavor: int,
724
- upper_bound: Type,
725
- default: Type,
726
- *,
727
- line: int = -1,
728
- column: int = -1,
729
- prefix: Parameters | None = None,
730
- ) -> None:
731
- super().__init__(name, fullname, id, upper_bound, default, line=line, column=column)
732
- self.flavor = flavor
733
- self.prefix = prefix or Parameters([], [], [])
734
-
735
- def with_flavor(self, flavor: int) -> ParamSpecType:
736
- return ParamSpecType(
737
- self.name,
738
- self.fullname,
739
- self.id,
740
- flavor,
741
- upper_bound=self.upper_bound,
742
- default=self.default,
743
- prefix=self.prefix,
744
- )
745
-
746
- def copy_modified(
747
- self,
748
- *,
749
- id: Bogus[TypeVarId | int] = _dummy,
750
- flavor: int = _dummy_int,
751
- prefix: Bogus[Parameters] = _dummy,
752
- default: Bogus[Type] = _dummy,
753
- **kwargs: Any,
754
- ) -> ParamSpecType:
755
- return ParamSpecType(
756
- self.name,
757
- self.fullname,
758
- id if id is not _dummy else self.id,
759
- flavor if flavor != _dummy_int else self.flavor,
760
- self.upper_bound,
761
- default=default if default is not _dummy else self.default,
762
- line=self.line,
763
- column=self.column,
764
- prefix=prefix if prefix is not _dummy else self.prefix,
765
- )
766
-
767
- def accept(self, visitor: TypeVisitor[T]) -> T:
768
- return visitor.visit_param_spec(self)
769
-
770
- def name_with_suffix(self) -> str:
771
- n = self.name
772
- if self.flavor == ParamSpecFlavor.ARGS:
773
- return f"{n}.args"
774
- elif self.flavor == ParamSpecFlavor.KWARGS:
775
- return f"{n}.kwargs"
776
- return n
777
-
778
- def __hash__(self) -> int:
779
- return hash((self.id, self.flavor, self.prefix))
780
-
781
- def __eq__(self, other: object) -> bool:
782
- if not isinstance(other, ParamSpecType):
783
- return NotImplemented
784
- # Upper bound can be ignored, since it's determined by flavor.
785
- return self.id == other.id and self.flavor == other.flavor and self.prefix == other.prefix
786
-
787
- def serialize(self) -> JsonDict:
788
- assert not self.id.is_meta_var()
789
- return {
790
- ".class": "ParamSpecType",
791
- "name": self.name,
792
- "fullname": self.fullname,
793
- "id": self.id.raw_id,
794
- "flavor": self.flavor,
795
- "upper_bound": self.upper_bound.serialize(),
796
- "default": self.default.serialize(),
797
- "prefix": self.prefix.serialize(),
798
- }
799
-
800
- @classmethod
801
- def deserialize(cls, data: JsonDict) -> ParamSpecType:
802
- assert data[".class"] == "ParamSpecType"
803
- return ParamSpecType(
804
- data["name"],
805
- data["fullname"],
806
- data["id"],
807
- data["flavor"],
808
- deserialize_type(data["upper_bound"]),
809
- deserialize_type(data["default"]),
810
- prefix=Parameters.deserialize(data["prefix"]),
811
- )
812
-
813
-
814
- class TypeVarTupleType(TypeVarLikeType):
815
- """Type that refers to a TypeVarTuple.
816
-
817
- See PEP646 for more information.
818
- """
819
-
820
- __slots__ = ("tuple_fallback", "min_len")
821
-
822
- def __init__(
823
- self,
824
- name: str,
825
- fullname: str,
826
- id: TypeVarId | int,
827
- upper_bound: Type,
828
- tuple_fallback: Instance,
829
- default: Type,
830
- *,
831
- line: int = -1,
832
- column: int = -1,
833
- min_len: int = 0,
834
- ) -> None:
835
- super().__init__(name, fullname, id, upper_bound, default, line=line, column=column)
836
- self.tuple_fallback = tuple_fallback
837
- # This value is not settable by a user. It is an internal-only thing to support
838
- # len()-narrowing of variadic tuples.
839
- self.min_len = min_len
840
-
841
- def serialize(self) -> JsonDict:
842
- assert not self.id.is_meta_var()
843
- return {
844
- ".class": "TypeVarTupleType",
845
- "name": self.name,
846
- "fullname": self.fullname,
847
- "id": self.id.raw_id,
848
- "upper_bound": self.upper_bound.serialize(),
849
- "tuple_fallback": self.tuple_fallback.serialize(),
850
- "default": self.default.serialize(),
851
- "min_len": self.min_len,
852
- }
853
-
854
- @classmethod
855
- def deserialize(cls, data: JsonDict) -> TypeVarTupleType:
856
- assert data[".class"] == "TypeVarTupleType"
857
- return TypeVarTupleType(
858
- data["name"],
859
- data["fullname"],
860
- data["id"],
861
- deserialize_type(data["upper_bound"]),
862
- Instance.deserialize(data["tuple_fallback"]),
863
- deserialize_type(data["default"]),
864
- min_len=data["min_len"],
865
- )
866
-
867
- def accept(self, visitor: TypeVisitor[T]) -> T:
868
- return visitor.visit_type_var_tuple(self)
869
-
870
- def __hash__(self) -> int:
871
- return hash((self.id, self.min_len))
872
-
873
- def __eq__(self, other: object) -> bool:
874
- if not isinstance(other, TypeVarTupleType):
875
- return NotImplemented
876
- return self.id == other.id and self.min_len == other.min_len
877
-
878
- def copy_modified(
879
- self,
880
- *,
881
- id: Bogus[TypeVarId | int] = _dummy,
882
- upper_bound: Bogus[Type] = _dummy,
883
- default: Bogus[Type] = _dummy,
884
- min_len: Bogus[int] = _dummy,
885
- **kwargs: Any,
886
- ) -> TypeVarTupleType:
887
- return TypeVarTupleType(
888
- self.name,
889
- self.fullname,
890
- self.id if id is _dummy else id,
891
- self.upper_bound if upper_bound is _dummy else upper_bound,
892
- self.tuple_fallback,
893
- self.default if default is _dummy else default,
894
- line=self.line,
895
- column=self.column,
896
- min_len=self.min_len if min_len is _dummy else min_len,
897
- )
898
-
899
-
900
- class UnboundType(ProperType):
901
- """Instance type that has not been bound during semantic analysis."""
902
-
903
- __slots__ = (
904
- "name",
905
- "args",
906
- "optional",
907
- "empty_tuple_index",
908
- "original_str_expr",
909
- "original_str_fallback",
910
- )
911
-
912
- def __init__(
913
- self,
914
- name: str | None,
915
- args: Sequence[Type] | None = None,
916
- line: int = -1,
917
- column: int = -1,
918
- optional: bool = False,
919
- empty_tuple_index: bool = False,
920
- original_str_expr: str | None = None,
921
- original_str_fallback: str | None = None,
922
- ) -> None:
923
- super().__init__(line, column)
924
- if not args:
925
- args = []
926
- assert name is not None
927
- self.name = name
928
- self.args = tuple(args)
929
- # Should this type be wrapped in an Optional?
930
- self.optional = optional
931
- # Special case for X[()]
932
- self.empty_tuple_index = empty_tuple_index
933
- # If this UnboundType was originally defined as a str or bytes, keep track of
934
- # the original contents of that string-like thing. This way, if this UnboundExpr
935
- # ever shows up inside of a LiteralType, we can determine whether that
936
- # Literal[...] is valid or not. E.g. Literal[foo] is most likely invalid
937
- # (unless 'foo' is an alias for another literal or something) and
938
- # Literal["foo"] most likely is.
939
- #
940
- # We keep track of the entire string instead of just using a boolean flag
941
- # so we can distinguish between things like Literal["foo"] vs
942
- # Literal[" foo "].
943
- #
944
- # We also keep track of what the original base fallback type was supposed to be
945
- # so we don't have to try and recompute it later
946
- self.original_str_expr = original_str_expr
947
- self.original_str_fallback = original_str_fallback
948
-
949
- def copy_modified(self, args: Bogus[Sequence[Type] | None] = _dummy) -> UnboundType:
950
- if args is _dummy:
951
- args = self.args
952
- return UnboundType(
953
- name=self.name,
954
- args=args,
955
- line=self.line,
956
- column=self.column,
957
- optional=self.optional,
958
- empty_tuple_index=self.empty_tuple_index,
959
- original_str_expr=self.original_str_expr,
960
- original_str_fallback=self.original_str_fallback,
961
- )
962
-
963
- def accept(self, visitor: TypeVisitor[T]) -> T:
964
- return visitor.visit_unbound_type(self)
965
-
966
- def __hash__(self) -> int:
967
- return hash((self.name, self.optional, tuple(self.args), self.original_str_expr))
968
-
969
- def __eq__(self, other: object) -> bool:
970
- if not isinstance(other, UnboundType):
971
- return NotImplemented
972
- return (
973
- self.name == other.name
974
- and self.optional == other.optional
975
- and self.args == other.args
976
- and self.original_str_expr == other.original_str_expr
977
- and self.original_str_fallback == other.original_str_fallback
978
- )
979
-
980
- def serialize(self) -> JsonDict:
981
- return {
982
- ".class": "UnboundType",
983
- "name": self.name,
984
- "args": [a.serialize() for a in self.args],
985
- "expr": self.original_str_expr,
986
- "expr_fallback": self.original_str_fallback,
987
- }
988
-
989
- @classmethod
990
- def deserialize(cls, data: JsonDict) -> UnboundType:
991
- assert data[".class"] == "UnboundType"
992
- return UnboundType(
993
- data["name"],
994
- [deserialize_type(a) for a in data["args"]],
995
- original_str_expr=data["expr"],
996
- original_str_fallback=data["expr_fallback"],
997
- )
998
-
999
-
1000
- class CallableArgument(ProperType):
1001
- """Represents a Arg(type, 'name') inside a Callable's type list.
1002
-
1003
- Note that this is a synthetic type for helping parse ASTs, not a real type.
1004
- """
1005
-
1006
- __slots__ = ("typ", "name", "constructor")
1007
-
1008
- typ: Type
1009
- name: str | None
1010
- constructor: str | None
1011
-
1012
- def __init__(
1013
- self,
1014
- typ: Type,
1015
- name: str | None,
1016
- constructor: str | None,
1017
- line: int = -1,
1018
- column: int = -1,
1019
- ) -> None:
1020
- super().__init__(line, column)
1021
- self.typ = typ
1022
- self.name = name
1023
- self.constructor = constructor
1024
-
1025
- def accept(self, visitor: TypeVisitor[T]) -> T:
1026
- assert isinstance(visitor, SyntheticTypeVisitor)
1027
- ret: T = visitor.visit_callable_argument(self)
1028
- return ret
1029
-
1030
- def serialize(self) -> JsonDict:
1031
- assert False, "Synthetic types don't serialize"
1032
-
1033
-
1034
- class TypeList(ProperType):
1035
- """Information about argument types and names [...].
1036
-
1037
- This is used for the arguments of a Callable type, i.e. for
1038
- [arg, ...] in Callable[[arg, ...], ret]. This is not a real type
1039
- but a syntactic AST construct. UnboundTypes can also have TypeList
1040
- types before they are processed into Callable types.
1041
- """
1042
-
1043
- __slots__ = ("items",)
1044
-
1045
- items: list[Type]
1046
-
1047
- def __init__(self, items: list[Type], line: int = -1, column: int = -1) -> None:
1048
- super().__init__(line, column)
1049
- self.items = items
1050
-
1051
- def accept(self, visitor: TypeVisitor[T]) -> T:
1052
- assert isinstance(visitor, SyntheticTypeVisitor)
1053
- ret: T = visitor.visit_type_list(self)
1054
- return ret
1055
-
1056
- def serialize(self) -> JsonDict:
1057
- assert False, "Synthetic types don't serialize"
1058
-
1059
- def __hash__(self) -> int:
1060
- return hash(tuple(self.items))
1061
-
1062
- def __eq__(self, other: object) -> bool:
1063
- return isinstance(other, TypeList) and self.items == other.items
1064
-
1065
-
1066
- class UnpackType(ProperType):
1067
- """Type operator Unpack from PEP646. Can be either with Unpack[]
1068
- or unpacking * syntax.
1069
-
1070
- The inner type should be either a TypeVarTuple, or a variable length tuple.
1071
- In an exceptional case of callable star argument it can be a fixed length tuple.
1072
-
1073
- Note: the above restrictions are only guaranteed by normalizations after semantic
1074
- analysis, if your code needs to handle UnpackType *during* semantic analysis, it is
1075
- wild west, technically anything can be present in the wrapped type.
1076
- """
1077
-
1078
- __slots__ = ["type", "from_star_syntax"]
1079
-
1080
- def __init__(
1081
- self, typ: Type, line: int = -1, column: int = -1, from_star_syntax: bool = False
1082
- ) -> None:
1083
- super().__init__(line, column)
1084
- self.type = typ
1085
- self.from_star_syntax = from_star_syntax
1086
-
1087
- def accept(self, visitor: TypeVisitor[T]) -> T:
1088
- return visitor.visit_unpack_type(self)
1089
-
1090
- def serialize(self) -> JsonDict:
1091
- return {".class": "UnpackType", "type": self.type.serialize()}
1092
-
1093
- @classmethod
1094
- def deserialize(cls, data: JsonDict) -> UnpackType:
1095
- assert data[".class"] == "UnpackType"
1096
- typ = data["type"]
1097
- return UnpackType(deserialize_type(typ))
1098
-
1099
- def __hash__(self) -> int:
1100
- return hash(self.type)
1101
-
1102
- def __eq__(self, other: object) -> bool:
1103
- return isinstance(other, UnpackType) and self.type == other.type
1104
-
1105
-
1106
- class AnyType(ProperType):
1107
- """The type 'Any'."""
1108
-
1109
- __slots__ = ("type_of_any", "source_any", "missing_import_name")
1110
-
1111
- def __init__(
1112
- self,
1113
- type_of_any: int,
1114
- source_any: AnyType | None = None,
1115
- missing_import_name: str | None = None,
1116
- line: int = -1,
1117
- column: int = -1,
1118
- ) -> None:
1119
- super().__init__(line, column)
1120
- self.type_of_any = type_of_any
1121
- # If this Any was created as a result of interacting with another 'Any', record the source
1122
- # and use it in reports.
1123
- self.source_any = source_any
1124
- if source_any and source_any.source_any:
1125
- self.source_any = source_any.source_any
1126
-
1127
- if source_any is None:
1128
- self.missing_import_name = missing_import_name
1129
- else:
1130
- self.missing_import_name = source_any.missing_import_name
1131
-
1132
- # Only unimported type anys and anys from other anys should have an import name
1133
- assert missing_import_name is None or type_of_any in (
1134
- TypeOfAny.from_unimported_type,
1135
- TypeOfAny.from_another_any,
1136
- )
1137
- # Only Anys that come from another Any can have source_any.
1138
- assert type_of_any != TypeOfAny.from_another_any or source_any is not None
1139
- # We should not have chains of Anys.
1140
- assert not self.source_any or self.source_any.type_of_any != TypeOfAny.from_another_any
1141
-
1142
- @property
1143
- def is_from_error(self) -> bool:
1144
- return self.type_of_any == TypeOfAny.from_error
1145
-
1146
- def accept(self, visitor: TypeVisitor[T]) -> T:
1147
- return visitor.visit_any(self)
1148
-
1149
- def copy_modified(
1150
- self,
1151
- # Mark with Bogus because _dummy is just an object (with type Any)
1152
- type_of_any: int = _dummy_int,
1153
- original_any: Bogus[AnyType | None] = _dummy,
1154
- ) -> AnyType:
1155
- if type_of_any == _dummy_int:
1156
- type_of_any = self.type_of_any
1157
- if original_any is _dummy:
1158
- original_any = self.source_any
1159
- return AnyType(
1160
- type_of_any=type_of_any,
1161
- source_any=original_any,
1162
- missing_import_name=self.missing_import_name,
1163
- line=self.line,
1164
- column=self.column,
1165
- )
1166
-
1167
- def __hash__(self) -> int:
1168
- return hash(AnyType)
1169
-
1170
- def __eq__(self, other: object) -> bool:
1171
- return isinstance(other, AnyType)
1172
-
1173
- def serialize(self) -> JsonDict:
1174
- return {
1175
- ".class": "AnyType",
1176
- "type_of_any": self.type_of_any,
1177
- "source_any": self.source_any.serialize() if self.source_any is not None else None,
1178
- "missing_import_name": self.missing_import_name,
1179
- }
1180
-
1181
- @classmethod
1182
- def deserialize(cls, data: JsonDict) -> AnyType:
1183
- assert data[".class"] == "AnyType"
1184
- source = data["source_any"]
1185
- return AnyType(
1186
- data["type_of_any"],
1187
- AnyType.deserialize(source) if source is not None else None,
1188
- data["missing_import_name"],
1189
- )
1190
-
1191
-
1192
- class UninhabitedType(ProperType):
1193
- """This type has no members.
1194
-
1195
- This type is the bottom type.
1196
- With strict Optional checking, it is the only common subtype between all
1197
- other types, which allows `meet` to be well defined. Without strict
1198
- Optional checking, NoneType fills this role.
1199
-
1200
- In general, for any type T:
1201
- join(UninhabitedType, T) = T
1202
- meet(UninhabitedType, T) = UninhabitedType
1203
- is_subtype(UninhabitedType, T) = True
1204
- """
1205
-
1206
- __slots__ = ("ambiguous", "is_noreturn")
1207
-
1208
- is_noreturn: bool # Does this come from a NoReturn? Purely for error messages.
1209
- # It is important to track whether this is an actual NoReturn type, or just a result
1210
- # of ambiguous type inference, in the latter case we don't want to mark a branch as
1211
- # unreachable in binder.
1212
- ambiguous: bool # Is this a result of inference for a variable without constraints?
1213
-
1214
- def __init__(self, is_noreturn: bool = False, line: int = -1, column: int = -1) -> None:
1215
- super().__init__(line, column)
1216
- self.is_noreturn = is_noreturn
1217
- self.ambiguous = False
1218
-
1219
- def can_be_true_default(self) -> bool:
1220
- return False
1221
-
1222
- def can_be_false_default(self) -> bool:
1223
- return False
1224
-
1225
- def accept(self, visitor: TypeVisitor[T]) -> T:
1226
- return visitor.visit_uninhabited_type(self)
1227
-
1228
- def __hash__(self) -> int:
1229
- return hash(UninhabitedType)
1230
-
1231
- def __eq__(self, other: object) -> bool:
1232
- return isinstance(other, UninhabitedType)
1233
-
1234
- def serialize(self) -> JsonDict:
1235
- return {".class": "UninhabitedType", "is_noreturn": self.is_noreturn}
1236
-
1237
- @classmethod
1238
- def deserialize(cls, data: JsonDict) -> UninhabitedType:
1239
- assert data[".class"] == "UninhabitedType"
1240
- return UninhabitedType(is_noreturn=data["is_noreturn"])
1241
-
1242
-
1243
- class NoneType(ProperType):
1244
- """The type of 'None'.
1245
-
1246
- This type can be written by users as 'None'.
1247
- """
1248
-
1249
- __slots__ = ()
1250
-
1251
- def __init__(self, line: int = -1, column: int = -1) -> None:
1252
- super().__init__(line, column)
1253
-
1254
- def can_be_true_default(self) -> bool:
1255
- return False
1256
-
1257
- def __hash__(self) -> int:
1258
- return hash(NoneType)
1259
-
1260
- def __eq__(self, other: object) -> bool:
1261
- return isinstance(other, NoneType)
1262
-
1263
- def accept(self, visitor: TypeVisitor[T]) -> T:
1264
- return visitor.visit_none_type(self)
1265
-
1266
- def serialize(self) -> JsonDict:
1267
- return {".class": "NoneType"}
1268
-
1269
- @classmethod
1270
- def deserialize(cls, data: JsonDict) -> NoneType:
1271
- assert data[".class"] == "NoneType"
1272
- return NoneType()
1273
-
1274
- def is_singleton_type(self) -> bool:
1275
- return True
1276
-
1277
-
1278
- # NoneType used to be called NoneTyp so to avoid needlessly breaking
1279
- # external plugins we keep that alias here.
1280
- NoneTyp = NoneType
1281
-
1282
-
1283
- class ErasedType(ProperType):
1284
- """Placeholder for an erased type.
1285
-
1286
- This is used during type inference. This has the special property that
1287
- it is ignored during type inference.
1288
- """
1289
-
1290
- __slots__ = ()
1291
-
1292
- def accept(self, visitor: TypeVisitor[T]) -> T:
1293
- return visitor.visit_erased_type(self)
1294
-
1295
-
1296
- class DeletedType(ProperType):
1297
- """Type of deleted variables.
1298
-
1299
- These can be used as lvalues but not rvalues.
1300
- """
1301
-
1302
- __slots__ = ("source",)
1303
-
1304
- source: str | None # May be None; name that generated this value
1305
-
1306
- def __init__(self, source: str | None = None, line: int = -1, column: int = -1) -> None:
1307
- super().__init__(line, column)
1308
- self.source = source
1309
-
1310
- def accept(self, visitor: TypeVisitor[T]) -> T:
1311
- return visitor.visit_deleted_type(self)
1312
-
1313
- def serialize(self) -> JsonDict:
1314
- return {".class": "DeletedType", "source": self.source}
1315
-
1316
- @classmethod
1317
- def deserialize(cls, data: JsonDict) -> DeletedType:
1318
- assert data[".class"] == "DeletedType"
1319
- return DeletedType(data["source"])
1320
-
1321
-
1322
- # Fake TypeInfo to be used as a placeholder during Instance de-serialization.
1323
- NOT_READY: Final = mypy.nodes.FakeInfo("De-serialization failure: TypeInfo not fixed")
1324
-
1325
-
1326
- class ExtraAttrs:
1327
- """Summary of module attributes and types.
1328
-
1329
- This is used for instances of types.ModuleType, because they can have different
1330
- attributes per instance, and for type narrowing with hasattr() checks.
1331
- """
1332
-
1333
- def __init__(
1334
- self,
1335
- attrs: dict[str, Type],
1336
- immutable: set[str] | None = None,
1337
- mod_name: str | None = None,
1338
- ) -> None:
1339
- self.attrs = attrs
1340
- if immutable is None:
1341
- immutable = set()
1342
- self.immutable = immutable
1343
- self.mod_name = mod_name
1344
-
1345
- def __hash__(self) -> int:
1346
- return hash((tuple(self.attrs.items()), tuple(sorted(self.immutable))))
1347
-
1348
- def __eq__(self, other: object) -> bool:
1349
- if not isinstance(other, ExtraAttrs):
1350
- return NotImplemented
1351
- return self.attrs == other.attrs and self.immutable == other.immutable
1352
-
1353
- def copy(self) -> ExtraAttrs:
1354
- return ExtraAttrs(self.attrs.copy(), self.immutable.copy(), self.mod_name)
1355
-
1356
- def __repr__(self) -> str:
1357
- return f"ExtraAttrs({self.attrs!r}, {self.immutable!r}, {self.mod_name!r})"
1358
-
1359
-
1360
- class Instance(ProperType):
1361
- """An instance type of form C[T1, ..., Tn].
1362
-
1363
- The list of type variables may be empty.
1364
-
1365
- Several types have fallbacks to `Instance`, because in Python everything is an object
1366
- and this concept is impossible to express without intersection types. We therefore use
1367
- fallbacks for all "non-special" (like UninhabitedType, ErasedType etc) types.
1368
- """
1369
-
1370
- __slots__ = ("type", "args", "invalid", "type_ref", "last_known_value", "_hash", "extra_attrs")
1371
-
1372
- def __init__(
1373
- self,
1374
- typ: mypy.nodes.TypeInfo,
1375
- args: Sequence[Type],
1376
- line: int = -1,
1377
- column: int = -1,
1378
- *,
1379
- last_known_value: LiteralType | None = None,
1380
- extra_attrs: ExtraAttrs | None = None,
1381
- ) -> None:
1382
- super().__init__(line, column)
1383
- self.type = typ
1384
- self.args = tuple(args)
1385
- self.type_ref: str | None = None
1386
-
1387
- # True if recovered after incorrect number of type arguments error
1388
- self.invalid = False
1389
-
1390
- # This field keeps track of the underlying Literal[...] value associated with
1391
- # this instance, if one is known.
1392
- #
1393
- # This field is set whenever possible within expressions, but is erased upon
1394
- # variable assignment (see erasetype.remove_instance_last_known_values) unless
1395
- # the variable is declared to be final.
1396
- #
1397
- # For example, consider the following program:
1398
- #
1399
- # a = 1
1400
- # b: Final[int] = 2
1401
- # c: Final = 3
1402
- # print(a + b + c + 4)
1403
- #
1404
- # The 'Instance' objects associated with the expressions '1', '2', '3', and '4' will
1405
- # have last_known_values of type Literal[1], Literal[2], Literal[3], and Literal[4]
1406
- # respectively. However, the Instance object assigned to 'a' and 'b' will have their
1407
- # last_known_value erased: variable 'a' is mutable; variable 'b' was declared to be
1408
- # specifically an int.
1409
- #
1410
- # Or more broadly, this field lets this Instance "remember" its original declaration
1411
- # when applicable. We want this behavior because we want implicit Final declarations
1412
- # to act pretty much identically with constants: we should be able to replace any
1413
- # places where we use some Final variable with the original value and get the same
1414
- # type-checking behavior. For example, we want this program:
1415
- #
1416
- # def expects_literal(x: Literal[3]) -> None: pass
1417
- # var: Final = 3
1418
- # expects_literal(var)
1419
- #
1420
- # ...to type-check in the exact same way as if we had written the program like this:
1421
- #
1422
- # def expects_literal(x: Literal[3]) -> None: pass
1423
- # expects_literal(3)
1424
- #
1425
- # In order to make this work (especially with literal types), we need var's type
1426
- # (an Instance) to remember the "original" value.
1427
- #
1428
- # Preserving this value within expressions is useful for similar reasons.
1429
- #
1430
- # Currently most of mypy will ignore this field and will continue to treat this type like
1431
- # a regular Instance. We end up using this field only when we are explicitly within a
1432
- # Literal context.
1433
- self.last_known_value = last_known_value
1434
-
1435
- # Cached hash value
1436
- self._hash = -1
1437
-
1438
- # Additional attributes defined per instance of this type. For example modules
1439
- # have different attributes per instance of types.ModuleType. This is intended
1440
- # to be "short-lived", we don't serialize it, and even don't store as variable type.
1441
- self.extra_attrs = extra_attrs
1442
-
1443
- def accept(self, visitor: TypeVisitor[T]) -> T:
1444
- return visitor.visit_instance(self)
1445
-
1446
- def __hash__(self) -> int:
1447
- if self._hash == -1:
1448
- self._hash = hash((self.type, self.args, self.last_known_value, self.extra_attrs))
1449
- return self._hash
1450
-
1451
- def __eq__(self, other: object) -> bool:
1452
- if not isinstance(other, Instance):
1453
- return NotImplemented
1454
- return (
1455
- self.type == other.type
1456
- and self.args == other.args
1457
- and self.last_known_value == other.last_known_value
1458
- and self.extra_attrs == other.extra_attrs
1459
- )
1460
-
1461
- def serialize(self) -> JsonDict | str:
1462
- assert self.type is not None
1463
- type_ref = self.type.fullname
1464
- if not self.args and not self.last_known_value:
1465
- return type_ref
1466
- data: JsonDict = {".class": "Instance"}
1467
- data["type_ref"] = type_ref
1468
- data["args"] = [arg.serialize() for arg in self.args]
1469
- if self.last_known_value is not None:
1470
- data["last_known_value"] = self.last_known_value.serialize()
1471
- return data
1472
-
1473
- @classmethod
1474
- def deserialize(cls, data: JsonDict | str) -> Instance:
1475
- if isinstance(data, str):
1476
- inst = Instance(NOT_READY, [])
1477
- inst.type_ref = data
1478
- return inst
1479
- assert data[".class"] == "Instance"
1480
- args: list[Type] = []
1481
- if "args" in data:
1482
- args_list = data["args"]
1483
- assert isinstance(args_list, list)
1484
- args = [deserialize_type(arg) for arg in args_list]
1485
- inst = Instance(NOT_READY, args)
1486
- inst.type_ref = data["type_ref"] # Will be fixed up by fixup.py later.
1487
- if "last_known_value" in data:
1488
- inst.last_known_value = LiteralType.deserialize(data["last_known_value"])
1489
- return inst
1490
-
1491
- def copy_modified(
1492
- self,
1493
- *,
1494
- args: Bogus[list[Type]] = _dummy,
1495
- last_known_value: Bogus[LiteralType | None] = _dummy,
1496
- ) -> Instance:
1497
- new = Instance(
1498
- self.type,
1499
- args if args is not _dummy else self.args,
1500
- self.line,
1501
- self.column,
1502
- last_known_value=(
1503
- last_known_value if last_known_value is not _dummy else self.last_known_value
1504
- ),
1505
- )
1506
- # We intentionally don't copy the extra_attrs here, so they will be erased.
1507
- new.can_be_true = self.can_be_true
1508
- new.can_be_false = self.can_be_false
1509
- return new
1510
-
1511
- def copy_with_extra_attr(self, name: str, typ: Type) -> Instance:
1512
- if self.extra_attrs:
1513
- existing_attrs = self.extra_attrs.copy()
1514
- else:
1515
- existing_attrs = ExtraAttrs({}, set(), None)
1516
- existing_attrs.attrs[name] = typ
1517
- new = self.copy_modified()
1518
- new.extra_attrs = existing_attrs
1519
- return new
1520
-
1521
- def is_singleton_type(self) -> bool:
1522
- # TODO:
1523
- # Also make this return True if the type corresponds to NotImplemented?
1524
- return (
1525
- self.type.is_enum
1526
- and len(self.get_enum_values()) == 1
1527
- or self.type.fullname in {"builtins.ellipsis", "types.EllipsisType"}
1528
- )
1529
-
1530
- def get_enum_values(self) -> list[str]:
1531
- """Return the list of values for an Enum."""
1532
- return [
1533
- name for name, sym in self.type.names.items() if isinstance(sym.node, mypy.nodes.Var)
1534
- ]
1535
-
1536
-
1537
- class FunctionLike(ProperType):
1538
- """Abstract base class for function types."""
1539
-
1540
- __slots__ = ("fallback",)
1541
-
1542
- fallback: Instance
1543
-
1544
- def __init__(self, line: int = -1, column: int = -1) -> None:
1545
- super().__init__(line, column)
1546
- self._can_be_false = False
1547
-
1548
- @abstractmethod
1549
- def is_type_obj(self) -> bool:
1550
- pass
1551
-
1552
- @abstractmethod
1553
- def type_object(self) -> mypy.nodes.TypeInfo:
1554
- pass
1555
-
1556
- @property
1557
- @abstractmethod
1558
- def items(self) -> list[CallableType]:
1559
- pass
1560
-
1561
- @abstractmethod
1562
- def with_name(self, name: str) -> FunctionLike:
1563
- pass
1564
-
1565
- @abstractmethod
1566
- def get_name(self) -> str | None:
1567
- pass
1568
-
1569
-
1570
- class FormalArgument(NamedTuple):
1571
- name: str | None
1572
- pos: int | None
1573
- typ: Type
1574
- required: bool
1575
-
1576
-
1577
- class Parameters(ProperType):
1578
- """Type that represents the parameters to a function.
1579
-
1580
- Used for ParamSpec analysis. Note that by convention we handle this
1581
- type as a Callable without return type, not as a "tuple with names",
1582
- so that it behaves contravariantly, in particular [x: int] <: [int].
1583
- """
1584
-
1585
- __slots__ = (
1586
- "arg_types",
1587
- "arg_kinds",
1588
- "arg_names",
1589
- "min_args",
1590
- "is_ellipsis_args",
1591
- # TODO: variables don't really belong here, but they are used to allow hacky support
1592
- # for forall . Foo[[x: T], T] by capturing generic callable with ParamSpec, see #15909
1593
- "variables",
1594
- "imprecise_arg_kinds",
1595
- )
1596
-
1597
- def __init__(
1598
- self,
1599
- arg_types: Sequence[Type],
1600
- arg_kinds: list[ArgKind],
1601
- arg_names: Sequence[str | None],
1602
- *,
1603
- variables: Sequence[TypeVarLikeType] | None = None,
1604
- is_ellipsis_args: bool = False,
1605
- imprecise_arg_kinds: bool = False,
1606
- line: int = -1,
1607
- column: int = -1,
1608
- ) -> None:
1609
- super().__init__(line, column)
1610
- self.arg_types = list(arg_types)
1611
- self.arg_kinds = arg_kinds
1612
- self.arg_names = list(arg_names)
1613
- assert len(arg_types) == len(arg_kinds) == len(arg_names)
1614
- assert not any(isinstance(t, Parameters) for t in arg_types)
1615
- self.min_args = arg_kinds.count(ARG_POS)
1616
- self.is_ellipsis_args = is_ellipsis_args
1617
- self.variables = variables or []
1618
- self.imprecise_arg_kinds = imprecise_arg_kinds
1619
-
1620
- def copy_modified(
1621
- self,
1622
- arg_types: Bogus[Sequence[Type]] = _dummy,
1623
- arg_kinds: Bogus[list[ArgKind]] = _dummy,
1624
- arg_names: Bogus[Sequence[str | None]] = _dummy,
1625
- *,
1626
- variables: Bogus[Sequence[TypeVarLikeType]] = _dummy,
1627
- is_ellipsis_args: Bogus[bool] = _dummy,
1628
- imprecise_arg_kinds: Bogus[bool] = _dummy,
1629
- ) -> Parameters:
1630
- return Parameters(
1631
- arg_types=arg_types if arg_types is not _dummy else self.arg_types,
1632
- arg_kinds=arg_kinds if arg_kinds is not _dummy else self.arg_kinds,
1633
- arg_names=arg_names if arg_names is not _dummy else self.arg_names,
1634
- is_ellipsis_args=(
1635
- is_ellipsis_args if is_ellipsis_args is not _dummy else self.is_ellipsis_args
1636
- ),
1637
- variables=variables if variables is not _dummy else self.variables,
1638
- imprecise_arg_kinds=(
1639
- imprecise_arg_kinds
1640
- if imprecise_arg_kinds is not _dummy
1641
- else self.imprecise_arg_kinds
1642
- ),
1643
- )
1644
-
1645
- # TODO: here is a lot of code duplication with Callable type, fix this.
1646
- def var_arg(self) -> FormalArgument | None:
1647
- """The formal argument for *args."""
1648
- for position, (type, kind) in enumerate(zip(self.arg_types, self.arg_kinds)):
1649
- if kind == ARG_STAR:
1650
- return FormalArgument(None, position, type, False)
1651
- return None
1652
-
1653
- def kw_arg(self) -> FormalArgument | None:
1654
- """The formal argument for **kwargs."""
1655
- for position, (type, kind) in enumerate(zip(self.arg_types, self.arg_kinds)):
1656
- if kind == ARG_STAR2:
1657
- return FormalArgument(None, position, type, False)
1658
- return None
1659
-
1660
- def formal_arguments(self, include_star_args: bool = False) -> list[FormalArgument]:
1661
- """Yields the formal arguments corresponding to this callable, ignoring *arg and **kwargs.
1662
-
1663
- To handle *args and **kwargs, use the 'callable.var_args' and 'callable.kw_args' fields,
1664
- if they are not None.
1665
-
1666
- If you really want to include star args in the yielded output, set the
1667
- 'include_star_args' parameter to 'True'."""
1668
- args = []
1669
- done_with_positional = False
1670
- for i in range(len(self.arg_types)):
1671
- kind = self.arg_kinds[i]
1672
- if kind.is_named() or kind.is_star():
1673
- done_with_positional = True
1674
- if not include_star_args and kind.is_star():
1675
- continue
1676
-
1677
- required = kind.is_required()
1678
- pos = None if done_with_positional else i
1679
- arg = FormalArgument(self.arg_names[i], pos, self.arg_types[i], required)
1680
- args.append(arg)
1681
- return args
1682
-
1683
- def argument_by_name(self, name: str | None) -> FormalArgument | None:
1684
- if name is None:
1685
- return None
1686
- seen_star = False
1687
- for i, (arg_name, kind, typ) in enumerate(
1688
- zip(self.arg_names, self.arg_kinds, self.arg_types)
1689
- ):
1690
- # No more positional arguments after these.
1691
- if kind.is_named() or kind.is_star():
1692
- seen_star = True
1693
- if kind.is_star():
1694
- continue
1695
- if arg_name == name:
1696
- position = None if seen_star else i
1697
- return FormalArgument(name, position, typ, kind.is_required())
1698
- return self.try_synthesizing_arg_from_kwarg(name)
1699
-
1700
- def argument_by_position(self, position: int | None) -> FormalArgument | None:
1701
- if position is None:
1702
- return None
1703
- if position >= len(self.arg_names):
1704
- return self.try_synthesizing_arg_from_vararg(position)
1705
- name, kind, typ = (
1706
- self.arg_names[position],
1707
- self.arg_kinds[position],
1708
- self.arg_types[position],
1709
- )
1710
- if kind.is_positional():
1711
- return FormalArgument(name, position, typ, kind == ARG_POS)
1712
- else:
1713
- return self.try_synthesizing_arg_from_vararg(position)
1714
-
1715
- def try_synthesizing_arg_from_kwarg(self, name: str | None) -> FormalArgument | None:
1716
- kw_arg = self.kw_arg()
1717
- if kw_arg is not None:
1718
- return FormalArgument(name, None, kw_arg.typ, False)
1719
- else:
1720
- return None
1721
-
1722
- def try_synthesizing_arg_from_vararg(self, position: int | None) -> FormalArgument | None:
1723
- var_arg = self.var_arg()
1724
- if var_arg is not None:
1725
- return FormalArgument(None, position, var_arg.typ, False)
1726
- else:
1727
- return None
1728
-
1729
- def accept(self, visitor: TypeVisitor[T]) -> T:
1730
- return visitor.visit_parameters(self)
1731
-
1732
- def serialize(self) -> JsonDict:
1733
- return {
1734
- ".class": "Parameters",
1735
- "arg_types": [t.serialize() for t in self.arg_types],
1736
- "arg_kinds": [int(x.value) for x in self.arg_kinds],
1737
- "arg_names": self.arg_names,
1738
- "variables": [tv.serialize() for tv in self.variables],
1739
- "imprecise_arg_kinds": self.imprecise_arg_kinds,
1740
- }
1741
-
1742
- @classmethod
1743
- def deserialize(cls, data: JsonDict) -> Parameters:
1744
- assert data[".class"] == "Parameters"
1745
- return Parameters(
1746
- [deserialize_type(t) for t in data["arg_types"]],
1747
- [ArgKind(x) for x in data["arg_kinds"]],
1748
- data["arg_names"],
1749
- variables=[cast(TypeVarLikeType, deserialize_type(v)) for v in data["variables"]],
1750
- imprecise_arg_kinds=data["imprecise_arg_kinds"],
1751
- )
1752
-
1753
- def __hash__(self) -> int:
1754
- return hash(
1755
- (
1756
- self.is_ellipsis_args,
1757
- tuple(self.arg_types),
1758
- tuple(self.arg_names),
1759
- tuple(self.arg_kinds),
1760
- )
1761
- )
1762
-
1763
- def __eq__(self, other: object) -> bool:
1764
- if isinstance(other, (Parameters, CallableType)):
1765
- return (
1766
- self.arg_types == other.arg_types
1767
- and self.arg_names == other.arg_names
1768
- and self.arg_kinds == other.arg_kinds
1769
- and self.is_ellipsis_args == other.is_ellipsis_args
1770
- )
1771
- else:
1772
- return NotImplemented
1773
-
1774
-
1775
- CT = TypeVar("CT", bound="CallableType")
1776
-
1777
-
1778
- class CallableType(FunctionLike):
1779
- """Type of a non-overloaded callable object (such as function)."""
1780
-
1781
- __slots__ = (
1782
- "arg_types", # Types of function arguments
1783
- "arg_kinds", # ARG_ constants
1784
- "arg_names", # Argument names; None if not a keyword argument
1785
- "min_args", # Minimum number of arguments; derived from arg_kinds
1786
- "ret_type", # Return value type
1787
- "name", # Name (may be None; for error messages and plugins)
1788
- "definition", # For error messages. May be None.
1789
- "variables", # Type variables for a generic function
1790
- "is_ellipsis_args", # Is this Callable[..., t] (with literal '...')?
1791
- "implicit", # Was this type implicitly generated instead of explicitly
1792
- # specified by the user?
1793
- "special_sig", # Non-None for signatures that require special handling
1794
- # (currently only value is 'dict' for a signature similar to
1795
- # 'dict')
1796
- "from_type_type", # Was this callable generated by analyzing Type[...]
1797
- # instantiation?
1798
- "bound_args", # Bound type args, mostly unused but may be useful for
1799
- # tools that consume mypy ASTs
1800
- "def_extras", # Information about original definition we want to serialize.
1801
- # This is used for more detailed error messages.
1802
- "type_guard", # T, if -> TypeGuard[T] (ret_type is bool in this case).
1803
- "type_is", # T, if -> TypeIs[T] (ret_type is bool in this case).
1804
- "from_concatenate", # whether this callable is from a concatenate object
1805
- # (this is used for error messages)
1806
- "imprecise_arg_kinds",
1807
- "unpack_kwargs", # Was an Unpack[...] with **kwargs used to define this callable?
1808
- )
1809
-
1810
- def __init__(
1811
- self,
1812
- # maybe this should be refactored to take a Parameters object
1813
- arg_types: Sequence[Type],
1814
- arg_kinds: list[ArgKind],
1815
- arg_names: Sequence[str | None],
1816
- ret_type: Type,
1817
- fallback: Instance,
1818
- name: str | None = None,
1819
- definition: SymbolNode | None = None,
1820
- variables: Sequence[TypeVarLikeType] | None = None,
1821
- line: int = -1,
1822
- column: int = -1,
1823
- is_ellipsis_args: bool = False,
1824
- implicit: bool = False,
1825
- special_sig: str | None = None,
1826
- from_type_type: bool = False,
1827
- bound_args: Sequence[Type | None] = (),
1828
- def_extras: dict[str, Any] | None = None,
1829
- type_guard: Type | None = None,
1830
- type_is: Type | None = None,
1831
- from_concatenate: bool = False,
1832
- imprecise_arg_kinds: bool = False,
1833
- unpack_kwargs: bool = False,
1834
- ) -> None:
1835
- super().__init__(line, column)
1836
- assert len(arg_types) == len(arg_kinds) == len(arg_names)
1837
- for t, k in zip(arg_types, arg_kinds):
1838
- if isinstance(t, ParamSpecType):
1839
- assert not t.prefix.arg_types
1840
- # TODO: should we assert that only ARG_STAR contain ParamSpecType?
1841
- # See testParamSpecJoin, that relies on passing e.g `P.args` as plain argument.
1842
- if variables is None:
1843
- variables = []
1844
- self.arg_types = list(arg_types)
1845
- self.arg_kinds = arg_kinds
1846
- self.arg_names = list(arg_names)
1847
- self.min_args = arg_kinds.count(ARG_POS)
1848
- self.ret_type = ret_type
1849
- self.fallback = fallback
1850
- assert not name or "<bound method" not in name
1851
- self.name = name
1852
- self.definition = definition
1853
- self.variables = variables
1854
- self.is_ellipsis_args = is_ellipsis_args
1855
- self.implicit = implicit
1856
- self.special_sig = special_sig
1857
- self.from_type_type = from_type_type
1858
- self.from_concatenate = from_concatenate
1859
- self.imprecise_arg_kinds = imprecise_arg_kinds
1860
- if not bound_args:
1861
- bound_args = ()
1862
- self.bound_args = bound_args
1863
- if def_extras:
1864
- self.def_extras = def_extras
1865
- elif isinstance(definition, FuncDef):
1866
- # This information would be lost if we don't have definition
1867
- # after serialization, but it is useful in error messages.
1868
- # TODO: decide how to add more info here (file, line, column)
1869
- # without changing interface hash.
1870
- first_arg: str | None = None
1871
- if definition.arg_names and definition.info and not definition.is_static:
1872
- if getattr(definition, "arguments", None):
1873
- first_arg = definition.arguments[0].variable.name
1874
- else:
1875
- first_arg = definition.arg_names[0]
1876
- self.def_extras = {"first_arg": first_arg}
1877
- else:
1878
- self.def_extras = {}
1879
- self.type_guard = type_guard
1880
- self.type_is = type_is
1881
- self.unpack_kwargs = unpack_kwargs
1882
-
1883
- def copy_modified(
1884
- self: CT,
1885
- arg_types: Bogus[Sequence[Type]] = _dummy,
1886
- arg_kinds: Bogus[list[ArgKind]] = _dummy,
1887
- arg_names: Bogus[Sequence[str | None]] = _dummy,
1888
- ret_type: Bogus[Type] = _dummy,
1889
- fallback: Bogus[Instance] = _dummy,
1890
- name: Bogus[str | None] = _dummy,
1891
- definition: Bogus[SymbolNode] = _dummy,
1892
- variables: Bogus[Sequence[TypeVarLikeType]] = _dummy,
1893
- line: int = _dummy_int,
1894
- column: int = _dummy_int,
1895
- is_ellipsis_args: Bogus[bool] = _dummy,
1896
- implicit: Bogus[bool] = _dummy,
1897
- special_sig: Bogus[str | None] = _dummy,
1898
- from_type_type: Bogus[bool] = _dummy,
1899
- bound_args: Bogus[list[Type | None]] = _dummy,
1900
- def_extras: Bogus[dict[str, Any]] = _dummy,
1901
- type_guard: Bogus[Type | None] = _dummy,
1902
- type_is: Bogus[Type | None] = _dummy,
1903
- from_concatenate: Bogus[bool] = _dummy,
1904
- imprecise_arg_kinds: Bogus[bool] = _dummy,
1905
- unpack_kwargs: Bogus[bool] = _dummy,
1906
- ) -> CT:
1907
- modified = CallableType(
1908
- arg_types=arg_types if arg_types is not _dummy else self.arg_types,
1909
- arg_kinds=arg_kinds if arg_kinds is not _dummy else self.arg_kinds,
1910
- arg_names=arg_names if arg_names is not _dummy else self.arg_names,
1911
- ret_type=ret_type if ret_type is not _dummy else self.ret_type,
1912
- fallback=fallback if fallback is not _dummy else self.fallback,
1913
- name=name if name is not _dummy else self.name,
1914
- definition=definition if definition is not _dummy else self.definition,
1915
- variables=variables if variables is not _dummy else self.variables,
1916
- line=line if line != _dummy_int else self.line,
1917
- column=column if column != _dummy_int else self.column,
1918
- is_ellipsis_args=(
1919
- is_ellipsis_args if is_ellipsis_args is not _dummy else self.is_ellipsis_args
1920
- ),
1921
- implicit=implicit if implicit is not _dummy else self.implicit,
1922
- special_sig=special_sig if special_sig is not _dummy else self.special_sig,
1923
- from_type_type=from_type_type if from_type_type is not _dummy else self.from_type_type,
1924
- bound_args=bound_args if bound_args is not _dummy else self.bound_args,
1925
- def_extras=def_extras if def_extras is not _dummy else dict(self.def_extras),
1926
- type_guard=type_guard if type_guard is not _dummy else self.type_guard,
1927
- type_is=type_is if type_is is not _dummy else self.type_is,
1928
- from_concatenate=(
1929
- from_concatenate if from_concatenate is not _dummy else self.from_concatenate
1930
- ),
1931
- imprecise_arg_kinds=(
1932
- imprecise_arg_kinds
1933
- if imprecise_arg_kinds is not _dummy
1934
- else self.imprecise_arg_kinds
1935
- ),
1936
- unpack_kwargs=unpack_kwargs if unpack_kwargs is not _dummy else self.unpack_kwargs,
1937
- )
1938
- # Optimization: Only NewTypes are supported as subtypes since
1939
- # the class is effectively final, so we can use a cast safely.
1940
- return cast(CT, modified)
1941
-
1942
- def var_arg(self) -> FormalArgument | None:
1943
- """The formal argument for *args."""
1944
- for position, (type, kind) in enumerate(zip(self.arg_types, self.arg_kinds)):
1945
- if kind == ARG_STAR:
1946
- return FormalArgument(None, position, type, False)
1947
- return None
1948
-
1949
- def kw_arg(self) -> FormalArgument | None:
1950
- """The formal argument for **kwargs."""
1951
- for position, (type, kind) in enumerate(zip(self.arg_types, self.arg_kinds)):
1952
- if kind == ARG_STAR2:
1953
- return FormalArgument(None, position, type, False)
1954
- return None
1955
-
1956
- @property
1957
- def is_var_arg(self) -> bool:
1958
- """Does this callable have a *args argument?"""
1959
- return ARG_STAR in self.arg_kinds
1960
-
1961
- @property
1962
- def is_kw_arg(self) -> bool:
1963
- """Does this callable have a **kwargs argument?"""
1964
- return ARG_STAR2 in self.arg_kinds
1965
-
1966
- def is_type_obj(self) -> bool:
1967
- return self.fallback.type.is_metaclass() and not isinstance(
1968
- get_proper_type(self.ret_type), UninhabitedType
1969
- )
1970
-
1971
- def type_object(self) -> mypy.nodes.TypeInfo:
1972
- assert self.is_type_obj()
1973
- ret = get_proper_type(self.ret_type)
1974
- if isinstance(ret, TypeVarType):
1975
- ret = get_proper_type(ret.upper_bound)
1976
- if isinstance(ret, TupleType):
1977
- ret = ret.partial_fallback
1978
- if isinstance(ret, TypedDictType):
1979
- ret = ret.fallback
1980
- assert isinstance(ret, Instance)
1981
- return ret.type
1982
-
1983
- def accept(self, visitor: TypeVisitor[T]) -> T:
1984
- return visitor.visit_callable_type(self)
1985
-
1986
- def with_name(self, name: str) -> CallableType:
1987
- """Return a copy of this type with the specified name."""
1988
- return self.copy_modified(ret_type=self.ret_type, name=name)
1989
-
1990
- def get_name(self) -> str | None:
1991
- return self.name
1992
-
1993
- def max_possible_positional_args(self) -> int:
1994
- """Returns maximum number of positional arguments this method could possibly accept.
1995
-
1996
- This takes into account *arg and **kwargs but excludes keyword-only args."""
1997
- if self.is_var_arg or self.is_kw_arg:
1998
- return sys.maxsize
1999
- return sum(kind.is_positional() for kind in self.arg_kinds)
2000
-
2001
- def formal_arguments(self, include_star_args: bool = False) -> list[FormalArgument]:
2002
- """Return a list of the formal arguments of this callable, ignoring *arg and **kwargs.
2003
-
2004
- To handle *args and **kwargs, use the 'callable.var_args' and 'callable.kw_args' fields,
2005
- if they are not None.
2006
-
2007
- If you really want to include star args in the yielded output, set the
2008
- 'include_star_args' parameter to 'True'."""
2009
- args = []
2010
- done_with_positional = False
2011
- for i in range(len(self.arg_types)):
2012
- kind = self.arg_kinds[i]
2013
- if kind.is_named() or kind.is_star():
2014
- done_with_positional = True
2015
- if not include_star_args and kind.is_star():
2016
- continue
2017
-
2018
- required = kind.is_required()
2019
- pos = None if done_with_positional else i
2020
- arg = FormalArgument(self.arg_names[i], pos, self.arg_types[i], required)
2021
- args.append(arg)
2022
- return args
2023
-
2024
- def argument_by_name(self, name: str | None) -> FormalArgument | None:
2025
- if name is None:
2026
- return None
2027
- seen_star = False
2028
- for i, (arg_name, kind, typ) in enumerate(
2029
- zip(self.arg_names, self.arg_kinds, self.arg_types)
2030
- ):
2031
- # No more positional arguments after these.
2032
- if kind.is_named() or kind.is_star():
2033
- seen_star = True
2034
- if kind.is_star():
2035
- continue
2036
- if arg_name == name:
2037
- position = None if seen_star else i
2038
- return FormalArgument(name, position, typ, kind.is_required())
2039
- return self.try_synthesizing_arg_from_kwarg(name)
2040
-
2041
- def argument_by_position(self, position: int | None) -> FormalArgument | None:
2042
- if position is None:
2043
- return None
2044
- if position >= len(self.arg_names):
2045
- return self.try_synthesizing_arg_from_vararg(position)
2046
- name, kind, typ = (
2047
- self.arg_names[position],
2048
- self.arg_kinds[position],
2049
- self.arg_types[position],
2050
- )
2051
- if kind.is_positional():
2052
- return FormalArgument(name, position, typ, kind == ARG_POS)
2053
- else:
2054
- return self.try_synthesizing_arg_from_vararg(position)
2055
-
2056
- def try_synthesizing_arg_from_kwarg(self, name: str | None) -> FormalArgument | None:
2057
- kw_arg = self.kw_arg()
2058
- if kw_arg is not None:
2059
- return FormalArgument(name, None, kw_arg.typ, False)
2060
- else:
2061
- return None
2062
-
2063
- def try_synthesizing_arg_from_vararg(self, position: int | None) -> FormalArgument | None:
2064
- var_arg = self.var_arg()
2065
- if var_arg is not None:
2066
- return FormalArgument(None, position, var_arg.typ, False)
2067
- else:
2068
- return None
2069
-
2070
- @property
2071
- def items(self) -> list[CallableType]:
2072
- return [self]
2073
-
2074
- def is_generic(self) -> bool:
2075
- return bool(self.variables)
2076
-
2077
- def type_var_ids(self) -> list[TypeVarId]:
2078
- a: list[TypeVarId] = []
2079
- for tv in self.variables:
2080
- a.append(tv.id)
2081
- return a
2082
-
2083
- def param_spec(self) -> ParamSpecType | None:
2084
- """Return ParamSpec if callable can be called with one.
2085
-
2086
- A Callable accepting ParamSpec P args (*args, **kwargs) must have the
2087
- two final parameters like this: *args: P.args, **kwargs: P.kwargs.
2088
- """
2089
- if len(self.arg_types) < 2:
2090
- return None
2091
- if self.arg_kinds[-2] != ARG_STAR or self.arg_kinds[-1] != ARG_STAR2:
2092
- return None
2093
- arg_type = self.arg_types[-2]
2094
- if not isinstance(arg_type, ParamSpecType):
2095
- return None
2096
-
2097
- # Prepend prefix for def f(prefix..., *args: P.args, **kwargs: P.kwargs) -> ...
2098
- # TODO: confirm that all arg kinds are positional
2099
- prefix = Parameters(self.arg_types[:-2], self.arg_kinds[:-2], self.arg_names[:-2])
2100
- return arg_type.copy_modified(flavor=ParamSpecFlavor.BARE, prefix=prefix)
2101
-
2102
- def with_unpacked_kwargs(self) -> NormalizedCallableType:
2103
- if not self.unpack_kwargs:
2104
- return cast(NormalizedCallableType, self)
2105
- last_type = get_proper_type(self.arg_types[-1])
2106
- assert isinstance(last_type, TypedDictType)
2107
- extra_kinds = [
2108
- ArgKind.ARG_NAMED if name in last_type.required_keys else ArgKind.ARG_NAMED_OPT
2109
- for name in last_type.items
2110
- ]
2111
- new_arg_kinds = self.arg_kinds[:-1] + extra_kinds
2112
- new_arg_names = self.arg_names[:-1] + list(last_type.items)
2113
- new_arg_types = self.arg_types[:-1] + list(last_type.items.values())
2114
- return NormalizedCallableType(
2115
- self.copy_modified(
2116
- arg_kinds=new_arg_kinds,
2117
- arg_names=new_arg_names,
2118
- arg_types=new_arg_types,
2119
- unpack_kwargs=False,
2120
- )
2121
- )
2122
-
2123
- def with_normalized_var_args(self) -> Self:
2124
- var_arg = self.var_arg()
2125
- if not var_arg or not isinstance(var_arg.typ, UnpackType):
2126
- return self
2127
- unpacked = get_proper_type(var_arg.typ.type)
2128
- if not isinstance(unpacked, TupleType):
2129
- # Note that we don't normalize *args: *tuple[X, ...] -> *args: X,
2130
- # this should be done once in semanal_typeargs.py for user-defined types,
2131
- # and we ourselves should never construct such type.
2132
- return self
2133
- unpack_index = find_unpack_in_list(unpacked.items)
2134
- if unpack_index == 0 and len(unpacked.items) > 1:
2135
- # Already normalized.
2136
- return self
2137
-
2138
- # Boilerplate:
2139
- var_arg_index = self.arg_kinds.index(ARG_STAR)
2140
- types_prefix = self.arg_types[:var_arg_index]
2141
- kinds_prefix = self.arg_kinds[:var_arg_index]
2142
- names_prefix = self.arg_names[:var_arg_index]
2143
- types_suffix = self.arg_types[var_arg_index + 1 :]
2144
- kinds_suffix = self.arg_kinds[var_arg_index + 1 :]
2145
- names_suffix = self.arg_names[var_arg_index + 1 :]
2146
- no_name: str | None = None # to silence mypy
2147
-
2148
- # Now we have something non-trivial to do.
2149
- if unpack_index is None:
2150
- # Plain *Tuple[X, Y, Z] -> replace with ARG_POS completely
2151
- types_middle = unpacked.items
2152
- kinds_middle = [ARG_POS] * len(unpacked.items)
2153
- names_middle = [no_name] * len(unpacked.items)
2154
- else:
2155
- # *Tuple[X, *Ts, Y, Z] or *Tuple[X, *tuple[T, ...], X, Z], here
2156
- # we replace the prefix by ARG_POS (this is how some places expect
2157
- # Callables to be represented)
2158
- nested_unpack = unpacked.items[unpack_index]
2159
- assert isinstance(nested_unpack, UnpackType)
2160
- nested_unpacked = get_proper_type(nested_unpack.type)
2161
- if unpack_index == len(unpacked.items) - 1:
2162
- # Normalize also single item tuples like
2163
- # *args: *Tuple[*tuple[X, ...]] -> *args: X
2164
- # *args: *Tuple[*Ts] -> *args: *Ts
2165
- # This may be not strictly necessary, but these are very verbose.
2166
- if isinstance(nested_unpacked, Instance):
2167
- assert nested_unpacked.type.fullname == "builtins.tuple"
2168
- new_unpack = nested_unpacked.args[0]
2169
- else:
2170
- if not isinstance(nested_unpacked, TypeVarTupleType):
2171
- # We found a non-nomralized tuple type, this means this method
2172
- # is called during semantic analysis (e.g. from get_proper_type())
2173
- # there is no point in normalizing callables at this stage.
2174
- return self
2175
- new_unpack = nested_unpack
2176
- else:
2177
- new_unpack = UnpackType(
2178
- unpacked.copy_modified(items=unpacked.items[unpack_index:])
2179
- )
2180
- types_middle = unpacked.items[:unpack_index] + [new_unpack]
2181
- kinds_middle = [ARG_POS] * unpack_index + [ARG_STAR]
2182
- names_middle = [no_name] * unpack_index + [self.arg_names[var_arg_index]]
2183
- return self.copy_modified(
2184
- arg_types=types_prefix + types_middle + types_suffix,
2185
- arg_kinds=kinds_prefix + kinds_middle + kinds_suffix,
2186
- arg_names=names_prefix + names_middle + names_suffix,
2187
- )
2188
-
2189
- def __hash__(self) -> int:
2190
- # self.is_type_obj() will fail if self.fallback.type is a FakeInfo
2191
- if isinstance(self.fallback.type, FakeInfo):
2192
- is_type_obj = 2
2193
- else:
2194
- is_type_obj = self.is_type_obj()
2195
- return hash(
2196
- (
2197
- self.ret_type,
2198
- is_type_obj,
2199
- self.is_ellipsis_args,
2200
- self.name,
2201
- tuple(self.arg_types),
2202
- tuple(self.arg_names),
2203
- tuple(self.arg_kinds),
2204
- self.fallback,
2205
- )
2206
- )
2207
-
2208
- def __eq__(self, other: object) -> bool:
2209
- if isinstance(other, CallableType):
2210
- return (
2211
- self.ret_type == other.ret_type
2212
- and self.arg_types == other.arg_types
2213
- and self.arg_names == other.arg_names
2214
- and self.arg_kinds == other.arg_kinds
2215
- and self.name == other.name
2216
- and self.is_type_obj() == other.is_type_obj()
2217
- and self.is_ellipsis_args == other.is_ellipsis_args
2218
- and self.fallback == other.fallback
2219
- )
2220
- else:
2221
- return NotImplemented
2222
-
2223
- def serialize(self) -> JsonDict:
2224
- # TODO: As an optimization, leave out everything related to
2225
- # generic functions for non-generic functions.
2226
- return {
2227
- ".class": "CallableType",
2228
- "arg_types": [t.serialize() for t in self.arg_types],
2229
- "arg_kinds": [int(x.value) for x in self.arg_kinds],
2230
- "arg_names": self.arg_names,
2231
- "ret_type": self.ret_type.serialize(),
2232
- "fallback": self.fallback.serialize(),
2233
- "name": self.name,
2234
- # We don't serialize the definition (only used for error messages).
2235
- "variables": [v.serialize() for v in self.variables],
2236
- "is_ellipsis_args": self.is_ellipsis_args,
2237
- "implicit": self.implicit,
2238
- "bound_args": [(None if t is None else t.serialize()) for t in self.bound_args],
2239
- "def_extras": dict(self.def_extras),
2240
- "type_guard": self.type_guard.serialize() if self.type_guard is not None else None,
2241
- "type_is": (self.type_is.serialize() if self.type_is is not None else None),
2242
- "from_concatenate": self.from_concatenate,
2243
- "imprecise_arg_kinds": self.imprecise_arg_kinds,
2244
- "unpack_kwargs": self.unpack_kwargs,
2245
- }
2246
-
2247
- @classmethod
2248
- def deserialize(cls, data: JsonDict) -> CallableType:
2249
- assert data[".class"] == "CallableType"
2250
- # TODO: Set definition to the containing SymbolNode?
2251
- return CallableType(
2252
- [deserialize_type(t) for t in data["arg_types"]],
2253
- [ArgKind(x) for x in data["arg_kinds"]],
2254
- data["arg_names"],
2255
- deserialize_type(data["ret_type"]),
2256
- Instance.deserialize(data["fallback"]),
2257
- name=data["name"],
2258
- variables=[cast(TypeVarLikeType, deserialize_type(v)) for v in data["variables"]],
2259
- is_ellipsis_args=data["is_ellipsis_args"],
2260
- implicit=data["implicit"],
2261
- bound_args=[(None if t is None else deserialize_type(t)) for t in data["bound_args"]],
2262
- def_extras=data["def_extras"],
2263
- type_guard=(
2264
- deserialize_type(data["type_guard"]) if data["type_guard"] is not None else None
2265
- ),
2266
- type_is=(deserialize_type(data["type_is"]) if data["type_is"] is not None else None),
2267
- from_concatenate=data["from_concatenate"],
2268
- imprecise_arg_kinds=data["imprecise_arg_kinds"],
2269
- unpack_kwargs=data["unpack_kwargs"],
2270
- )
2271
-
2272
-
2273
- # This is a little safety net to prevent reckless special-casing of callables
2274
- # that can potentially break Unpack[...] with **kwargs.
2275
- # TODO: use this in more places in checkexpr.py etc?
2276
- NormalizedCallableType = NewType("NormalizedCallableType", CallableType)
2277
-
2278
-
2279
- class Overloaded(FunctionLike):
2280
- """Overloaded function type T1, ... Tn, where each Ti is CallableType.
2281
-
2282
- The variant to call is chosen based on static argument
2283
- types. Overloaded function types can only be defined in stub
2284
- files, and thus there is no explicit runtime dispatch
2285
- implementation.
2286
- """
2287
-
2288
- __slots__ = ("_items",)
2289
-
2290
- _items: list[CallableType] # Must not be empty
2291
-
2292
- def __init__(self, items: list[CallableType]) -> None:
2293
- super().__init__(items[0].line, items[0].column)
2294
- self._items = items
2295
- self.fallback = items[0].fallback
2296
-
2297
- @property
2298
- def items(self) -> list[CallableType]:
2299
- return self._items
2300
-
2301
- def name(self) -> str | None:
2302
- return self.get_name()
2303
-
2304
- def is_type_obj(self) -> bool:
2305
- # All the items must have the same type object status, so it's
2306
- # sufficient to query only (any) one of them.
2307
- return self._items[0].is_type_obj()
2308
-
2309
- def type_object(self) -> mypy.nodes.TypeInfo:
2310
- # All the items must have the same type object, so it's sufficient to
2311
- # query only (any) one of them.
2312
- return self._items[0].type_object()
2313
-
2314
- def with_name(self, name: str) -> Overloaded:
2315
- ni: list[CallableType] = []
2316
- for it in self._items:
2317
- ni.append(it.with_name(name))
2318
- return Overloaded(ni)
2319
-
2320
- def get_name(self) -> str | None:
2321
- return self._items[0].name
2322
-
2323
- def with_unpacked_kwargs(self) -> Overloaded:
2324
- if any(i.unpack_kwargs for i in self.items):
2325
- return Overloaded([i.with_unpacked_kwargs() for i in self.items])
2326
- return self
2327
-
2328
- def accept(self, visitor: TypeVisitor[T]) -> T:
2329
- return visitor.visit_overloaded(self)
2330
-
2331
- def __hash__(self) -> int:
2332
- return hash(tuple(self.items))
2333
-
2334
- def __eq__(self, other: object) -> bool:
2335
- if not isinstance(other, Overloaded):
2336
- return NotImplemented
2337
- return self.items == other.items
2338
-
2339
- def serialize(self) -> JsonDict:
2340
- return {".class": "Overloaded", "items": [t.serialize() for t in self.items]}
2341
-
2342
- @classmethod
2343
- def deserialize(cls, data: JsonDict) -> Overloaded:
2344
- assert data[".class"] == "Overloaded"
2345
- return Overloaded([CallableType.deserialize(t) for t in data["items"]])
2346
-
2347
-
2348
- class TupleType(ProperType):
2349
- """The tuple type Tuple[T1, ..., Tn] (at least one type argument).
2350
-
2351
- Instance variables:
2352
- items: Tuple item types
2353
- partial_fallback: The (imprecise) underlying instance type that is used
2354
- for non-tuple methods. This is generally builtins.tuple[Any, ...] for
2355
- regular tuples, but it's different for named tuples and classes with
2356
- a tuple base class. Use mypy.typeops.tuple_fallback to calculate the
2357
- precise fallback type derived from item types.
2358
- implicit: If True, derived from a tuple expression (t,....) instead of Tuple[t, ...]
2359
- """
2360
-
2361
- __slots__ = ("items", "partial_fallback", "implicit")
2362
-
2363
- items: list[Type]
2364
- partial_fallback: Instance
2365
- implicit: bool
2366
-
2367
- def __init__(
2368
- self,
2369
- items: list[Type],
2370
- fallback: Instance,
2371
- line: int = -1,
2372
- column: int = -1,
2373
- implicit: bool = False,
2374
- ) -> None:
2375
- super().__init__(line, column)
2376
- self.partial_fallback = fallback
2377
- self.items = items
2378
- self.implicit = implicit
2379
-
2380
- def can_be_true_default(self) -> bool:
2381
- if self.can_be_any_bool():
2382
- # Corner case: it is a `NamedTuple` with `__bool__` method defined.
2383
- # It can be anything: both `True` and `False`.
2384
- return True
2385
- return self.length() > 0
2386
-
2387
- def can_be_false_default(self) -> bool:
2388
- if self.can_be_any_bool():
2389
- # Corner case: it is a `NamedTuple` with `__bool__` method defined.
2390
- # It can be anything: both `True` and `False`.
2391
- return True
2392
- if self.length() == 0:
2393
- return True
2394
- if self.length() > 1:
2395
- return False
2396
- # Special case tuple[*Ts] may or may not be false.
2397
- item = self.items[0]
2398
- if not isinstance(item, UnpackType):
2399
- return False
2400
- if not isinstance(item.type, TypeVarTupleType):
2401
- # Non-normalized tuple[int, ...] can be false.
2402
- return True
2403
- return item.type.min_len == 0
2404
-
2405
- def can_be_any_bool(self) -> bool:
2406
- return bool(
2407
- self.partial_fallback.type
2408
- and self.partial_fallback.type.fullname != "builtins.tuple"
2409
- and self.partial_fallback.type.names.get("__bool__")
2410
- )
2411
-
2412
- def length(self) -> int:
2413
- return len(self.items)
2414
-
2415
- def accept(self, visitor: TypeVisitor[T]) -> T:
2416
- return visitor.visit_tuple_type(self)
2417
-
2418
- def __hash__(self) -> int:
2419
- return hash((tuple(self.items), self.partial_fallback))
2420
-
2421
- def __eq__(self, other: object) -> bool:
2422
- if not isinstance(other, TupleType):
2423
- return NotImplemented
2424
- return self.items == other.items and self.partial_fallback == other.partial_fallback
2425
-
2426
- def serialize(self) -> JsonDict:
2427
- return {
2428
- ".class": "TupleType",
2429
- "items": [t.serialize() for t in self.items],
2430
- "partial_fallback": self.partial_fallback.serialize(),
2431
- "implicit": self.implicit,
2432
- }
2433
-
2434
- @classmethod
2435
- def deserialize(cls, data: JsonDict) -> TupleType:
2436
- assert data[".class"] == "TupleType"
2437
- return TupleType(
2438
- [deserialize_type(t) for t in data["items"]],
2439
- Instance.deserialize(data["partial_fallback"]),
2440
- implicit=data["implicit"],
2441
- )
2442
-
2443
- def copy_modified(
2444
- self, *, fallback: Instance | None = None, items: list[Type] | None = None
2445
- ) -> TupleType:
2446
- if fallback is None:
2447
- fallback = self.partial_fallback
2448
- if items is None:
2449
- items = self.items
2450
- return TupleType(items, fallback, self.line, self.column)
2451
-
2452
- def slice(
2453
- self, begin: int | None, end: int | None, stride: int | None, *, fallback: Instance | None
2454
- ) -> TupleType | None:
2455
- if fallback is None:
2456
- fallback = self.partial_fallback
2457
-
2458
- if any(isinstance(t, UnpackType) for t in self.items):
2459
- total = len(self.items)
2460
- unpack_index = find_unpack_in_list(self.items)
2461
- assert unpack_index is not None
2462
- if begin is None and end is None:
2463
- # We special-case this to support reversing variadic tuples.
2464
- # General support for slicing is tricky, so we handle only simple cases.
2465
- if stride == -1:
2466
- slice_items = self.items[::-1]
2467
- elif stride is None or stride == 1:
2468
- slice_items = self.items
2469
- else:
2470
- return None
2471
- elif (begin is None or unpack_index >= begin >= 0) and (
2472
- end is not None and unpack_index >= end >= 0
2473
- ):
2474
- # Start and end are in the prefix, everything works in this case.
2475
- slice_items = self.items[begin:end:stride]
2476
- elif (begin is not None and unpack_index - total < begin < 0) and (
2477
- end is None or unpack_index - total < end < 0
2478
- ):
2479
- # Start and end are in the suffix, everything works in this case.
2480
- slice_items = self.items[begin:end:stride]
2481
- elif (begin is None or unpack_index >= begin >= 0) and (
2482
- end is None or unpack_index - total < end < 0
2483
- ):
2484
- # Start in the prefix, end in the suffix, we can support only trivial strides.
2485
- if stride is None or stride == 1:
2486
- slice_items = self.items[begin:end:stride]
2487
- else:
2488
- return None
2489
- elif (begin is not None and unpack_index - total < begin < 0) and (
2490
- end is not None and unpack_index >= end >= 0
2491
- ):
2492
- # Start in the suffix, end in the prefix, we can support only trivial strides.
2493
- if stride is None or stride == -1:
2494
- slice_items = self.items[begin:end:stride]
2495
- else:
2496
- return None
2497
- else:
2498
- # TODO: there some additional cases we can support for homogeneous variadic
2499
- # items, we can "eat away" finite number of items.
2500
- return None
2501
- else:
2502
- slice_items = self.items[begin:end:stride]
2503
- return TupleType(slice_items, fallback, self.line, self.column, self.implicit)
2504
-
2505
-
2506
- class TypedDictType(ProperType):
2507
- """Type of TypedDict object {'k1': v1, ..., 'kn': vn}.
2508
-
2509
- A TypedDict object is a dictionary with specific string (literal) keys. Each
2510
- key has a value with a distinct type that depends on the key. TypedDict objects
2511
- are normal dict objects at runtime.
2512
-
2513
- A TypedDictType can be either named or anonymous. If it's anonymous, its
2514
- fallback will be typing_extensions._TypedDict (Instance). _TypedDict is a subclass
2515
- of Mapping[str, object] and defines all non-mapping dict methods that TypedDict
2516
- supports. Some dict methods are unsafe and not supported. _TypedDict isn't defined
2517
- at runtime.
2518
-
2519
- If a TypedDict is named, its fallback will be an Instance of the named type
2520
- (ex: "Point") whose TypeInfo has a typeddict_type that is anonymous. This
2521
- is similar to how named tuples work.
2522
-
2523
- TODO: The fallback structure is perhaps overly complicated.
2524
- """
2525
-
2526
- __slots__ = ("items", "required_keys", "fallback")
2527
-
2528
- items: dict[str, Type] # item_name -> item_type
2529
- required_keys: set[str]
2530
- fallback: Instance
2531
-
2532
- def __init__(
2533
- self,
2534
- items: dict[str, Type],
2535
- required_keys: set[str],
2536
- fallback: Instance,
2537
- line: int = -1,
2538
- column: int = -1,
2539
- ) -> None:
2540
- super().__init__(line, column)
2541
- self.items = items
2542
- self.required_keys = required_keys
2543
- self.fallback = fallback
2544
- self.can_be_true = len(self.items) > 0
2545
- self.can_be_false = len(self.required_keys) == 0
2546
-
2547
- def accept(self, visitor: TypeVisitor[T]) -> T:
2548
- return visitor.visit_typeddict_type(self)
2549
-
2550
- def __hash__(self) -> int:
2551
- return hash((frozenset(self.items.items()), self.fallback, frozenset(self.required_keys)))
2552
-
2553
- def __eq__(self, other: object) -> bool:
2554
- if not isinstance(other, TypedDictType):
2555
- return NotImplemented
2556
-
2557
- return (
2558
- frozenset(self.items.keys()) == frozenset(other.items.keys())
2559
- and all(
2560
- left_item_type == right_item_type
2561
- for (_, left_item_type, right_item_type) in self.zip(other)
2562
- )
2563
- and self.fallback == other.fallback
2564
- and self.required_keys == other.required_keys
2565
- )
2566
-
2567
- def serialize(self) -> JsonDict:
2568
- return {
2569
- ".class": "TypedDictType",
2570
- "items": [[n, t.serialize()] for (n, t) in self.items.items()],
2571
- "required_keys": sorted(self.required_keys),
2572
- "fallback": self.fallback.serialize(),
2573
- }
2574
-
2575
- @classmethod
2576
- def deserialize(cls, data: JsonDict) -> TypedDictType:
2577
- assert data[".class"] == "TypedDictType"
2578
- return TypedDictType(
2579
- {n: deserialize_type(t) for (n, t) in data["items"]},
2580
- set(data["required_keys"]),
2581
- Instance.deserialize(data["fallback"]),
2582
- )
2583
-
2584
- @property
2585
- def is_final(self) -> bool:
2586
- return self.fallback.type.is_final
2587
-
2588
- def is_anonymous(self) -> bool:
2589
- return self.fallback.type.fullname in TPDICT_FB_NAMES
2590
-
2591
- def as_anonymous(self) -> TypedDictType:
2592
- if self.is_anonymous():
2593
- return self
2594
- assert self.fallback.type.typeddict_type is not None
2595
- return self.fallback.type.typeddict_type.as_anonymous()
2596
-
2597
- def copy_modified(
2598
- self,
2599
- *,
2600
- fallback: Instance | None = None,
2601
- item_types: list[Type] | None = None,
2602
- item_names: list[str] | None = None,
2603
- required_keys: set[str] | None = None,
2604
- ) -> TypedDictType:
2605
- if fallback is None:
2606
- fallback = self.fallback
2607
- if item_types is None:
2608
- items = self.items
2609
- else:
2610
- items = dict(zip(self.items, item_types))
2611
- if required_keys is None:
2612
- required_keys = self.required_keys
2613
- if item_names is not None:
2614
- items = {k: v for (k, v) in items.items() if k in item_names}
2615
- required_keys &= set(item_names)
2616
- return TypedDictType(items, required_keys, fallback, self.line, self.column)
2617
-
2618
- def create_anonymous_fallback(self) -> Instance:
2619
- anonymous = self.as_anonymous()
2620
- return anonymous.fallback
2621
-
2622
- def names_are_wider_than(self, other: TypedDictType) -> bool:
2623
- return len(other.items.keys() - self.items.keys()) == 0
2624
-
2625
- def zip(self, right: TypedDictType) -> Iterable[tuple[str, Type, Type]]:
2626
- left = self
2627
- for item_name, left_item_type in left.items.items():
2628
- right_item_type = right.items.get(item_name)
2629
- if right_item_type is not None:
2630
- yield (item_name, left_item_type, right_item_type)
2631
-
2632
- def zipall(self, right: TypedDictType) -> Iterable[tuple[str, Type | None, Type | None]]:
2633
- left = self
2634
- for item_name, left_item_type in left.items.items():
2635
- right_item_type = right.items.get(item_name)
2636
- yield (item_name, left_item_type, right_item_type)
2637
- for item_name, right_item_type in right.items.items():
2638
- if item_name in left.items:
2639
- continue
2640
- yield (item_name, None, right_item_type)
2641
-
2642
-
2643
- class RawExpressionType(ProperType):
2644
- """A synthetic type representing some arbitrary expression that does not cleanly
2645
- translate into a type.
2646
-
2647
- This synthetic type is only used at the beginning stages of semantic analysis
2648
- and should be completely removing during the process for mapping UnboundTypes to
2649
- actual types: we either turn it into a LiteralType or an AnyType.
2650
-
2651
- For example, suppose `Foo[1]` is initially represented as the following:
2652
-
2653
- UnboundType(
2654
- name='Foo',
2655
- args=[
2656
- RawExpressionType(value=1, base_type_name='builtins.int'),
2657
- ],
2658
- )
2659
-
2660
- As we perform semantic analysis, this type will transform into one of two
2661
- possible forms.
2662
-
2663
- If 'Foo' was an alias for 'Literal' all along, this type is transformed into:
2664
-
2665
- LiteralType(value=1, fallback=int_instance_here)
2666
-
2667
- Alternatively, if 'Foo' is an unrelated class, we report an error and instead
2668
- produce something like this:
2669
-
2670
- Instance(type=typeinfo_for_foo, args=[AnyType(TypeOfAny.from_error))
2671
-
2672
- If the "note" field is not None, the provided note will be reported alongside the
2673
- error at this point.
2674
-
2675
- Note: if "literal_value" is None, that means this object is representing some
2676
- expression that cannot possibly be a parameter of Literal[...]. For example,
2677
- "Foo[3j]" would be represented as:
2678
-
2679
- UnboundType(
2680
- name='Foo',
2681
- args=[
2682
- RawExpressionType(value=None, base_type_name='builtins.complex'),
2683
- ],
2684
- )
2685
- """
2686
-
2687
- __slots__ = ("literal_value", "base_type_name", "note")
2688
-
2689
- def __init__(
2690
- self,
2691
- literal_value: LiteralValue | None,
2692
- base_type_name: str,
2693
- line: int = -1,
2694
- column: int = -1,
2695
- note: str | None = None,
2696
- ) -> None:
2697
- super().__init__(line, column)
2698
- self.literal_value = literal_value
2699
- self.base_type_name = base_type_name
2700
- self.note = note
2701
-
2702
- def simple_name(self) -> str:
2703
- return self.base_type_name.replace("builtins.", "")
2704
-
2705
- def accept(self, visitor: TypeVisitor[T]) -> T:
2706
- assert isinstance(visitor, SyntheticTypeVisitor)
2707
- ret: T = visitor.visit_raw_expression_type(self)
2708
- return ret
2709
-
2710
- def serialize(self) -> JsonDict:
2711
- assert False, "Synthetic types don't serialize"
2712
-
2713
- def __hash__(self) -> int:
2714
- return hash((self.literal_value, self.base_type_name))
2715
-
2716
- def __eq__(self, other: object) -> bool:
2717
- if isinstance(other, RawExpressionType):
2718
- return (
2719
- self.base_type_name == other.base_type_name
2720
- and self.literal_value == other.literal_value
2721
- )
2722
- else:
2723
- return NotImplemented
2724
-
2725
-
2726
- class LiteralType(ProperType):
2727
- """The type of a Literal instance. Literal[Value]
2728
-
2729
- A Literal always consists of:
2730
-
2731
- 1. A native Python object corresponding to the contained inner value
2732
- 2. A fallback for this Literal. The fallback also corresponds to the
2733
- parent type this Literal subtypes.
2734
-
2735
- For example, 'Literal[42]' is represented as
2736
- 'LiteralType(value=42, fallback=instance_of_int)'
2737
-
2738
- As another example, `Literal[Color.RED]` (where Color is an enum) is
2739
- represented as `LiteralType(value="RED", fallback=instance_of_color)'.
2740
- """
2741
-
2742
- __slots__ = ("value", "fallback", "_hash")
2743
-
2744
- def __init__(
2745
- self, value: LiteralValue, fallback: Instance, line: int = -1, column: int = -1
2746
- ) -> None:
2747
- super().__init__(line, column)
2748
- self.value = value
2749
- self.fallback = fallback
2750
- self._hash = -1 # Cached hash value
2751
-
2752
- def can_be_false_default(self) -> bool:
2753
- return not self.value
2754
-
2755
- def can_be_true_default(self) -> bool:
2756
- return bool(self.value)
2757
-
2758
- def accept(self, visitor: TypeVisitor[T]) -> T:
2759
- return visitor.visit_literal_type(self)
2760
-
2761
- def __hash__(self) -> int:
2762
- if self._hash == -1:
2763
- self._hash = hash((self.value, self.fallback))
2764
- return self._hash
2765
-
2766
- def __eq__(self, other: object) -> bool:
2767
- if isinstance(other, LiteralType):
2768
- return self.fallback == other.fallback and self.value == other.value
2769
- else:
2770
- return NotImplemented
2771
-
2772
- def is_enum_literal(self) -> bool:
2773
- return self.fallback.type.is_enum
2774
-
2775
- def value_repr(self) -> str:
2776
- """Returns the string representation of the underlying type.
2777
-
2778
- This function is almost equivalent to running `repr(self.value)`,
2779
- except it includes some additional logic to correctly handle cases
2780
- where the value is a string, byte string, a unicode string, or an enum.
2781
- """
2782
- raw = repr(self.value)
2783
- fallback_name = self.fallback.type.fullname
2784
-
2785
- # If this is backed by an enum,
2786
- if self.is_enum_literal():
2787
- return f"{fallback_name}.{self.value}"
2788
-
2789
- if fallback_name == "builtins.bytes":
2790
- # Note: 'builtins.bytes' only appears in Python 3, so we want to
2791
- # explicitly prefix with a "b"
2792
- return "b" + raw
2793
- else:
2794
- # 'builtins.str' could mean either depending on context, but either way
2795
- # we don't prefix: it's the "native" string. And of course, if value is
2796
- # some other type, we just return that string repr directly.
2797
- return raw
2798
-
2799
- def serialize(self) -> JsonDict | str:
2800
- return {
2801
- ".class": "LiteralType",
2802
- "value": self.value,
2803
- "fallback": self.fallback.serialize(),
2804
- }
2805
-
2806
- @classmethod
2807
- def deserialize(cls, data: JsonDict) -> LiteralType:
2808
- assert data[".class"] == "LiteralType"
2809
- return LiteralType(value=data["value"], fallback=Instance.deserialize(data["fallback"]))
2810
-
2811
- def is_singleton_type(self) -> bool:
2812
- return self.is_enum_literal() or isinstance(self.value, bool)
2813
-
2814
-
2815
- class UnionType(ProperType):
2816
- """The union type Union[T1, ..., Tn] (at least one type argument)."""
2817
-
2818
- __slots__ = ("items", "is_evaluated", "uses_pep604_syntax")
2819
-
2820
- def __init__(
2821
- self,
2822
- items: Sequence[Type],
2823
- line: int = -1,
2824
- column: int = -1,
2825
- is_evaluated: bool = True,
2826
- uses_pep604_syntax: bool = False,
2827
- ) -> None:
2828
- super().__init__(line, column)
2829
- # We must keep this false to avoid crashes during semantic analysis.
2830
- # TODO: maybe switch this to True during type-checking pass?
2831
- self.items = flatten_nested_unions(items, handle_type_alias_type=False)
2832
- # is_evaluated should be set to false for type comments and string literals
2833
- self.is_evaluated = is_evaluated
2834
- # uses_pep604_syntax is True if Union uses OR syntax (X | Y)
2835
- self.uses_pep604_syntax = uses_pep604_syntax
2836
-
2837
- def can_be_true_default(self) -> bool:
2838
- return any(item.can_be_true for item in self.items)
2839
-
2840
- def can_be_false_default(self) -> bool:
2841
- return any(item.can_be_false for item in self.items)
2842
-
2843
- def __hash__(self) -> int:
2844
- return hash(frozenset(self.items))
2845
-
2846
- def __eq__(self, other: object) -> bool:
2847
- if not isinstance(other, UnionType):
2848
- return NotImplemented
2849
- return frozenset(self.items) == frozenset(other.items)
2850
-
2851
- @overload
2852
- @staticmethod
2853
- def make_union(
2854
- items: Sequence[ProperType], line: int = -1, column: int = -1
2855
- ) -> ProperType: ...
2856
-
2857
- @overload
2858
- @staticmethod
2859
- def make_union(items: Sequence[Type], line: int = -1, column: int = -1) -> Type: ...
2860
-
2861
- @staticmethod
2862
- def make_union(items: Sequence[Type], line: int = -1, column: int = -1) -> Type:
2863
- if len(items) > 1:
2864
- return UnionType(items, line, column)
2865
- elif len(items) == 1:
2866
- return items[0]
2867
- else:
2868
- return UninhabitedType()
2869
-
2870
- def length(self) -> int:
2871
- return len(self.items)
2872
-
2873
- def accept(self, visitor: TypeVisitor[T]) -> T:
2874
- return visitor.visit_union_type(self)
2875
-
2876
- def relevant_items(self) -> list[Type]:
2877
- """Removes NoneTypes from Unions when strict Optional checking is off."""
2878
- if state.strict_optional:
2879
- return self.items
2880
- else:
2881
- return [i for i in self.items if not isinstance(get_proper_type(i), NoneType)]
2882
-
2883
- def serialize(self) -> JsonDict:
2884
- return {".class": "UnionType", "items": [t.serialize() for t in self.items]}
2885
-
2886
- @classmethod
2887
- def deserialize(cls, data: JsonDict) -> UnionType:
2888
- assert data[".class"] == "UnionType"
2889
- return UnionType([deserialize_type(t) for t in data["items"]])
2890
-
2891
-
2892
- class PartialType(ProperType):
2893
- """Type such as List[?] where type arguments are unknown, or partial None type.
2894
-
2895
- These are used for inferring types in multiphase initialization such as this:
2896
-
2897
- x = [] # x gets a partial type List[?], as item type is unknown
2898
- x.append(1) # partial type gets replaced with normal type List[int]
2899
-
2900
- Or with None:
2901
-
2902
- x = None # x gets a partial type None
2903
- if c:
2904
- x = 1 # Infer actual type int for x
2905
- """
2906
-
2907
- __slots__ = ("type", "var", "value_type")
2908
-
2909
- # None for the 'None' partial type; otherwise a generic class
2910
- type: mypy.nodes.TypeInfo | None
2911
- var: mypy.nodes.Var
2912
- # For partial defaultdict[K, V], the type V (K is unknown). If V is generic,
2913
- # the type argument is Any and will be replaced later.
2914
- value_type: Instance | None
2915
-
2916
- def __init__(
2917
- self,
2918
- type: mypy.nodes.TypeInfo | None,
2919
- var: mypy.nodes.Var,
2920
- value_type: Instance | None = None,
2921
- ) -> None:
2922
- super().__init__()
2923
- self.type = type
2924
- self.var = var
2925
- self.value_type = value_type
2926
-
2927
- def accept(self, visitor: TypeVisitor[T]) -> T:
2928
- return visitor.visit_partial_type(self)
2929
-
2930
-
2931
- class EllipsisType(ProperType):
2932
- """The type ... (ellipsis).
2933
-
2934
- This is not a real type but a syntactic AST construct, used in Callable[..., T], for example.
2935
-
2936
- A semantically analyzed type will never have ellipsis types.
2937
- """
2938
-
2939
- __slots__ = ()
2940
-
2941
- def accept(self, visitor: TypeVisitor[T]) -> T:
2942
- assert isinstance(visitor, SyntheticTypeVisitor)
2943
- ret: T = visitor.visit_ellipsis_type(self)
2944
- return ret
2945
-
2946
- def serialize(self) -> JsonDict:
2947
- assert False, "Synthetic types don't serialize"
2948
-
2949
-
2950
- class TypeType(ProperType):
2951
- """For types like Type[User].
2952
-
2953
- This annotates variables that are class objects, constrained by
2954
- the type argument. See PEP 484 for more details.
2955
-
2956
- We may encounter expressions whose values are specific classes;
2957
- those are represented as callables (possibly overloaded)
2958
- corresponding to the class's constructor's signature and returning
2959
- an instance of that class. The difference with Type[C] is that
2960
- those callables always represent the exact class given as the
2961
- return type; Type[C] represents any class that's a subclass of C,
2962
- and C may also be a type variable or a union (or Any).
2963
-
2964
- Many questions around subtype relationships between Type[C1] and
2965
- def(...) -> C2 are answered by looking at the subtype
2966
- relationships between C1 and C2, since Type[] is considered
2967
- covariant.
2968
-
2969
- There's an unsolved problem with constructor signatures (also
2970
- unsolved in PEP 484): calling a variable whose type is Type[C]
2971
- assumes the constructor signature for C, even though a subclass of
2972
- C might completely change the constructor signature. For now we
2973
- just assume that users of Type[C] are careful not to do that (in
2974
- the future we might detect when they are violating that
2975
- assumption).
2976
- """
2977
-
2978
- __slots__ = ("item",)
2979
-
2980
- # This can't be everything, but it can be a class reference,
2981
- # a generic class instance, a union, Any, a type variable...
2982
- item: ProperType
2983
-
2984
- def __init__(
2985
- self,
2986
- item: Bogus[Instance | AnyType | TypeVarType | TupleType | NoneType | CallableType],
2987
- *,
2988
- line: int = -1,
2989
- column: int = -1,
2990
- ) -> None:
2991
- """To ensure Type[Union[A, B]] is always represented as Union[Type[A], Type[B]], item of
2992
- type UnionType must be handled through make_normalized static method.
2993
- """
2994
- super().__init__(line, column)
2995
- self.item = item
2996
-
2997
- @staticmethod
2998
- def make_normalized(item: Type, *, line: int = -1, column: int = -1) -> ProperType:
2999
- item = get_proper_type(item)
3000
- if isinstance(item, UnionType):
3001
- return UnionType.make_union(
3002
- [TypeType.make_normalized(union_item) for union_item in item.items],
3003
- line=line,
3004
- column=column,
3005
- )
3006
- return TypeType(item, line=line, column=column) # type: ignore[arg-type]
3007
-
3008
- def accept(self, visitor: TypeVisitor[T]) -> T:
3009
- return visitor.visit_type_type(self)
3010
-
3011
- def __hash__(self) -> int:
3012
- return hash(self.item)
3013
-
3014
- def __eq__(self, other: object) -> bool:
3015
- if not isinstance(other, TypeType):
3016
- return NotImplemented
3017
- return self.item == other.item
3018
-
3019
- def serialize(self) -> JsonDict:
3020
- return {".class": "TypeType", "item": self.item.serialize()}
3021
-
3022
- @classmethod
3023
- def deserialize(cls, data: JsonDict) -> Type:
3024
- assert data[".class"] == "TypeType"
3025
- return TypeType.make_normalized(deserialize_type(data["item"]))
3026
-
3027
-
3028
- class PlaceholderType(ProperType):
3029
- """Temporary, yet-unknown type during semantic analysis.
3030
-
3031
- This is needed when there's a reference to a type before the real symbol
3032
- table entry of the target type is available (specifically, we use a
3033
- temporary PlaceholderNode symbol node). Consider this example:
3034
-
3035
- class str(Sequence[str]): ...
3036
-
3037
- We use a PlaceholderType for the 'str' in 'Sequence[str]' since we can't create
3038
- a TypeInfo for 'str' until all base classes have been resolved. We'll soon
3039
- perform another analysis iteration which replaces the base class with a complete
3040
- type without any placeholders. After semantic analysis, no placeholder types must
3041
- exist.
3042
- """
3043
-
3044
- __slots__ = ("fullname", "args")
3045
-
3046
- def __init__(self, fullname: str | None, args: list[Type], line: int) -> None:
3047
- super().__init__(line)
3048
- self.fullname = fullname # Must be a valid full name of an actual node (or None).
3049
- self.args = args
3050
-
3051
- def accept(self, visitor: TypeVisitor[T]) -> T:
3052
- assert isinstance(visitor, SyntheticTypeVisitor)
3053
- ret: T = visitor.visit_placeholder_type(self)
3054
- return ret
3055
-
3056
- def __hash__(self) -> int:
3057
- return hash((self.fullname, tuple(self.args)))
3058
-
3059
- def __eq__(self, other: object) -> bool:
3060
- if not isinstance(other, PlaceholderType):
3061
- return NotImplemented
3062
- return self.fullname == other.fullname and self.args == other.args
3063
-
3064
- def serialize(self) -> str:
3065
- # We should never get here since all placeholders should be replaced
3066
- # during semantic analysis.
3067
- assert False, f"Internal error: unresolved placeholder type {self.fullname}"
3068
-
3069
-
3070
- @overload
3071
- def get_proper_type(typ: None) -> None: ...
3072
-
3073
-
3074
- @overload
3075
- def get_proper_type(typ: Type) -> ProperType: ...
3076
-
3077
-
3078
- def get_proper_type(typ: Type | None) -> ProperType | None:
3079
- """Get the expansion of a type alias type.
3080
-
3081
- If the type is already a proper type, this is a no-op. Use this function
3082
- wherever a decision is made on a call like e.g. 'if isinstance(typ, UnionType): ...',
3083
- because 'typ' in this case may be an alias to union. Note: if after making the decision
3084
- on the isinstance() call you pass on the original type (and not one of its components)
3085
- it is recommended to *always* pass on the unexpanded alias.
3086
- """
3087
- if typ is None:
3088
- return None
3089
- if isinstance(typ, TypeGuardedType): # type: ignore[misc]
3090
- typ = typ.type_guard
3091
- while isinstance(typ, TypeAliasType):
3092
- typ = typ._expand_once()
3093
- # TODO: store the name of original type alias on this type, so we can show it in errors.
3094
- return cast(ProperType, typ)
3095
-
3096
-
3097
- @overload
3098
- def get_proper_types(types: list[Type] | tuple[Type, ...]) -> list[ProperType]: # type: ignore[overload-overlap]
3099
- ...
3100
-
3101
-
3102
- @overload
3103
- def get_proper_types(
3104
- types: list[Type | None] | tuple[Type | None, ...]
3105
- ) -> list[ProperType | None]: ...
3106
-
3107
-
3108
- def get_proper_types(
3109
- types: list[Type] | list[Type | None] | tuple[Type | None, ...]
3110
- ) -> list[ProperType] | list[ProperType | None]:
3111
- if isinstance(types, list):
3112
- typelist = types
3113
- # Optimize for the common case so that we don't need to allocate anything
3114
- if not any(
3115
- isinstance(t, (TypeAliasType, TypeGuardedType)) for t in typelist # type: ignore[misc]
3116
- ):
3117
- return cast("list[ProperType]", typelist)
3118
- return [get_proper_type(t) for t in typelist]
3119
- else:
3120
- return [get_proper_type(t) for t in types]
3121
-
3122
-
3123
- # We split off the type visitor base classes to another module
3124
- # to make it easier to gradually get modules working with mypyc.
3125
- # Import them here, after the types are defined.
3126
- # This is intended as a re-export also.
3127
- from mypy.type_visitor import (
3128
- ALL_STRATEGY as ALL_STRATEGY,
3129
- ANY_STRATEGY as ANY_STRATEGY,
3130
- BoolTypeQuery as BoolTypeQuery,
3131
- SyntheticTypeVisitor as SyntheticTypeVisitor,
3132
- TypeQuery as TypeQuery,
3133
- TypeTranslator as TypeTranslator,
3134
- TypeVisitor as TypeVisitor,
3135
- )
3136
- from mypy.typetraverser import TypeTraverserVisitor
3137
-
3138
-
3139
- class TypeStrVisitor(SyntheticTypeVisitor[str]):
3140
- """Visitor for pretty-printing types into strings.
3141
-
3142
- This is mostly for debugging/testing.
3143
-
3144
- Do not preserve original formatting.
3145
-
3146
- Notes:
3147
- - Represent unbound types as Foo? or Foo?[...].
3148
- - Represent the NoneType type as None.
3149
- """
3150
-
3151
- def __init__(self, id_mapper: IdMapper | None = None, *, options: Options) -> None:
3152
- self.id_mapper = id_mapper
3153
- self.any_as_dots = False
3154
- self.options = options
3155
-
3156
- def visit_unbound_type(self, t: UnboundType) -> str:
3157
- s = t.name + "?"
3158
- if t.args:
3159
- s += f"[{self.list_str(t.args)}]"
3160
- return s
3161
-
3162
- def visit_type_list(self, t: TypeList) -> str:
3163
- return f"<TypeList {self.list_str(t.items)}>"
3164
-
3165
- def visit_callable_argument(self, t: CallableArgument) -> str:
3166
- typ = t.typ.accept(self)
3167
- if t.name is None:
3168
- return f"{t.constructor}({typ})"
3169
- else:
3170
- return f"{t.constructor}({typ}, {t.name})"
3171
-
3172
- def visit_any(self, t: AnyType) -> str:
3173
- if self.any_as_dots and t.type_of_any == TypeOfAny.special_form:
3174
- return "..."
3175
- return "Any"
3176
-
3177
- def visit_none_type(self, t: NoneType) -> str:
3178
- return "None"
3179
-
3180
- def visit_uninhabited_type(self, t: UninhabitedType) -> str:
3181
- return "Never"
3182
-
3183
- def visit_erased_type(self, t: ErasedType) -> str:
3184
- return "<Erased>"
3185
-
3186
- def visit_deleted_type(self, t: DeletedType) -> str:
3187
- if t.source is None:
3188
- return "<Deleted>"
3189
- else:
3190
- return f"<Deleted '{t.source}'>"
3191
-
3192
- def visit_instance(self, t: Instance) -> str:
3193
- if t.last_known_value and not t.args:
3194
- # Instances with a literal fallback should never be generic. If they are,
3195
- # something went wrong so we fall back to showing the full Instance repr.
3196
- s = f"{t.last_known_value.accept(self)}?"
3197
- else:
3198
- s = t.type.fullname or t.type.name or "<???>"
3199
-
3200
- if t.args:
3201
- if t.type.fullname == "builtins.tuple":
3202
- assert len(t.args) == 1
3203
- s += f"[{self.list_str(t.args)}, ...]"
3204
- else:
3205
- s += f"[{self.list_str(t.args)}]"
3206
- elif t.type.has_type_var_tuple_type and len(t.type.type_vars) == 1:
3207
- s += "[()]"
3208
- if self.id_mapper:
3209
- s += f"<{self.id_mapper.id(t.type)}>"
3210
- return s
3211
-
3212
- def visit_type_var(self, t: TypeVarType) -> str:
3213
- if t.name is None:
3214
- # Anonymous type variable type (only numeric id).
3215
- s = f"`{t.id}"
3216
- else:
3217
- # Named type variable type.
3218
- s = f"{t.name}`{t.id}"
3219
- if self.id_mapper and t.upper_bound:
3220
- s += f"(upper_bound={t.upper_bound.accept(self)})"
3221
- if t.has_default():
3222
- s += f" = {t.default.accept(self)}"
3223
- return s
3224
-
3225
- def visit_param_spec(self, t: ParamSpecType) -> str:
3226
- # prefixes are displayed as Concatenate
3227
- s = ""
3228
- if t.prefix.arg_types:
3229
- s += f"[{self.list_str(t.prefix.arg_types)}, **"
3230
- if t.name is None:
3231
- # Anonymous type variable type (only numeric id).
3232
- s += f"`{t.id}"
3233
- else:
3234
- # Named type variable type.
3235
- s += f"{t.name_with_suffix()}`{t.id}"
3236
- if t.prefix.arg_types:
3237
- s += "]"
3238
- if t.has_default():
3239
- s += f" = {t.default.accept(self)}"
3240
- return s
3241
-
3242
- def visit_parameters(self, t: Parameters) -> str:
3243
- # This is copied from visit_callable -- is there a way to decrease duplication?
3244
- if t.is_ellipsis_args:
3245
- return "..."
3246
-
3247
- s = ""
3248
- bare_asterisk = False
3249
- for i in range(len(t.arg_types)):
3250
- if s != "":
3251
- s += ", "
3252
- if t.arg_kinds[i].is_named() and not bare_asterisk:
3253
- s += "*, "
3254
- bare_asterisk = True
3255
- if t.arg_kinds[i] == ARG_STAR:
3256
- s += "*"
3257
- if t.arg_kinds[i] == ARG_STAR2:
3258
- s += "**"
3259
- name = t.arg_names[i]
3260
- if name:
3261
- s += f"{name}: "
3262
- r = t.arg_types[i].accept(self)
3263
-
3264
- s += r
3265
-
3266
- if t.arg_kinds[i].is_optional():
3267
- s += " ="
3268
-
3269
- return f"[{s}]"
3270
-
3271
- def visit_type_var_tuple(self, t: TypeVarTupleType) -> str:
3272
- if t.name is None:
3273
- # Anonymous type variable type (only numeric id).
3274
- s = f"`{t.id}"
3275
- else:
3276
- # Named type variable type.
3277
- s = f"{t.name}`{t.id}"
3278
- if t.has_default():
3279
- s += f" = {t.default.accept(self)}"
3280
- return s
3281
-
3282
- def visit_callable_type(self, t: CallableType) -> str:
3283
- param_spec = t.param_spec()
3284
- if param_spec is not None:
3285
- num_skip = 2
3286
- else:
3287
- num_skip = 0
3288
-
3289
- s = ""
3290
- asterisk = False
3291
- for i in range(len(t.arg_types) - num_skip):
3292
- if s != "":
3293
- s += ", "
3294
- if t.arg_kinds[i].is_named() and not asterisk:
3295
- s += "*, "
3296
- asterisk = True
3297
- if t.arg_kinds[i] == ARG_STAR:
3298
- s += "*"
3299
- asterisk = True
3300
- if t.arg_kinds[i] == ARG_STAR2:
3301
- s += "**"
3302
- name = t.arg_names[i]
3303
- if name:
3304
- s += name + ": "
3305
- type_str = t.arg_types[i].accept(self)
3306
- if t.arg_kinds[i] == ARG_STAR2 and t.unpack_kwargs:
3307
- type_str = f"Unpack[{type_str}]"
3308
- s += type_str
3309
- if t.arg_kinds[i].is_optional():
3310
- s += " ="
3311
-
3312
- if param_spec is not None:
3313
- n = param_spec.name
3314
- if s:
3315
- s += ", "
3316
- s += f"*{n}.args, **{n}.kwargs"
3317
- if param_spec.has_default():
3318
- s += f" = {param_spec.default.accept(self)}"
3319
-
3320
- s = f"({s})"
3321
-
3322
- if not isinstance(get_proper_type(t.ret_type), NoneType):
3323
- if t.type_guard is not None:
3324
- s += f" -> TypeGuard[{t.type_guard.accept(self)}]"
3325
- elif t.type_is is not None:
3326
- s += f" -> TypeIs[{t.type_is.accept(self)}]"
3327
- else:
3328
- s += f" -> {t.ret_type.accept(self)}"
3329
-
3330
- if t.variables:
3331
- vs = []
3332
- for var in t.variables:
3333
- if isinstance(var, TypeVarType):
3334
- # We reimplement TypeVarType.__repr__ here in order to support id_mapper.
3335
- if var.values:
3336
- vals = f"({', '.join(val.accept(self) for val in var.values)})"
3337
- vs.append(f"{var.name} in {vals}")
3338
- elif not is_named_instance(var.upper_bound, "builtins.object"):
3339
- vs.append(
3340
- f"{var.name} <: {var.upper_bound.accept(self)}{f' = {var.default.accept(self)}' if var.has_default() else ''}"
3341
- )
3342
- else:
3343
- vs.append(
3344
- f"{var.name}{f' = {var.default.accept(self)}' if var.has_default() else ''}"
3345
- )
3346
- else:
3347
- # For other TypeVarLikeTypes, use the name and default
3348
- vs.append(
3349
- f"{var.name}{f' = {var.default.accept(self)}' if var.has_default() else ''}"
3350
- )
3351
- s = f"[{', '.join(vs)}] {s}"
3352
-
3353
- return f"def {s}"
3354
-
3355
- def visit_overloaded(self, t: Overloaded) -> str:
3356
- a = []
3357
- for i in t.items:
3358
- a.append(i.accept(self))
3359
- return f"Overload({', '.join(a)})"
3360
-
3361
- def visit_tuple_type(self, t: TupleType) -> str:
3362
- s = self.list_str(t.items) or "()"
3363
- tuple_name = "tuple" if self.options.use_lowercase_names() else "Tuple"
3364
- if t.partial_fallback and t.partial_fallback.type:
3365
- fallback_name = t.partial_fallback.type.fullname
3366
- if fallback_name != "builtins.tuple":
3367
- return f"{tuple_name}[{s}, fallback={t.partial_fallback.accept(self)}]"
3368
- return f"{tuple_name}[{s}]"
3369
-
3370
- def visit_typeddict_type(self, t: TypedDictType) -> str:
3371
- def item_str(name: str, typ: str) -> str:
3372
- if name in t.required_keys:
3373
- return f"{name!r}: {typ}"
3374
- else:
3375
- return f"{name!r}?: {typ}"
3376
-
3377
- s = (
3378
- "{"
3379
- + ", ".join(item_str(name, typ.accept(self)) for name, typ in t.items.items())
3380
- + "}"
3381
- )
3382
- prefix = ""
3383
- if t.fallback and t.fallback.type:
3384
- if t.fallback.type.fullname not in TPDICT_FB_NAMES:
3385
- prefix = repr(t.fallback.type.fullname) + ", "
3386
- return f"TypedDict({prefix}{s})"
3387
-
3388
- def visit_raw_expression_type(self, t: RawExpressionType) -> str:
3389
- return repr(t.literal_value)
3390
-
3391
- def visit_literal_type(self, t: LiteralType) -> str:
3392
- return f"Literal[{t.value_repr()}]"
3393
-
3394
- def visit_union_type(self, t: UnionType) -> str:
3395
- s = self.list_str(t.items)
3396
- return f"Union[{s}]"
3397
-
3398
- def visit_partial_type(self, t: PartialType) -> str:
3399
- if t.type is None:
3400
- return "<partial None>"
3401
- else:
3402
- return "<partial {}[{}]>".format(t.type.name, ", ".join(["?"] * len(t.type.type_vars)))
3403
-
3404
- def visit_ellipsis_type(self, t: EllipsisType) -> str:
3405
- return "..."
3406
-
3407
- def visit_type_type(self, t: TypeType) -> str:
3408
- if self.options.use_lowercase_names():
3409
- type_name = "type"
3410
- else:
3411
- type_name = "Type"
3412
- return f"{type_name}[{t.item.accept(self)}]"
3413
-
3414
- def visit_placeholder_type(self, t: PlaceholderType) -> str:
3415
- return f"<placeholder {t.fullname}>"
3416
-
3417
- def visit_type_alias_type(self, t: TypeAliasType) -> str:
3418
- if t.alias is not None:
3419
- unrolled, recursed = t._partial_expansion()
3420
- self.any_as_dots = recursed
3421
- type_str = unrolled.accept(self)
3422
- self.any_as_dots = False
3423
- return type_str
3424
- return "<alias (unfixed)>"
3425
-
3426
- def visit_unpack_type(self, t: UnpackType) -> str:
3427
- return f"Unpack[{t.type.accept(self)}]"
3428
-
3429
- def list_str(self, a: Iterable[Type]) -> str:
3430
- """Convert items of an array to strings (pretty-print types)
3431
- and join the results with commas.
3432
- """
3433
- res = []
3434
- for t in a:
3435
- res.append(t.accept(self))
3436
- return ", ".join(res)
3437
-
3438
-
3439
- class TrivialSyntheticTypeTranslator(TypeTranslator, SyntheticTypeVisitor[Type]):
3440
- """A base class for type translators that need to be run during semantic analysis."""
3441
-
3442
- def visit_placeholder_type(self, t: PlaceholderType) -> Type:
3443
- return t
3444
-
3445
- def visit_callable_argument(self, t: CallableArgument) -> Type:
3446
- return t
3447
-
3448
- def visit_ellipsis_type(self, t: EllipsisType) -> Type:
3449
- return t
3450
-
3451
- def visit_raw_expression_type(self, t: RawExpressionType) -> Type:
3452
- return t
3453
-
3454
- def visit_type_list(self, t: TypeList) -> Type:
3455
- return t
3456
-
3457
-
3458
- class UnrollAliasVisitor(TrivialSyntheticTypeTranslator):
3459
- def __init__(self, initial_aliases: set[TypeAliasType]) -> None:
3460
- self.recursed = False
3461
- self.initial_aliases = initial_aliases
3462
-
3463
- def visit_type_alias_type(self, t: TypeAliasType) -> Type:
3464
- if t in self.initial_aliases:
3465
- self.recursed = True
3466
- return AnyType(TypeOfAny.special_form)
3467
- # Create a new visitor on encountering a new type alias, so that an alias like
3468
- # A = Tuple[B, B]
3469
- # B = int
3470
- # will not be detected as recursive on the second encounter of B.
3471
- subvisitor = UnrollAliasVisitor(self.initial_aliases | {t})
3472
- result = get_proper_type(t).accept(subvisitor)
3473
- if subvisitor.recursed:
3474
- self.recursed = True
3475
- return result
3476
-
3477
-
3478
- def is_named_instance(t: Type, fullnames: str | tuple[str, ...]) -> TypeGuard[Instance]:
3479
- if not isinstance(fullnames, tuple):
3480
- fullnames = (fullnames,)
3481
-
3482
- t = get_proper_type(t)
3483
- return isinstance(t, Instance) and t.type.fullname in fullnames
3484
-
3485
-
3486
- class LocationSetter(TypeTraverserVisitor):
3487
- # TODO: Should we update locations of other Type subclasses?
3488
- def __init__(self, line: int, column: int) -> None:
3489
- self.line = line
3490
- self.column = column
3491
-
3492
- def visit_instance(self, typ: Instance) -> None:
3493
- typ.line = self.line
3494
- typ.column = self.column
3495
- super().visit_instance(typ)
3496
-
3497
-
3498
- class HasTypeVars(BoolTypeQuery):
3499
- def __init__(self) -> None:
3500
- super().__init__(ANY_STRATEGY)
3501
- self.skip_alias_target = True
3502
-
3503
- def visit_type_var(self, t: TypeVarType) -> bool:
3504
- return True
3505
-
3506
- def visit_type_var_tuple(self, t: TypeVarTupleType) -> bool:
3507
- return True
3508
-
3509
- def visit_param_spec(self, t: ParamSpecType) -> bool:
3510
- return True
3511
-
3512
-
3513
- def has_type_vars(typ: Type) -> bool:
3514
- """Check if a type contains any type variables (recursively)."""
3515
- return typ.accept(HasTypeVars())
3516
-
3517
-
3518
- class HasRecursiveType(BoolTypeQuery):
3519
- def __init__(self) -> None:
3520
- super().__init__(ANY_STRATEGY)
3521
-
3522
- def visit_type_alias_type(self, t: TypeAliasType) -> bool:
3523
- return t.is_recursive or self.query_types(t.args)
3524
-
3525
-
3526
- # Use singleton since this is hot (note: call reset() before using)
3527
- _has_recursive_type: Final = HasRecursiveType()
3528
-
3529
-
3530
- def has_recursive_types(typ: Type) -> bool:
3531
- """Check if a type contains any recursive aliases (recursively)."""
3532
- _has_recursive_type.reset()
3533
- return typ.accept(_has_recursive_type)
3534
-
3535
-
3536
- def split_with_prefix_and_suffix(
3537
- types: tuple[Type, ...], prefix: int, suffix: int
3538
- ) -> tuple[tuple[Type, ...], tuple[Type, ...], tuple[Type, ...]]:
3539
- if len(types) <= prefix + suffix:
3540
- types = extend_args_for_prefix_and_suffix(types, prefix, suffix)
3541
- if suffix:
3542
- return types[:prefix], types[prefix:-suffix], types[-suffix:]
3543
- else:
3544
- return types[:prefix], types[prefix:], ()
3545
-
3546
-
3547
- def extend_args_for_prefix_and_suffix(
3548
- types: tuple[Type, ...], prefix: int, suffix: int
3549
- ) -> tuple[Type, ...]:
3550
- """Extend list of types by eating out from variadic tuple to satisfy prefix and suffix."""
3551
- idx = None
3552
- item = None
3553
- for i, t in enumerate(types):
3554
- if isinstance(t, UnpackType):
3555
- p_type = get_proper_type(t.type)
3556
- if isinstance(p_type, Instance) and p_type.type.fullname == "builtins.tuple":
3557
- item = p_type.args[0]
3558
- idx = i
3559
- break
3560
-
3561
- if idx is None:
3562
- return types
3563
- assert item is not None
3564
- if idx < prefix:
3565
- start = (item,) * (prefix - idx)
3566
- else:
3567
- start = ()
3568
- if len(types) - idx - 1 < suffix:
3569
- end = (item,) * (suffix - len(types) + idx + 1)
3570
- else:
3571
- end = ()
3572
- return types[:idx] + start + (types[idx],) + end + types[idx + 1 :]
3573
-
3574
-
3575
- def flatten_nested_unions(
3576
- types: Sequence[Type], handle_type_alias_type: bool = True
3577
- ) -> list[Type]:
3578
- """Flatten nested unions in a type list."""
3579
- if not isinstance(types, list):
3580
- typelist = list(types)
3581
- else:
3582
- typelist = cast("list[Type]", types)
3583
-
3584
- # Fast path: most of the time there is nothing to flatten
3585
- if not any(isinstance(t, (TypeAliasType, UnionType)) for t in typelist): # type: ignore[misc]
3586
- return typelist
3587
-
3588
- flat_items: list[Type] = []
3589
- for t in typelist:
3590
- tp = get_proper_type(t) if handle_type_alias_type else t
3591
- if isinstance(tp, ProperType) and isinstance(tp, UnionType):
3592
- flat_items.extend(
3593
- flatten_nested_unions(tp.items, handle_type_alias_type=handle_type_alias_type)
3594
- )
3595
- else:
3596
- # Must preserve original aliases when possible.
3597
- flat_items.append(t)
3598
- return flat_items
3599
-
3600
-
3601
- def find_unpack_in_list(items: Sequence[Type]) -> int | None:
3602
- unpack_index: int | None = None
3603
- for i, item in enumerate(items):
3604
- if isinstance(item, UnpackType):
3605
- # We cannot fail here, so we must check this in an earlier
3606
- # semanal phase.
3607
- # Funky code here avoids mypyc narrowing the type of unpack_index.
3608
- old_index = unpack_index
3609
- assert old_index is None
3610
- # Don't return so that we can also sanity check there is only one.
3611
- unpack_index = i
3612
- return unpack_index
3613
-
3614
-
3615
- def flatten_nested_tuples(types: Sequence[Type]) -> list[Type]:
3616
- """Recursively flatten TupleTypes nested with Unpack.
3617
-
3618
- For example this will transform
3619
- Tuple[A, Unpack[Tuple[B, Unpack[Tuple[C, D]]]]]
3620
- into
3621
- Tuple[A, B, C, D]
3622
- """
3623
- res = []
3624
- for typ in types:
3625
- if not isinstance(typ, UnpackType):
3626
- res.append(typ)
3627
- continue
3628
- p_type = get_proper_type(typ.type)
3629
- if not isinstance(p_type, TupleType):
3630
- res.append(typ)
3631
- continue
3632
- res.extend(flatten_nested_tuples(p_type.items))
3633
- return res
3634
-
3635
-
3636
- def is_literal_type(typ: ProperType, fallback_fullname: str, value: LiteralValue) -> bool:
3637
- """Check if this type is a LiteralType with the given fallback type and value."""
3638
- if isinstance(typ, Instance) and typ.last_known_value:
3639
- typ = typ.last_known_value
3640
- return (
3641
- isinstance(typ, LiteralType)
3642
- and typ.fallback.type.fullname == fallback_fullname
3643
- and typ.value == value
3644
- )
3645
-
3646
-
3647
- names: Final = globals().copy()
3648
- names.pop("NOT_READY", None)
3649
- deserialize_map: Final = {
3650
- key: obj.deserialize
3651
- for key, obj in names.items()
3652
- if isinstance(obj, type) and issubclass(obj, Type) and obj is not Type
3653
- }
3654
-
3655
-
3656
- def callable_with_ellipsis(any_type: AnyType, ret_type: Type, fallback: Instance) -> CallableType:
3657
- """Construct type Callable[..., ret_type]."""
3658
- return CallableType(
3659
- [any_type, any_type],
3660
- [ARG_STAR, ARG_STAR2],
3661
- [None, None],
3662
- ret_type=ret_type,
3663
- fallback=fallback,
3664
- is_ellipsis_args=True,
3665
- )
3666
-
3667
-
3668
- def remove_dups(types: list[T]) -> list[T]:
3669
- if len(types) <= 1:
3670
- return types
3671
- # Get unique elements in order of appearance
3672
- all_types: set[T] = set()
3673
- new_types: list[T] = []
3674
- for t in types:
3675
- if t not in all_types:
3676
- new_types.append(t)
3677
- all_types.add(t)
3678
- return new_types
3679
-
3680
-
3681
- def type_vars_as_args(type_vars: Sequence[TypeVarLikeType]) -> tuple[Type, ...]:
3682
- """Represent type variables as they would appear in a type argument list."""
3683
- args: list[Type] = []
3684
- for tv in type_vars:
3685
- if isinstance(tv, TypeVarTupleType):
3686
- args.append(UnpackType(tv))
3687
- else:
3688
- args.append(tv)
3689
- return tuple(args)
3690
-
3691
-
3692
- # This cyclic import is unfortunate, but to avoid it we would need to move away all uses
3693
- # of get_proper_type() from types.py. Majority of them have been removed, but few remaining
3694
- # are quite tricky to get rid of, but ultimately we want to do it at some point.
3695
- from mypy.expandtype import ExpandTypeVisitor
3696
-
3697
-
3698
- class InstantiateAliasVisitor(ExpandTypeVisitor):
3699
- def visit_union_type(self, t: UnionType) -> Type:
3700
- # Unlike regular expand_type(), we don't do any simplification for unions,
3701
- # not even removing strict duplicates. There are three reasons for this:
3702
- # * get_proper_type() is a very hot function, even slightest slow down will
3703
- # cause a perf regression
3704
- # * We want to preserve this historical behaviour, to avoid possible
3705
- # regressions
3706
- # * Simplifying unions may (indirectly) call get_proper_type(), causing
3707
- # infinite recursion.
3708
- return TypeTranslator.visit_union_type(self, t)