jaclang 0.7.34__py3-none-any.whl → 0.8.0__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 (1480) hide show
  1. jaclang/__init__.py +7 -414
  2. jaclang/cli/cli.md +5 -5
  3. jaclang/cli/cli.py +311 -214
  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 +61 -92
  9. jaclang/compiler/larkparse/jac_parser.py +3444 -0
  10. jaclang/compiler/parser.py +1004 -1223
  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 +146 -102
  16. jaclang/compiler/passes/main/def_use_pass.py +64 -269
  17. jaclang/compiler/passes/main/import_pass.py +175 -360
  18. jaclang/compiler/passes/main/inheritance_pass.py +107 -105
  19. jaclang/compiler/passes/main/pyast_gen_pass.py +1129 -1600
  20. jaclang/compiler/passes/main/pyast_load_pass.py +540 -584
  21. jaclang/compiler/passes/main/pybc_gen_pass.py +38 -35
  22. jaclang/compiler/passes/main/pyjac_ast_link_pass.py +46 -160
  23. jaclang/compiler/passes/main/sym_tab_build_pass.py +113 -1202
  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 +23 -0
  66. jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/main.jac +14 -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 +99 -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 +1210 -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 +205 -0
  107. jaclang/compiler/tests/fixtures/codegentext.jac +31 -0
  108. jaclang/compiler/tests/fixtures/fam.jac +10 -10
  109. jaclang/compiler/tests/fixtures/hello_world.jac +1 -1
  110. jaclang/compiler/tests/fixtures/staticcheck.jac +2 -2
  111. jaclang/compiler/tests/test_importer.py +21 -16
  112. jaclang/compiler/tests/test_parser.py +38 -17
  113. jaclang/compiler/{absyntree.py → unitree.py} +1120 -1012
  114. jaclang/langserve/engine.py +183 -171
  115. jaclang/langserve/sem_manager.py +26 -22
  116. jaclang/langserve/server.py +6 -15
  117. jaclang/langserve/tests/fixtures/base_module_structure.jac +7 -7
  118. jaclang/langserve/tests/fixtures/circle.jac +6 -6
  119. jaclang/langserve/tests/fixtures/circle_err.jac +6 -6
  120. jaclang/langserve/tests/fixtures/circle_pure.impl.jac +5 -5
  121. jaclang/langserve/tests/fixtures/circle_pure.jac +7 -7
  122. jaclang/langserve/tests/fixtures/circle_pure_err.impl.jac +2 -2
  123. jaclang/langserve/tests/fixtures/circle_pure_err.jac +7 -7
  124. jaclang/langserve/tests/fixtures/import_include_statements.jac +6 -6
  125. jaclang/langserve/tests/fixtures/rename.jac +6 -6
  126. jaclang/langserve/tests/server_test/test_lang_serve.py +262 -0
  127. jaclang/langserve/tests/server_test/utils.py +115 -0
  128. jaclang/langserve/tests/test_sem_tokens.py +2 -2
  129. jaclang/langserve/tests/test_server.py +41 -23
  130. jaclang/langserve/utils.jac +438 -0
  131. jaclang/runtimelib/{architype.py → archetype.py} +85 -61
  132. jaclang/runtimelib/builtin.py +92 -0
  133. jaclang/runtimelib/constructs.py +11 -13
  134. jaclang/runtimelib/importer.py +63 -51
  135. jaclang/runtimelib/machine.py +1551 -144
  136. jaclang/runtimelib/memory.py +6 -6
  137. jaclang/{plugin → runtimelib}/tests/fixtures/graph_purger.jac +1 -1
  138. jaclang/{plugin → runtimelib}/tests/fixtures/impl_match.jac +2 -2
  139. jaclang/runtimelib/tests/fixtures/impl_match_impl.jac +3 -0
  140. jaclang/{plugin → runtimelib}/tests/fixtures/other_root_access.jac +7 -7
  141. jaclang/{plugin → runtimelib}/tests/fixtures/savable_object.jac +3 -5
  142. jaclang/{plugin → runtimelib}/tests/fixtures/simple_node_connection.jac +6 -6
  143. jaclang/{plugin → runtimelib}/tests/fixtures/simple_persistent.jac +1 -1
  144. jaclang/runtimelib/tests/test_features.py +72 -0
  145. jaclang/{plugin → runtimelib}/tests/test_jaseci.py +6 -5
  146. jaclang/runtimelib/utils.py +31 -63
  147. jaclang/settings.py +1 -6
  148. jaclang/tests/fixtures/{abc.jac → abc_check.jac} +6 -6
  149. jaclang/tests/fixtures/arch_rel_import_creation.jac +4 -4
  150. jaclang/tests/fixtures/async_ability.jac +18 -0
  151. jaclang/tests/fixtures/async_walker.jac +23 -0
  152. jaclang/tests/fixtures/baddy.jac +1 -1
  153. jaclang/tests/fixtures/base_class1.jac +2 -2
  154. jaclang/tests/fixtures/base_class2.jac +2 -2
  155. jaclang/tests/fixtures/base_class_complex_expr.jac +3 -3
  156. jaclang/tests/fixtures/builtin_dotgen.jac +1 -1
  157. jaclang/tests/fixtures/builtin_dotgen_json.jac +21 -0
  158. jaclang/tests/fixtures/byllmissue.jac +1 -1
  159. jaclang/tests/fixtures/chandra_bugs.jac +1 -1
  160. jaclang/tests/fixtures/chandra_bugs2.jac +1 -1
  161. jaclang/tests/fixtures/cls_method.jac +6 -6
  162. jaclang/tests/fixtures/concurrency.jac +39 -0
  163. jaclang/tests/fixtures/connect_traverse_syntax.jac +18 -0
  164. jaclang/tests/fixtures/create_dynamic_archetype.jac +35 -0
  165. jaclang/tests/fixtures/decl_defn_param_name.jac +4 -4
  166. jaclang/tests/fixtures/deep/deeper/__init__.jac +1 -0
  167. jaclang/tests/fixtures/deep/deeper/deep_outer_import.jac +2 -3
  168. jaclang/tests/fixtures/deep/deeper/deep_outer_import2.jac +3 -3
  169. jaclang/tests/fixtures/deep/deeper/snd_lev.jac +2 -2
  170. jaclang/tests/fixtures/deep/mycode.jac +1 -1
  171. jaclang/tests/fixtures/deep/one_lev.jac +3 -4
  172. jaclang/tests/fixtures/deep/one_lev_dup.jac +2 -2
  173. jaclang/tests/fixtures/deep_convert.jac +1 -1
  174. jaclang/tests/fixtures/deep_import.jac +2 -2
  175. jaclang/tests/fixtures/deep_import_interp.jac +8 -0
  176. jaclang/tests/fixtures/deep_import_mods.jac +3 -3
  177. jaclang/tests/fixtures/deferred_field.jac +1 -1
  178. jaclang/tests/fixtures/del_clean.jac +7 -0
  179. jaclang/tests/fixtures/disconn.jac +2 -2
  180. jaclang/tests/fixtures/dynamic_archetype.jac +34 -0
  181. jaclang/tests/fixtures/edge_node_walk.jac +12 -12
  182. jaclang/tests/fixtures/edge_ops.jac +7 -7
  183. jaclang/tests/fixtures/edges_walk.jac +10 -10
  184. jaclang/tests/fixtures/edgetypeissue.jac +1 -1
  185. jaclang/tests/fixtures/enum_inside_archtype.jac +4 -4
  186. jaclang/tests/fixtures/err.impl.jac +1 -1
  187. jaclang/tests/fixtures/err.jac +2 -2
  188. jaclang/tests/fixtures/err_runtime.jac +2 -2
  189. jaclang/tests/fixtures/foo.jac +7 -7
  190. jaclang/tests/fixtures/game1.jac +4 -4
  191. jaclang/tests/fixtures/gendot_bubble_sort.jac +4 -4
  192. jaclang/tests/fixtures/glob_multivar_statement.jac +1 -1
  193. jaclang/tests/fixtures/guess_game.jac +5 -5
  194. jaclang/tests/fixtures/has_goodness.jac +1 -1
  195. jaclang/tests/fixtures/hash_init_check.jac +3 -3
  196. jaclang/tests/fixtures/hello.jac +1 -1
  197. jaclang/tests/fixtures/ignore.jac +3 -3
  198. jaclang/tests/fixtures/ignore_dup.jac +3 -3
  199. jaclang/tests/fixtures/impl_match_confused.impl.jac +1 -1
  200. jaclang/tests/fixtures/import.jac +9 -9
  201. jaclang/tests/fixtures/import_all.jac +1 -1
  202. jaclang/tests/fixtures/index_slice.jac +1 -1
  203. jaclang/tests/fixtures/inherit_check.jac +3 -3
  204. jaclang/tests/fixtures/jac_from_py.py +4 -0
  205. jaclang/tests/fixtures/jacsamp.jac +1 -1
  206. jaclang/tests/fixtures/jactest_main.jac +1 -1
  207. jaclang/tests/fixtures/jp_importer.jac +7 -8
  208. jaclang/tests/fixtures/jp_importer_auto.jac +3 -3
  209. jaclang/tests/fixtures/lambda.jac +2 -2
  210. jaclang/tests/fixtures/needs_import.jac +6 -6
  211. jaclang/tests/fixtures/needs_import_1.jac +1 -1
  212. jaclang/tests/fixtures/needs_import_2.jac +1 -1
  213. jaclang/tests/fixtures/needs_import_3.jac +1 -1
  214. jaclang/tests/fixtures/needs_import_dup.jac +6 -6
  215. jaclang/tests/fixtures/node_del.jac +60 -0
  216. jaclang/tests/fixtures/nosigself.jac +3 -3
  217. jaclang/tests/fixtures/py2jac.py +30 -0
  218. jaclang/tests/fixtures/py_bool_expr.py +7 -0
  219. jaclang/tests/fixtures/py_namedexpr.py +7 -0
  220. jaclang/tests/fixtures/pyfunc_3.py +0 -2
  221. jaclang/tests/fixtures/random_check.jac +5 -5
  222. jaclang/tests/fixtures/simple_archs.jac +2 -2
  223. jaclang/tests/fixtures/simple_walk.jac +52 -0
  224. jaclang/tests/fixtures/slice_vals.jac +3 -3
  225. jaclang/tests/fixtures/sub_abil_sep.jac +3 -3
  226. jaclang/tests/fixtures/sub_abil_sep_multilev.jac +3 -3
  227. jaclang/tests/fixtures/trailing_comma.jac +4 -4
  228. jaclang/tests/fixtures/type_info.jac +5 -5
  229. jaclang/{compiler/passes/main/tests → tests}/fixtures/uninitialized_hasvars.jac +1 -1
  230. jaclang/tests/fixtures/visit_order.jac +4 -4
  231. jaclang/tests/fixtures/walker_override.jac +2 -2
  232. jaclang/tests/fixtures/walker_update.jac +5 -5
  233. jaclang/tests/fixtures/with_context.jac +4 -4
  234. jaclang/tests/test_bugs.py +2 -2
  235. jaclang/tests/test_cli.py +118 -223
  236. jaclang/tests/test_language.py +466 -473
  237. jaclang/tests/test_man_code.py +2 -2
  238. jaclang/tests/test_reference.py +4 -4
  239. jaclang/tests/test_settings.py +16 -16
  240. jaclang/tests/test_typecheck.py +555 -0
  241. jaclang/utils/__init__.py +4 -0
  242. jaclang/utils/helpers.py +12 -27
  243. jaclang/utils/lang_tools.py +84 -74
  244. jaclang/utils/module_resolver.py +69 -0
  245. jaclang/utils/test.py +8 -5
  246. jaclang/utils/tests/test_lang_tools.py +38 -13
  247. jaclang/utils/treeprinter.py +177 -40
  248. jaclang/vendor/__init__.py +1 -2
  249. jaclang/vendor/attr/__init__.py +14 -44
  250. jaclang/vendor/attr/__init__.pyi +155 -321
  251. jaclang/vendor/attr/_cmp.py +25 -15
  252. jaclang/vendor/attr/_cmp.pyi +7 -7
  253. jaclang/vendor/attr/_compat.py +15 -8
  254. jaclang/vendor/attr/_config.py +1 -1
  255. jaclang/vendor/attr/_funcs.py +148 -163
  256. jaclang/vendor/attr/_make.py +859 -855
  257. jaclang/vendor/attr/_next_gen.py +426 -32
  258. jaclang/vendor/attr/converters.py +67 -49
  259. jaclang/vendor/attr/converters.pyi +13 -7
  260. jaclang/vendor/attr/filters.py +17 -11
  261. jaclang/vendor/attr/filters.pyi +3 -3
  262. jaclang/vendor/attr/setters.py +11 -5
  263. jaclang/vendor/attr/setters.pyi +2 -1
  264. jaclang/vendor/attr/validators.py +191 -162
  265. jaclang/vendor/attr/validators.pyi +25 -27
  266. jaclang/vendor/attrs/__init__.py +9 -5
  267. jaclang/vendor/attrs/__init__.pyi +225 -29
  268. jaclang/vendor/attrs-25.3.0.dist-info/INSTALLER +1 -0
  269. jaclang/vendor/{attrs-23.2.0.dist-info → attrs-25.3.0.dist-info}/METADATA +83 -53
  270. jaclang/vendor/attrs-25.3.0.dist-info/RECORD +56 -0
  271. jaclang/vendor/{attrs-23.2.0.dist-info → attrs-25.3.0.dist-info}/WHEEL +1 -1
  272. jaclang/vendor/bin/dmypy +8 -0
  273. jaclang/vendor/bin/mypy +8 -0
  274. jaclang/vendor/bin/mypyc +8 -0
  275. jaclang/vendor/bin/stubgen +8 -0
  276. jaclang/vendor/bin/stubtest +8 -0
  277. jaclang/vendor/cattr/gen.py +2 -2
  278. jaclang/vendor/cattr/preconf/bson.py +1 -0
  279. jaclang/vendor/cattr/preconf/json.py +1 -0
  280. jaclang/vendor/cattr/preconf/msgpack.py +1 -0
  281. jaclang/vendor/cattr/preconf/orjson.py +1 -0
  282. jaclang/vendor/cattr/preconf/pyyaml.py +1 -0
  283. jaclang/vendor/cattr/preconf/tomlkit.py +1 -0
  284. jaclang/vendor/cattr/preconf/ujson.py +1 -0
  285. jaclang/vendor/cattrs/__init__.py +21 -21
  286. jaclang/vendor/cattrs/_compat.py +176 -62
  287. jaclang/vendor/cattrs/_generics.py +5 -3
  288. jaclang/vendor/cattrs/cols.py +289 -0
  289. jaclang/vendor/cattrs/converters.py +505 -187
  290. jaclang/vendor/cattrs/disambiguators.py +118 -45
  291. jaclang/vendor/cattrs/dispatch.py +66 -36
  292. jaclang/vendor/cattrs/fns.py +6 -1
  293. jaclang/vendor/cattrs/gen/__init__.py +365 -202
  294. jaclang/vendor/cattrs/gen/_generics.py +41 -5
  295. jaclang/vendor/cattrs/gen/_lc.py +3 -2
  296. jaclang/vendor/cattrs/gen/_shared.py +39 -32
  297. jaclang/vendor/cattrs/gen/typeddicts.py +75 -88
  298. jaclang/vendor/cattrs/preconf/__init__.py +20 -0
  299. jaclang/vendor/cattrs/preconf/bson.py +7 -8
  300. jaclang/vendor/cattrs/preconf/cbor2.py +3 -0
  301. jaclang/vendor/cattrs/preconf/json.py +8 -4
  302. jaclang/vendor/cattrs/preconf/msgpack.py +3 -0
  303. jaclang/vendor/cattrs/preconf/msgspec.py +185 -0
  304. jaclang/vendor/cattrs/preconf/orjson.py +20 -7
  305. jaclang/vendor/cattrs/preconf/pyyaml.py +15 -3
  306. jaclang/vendor/cattrs/preconf/tomlkit.py +3 -1
  307. jaclang/vendor/cattrs/preconf/ujson.py +3 -0
  308. jaclang/vendor/cattrs/strategies/__init__.py +1 -0
  309. jaclang/vendor/cattrs/strategies/_class_methods.py +1 -1
  310. jaclang/vendor/cattrs/strategies/_subclasses.py +43 -29
  311. jaclang/vendor/cattrs/strategies/_unions.py +47 -24
  312. jaclang/vendor/cattrs/v.py +1 -0
  313. jaclang/vendor/cattrs-24.1.3.dist-info/INSTALLER +1 -0
  314. jaclang/vendor/cattrs-24.1.3.dist-info/METADATA +161 -0
  315. jaclang/vendor/cattrs-24.1.3.dist-info/RECORD +96 -0
  316. jaclang/vendor/{cattrs-23.2.3.dist-info → cattrs-24.1.3.dist-info}/WHEEL +1 -1
  317. jaclang/vendor/lark/__init__.py +38 -38
  318. jaclang/vendor/lark/__pyinstaller/__init__.py +6 -6
  319. jaclang/vendor/lark/__pyinstaller/hook-lark.py +14 -14
  320. jaclang/vendor/lark/ast_utils.py +59 -59
  321. jaclang/vendor/lark/common.py +86 -89
  322. jaclang/vendor/lark/exceptions.py +292 -292
  323. jaclang/vendor/lark/grammar.py +130 -130
  324. jaclang/vendor/lark/grammars/common.lark +59 -59
  325. jaclang/vendor/lark/grammars/lark.lark +62 -62
  326. jaclang/vendor/lark/grammars/python.lark +302 -302
  327. jaclang/vendor/lark/grammars/unicode.lark +7 -7
  328. jaclang/vendor/lark/indenter.py +143 -112
  329. jaclang/vendor/lark/lark.py +658 -661
  330. jaclang/vendor/lark/lexer.py +678 -678
  331. jaclang/vendor/lark/load_grammar.py +1428 -1428
  332. jaclang/vendor/lark/parse_tree_builder.py +391 -391
  333. jaclang/vendor/lark/parser_frontends.py +257 -257
  334. jaclang/vendor/lark/parsers/cyk.py +340 -340
  335. jaclang/vendor/lark/parsers/earley.py +317 -308
  336. jaclang/vendor/lark/parsers/earley_common.py +42 -42
  337. jaclang/vendor/lark/parsers/earley_forest.py +802 -810
  338. jaclang/vendor/lark/parsers/grammar_analysis.py +203 -203
  339. jaclang/vendor/lark/parsers/lalr_analysis.py +332 -332
  340. jaclang/vendor/lark/parsers/lalr_interactive_parser.py +158 -157
  341. jaclang/vendor/lark/parsers/lalr_parser.py +122 -122
  342. jaclang/vendor/lark/parsers/lalr_parser_state.py +110 -110
  343. jaclang/vendor/lark/parsers/xearley.py +165 -165
  344. jaclang/vendor/lark/reconstruct.py +107 -107
  345. jaclang/vendor/lark/tools/__init__.py +70 -71
  346. jaclang/vendor/lark/tools/nearley.py +202 -202
  347. jaclang/vendor/lark/tools/serialize.py +32 -32
  348. jaclang/vendor/lark/tools/standalone.py +196 -196
  349. jaclang/vendor/lark/tree.py +267 -272
  350. jaclang/vendor/lark/tree_matcher.py +186 -186
  351. jaclang/vendor/lark/utils.py +346 -361
  352. jaclang/vendor/lark/visitors.py +596 -593
  353. jaclang/vendor/lark-1.2.2.dist-info/INSTALLER +1 -0
  354. jaclang/vendor/{lark-1.1.9.dist-info → lark-1.2.2.dist-info}/METADATA +48 -47
  355. jaclang/vendor/lark-1.2.2.dist-info/RECORD +83 -0
  356. jaclang/vendor/{mypy_extensions-1.0.0.dist-info → lark-1.2.2.dist-info}/WHEEL +1 -1
  357. jaclang/vendor/{lark-1.1.9.dist-info → lark-1.2.2.dist-info/licenses}/LICENSE +18 -18
  358. jaclang/vendor/lsprotocol-2023.0.1.dist-info/INSTALLER +1 -0
  359. jaclang/vendor/lsprotocol-2023.0.1.dist-info/METADATA +2 -1
  360. jaclang/vendor/lsprotocol-2023.0.1.dist-info/RECORD +17 -10
  361. jaclang/vendor/lsprotocol-2023.0.1.dist-info/WHEEL +1 -1
  362. jaclang/vendor/pluggy/_version.py +7 -2
  363. jaclang/vendor/pluggy-1.5.0.dist-info/INSTALLER +1 -0
  364. jaclang/vendor/pluggy-1.5.0.dist-info/METADATA +6 -5
  365. jaclang/vendor/pluggy-1.5.0.dist-info/RECORD +24 -14
  366. jaclang/vendor/pluggy-1.5.0.dist-info/WHEEL +1 -1
  367. jaclang/vendor/pygls-1.3.1.dist-info/INSTALLER +1 -0
  368. jaclang/vendor/pygls-1.3.1.dist-info/METADATA +2 -2
  369. jaclang/vendor/pygls-1.3.1.dist-info/RECORD +45 -24
  370. jaclang/vendor/pygls-1.3.1.dist-info/WHEEL +1 -1
  371. {jaclang-0.7.34.dist-info → jaclang-0.8.0.dist-info}/METADATA +4 -4
  372. jaclang-0.8.0.dist-info/RECORD +552 -0
  373. {jaclang-0.7.34.dist-info → jaclang-0.8.0.dist-info}/WHEEL +1 -1
  374. jaclang/compiler/.gitignore +0 -1
  375. jaclang/compiler/compile.py +0 -119
  376. jaclang/compiler/passes/main/access_modifier_pass.py +0 -130
  377. jaclang/compiler/passes/main/fuse_typeinfo_pass.py +0 -656
  378. jaclang/compiler/passes/main/py_collect_dep_pass.py +0 -78
  379. jaclang/compiler/passes/main/pyout_pass.py +0 -86
  380. jaclang/compiler/passes/main/registry_pass.py +0 -156
  381. jaclang/compiler/passes/main/schedules.py +0 -47
  382. jaclang/compiler/passes/main/sub_node_tab_pass.py +0 -36
  383. jaclang/compiler/passes/main/tests/fixtures/registry.jac +0 -36
  384. jaclang/compiler/passes/main/tests/test_decl_def_match_pass.py +0 -114
  385. jaclang/compiler/passes/main/tests/test_registry_pass.py +0 -31
  386. jaclang/compiler/passes/main/tests/test_type_check_pass.py +0 -91
  387. jaclang/compiler/passes/main/tests/test_typeinfo_pass.py +0 -29
  388. jaclang/compiler/passes/main/type_check_pass.py +0 -128
  389. jaclang/compiler/passes/tool/schedules.py +0 -18
  390. jaclang/compiler/passes/tool/tests/fixtures/genai/essay_review.jac +0 -36
  391. jaclang/compiler/passes/tool/tests/fixtures/genai/expert_answer.jac +0 -17
  392. jaclang/compiler/passes/tool/tests/fixtures/genai/joke_gen.jac +0 -32
  393. jaclang/compiler/passes/tool/tests/fixtures/genai/odd_word_out.jac +0 -27
  394. jaclang/compiler/passes/tool/tests/fixtures/genai/personality_finder.jac +0 -35
  395. jaclang/compiler/passes/tool/tests/fixtures/genai/text_to_type.jac +0 -25
  396. jaclang/compiler/passes/tool/tests/fixtures/genai/translator.jac +0 -13
  397. jaclang/compiler/passes/tool/tests/fixtures/genai/wikipedia.jac +0 -63
  398. jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/architype_test.jac +0 -13
  399. jaclang/compiler/passes/utils/mypy_ast_build.py +0 -940
  400. jaclang/compiler/py_info.py +0 -22
  401. jaclang/compiler/semtable.py +0 -159
  402. jaclang/compiler/symtable.py +0 -297
  403. jaclang/langserve/utils.py +0 -458
  404. jaclang/plugin/__init__.py +0 -7
  405. jaclang/plugin/builtin.py +0 -57
  406. jaclang/plugin/default.py +0 -1443
  407. jaclang/plugin/feature.py +0 -574
  408. jaclang/plugin/plugin.md +0 -471
  409. jaclang/plugin/spec.py +0 -536
  410. jaclang/plugin/tests/fixtures/impl_match_impl.jac +0 -3
  411. jaclang/plugin/tests/test_features.py +0 -56
  412. jaclang/runtimelib/context.py +0 -191
  413. jaclang/tests/fixtures/create_dynamic_architype.jac +0 -35
  414. jaclang/tests/fixtures/dynamic_architype.jac +0 -34
  415. jaclang/tests/fixtures/impl_grab.impl.jac +0 -5
  416. jaclang/tests/fixtures/mtest.impl.jac +0 -6
  417. jaclang/tests/fixtures/registry.jac +0 -58
  418. jaclang/tests/fixtures/semstr.jac +0 -30
  419. jaclang/tests/main.jac +0 -2
  420. jaclang/utils/profiler.py +0 -62
  421. jaclang/vendor/attrs-23.2.0.dist-info/RECORD +0 -35
  422. jaclang/vendor/cattrs-23.2.3.dist-info/METADATA +0 -221
  423. jaclang/vendor/cattrs-23.2.3.dist-info/RECORD +0 -48
  424. jaclang/vendor/lark-1.1.9.dist-info/RECORD +0 -46
  425. jaclang/vendor/lark-1.1.9.dist-info/WHEEL +0 -5
  426. jaclang/vendor/mypy/__init__.py +0 -1
  427. jaclang/vendor/mypy/__main__.py +0 -37
  428. jaclang/vendor/mypy/api.py +0 -94
  429. jaclang/vendor/mypy/applytype.py +0 -172
  430. jaclang/vendor/mypy/argmap.py +0 -268
  431. jaclang/vendor/mypy/binder.py +0 -538
  432. jaclang/vendor/mypy/bogus_type.py +0 -27
  433. jaclang/vendor/mypy/build.py +0 -3562
  434. jaclang/vendor/mypy/checker.py +0 -8445
  435. jaclang/vendor/mypy/checkexpr.py +0 -6623
  436. jaclang/vendor/mypy/checkmember.py +0 -1363
  437. jaclang/vendor/mypy/checkpattern.py +0 -801
  438. jaclang/vendor/mypy/checkstrformat.py +0 -1109
  439. jaclang/vendor/mypy/config_parser.py +0 -670
  440. jaclang/vendor/mypy/constant_fold.py +0 -187
  441. jaclang/vendor/mypy/constraints.py +0 -1636
  442. jaclang/vendor/mypy/copytype.py +0 -133
  443. jaclang/vendor/mypy/defaults.py +0 -46
  444. jaclang/vendor/mypy/dmypy/__main__.py +0 -6
  445. jaclang/vendor/mypy/dmypy/client.py +0 -749
  446. jaclang/vendor/mypy/dmypy_os.py +0 -42
  447. jaclang/vendor/mypy/dmypy_server.py +0 -1107
  448. jaclang/vendor/mypy/dmypy_util.py +0 -117
  449. jaclang/vendor/mypy/erasetype.py +0 -278
  450. jaclang/vendor/mypy/errorcodes.py +0 -291
  451. jaclang/vendor/mypy/errors.py +0 -1280
  452. jaclang/vendor/mypy/evalexpr.py +0 -205
  453. jaclang/vendor/mypy/expandtype.py +0 -524
  454. jaclang/vendor/mypy/exprtotype.py +0 -209
  455. jaclang/vendor/mypy/fastparse.py +0 -2147
  456. jaclang/vendor/mypy/find_sources.py +0 -243
  457. jaclang/vendor/mypy/fixup.py +0 -428
  458. jaclang/vendor/mypy/freetree.py +0 -23
  459. jaclang/vendor/mypy/fscache.py +0 -309
  460. jaclang/vendor/mypy/fswatcher.py +0 -106
  461. jaclang/vendor/mypy/gclogger.py +0 -47
  462. jaclang/vendor/mypy/git.py +0 -34
  463. jaclang/vendor/mypy/graph_utils.py +0 -112
  464. jaclang/vendor/mypy/indirection.py +0 -121
  465. jaclang/vendor/mypy/infer.py +0 -75
  466. jaclang/vendor/mypy/inspections.py +0 -627
  467. jaclang/vendor/mypy/ipc.py +0 -310
  468. jaclang/vendor/mypy/join.py +0 -871
  469. jaclang/vendor/mypy/literals.py +0 -306
  470. jaclang/vendor/mypy/lookup.py +0 -61
  471. jaclang/vendor/mypy/main.py +0 -1574
  472. jaclang/vendor/mypy/maptype.py +0 -106
  473. jaclang/vendor/mypy/meet.py +0 -1140
  474. jaclang/vendor/mypy/memprofile.py +0 -121
  475. jaclang/vendor/mypy/message_registry.py +0 -329
  476. jaclang/vendor/mypy/messages.py +0 -3186
  477. jaclang/vendor/mypy/metastore.py +0 -225
  478. jaclang/vendor/mypy/mixedtraverser.py +0 -112
  479. jaclang/vendor/mypy/modulefinder.py +0 -875
  480. jaclang/vendor/mypy/moduleinspect.py +0 -184
  481. jaclang/vendor/mypy/mro.py +0 -62
  482. jaclang/vendor/mypy/nodes.py +0 -4115
  483. jaclang/vendor/mypy/operators.py +0 -126
  484. jaclang/vendor/mypy/options.py +0 -556
  485. jaclang/vendor/mypy/parse.py +0 -30
  486. jaclang/vendor/mypy/partially_defined.py +0 -675
  487. jaclang/vendor/mypy/patterns.py +0 -150
  488. jaclang/vendor/mypy/plugin.py +0 -901
  489. jaclang/vendor/mypy/plugins/attrs.py +0 -1166
  490. jaclang/vendor/mypy/plugins/common.py +0 -440
  491. jaclang/vendor/mypy/plugins/ctypes.py +0 -245
  492. jaclang/vendor/mypy/plugins/dataclasses.py +0 -1108
  493. jaclang/vendor/mypy/plugins/default.py +0 -531
  494. jaclang/vendor/mypy/plugins/enums.py +0 -259
  495. jaclang/vendor/mypy/plugins/functools.py +0 -104
  496. jaclang/vendor/mypy/plugins/proper_plugin.py +0 -175
  497. jaclang/vendor/mypy/plugins/singledispatch.py +0 -224
  498. jaclang/vendor/mypy/py.typed +0 -1
  499. jaclang/vendor/mypy/pyinfo.py +0 -78
  500. jaclang/vendor/mypy/reachability.py +0 -362
  501. jaclang/vendor/mypy/refinfo.py +0 -92
  502. jaclang/vendor/mypy/renaming.py +0 -568
  503. jaclang/vendor/mypy/report.py +0 -924
  504. jaclang/vendor/mypy/scope.py +0 -125
  505. jaclang/vendor/mypy/semanal.py +0 -7187
  506. jaclang/vendor/mypy/semanal_classprop.py +0 -187
  507. jaclang/vendor/mypy/semanal_enum.py +0 -253
  508. jaclang/vendor/mypy/semanal_infer.py +0 -128
  509. jaclang/vendor/mypy/semanal_main.py +0 -511
  510. jaclang/vendor/mypy/semanal_namedtuple.py +0 -670
  511. jaclang/vendor/mypy/semanal_newtype.py +0 -273
  512. jaclang/vendor/mypy/semanal_pass1.py +0 -156
  513. jaclang/vendor/mypy/semanal_shared.py +0 -490
  514. jaclang/vendor/mypy/semanal_typeargs.py +0 -265
  515. jaclang/vendor/mypy/semanal_typeddict.py +0 -575
  516. jaclang/vendor/mypy/server/astdiff.py +0 -518
  517. jaclang/vendor/mypy/server/astmerge.py +0 -562
  518. jaclang/vendor/mypy/server/aststrip.py +0 -281
  519. jaclang/vendor/mypy/server/deps.py +0 -1137
  520. jaclang/vendor/mypy/server/mergecheck.py +0 -83
  521. jaclang/vendor/mypy/server/objgraph.py +0 -101
  522. jaclang/vendor/mypy/server/subexpr.py +0 -198
  523. jaclang/vendor/mypy/server/target.py +0 -11
  524. jaclang/vendor/mypy/server/trigger.py +0 -26
  525. jaclang/vendor/mypy/server/update.py +0 -1339
  526. jaclang/vendor/mypy/sharedparse.py +0 -112
  527. jaclang/vendor/mypy/solve.py +0 -562
  528. jaclang/vendor/mypy/split_namespace.py +0 -35
  529. jaclang/vendor/mypy/state.py +0 -28
  530. jaclang/vendor/mypy/stats.py +0 -489
  531. jaclang/vendor/mypy/strconv.py +0 -641
  532. jaclang/vendor/mypy/stubdoc.py +0 -491
  533. jaclang/vendor/mypy/stubgen.py +0 -1886
  534. jaclang/vendor/mypy/stubgenc.py +0 -993
  535. jaclang/vendor/mypy/stubinfo.py +0 -173
  536. jaclang/vendor/mypy/stubtest.py +0 -2079
  537. jaclang/vendor/mypy/stubutil.py +0 -834
  538. jaclang/vendor/mypy/subtypes.py +0 -1980
  539. jaclang/vendor/mypy/suggestions.py +0 -1046
  540. jaclang/vendor/mypy/test/config.py +0 -28
  541. jaclang/vendor/mypy/test/data.py +0 -821
  542. jaclang/vendor/mypy/test/helpers.py +0 -476
  543. jaclang/vendor/mypy/test/meta/_pytest.py +0 -72
  544. jaclang/vendor/mypy/test/meta/test_diff_helper.py +0 -47
  545. jaclang/vendor/mypy/test/meta/test_parse_data.py +0 -73
  546. jaclang/vendor/mypy/test/meta/test_update_data.py +0 -135
  547. jaclang/vendor/mypy/test/test_find_sources.py +0 -376
  548. jaclang/vendor/mypy/test/test_ref_info.py +0 -45
  549. jaclang/vendor/mypy/test/testapi.py +0 -45
  550. jaclang/vendor/mypy/test/testargs.py +0 -77
  551. jaclang/vendor/mypy/test/testcheck.py +0 -322
  552. jaclang/vendor/mypy/test/testcmdline.py +0 -152
  553. jaclang/vendor/mypy/test/testconstraints.py +0 -134
  554. jaclang/vendor/mypy/test/testdaemon.py +0 -132
  555. jaclang/vendor/mypy/test/testdeps.py +0 -77
  556. jaclang/vendor/mypy/test/testdiff.py +0 -67
  557. jaclang/vendor/mypy/test/testerrorstream.py +0 -46
  558. jaclang/vendor/mypy/test/testfinegrained.py +0 -438
  559. jaclang/vendor/mypy/test/testfinegrainedcache.py +0 -18
  560. jaclang/vendor/mypy/test/testformatter.py +0 -85
  561. jaclang/vendor/mypy/test/testfscache.py +0 -101
  562. jaclang/vendor/mypy/test/testgraph.py +0 -83
  563. jaclang/vendor/mypy/test/testinfer.py +0 -373
  564. jaclang/vendor/mypy/test/testipc.py +0 -119
  565. jaclang/vendor/mypy/test/testmerge.py +0 -238
  566. jaclang/vendor/mypy/test/testmodulefinder.py +0 -278
  567. jaclang/vendor/mypy/test/testmypyc.py +0 -14
  568. jaclang/vendor/mypy/test/testparse.py +0 -107
  569. jaclang/vendor/mypy/test/testpep561.py +0 -211
  570. jaclang/vendor/mypy/test/testpythoneval.py +0 -117
  571. jaclang/vendor/mypy/test/testreports.py +0 -55
  572. jaclang/vendor/mypy/test/testsemanal.py +0 -209
  573. jaclang/vendor/mypy/test/testsolve.py +0 -285
  574. jaclang/vendor/mypy/test/teststubgen.py +0 -1412
  575. jaclang/vendor/mypy/test/teststubinfo.py +0 -12
  576. jaclang/vendor/mypy/test/teststubtest.py +0 -2492
  577. jaclang/vendor/mypy/test/testsubtypes.py +0 -303
  578. jaclang/vendor/mypy/test/testtransform.py +0 -64
  579. jaclang/vendor/mypy/test/testtypegen.py +0 -83
  580. jaclang/vendor/mypy/test/testtypes.py +0 -1551
  581. jaclang/vendor/mypy/test/testutil.py +0 -111
  582. jaclang/vendor/mypy/test/typefixture.py +0 -415
  583. jaclang/vendor/mypy/test/update_data.py +0 -87
  584. jaclang/vendor/mypy/test/visitors.py +0 -63
  585. jaclang/vendor/mypy/traverser.py +0 -961
  586. jaclang/vendor/mypy/treetransform.py +0 -800
  587. jaclang/vendor/mypy/tvar_scope.py +0 -169
  588. jaclang/vendor/mypy/type_visitor.py +0 -564
  589. jaclang/vendor/mypy/typeanal.py +0 -2596
  590. jaclang/vendor/mypy/typeops.py +0 -1082
  591. jaclang/vendor/mypy/types.py +0 -3708
  592. jaclang/vendor/mypy/types_utils.py +0 -166
  593. jaclang/vendor/mypy/typeshed/LICENSE +0 -237
  594. jaclang/vendor/mypy/typeshed/stdlib/VERSIONS +0 -309
  595. jaclang/vendor/mypy/typeshed/stdlib/__future__.pyi +0 -36
  596. jaclang/vendor/mypy/typeshed/stdlib/__main__.pyi +0 -3
  597. jaclang/vendor/mypy/typeshed/stdlib/_ast.pyi +0 -591
  598. jaclang/vendor/mypy/typeshed/stdlib/_bisect.pyi +0 -84
  599. jaclang/vendor/mypy/typeshed/stdlib/_bootlocale.pyi +0 -1
  600. jaclang/vendor/mypy/typeshed/stdlib/_codecs.pyi +0 -133
  601. jaclang/vendor/mypy/typeshed/stdlib/_collections_abc.pyi +0 -94
  602. jaclang/vendor/mypy/typeshed/stdlib/_compat_pickle.pyi +0 -8
  603. jaclang/vendor/mypy/typeshed/stdlib/_compression.pyi +0 -25
  604. jaclang/vendor/mypy/typeshed/stdlib/_csv.pyi +0 -90
  605. jaclang/vendor/mypy/typeshed/stdlib/_ctypes.pyi +0 -207
  606. jaclang/vendor/mypy/typeshed/stdlib/_curses.pyi +0 -566
  607. jaclang/vendor/mypy/typeshed/stdlib/_decimal.pyi +0 -281
  608. jaclang/vendor/mypy/typeshed/stdlib/_dummy_thread.pyi +0 -33
  609. jaclang/vendor/mypy/typeshed/stdlib/_dummy_threading.pyi +0 -164
  610. jaclang/vendor/mypy/typeshed/stdlib/_heapq.pyi +0 -11
  611. jaclang/vendor/mypy/typeshed/stdlib/_imp.pyi +0 -28
  612. jaclang/vendor/mypy/typeshed/stdlib/_json.pyi +0 -49
  613. jaclang/vendor/mypy/typeshed/stdlib/_locale.pyi +0 -100
  614. jaclang/vendor/mypy/typeshed/stdlib/_lsprof.pyi +0 -35
  615. jaclang/vendor/mypy/typeshed/stdlib/_markupbase.pyi +0 -16
  616. jaclang/vendor/mypy/typeshed/stdlib/_msi.pyi +0 -92
  617. jaclang/vendor/mypy/typeshed/stdlib/_operator.pyi +0 -147
  618. jaclang/vendor/mypy/typeshed/stdlib/_osx_support.pyi +0 -34
  619. jaclang/vendor/mypy/typeshed/stdlib/_posixsubprocess.pyi +0 -33
  620. jaclang/vendor/mypy/typeshed/stdlib/_py_abc.pyi +0 -14
  621. jaclang/vendor/mypy/typeshed/stdlib/_pydecimal.pyi +0 -43
  622. jaclang/vendor/mypy/typeshed/stdlib/_random.pyi +0 -12
  623. jaclang/vendor/mypy/typeshed/stdlib/_sitebuiltins.pyi +0 -16
  624. jaclang/vendor/mypy/typeshed/stdlib/_socket.pyi +0 -803
  625. jaclang/vendor/mypy/typeshed/stdlib/_stat.pyi +0 -103
  626. jaclang/vendor/mypy/typeshed/stdlib/_thread.pyi +0 -59
  627. jaclang/vendor/mypy/typeshed/stdlib/_threading_local.pyi +0 -17
  628. jaclang/vendor/mypy/typeshed/stdlib/_tkinter.pyi +0 -121
  629. jaclang/vendor/mypy/typeshed/stdlib/_tracemalloc.pyi +0 -17
  630. jaclang/vendor/mypy/typeshed/stdlib/_typeshed/__init__.pyi +0 -347
  631. jaclang/vendor/mypy/typeshed/stdlib/_typeshed/dbapi.pyi +0 -37
  632. jaclang/vendor/mypy/typeshed/stdlib/_typeshed/wsgi.pyi +0 -44
  633. jaclang/vendor/mypy/typeshed/stdlib/_typeshed/xml.pyi +0 -9
  634. jaclang/vendor/mypy/typeshed/stdlib/_warnings.pyi +0 -55
  635. jaclang/vendor/mypy/typeshed/stdlib/_weakref.pyi +0 -41
  636. jaclang/vendor/mypy/typeshed/stdlib/_weakrefset.pyi +0 -51
  637. jaclang/vendor/mypy/typeshed/stdlib/_winapi.pyi +0 -255
  638. jaclang/vendor/mypy/typeshed/stdlib/abc.pyi +0 -51
  639. jaclang/vendor/mypy/typeshed/stdlib/aifc.pyi +0 -91
  640. jaclang/vendor/mypy/typeshed/stdlib/antigravity.pyi +0 -3
  641. jaclang/vendor/mypy/typeshed/stdlib/argparse.pyi +0 -595
  642. jaclang/vendor/mypy/typeshed/stdlib/array.pyi +0 -92
  643. jaclang/vendor/mypy/typeshed/stdlib/ast.pyi +0 -277
  644. jaclang/vendor/mypy/typeshed/stdlib/asynchat.pyi +0 -21
  645. jaclang/vendor/mypy/typeshed/stdlib/asyncio/__init__.pyi +0 -41
  646. jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_events.pyi +0 -440
  647. jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_futures.pyi +0 -19
  648. jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_subprocess.pyi +0 -63
  649. jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_tasks.pyi +0 -9
  650. jaclang/vendor/mypy/typeshed/stdlib/asyncio/constants.pyi +0 -20
  651. jaclang/vendor/mypy/typeshed/stdlib/asyncio/coroutines.pyi +0 -26
  652. jaclang/vendor/mypy/typeshed/stdlib/asyncio/events.pyi +0 -580
  653. jaclang/vendor/mypy/typeshed/stdlib/asyncio/exceptions.pyi +0 -43
  654. jaclang/vendor/mypy/typeshed/stdlib/asyncio/format_helpers.pyi +0 -20
  655. jaclang/vendor/mypy/typeshed/stdlib/asyncio/futures.pyi +0 -57
  656. jaclang/vendor/mypy/typeshed/stdlib/asyncio/locks.pyi +0 -121
  657. jaclang/vendor/mypy/typeshed/stdlib/asyncio/log.pyi +0 -3
  658. jaclang/vendor/mypy/typeshed/stdlib/asyncio/mixins.pyi +0 -9
  659. jaclang/vendor/mypy/typeshed/stdlib/asyncio/proactor_events.pyi +0 -64
  660. jaclang/vendor/mypy/typeshed/stdlib/asyncio/protocols.pyi +0 -34
  661. jaclang/vendor/mypy/typeshed/stdlib/asyncio/queues.pyi +0 -47
  662. jaclang/vendor/mypy/typeshed/stdlib/asyncio/runners.pyi +0 -32
  663. jaclang/vendor/mypy/typeshed/stdlib/asyncio/selector_events.pyi +0 -8
  664. jaclang/vendor/mypy/typeshed/stdlib/asyncio/sslproto.pyi +0 -165
  665. jaclang/vendor/mypy/typeshed/stdlib/asyncio/staggered.pyi +0 -10
  666. jaclang/vendor/mypy/typeshed/stdlib/asyncio/streams.pyi +0 -153
  667. jaclang/vendor/mypy/typeshed/stdlib/asyncio/subprocess.pyi +0 -229
  668. jaclang/vendor/mypy/typeshed/stdlib/asyncio/taskgroups.pyi +0 -25
  669. jaclang/vendor/mypy/typeshed/stdlib/asyncio/tasks.pyi +0 -497
  670. jaclang/vendor/mypy/typeshed/stdlib/asyncio/threads.pyi +0 -9
  671. jaclang/vendor/mypy/typeshed/stdlib/asyncio/timeouts.pyi +0 -19
  672. jaclang/vendor/mypy/typeshed/stdlib/asyncio/transports.pyi +0 -47
  673. jaclang/vendor/mypy/typeshed/stdlib/asyncio/trsock.pyi +0 -94
  674. jaclang/vendor/mypy/typeshed/stdlib/asyncio/unix_events.pyi +0 -196
  675. jaclang/vendor/mypy/typeshed/stdlib/asyncio/windows_events.pyi +0 -85
  676. jaclang/vendor/mypy/typeshed/stdlib/asyncio/windows_utils.pyi +0 -49
  677. jaclang/vendor/mypy/typeshed/stdlib/asyncore.pyi +0 -90
  678. jaclang/vendor/mypy/typeshed/stdlib/atexit.pyi +0 -12
  679. jaclang/vendor/mypy/typeshed/stdlib/audioop.pyi +0 -43
  680. jaclang/vendor/mypy/typeshed/stdlib/base64.pyi +0 -59
  681. jaclang/vendor/mypy/typeshed/stdlib/bdb.pyi +0 -102
  682. jaclang/vendor/mypy/typeshed/stdlib/binascii.pyi +0 -36
  683. jaclang/vendor/mypy/typeshed/stdlib/binhex.pyi +0 -45
  684. jaclang/vendor/mypy/typeshed/stdlib/bisect.pyi +0 -4
  685. jaclang/vendor/mypy/typeshed/stdlib/builtins.pyi +0 -1936
  686. jaclang/vendor/mypy/typeshed/stdlib/bz2.pyi +0 -146
  687. jaclang/vendor/mypy/typeshed/stdlib/cProfile.pyi +0 -31
  688. jaclang/vendor/mypy/typeshed/stdlib/calendar.pyi +0 -208
  689. jaclang/vendor/mypy/typeshed/stdlib/cgi.pyi +0 -118
  690. jaclang/vendor/mypy/typeshed/stdlib/cgitb.pyi +0 -32
  691. jaclang/vendor/mypy/typeshed/stdlib/chunk.pyi +0 -20
  692. jaclang/vendor/mypy/typeshed/stdlib/cmath.pyi +0 -36
  693. jaclang/vendor/mypy/typeshed/stdlib/cmd.pyi +0 -45
  694. jaclang/vendor/mypy/typeshed/stdlib/code.pyi +0 -33
  695. jaclang/vendor/mypy/typeshed/stdlib/codecs.pyi +0 -285
  696. jaclang/vendor/mypy/typeshed/stdlib/codeop.pyi +0 -13
  697. jaclang/vendor/mypy/typeshed/stdlib/collections/__init__.pyi +0 -485
  698. jaclang/vendor/mypy/typeshed/stdlib/collections/abc.pyi +0 -2
  699. jaclang/vendor/mypy/typeshed/stdlib/colorsys.pyi +0 -13
  700. jaclang/vendor/mypy/typeshed/stdlib/compileall.pyi +0 -111
  701. jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/__init__.pyi +0 -32
  702. jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/_base.pyi +0 -126
  703. jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/process.pyi +0 -233
  704. jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/thread.pyi +0 -80
  705. jaclang/vendor/mypy/typeshed/stdlib/configparser.pyi +0 -313
  706. jaclang/vendor/mypy/typeshed/stdlib/contextlib.pyi +0 -208
  707. jaclang/vendor/mypy/typeshed/stdlib/contextvars.pyi +0 -63
  708. jaclang/vendor/mypy/typeshed/stdlib/copy.pyi +0 -16
  709. jaclang/vendor/mypy/typeshed/stdlib/copyreg.pyi +0 -21
  710. jaclang/vendor/mypy/typeshed/stdlib/crypt.pyi +0 -12
  711. jaclang/vendor/mypy/typeshed/stdlib/csv.pyi +0 -147
  712. jaclang/vendor/mypy/typeshed/stdlib/ctypes/__init__.pyi +0 -187
  713. jaclang/vendor/mypy/typeshed/stdlib/ctypes/_endian.pyi +0 -19
  714. jaclang/vendor/mypy/typeshed/stdlib/ctypes/util.pyi +0 -6
  715. jaclang/vendor/mypy/typeshed/stdlib/ctypes/wintypes.pyi +0 -298
  716. jaclang/vendor/mypy/typeshed/stdlib/curses/__init__.pyi +0 -22
  717. jaclang/vendor/mypy/typeshed/stdlib/curses/ascii.pyi +0 -62
  718. jaclang/vendor/mypy/typeshed/stdlib/curses/has_key.pyi +0 -1
  719. jaclang/vendor/mypy/typeshed/stdlib/curses/panel.pyi +0 -22
  720. jaclang/vendor/mypy/typeshed/stdlib/curses/textpad.pyi +0 -11
  721. jaclang/vendor/mypy/typeshed/stdlib/dataclasses.pyi +0 -315
  722. jaclang/vendor/mypy/typeshed/stdlib/datetime.pyi +0 -295
  723. jaclang/vendor/mypy/typeshed/stdlib/dbm/__init__.pyi +0 -95
  724. jaclang/vendor/mypy/typeshed/stdlib/dbm/dumb.pyi +0 -31
  725. jaclang/vendor/mypy/typeshed/stdlib/dbm/gnu.pyi +0 -41
  726. jaclang/vendor/mypy/typeshed/stdlib/dbm/ndbm.pyi +0 -37
  727. jaclang/vendor/mypy/typeshed/stdlib/decimal.pyi +0 -2
  728. jaclang/vendor/mypy/typeshed/stdlib/difflib.pyi +0 -140
  729. jaclang/vendor/mypy/typeshed/stdlib/dis.pyi +0 -144
  730. jaclang/vendor/mypy/typeshed/stdlib/distutils/__init__.pyi +0 -5
  731. jaclang/vendor/mypy/typeshed/stdlib/distutils/archive_util.pyi +0 -20
  732. jaclang/vendor/mypy/typeshed/stdlib/distutils/bcppcompiler.pyi +0 -3
  733. jaclang/vendor/mypy/typeshed/stdlib/distutils/ccompiler.pyi +0 -152
  734. jaclang/vendor/mypy/typeshed/stdlib/distutils/cmd.pyi +0 -66
  735. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist.pyi +0 -25
  736. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_dumb.pyi +0 -21
  737. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_msi.pyi +0 -45
  738. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_rpm.pyi +0 -52
  739. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_wininst.pyi +0 -16
  740. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build.pyi +0 -31
  741. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_clib.pyi +0 -27
  742. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_ext.pyi +0 -50
  743. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_py.pyi +0 -44
  744. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_scripts.pyi +0 -24
  745. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/check.pyi +0 -39
  746. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/clean.pyi +0 -17
  747. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/config.pyi +0 -83
  748. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install.pyi +0 -63
  749. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_data.pyi +0 -19
  750. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_egg_info.pyi +0 -18
  751. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_headers.pyi +0 -16
  752. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_lib.pyi +0 -25
  753. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_scripts.pyi +0 -18
  754. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/register.pyi +0 -18
  755. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/sdist.pyi +0 -42
  756. jaclang/vendor/mypy/typeshed/stdlib/distutils/command/upload.pyi +0 -17
  757. jaclang/vendor/mypy/typeshed/stdlib/distutils/config.pyi +0 -17
  758. jaclang/vendor/mypy/typeshed/stdlib/distutils/core.pyi +0 -57
  759. jaclang/vendor/mypy/typeshed/stdlib/distutils/cygwinccompiler.pyi +0 -20
  760. jaclang/vendor/mypy/typeshed/stdlib/distutils/debug.pyi +0 -1
  761. jaclang/vendor/mypy/typeshed/stdlib/distutils/dep_util.pyi +0 -3
  762. jaclang/vendor/mypy/typeshed/stdlib/distutils/dir_util.pyi +0 -13
  763. jaclang/vendor/mypy/typeshed/stdlib/distutils/dist.pyi +0 -146
  764. jaclang/vendor/mypy/typeshed/stdlib/distutils/errors.pyi +0 -19
  765. jaclang/vendor/mypy/typeshed/stdlib/distutils/extension.pyi +0 -36
  766. jaclang/vendor/mypy/typeshed/stdlib/distutils/fancy_getopt.pyi +0 -34
  767. jaclang/vendor/mypy/typeshed/stdlib/distutils/file_util.pyi +0 -14
  768. jaclang/vendor/mypy/typeshed/stdlib/distutils/filelist.pyi +0 -50
  769. jaclang/vendor/mypy/typeshed/stdlib/distutils/log.pyi +0 -25
  770. jaclang/vendor/mypy/typeshed/stdlib/distutils/msvccompiler.pyi +0 -3
  771. jaclang/vendor/mypy/typeshed/stdlib/distutils/spawn.pyi +0 -2
  772. jaclang/vendor/mypy/typeshed/stdlib/distutils/sysconfig.pyi +0 -31
  773. jaclang/vendor/mypy/typeshed/stdlib/distutils/text_file.pyi +0 -21
  774. jaclang/vendor/mypy/typeshed/stdlib/distutils/unixccompiler.pyi +0 -3
  775. jaclang/vendor/mypy/typeshed/stdlib/distutils/util.pyi +0 -46
  776. jaclang/vendor/mypy/typeshed/stdlib/distutils/version.pyi +0 -36
  777. jaclang/vendor/mypy/typeshed/stdlib/doctest.pyi +0 -248
  778. jaclang/vendor/mypy/typeshed/stdlib/dummy_threading.pyi +0 -2
  779. jaclang/vendor/mypy/typeshed/stdlib/email/__init__.pyi +0 -29
  780. jaclang/vendor/mypy/typeshed/stdlib/email/_header_value_parser.pyi +0 -392
  781. jaclang/vendor/mypy/typeshed/stdlib/email/_policybase.pyi +0 -51
  782. jaclang/vendor/mypy/typeshed/stdlib/email/base64mime.pyi +0 -13
  783. jaclang/vendor/mypy/typeshed/stdlib/email/charset.pyi +0 -34
  784. jaclang/vendor/mypy/typeshed/stdlib/email/contentmanager.pyi +0 -11
  785. jaclang/vendor/mypy/typeshed/stdlib/email/encoders.pyi +0 -8
  786. jaclang/vendor/mypy/typeshed/stdlib/email/errors.pyi +0 -39
  787. jaclang/vendor/mypy/typeshed/stdlib/email/feedparser.pyi +0 -23
  788. jaclang/vendor/mypy/typeshed/stdlib/email/generator.pyi +0 -40
  789. jaclang/vendor/mypy/typeshed/stdlib/email/header.pyi +0 -31
  790. jaclang/vendor/mypy/typeshed/stdlib/email/headerregistry.pyi +0 -178
  791. jaclang/vendor/mypy/typeshed/stdlib/email/iterators.pyi +0 -12
  792. jaclang/vendor/mypy/typeshed/stdlib/email/message.pyi +0 -165
  793. jaclang/vendor/mypy/typeshed/stdlib/email/mime/application.pyi +0 -17
  794. jaclang/vendor/mypy/typeshed/stdlib/email/mime/audio.pyi +0 -17
  795. jaclang/vendor/mypy/typeshed/stdlib/email/mime/base.pyi +0 -8
  796. jaclang/vendor/mypy/typeshed/stdlib/email/mime/image.pyi +0 -17
  797. jaclang/vendor/mypy/typeshed/stdlib/email/mime/message.pyi +0 -8
  798. jaclang/vendor/mypy/typeshed/stdlib/email/mime/multipart.pyi +0 -18
  799. jaclang/vendor/mypy/typeshed/stdlib/email/mime/nonmultipart.pyi +0 -5
  800. jaclang/vendor/mypy/typeshed/stdlib/email/mime/text.pyi +0 -9
  801. jaclang/vendor/mypy/typeshed/stdlib/email/parser.pyi +0 -26
  802. jaclang/vendor/mypy/typeshed/stdlib/email/policy.pyi +0 -38
  803. jaclang/vendor/mypy/typeshed/stdlib/email/quoprimime.pyi +0 -28
  804. jaclang/vendor/mypy/typeshed/stdlib/email/utils.pyi +0 -70
  805. jaclang/vendor/mypy/typeshed/stdlib/encodings/__init__.pyi +0 -10
  806. jaclang/vendor/mypy/typeshed/stdlib/encodings/utf_8.pyi +0 -21
  807. jaclang/vendor/mypy/typeshed/stdlib/encodings/utf_8_sig.pyi +0 -22
  808. jaclang/vendor/mypy/typeshed/stdlib/ensurepip/__init__.pyi +0 -12
  809. jaclang/vendor/mypy/typeshed/stdlib/enum.pyi +0 -320
  810. jaclang/vendor/mypy/typeshed/stdlib/errno.pyi +0 -222
  811. jaclang/vendor/mypy/typeshed/stdlib/faulthandler.pyi +0 -13
  812. jaclang/vendor/mypy/typeshed/stdlib/fcntl.pyi +0 -127
  813. jaclang/vendor/mypy/typeshed/stdlib/filecmp.pyi +0 -57
  814. jaclang/vendor/mypy/typeshed/stdlib/fileinput.pyi +0 -213
  815. jaclang/vendor/mypy/typeshed/stdlib/fnmatch.pyi +0 -9
  816. jaclang/vendor/mypy/typeshed/stdlib/formatter.pyi +0 -88
  817. jaclang/vendor/mypy/typeshed/stdlib/fractions.pyi +0 -150
  818. jaclang/vendor/mypy/typeshed/stdlib/ftplib.pyi +0 -178
  819. jaclang/vendor/mypy/typeshed/stdlib/functools.pyi +0 -213
  820. jaclang/vendor/mypy/typeshed/stdlib/gc.pyi +0 -37
  821. jaclang/vendor/mypy/typeshed/stdlib/genericpath.pyi +0 -52
  822. jaclang/vendor/mypy/typeshed/stdlib/getopt.pyi +0 -11
  823. jaclang/vendor/mypy/typeshed/stdlib/getpass.pyi +0 -8
  824. jaclang/vendor/mypy/typeshed/stdlib/gettext.pyi +0 -169
  825. jaclang/vendor/mypy/typeshed/stdlib/glob.pyi +0 -42
  826. jaclang/vendor/mypy/typeshed/stdlib/graphlib.pyi +0 -28
  827. jaclang/vendor/mypy/typeshed/stdlib/grp.pyi +0 -22
  828. jaclang/vendor/mypy/typeshed/stdlib/gzip.pyi +0 -160
  829. jaclang/vendor/mypy/typeshed/stdlib/hashlib.pyi +0 -167
  830. jaclang/vendor/mypy/typeshed/stdlib/heapq.pyi +0 -17
  831. jaclang/vendor/mypy/typeshed/stdlib/hmac.pyi +0 -38
  832. jaclang/vendor/mypy/typeshed/stdlib/html/__init__.pyi +0 -6
  833. jaclang/vendor/mypy/typeshed/stdlib/html/entities.pyi +0 -6
  834. jaclang/vendor/mypy/typeshed/stdlib/html/parser.pyi +0 -34
  835. jaclang/vendor/mypy/typeshed/stdlib/http/__init__.pyi +0 -105
  836. jaclang/vendor/mypy/typeshed/stdlib/http/client.pyi +0 -259
  837. jaclang/vendor/mypy/typeshed/stdlib/http/cookiejar.pyi +0 -159
  838. jaclang/vendor/mypy/typeshed/stdlib/http/cookies.pyi +0 -60
  839. jaclang/vendor/mypy/typeshed/stdlib/http/server.pyi +0 -83
  840. jaclang/vendor/mypy/typeshed/stdlib/imaplib.pyi +0 -168
  841. jaclang/vendor/mypy/typeshed/stdlib/imghdr.pyi +0 -17
  842. jaclang/vendor/mypy/typeshed/stdlib/imp.pyi +0 -62
  843. jaclang/vendor/mypy/typeshed/stdlib/importlib/__init__.pyi +0 -24
  844. jaclang/vendor/mypy/typeshed/stdlib/importlib/_abc.pyi +0 -15
  845. jaclang/vendor/mypy/typeshed/stdlib/importlib/abc.pyi +0 -172
  846. jaclang/vendor/mypy/typeshed/stdlib/importlib/machinery.pyi +0 -179
  847. jaclang/vendor/mypy/typeshed/stdlib/importlib/metadata/__init__.pyi +0 -285
  848. jaclang/vendor/mypy/typeshed/stdlib/importlib/metadata/_meta.pyi +0 -49
  849. jaclang/vendor/mypy/typeshed/stdlib/importlib/readers.pyi +0 -68
  850. jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/__init__.pyi +0 -46
  851. jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/abc.pyi +0 -12
  852. jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/readers.pyi +0 -14
  853. jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/simple.pyi +0 -56
  854. jaclang/vendor/mypy/typeshed/stdlib/importlib/simple.pyi +0 -11
  855. jaclang/vendor/mypy/typeshed/stdlib/importlib/util.pyi +0 -43
  856. jaclang/vendor/mypy/typeshed/stdlib/inspect.pyi +0 -632
  857. jaclang/vendor/mypy/typeshed/stdlib/io.pyi +0 -238
  858. jaclang/vendor/mypy/typeshed/stdlib/ipaddress.pyi +0 -208
  859. jaclang/vendor/mypy/typeshed/stdlib/itertools.pyi +0 -273
  860. jaclang/vendor/mypy/typeshed/stdlib/json/__init__.pyi +0 -61
  861. jaclang/vendor/mypy/typeshed/stdlib/json/decoder.pyi +0 -32
  862. jaclang/vendor/mypy/typeshed/stdlib/json/encoder.pyi +0 -40
  863. jaclang/vendor/mypy/typeshed/stdlib/json/tool.pyi +0 -1
  864. jaclang/vendor/mypy/typeshed/stdlib/keyword.pyi +0 -21
  865. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/btm_matcher.pyi +0 -28
  866. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixer_base.pyi +0 -42
  867. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_apply.pyi +0 -8
  868. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_asserts.pyi +0 -10
  869. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_basestring.pyi +0 -8
  870. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_buffer.pyi +0 -8
  871. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_dict.pyi +0 -16
  872. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_except.pyi +0 -14
  873. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_exec.pyi +0 -8
  874. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_execfile.pyi +0 -8
  875. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_exitfunc.pyi +0 -13
  876. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_filter.pyi +0 -9
  877. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_funcattrs.pyi +0 -8
  878. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_future.pyi +0 -8
  879. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_getcwdu.pyi +0 -8
  880. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_has_key.pyi +0 -8
  881. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_idioms.pyi +0 -15
  882. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_import.pyi +0 -16
  883. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_imports.pyi +0 -21
  884. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_imports2.pyi +0 -6
  885. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_input.pyi +0 -11
  886. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_intern.pyi +0 -9
  887. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_isinstance.pyi +0 -8
  888. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_itertools.pyi +0 -9
  889. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_itertools_imports.pyi +0 -7
  890. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_long.pyi +0 -7
  891. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_map.pyi +0 -9
  892. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_metaclass.pyi +0 -17
  893. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_methodattrs.pyi +0 -10
  894. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_ne.pyi +0 -8
  895. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_next.pyi +0 -19
  896. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_nonzero.pyi +0 -8
  897. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_numliterals.pyi +0 -8
  898. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_operator.pyi +0 -12
  899. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_paren.pyi +0 -8
  900. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_print.pyi +0 -12
  901. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_raise.pyi +0 -8
  902. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_raw_input.pyi +0 -8
  903. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_reduce.pyi +0 -8
  904. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_reload.pyi +0 -9
  905. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_renames.pyi +0 -17
  906. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_repr.pyi +0 -8
  907. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_set_literal.pyi +0 -7
  908. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_standarderror.pyi +0 -8
  909. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_sys_exc.pyi +0 -9
  910. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_throw.pyi +0 -8
  911. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_tuple_params.pyi +0 -17
  912. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_types.pyi +0 -8
  913. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_unicode.pyi +0 -12
  914. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_urllib.pyi +0 -15
  915. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_ws_comma.pyi +0 -12
  916. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_xrange.pyi +0 -20
  917. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_xreadlines.pyi +0 -8
  918. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_zip.pyi +0 -9
  919. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/main.pyi +0 -42
  920. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/__init__.pyi +0 -9
  921. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/driver.pyi +0 -27
  922. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/grammar.pyi +0 -24
  923. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/literals.pyi +0 -7
  924. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/parse.pyi +0 -30
  925. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/pgen.pyi +0 -50
  926. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/token.pyi +0 -67
  927. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/tokenize.pyi +0 -96
  928. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pygram.pyi +0 -114
  929. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pytree.pyi +0 -117
  930. jaclang/vendor/mypy/typeshed/stdlib/lib2to3/refactor.pyi +0 -82
  931. jaclang/vendor/mypy/typeshed/stdlib/linecache.pyi +0 -23
  932. jaclang/vendor/mypy/typeshed/stdlib/locale.pyi +0 -152
  933. jaclang/vendor/mypy/typeshed/stdlib/logging/__init__.pyi +0 -658
  934. jaclang/vendor/mypy/typeshed/stdlib/logging/config.pyi +0 -134
  935. jaclang/vendor/mypy/typeshed/stdlib/logging/handlers.pyi +0 -275
  936. jaclang/vendor/mypy/typeshed/stdlib/lzma.pyi +0 -197
  937. jaclang/vendor/mypy/typeshed/stdlib/mailbox.pyi +0 -256
  938. jaclang/vendor/mypy/typeshed/stdlib/mailcap.pyi +0 -11
  939. jaclang/vendor/mypy/typeshed/stdlib/marshal.pyi +0 -33
  940. jaclang/vendor/mypy/typeshed/stdlib/math.pyi +0 -125
  941. jaclang/vendor/mypy/typeshed/stdlib/mimetypes.pyi +0 -46
  942. jaclang/vendor/mypy/typeshed/stdlib/mmap.pyi +0 -113
  943. jaclang/vendor/mypy/typeshed/stdlib/modulefinder.pyi +0 -66
  944. jaclang/vendor/mypy/typeshed/stdlib/msilib/__init__.pyi +0 -177
  945. jaclang/vendor/mypy/typeshed/stdlib/msilib/schema.pyi +0 -94
  946. jaclang/vendor/mypy/typeshed/stdlib/msilib/sequence.pyi +0 -13
  947. jaclang/vendor/mypy/typeshed/stdlib/msilib/text.pyi +0 -7
  948. jaclang/vendor/mypy/typeshed/stdlib/msvcrt.pyi +0 -32
  949. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/__init__.pyi +0 -90
  950. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/connection.pyi +0 -75
  951. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/context.pyi +0 -189
  952. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/dummy/__init__.pyi +0 -77
  953. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/dummy/connection.pyi +0 -39
  954. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/forkserver.pyi +0 -31
  955. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/heap.pyi +0 -36
  956. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/managers.pyi +0 -212
  957. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/pool.pyi +0 -103
  958. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_fork.pyi +0 -23
  959. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_forkserver.pyi +0 -16
  960. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_spawn_posix.pyi +0 -20
  961. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_spawn_win32.pyi +0 -30
  962. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/process.pyi +0 -39
  963. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/queues.pyi +0 -41
  964. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/reduction.pyi +0 -90
  965. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/resource_sharer.pyi +0 -20
  966. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/resource_tracker.pyi +0 -18
  967. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/shared_memory.pyi +0 -40
  968. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/sharedctypes.pyi +0 -107
  969. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/spawn.pyi +0 -32
  970. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/synchronize.pyi +0 -54
  971. jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/util.pyi +0 -98
  972. jaclang/vendor/mypy/typeshed/stdlib/netrc.pyi +0 -23
  973. jaclang/vendor/mypy/typeshed/stdlib/nis.pyi +0 -9
  974. jaclang/vendor/mypy/typeshed/stdlib/nntplib.pyi +0 -125
  975. jaclang/vendor/mypy/typeshed/stdlib/nt.pyi +0 -111
  976. jaclang/vendor/mypy/typeshed/stdlib/ntpath.pyi +0 -119
  977. jaclang/vendor/mypy/typeshed/stdlib/nturl2path.pyi +0 -2
  978. jaclang/vendor/mypy/typeshed/stdlib/numbers.pyi +0 -209
  979. jaclang/vendor/mypy/typeshed/stdlib/opcode.pyi +0 -59
  980. jaclang/vendor/mypy/typeshed/stdlib/operator.pyi +0 -110
  981. jaclang/vendor/mypy/typeshed/stdlib/optparse.pyi +0 -255
  982. jaclang/vendor/mypy/typeshed/stdlib/os/__init__.pyi +0 -1157
  983. jaclang/vendor/mypy/typeshed/stdlib/os/path.pyi +0 -8
  984. jaclang/vendor/mypy/typeshed/stdlib/ossaudiodev.pyi +0 -131
  985. jaclang/vendor/mypy/typeshed/stdlib/parser.pyi +0 -24
  986. jaclang/vendor/mypy/typeshed/stdlib/pathlib.pyi +0 -232
  987. jaclang/vendor/mypy/typeshed/stdlib/pdb.pyi +0 -181
  988. jaclang/vendor/mypy/typeshed/stdlib/pickle.pyi +0 -271
  989. jaclang/vendor/mypy/typeshed/stdlib/pickletools.pyi +0 -167
  990. jaclang/vendor/mypy/typeshed/stdlib/pipes.pyi +0 -16
  991. jaclang/vendor/mypy/typeshed/stdlib/pkgutil.pyi +0 -53
  992. jaclang/vendor/mypy/typeshed/stdlib/platform.pyi +0 -42
  993. jaclang/vendor/mypy/typeshed/stdlib/plistlib.pyi +0 -113
  994. jaclang/vendor/mypy/typeshed/stdlib/poplib.pyi +0 -71
  995. jaclang/vendor/mypy/typeshed/stdlib/posix.pyi +0 -361
  996. jaclang/vendor/mypy/typeshed/stdlib/posixpath.pyi +0 -161
  997. jaclang/vendor/mypy/typeshed/stdlib/pprint.pyi +0 -112
  998. jaclang/vendor/mypy/typeshed/stdlib/profile.pyi +0 -31
  999. jaclang/vendor/mypy/typeshed/stdlib/pstats.pyi +0 -80
  1000. jaclang/vendor/mypy/typeshed/stdlib/pty.pyi +0 -19
  1001. jaclang/vendor/mypy/typeshed/stdlib/pwd.pyi +0 -28
  1002. jaclang/vendor/mypy/typeshed/stdlib/py_compile.pyi +0 -34
  1003. jaclang/vendor/mypy/typeshed/stdlib/pyclbr.pyi +0 -74
  1004. jaclang/vendor/mypy/typeshed/stdlib/pydoc.pyi +0 -261
  1005. jaclang/vendor/mypy/typeshed/stdlib/pydoc_data/__init__.pyi +0 -0
  1006. jaclang/vendor/mypy/typeshed/stdlib/pydoc_data/topics.pyi +0 -1
  1007. jaclang/vendor/mypy/typeshed/stdlib/pyexpat/__init__.pyi +0 -85
  1008. jaclang/vendor/mypy/typeshed/stdlib/pyexpat/errors.pyi +0 -49
  1009. jaclang/vendor/mypy/typeshed/stdlib/pyexpat/model.pyi +0 -11
  1010. jaclang/vendor/mypy/typeshed/stdlib/queue.pyi +0 -66
  1011. jaclang/vendor/mypy/typeshed/stdlib/quopri.pyi +0 -11
  1012. jaclang/vendor/mypy/typeshed/stdlib/random.pyi +0 -138
  1013. jaclang/vendor/mypy/typeshed/stdlib/re.pyi +0 -290
  1014. jaclang/vendor/mypy/typeshed/stdlib/readline.pyi +0 -36
  1015. jaclang/vendor/mypy/typeshed/stdlib/reprlib.pyi +0 -65
  1016. jaclang/vendor/mypy/typeshed/stdlib/resource.pyi +0 -94
  1017. jaclang/vendor/mypy/typeshed/stdlib/rlcompleter.pyi +0 -9
  1018. jaclang/vendor/mypy/typeshed/stdlib/runpy.pyi +0 -24
  1019. jaclang/vendor/mypy/typeshed/stdlib/sched.pyi +0 -42
  1020. jaclang/vendor/mypy/typeshed/stdlib/secrets.pyi +0 -15
  1021. jaclang/vendor/mypy/typeshed/stdlib/select.pyi +0 -155
  1022. jaclang/vendor/mypy/typeshed/stdlib/selectors.pyi +0 -67
  1023. jaclang/vendor/mypy/typeshed/stdlib/shelve.pyi +0 -46
  1024. jaclang/vendor/mypy/typeshed/stdlib/shlex.pyi +0 -63
  1025. jaclang/vendor/mypy/typeshed/stdlib/shutil.pyi +0 -185
  1026. jaclang/vendor/mypy/typeshed/stdlib/signal.pyi +0 -188
  1027. jaclang/vendor/mypy/typeshed/stdlib/site.pyi +0 -27
  1028. jaclang/vendor/mypy/typeshed/stdlib/smtpd.pyi +0 -91
  1029. jaclang/vendor/mypy/typeshed/stdlib/smtplib.pyi +0 -204
  1030. jaclang/vendor/mypy/typeshed/stdlib/sndhdr.pyi +0 -14
  1031. jaclang/vendor/mypy/typeshed/stdlib/socket.pyi +0 -825
  1032. jaclang/vendor/mypy/typeshed/stdlib/socketserver.pyi +0 -168
  1033. jaclang/vendor/mypy/typeshed/stdlib/spwd.pyi +0 -41
  1034. jaclang/vendor/mypy/typeshed/stdlib/sqlite3/__init__.pyi +0 -1
  1035. jaclang/vendor/mypy/typeshed/stdlib/sqlite3/dbapi2.pyi +0 -551
  1036. jaclang/vendor/mypy/typeshed/stdlib/sre_compile.pyi +0 -11
  1037. jaclang/vendor/mypy/typeshed/stdlib/sre_constants.pyi +0 -130
  1038. jaclang/vendor/mypy/typeshed/stdlib/sre_parse.pyi +0 -104
  1039. jaclang/vendor/mypy/typeshed/stdlib/ssl.pyi +0 -537
  1040. jaclang/vendor/mypy/typeshed/stdlib/stat.pyi +0 -1
  1041. jaclang/vendor/mypy/typeshed/stdlib/statistics.pyi +0 -132
  1042. jaclang/vendor/mypy/typeshed/stdlib/string.pyi +0 -83
  1043. jaclang/vendor/mypy/typeshed/stdlib/stringprep.pyi +0 -27
  1044. jaclang/vendor/mypy/typeshed/stdlib/struct.pyi +0 -26
  1045. jaclang/vendor/mypy/typeshed/stdlib/subprocess.pyi +0 -2615
  1046. jaclang/vendor/mypy/typeshed/stdlib/sunau.pyi +0 -86
  1047. jaclang/vendor/mypy/typeshed/stdlib/symbol.pyi +0 -93
  1048. jaclang/vendor/mypy/typeshed/stdlib/symtable.pyi +0 -58
  1049. jaclang/vendor/mypy/typeshed/stdlib/sys/__init__.pyi +0 -373
  1050. jaclang/vendor/mypy/typeshed/stdlib/sys/_monitoring.pyi +0 -52
  1051. jaclang/vendor/mypy/typeshed/stdlib/sysconfig.pyi +0 -48
  1052. jaclang/vendor/mypy/typeshed/stdlib/syslog.pyi +0 -46
  1053. jaclang/vendor/mypy/typeshed/stdlib/tabnanny.pyi +0 -16
  1054. jaclang/vendor/mypy/typeshed/stdlib/tarfile.pyi +0 -441
  1055. jaclang/vendor/mypy/typeshed/stdlib/telnetlib.pyi +0 -122
  1056. jaclang/vendor/mypy/typeshed/stdlib/tempfile.pyi +0 -477
  1057. jaclang/vendor/mypy/typeshed/stdlib/termios.pyi +0 -267
  1058. jaclang/vendor/mypy/typeshed/stdlib/textwrap.pyi +0 -103
  1059. jaclang/vendor/mypy/typeshed/stdlib/this.pyi +0 -2
  1060. jaclang/vendor/mypy/typeshed/stdlib/threading.pyi +0 -187
  1061. jaclang/vendor/mypy/typeshed/stdlib/time.pyi +0 -108
  1062. jaclang/vendor/mypy/typeshed/stdlib/timeit.pyi +0 -32
  1063. jaclang/vendor/mypy/typeshed/stdlib/tkinter/__init__.pyi +0 -3654
  1064. jaclang/vendor/mypy/typeshed/stdlib/tkinter/colorchooser.pyi +0 -20
  1065. jaclang/vendor/mypy/typeshed/stdlib/tkinter/commondialog.pyi +0 -14
  1066. jaclang/vendor/mypy/typeshed/stdlib/tkinter/constants.pyi +0 -80
  1067. jaclang/vendor/mypy/typeshed/stdlib/tkinter/dialog.pyi +0 -16
  1068. jaclang/vendor/mypy/typeshed/stdlib/tkinter/dnd.pyi +0 -20
  1069. jaclang/vendor/mypy/typeshed/stdlib/tkinter/filedialog.pyi +0 -151
  1070. jaclang/vendor/mypy/typeshed/stdlib/tkinter/font.pyi +0 -116
  1071. jaclang/vendor/mypy/typeshed/stdlib/tkinter/messagebox.pyi +0 -44
  1072. jaclang/vendor/mypy/typeshed/stdlib/tkinter/scrolledtext.pyi +0 -9
  1073. jaclang/vendor/mypy/typeshed/stdlib/tkinter/simpledialog.pyi +0 -54
  1074. jaclang/vendor/mypy/typeshed/stdlib/tkinter/tix.pyi +0 -299
  1075. jaclang/vendor/mypy/typeshed/stdlib/tkinter/ttk.pyi +0 -1204
  1076. jaclang/vendor/mypy/typeshed/stdlib/token.pyi +0 -159
  1077. jaclang/vendor/mypy/typeshed/stdlib/tokenize.pyi +0 -177
  1078. jaclang/vendor/mypy/typeshed/stdlib/tomllib.pyi +0 -10
  1079. jaclang/vendor/mypy/typeshed/stdlib/trace.pyi +0 -79
  1080. jaclang/vendor/mypy/typeshed/stdlib/traceback.pyi +0 -262
  1081. jaclang/vendor/mypy/typeshed/stdlib/tracemalloc.pyi +0 -124
  1082. jaclang/vendor/mypy/typeshed/stdlib/tty.pyi +0 -30
  1083. jaclang/vendor/mypy/typeshed/stdlib/turtle.pyi +0 -713
  1084. jaclang/vendor/mypy/typeshed/stdlib/types.pyi +0 -614
  1085. jaclang/vendor/mypy/typeshed/stdlib/typing.pyi +0 -976
  1086. jaclang/vendor/mypy/typeshed/stdlib/typing_extensions.pyi +0 -509
  1087. jaclang/vendor/mypy/typeshed/stdlib/unicodedata.pyi +0 -73
  1088. jaclang/vendor/mypy/typeshed/stdlib/unittest/__init__.pyi +0 -67
  1089. jaclang/vendor/mypy/typeshed/stdlib/unittest/_log.pyi +0 -27
  1090. jaclang/vendor/mypy/typeshed/stdlib/unittest/async_case.pyi +0 -21
  1091. jaclang/vendor/mypy/typeshed/stdlib/unittest/case.pyi +0 -342
  1092. jaclang/vendor/mypy/typeshed/stdlib/unittest/loader.pyi +0 -51
  1093. jaclang/vendor/mypy/typeshed/stdlib/unittest/main.pyi +0 -69
  1094. jaclang/vendor/mypy/typeshed/stdlib/unittest/mock.pyi +0 -430
  1095. jaclang/vendor/mypy/typeshed/stdlib/unittest/result.pyi +0 -47
  1096. jaclang/vendor/mypy/typeshed/stdlib/unittest/runner.pyi +0 -72
  1097. jaclang/vendor/mypy/typeshed/stdlib/unittest/signals.pyi +0 -15
  1098. jaclang/vendor/mypy/typeshed/stdlib/unittest/suite.pyi +0 -22
  1099. jaclang/vendor/mypy/typeshed/stdlib/unittest/util.pyi +0 -23
  1100. jaclang/vendor/mypy/typeshed/stdlib/urllib/__init__.pyi +0 -0
  1101. jaclang/vendor/mypy/typeshed/stdlib/urllib/error.pyi +0 -23
  1102. jaclang/vendor/mypy/typeshed/stdlib/urllib/parse.pyi +0 -210
  1103. jaclang/vendor/mypy/typeshed/stdlib/urllib/request.pyi +0 -400
  1104. jaclang/vendor/mypy/typeshed/stdlib/urllib/response.pyi +0 -43
  1105. jaclang/vendor/mypy/typeshed/stdlib/urllib/robotparser.pyi +0 -20
  1106. jaclang/vendor/mypy/typeshed/stdlib/uu.pyi +0 -13
  1107. jaclang/vendor/mypy/typeshed/stdlib/uuid.pyi +0 -100
  1108. jaclang/vendor/mypy/typeshed/stdlib/warnings.pyi +0 -112
  1109. jaclang/vendor/mypy/typeshed/stdlib/wave.pyi +0 -85
  1110. jaclang/vendor/mypy/typeshed/stdlib/weakref.pyi +0 -149
  1111. jaclang/vendor/mypy/typeshed/stdlib/webbrowser.pyi +0 -74
  1112. jaclang/vendor/mypy/typeshed/stdlib/winreg.pyi +0 -132
  1113. jaclang/vendor/mypy/typeshed/stdlib/winsound.pyi +0 -28
  1114. jaclang/vendor/mypy/typeshed/stdlib/wsgiref/__init__.pyi +0 -0
  1115. jaclang/vendor/mypy/typeshed/stdlib/wsgiref/handlers.pyi +0 -91
  1116. jaclang/vendor/mypy/typeshed/stdlib/wsgiref/headers.pyi +0 -26
  1117. jaclang/vendor/mypy/typeshed/stdlib/wsgiref/simple_server.pyi +0 -37
  1118. jaclang/vendor/mypy/typeshed/stdlib/wsgiref/types.pyi +0 -32
  1119. jaclang/vendor/mypy/typeshed/stdlib/wsgiref/util.pyi +0 -24
  1120. jaclang/vendor/mypy/typeshed/stdlib/wsgiref/validate.pyi +0 -50
  1121. jaclang/vendor/mypy/typeshed/stdlib/xdrlib.pyi +0 -57
  1122. jaclang/vendor/mypy/typeshed/stdlib/xml/__init__.pyi +0 -1
  1123. jaclang/vendor/mypy/typeshed/stdlib/xml/dom/NodeFilter.pyi +0 -19
  1124. jaclang/vendor/mypy/typeshed/stdlib/xml/dom/__init__.pyi +0 -69
  1125. jaclang/vendor/mypy/typeshed/stdlib/xml/dom/domreg.pyi +0 -8
  1126. jaclang/vendor/mypy/typeshed/stdlib/xml/dom/expatbuilder.pyi +0 -100
  1127. jaclang/vendor/mypy/typeshed/stdlib/xml/dom/minicompat.pyi +0 -22
  1128. jaclang/vendor/mypy/typeshed/stdlib/xml/dom/minidom.pyi +0 -404
  1129. jaclang/vendor/mypy/typeshed/stdlib/xml/dom/pulldom.pyi +0 -94
  1130. jaclang/vendor/mypy/typeshed/stdlib/xml/dom/xmlbuilder.pyi +0 -108
  1131. jaclang/vendor/mypy/typeshed/stdlib/xml/etree/ElementInclude.pyi +0 -28
  1132. jaclang/vendor/mypy/typeshed/stdlib/xml/etree/ElementPath.pyi +0 -34
  1133. jaclang/vendor/mypy/typeshed/stdlib/xml/etree/ElementTree.pyi +0 -327
  1134. jaclang/vendor/mypy/typeshed/stdlib/xml/etree/__init__.pyi +0 -0
  1135. jaclang/vendor/mypy/typeshed/stdlib/xml/etree/cElementTree.pyi +0 -1
  1136. jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/__init__.pyi +0 -1
  1137. jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/expat/__init__.pyi +0 -1
  1138. jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/expat/errors.pyi +0 -1
  1139. jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/expat/model.pyi +0 -1
  1140. jaclang/vendor/mypy/typeshed/stdlib/xml/sax/__init__.pyi +0 -25
  1141. jaclang/vendor/mypy/typeshed/stdlib/xml/sax/_exceptions.pyi +0 -19
  1142. jaclang/vendor/mypy/typeshed/stdlib/xml/sax/handler.pyi +0 -55
  1143. jaclang/vendor/mypy/typeshed/stdlib/xml/sax/saxutils.pyi +0 -60
  1144. jaclang/vendor/mypy/typeshed/stdlib/xml/sax/xmlreader.pyi +0 -87
  1145. jaclang/vendor/mypy/typeshed/stdlib/xmlrpc/__init__.pyi +0 -0
  1146. jaclang/vendor/mypy/typeshed/stdlib/xmlrpc/client.pyi +0 -296
  1147. jaclang/vendor/mypy/typeshed/stdlib/xmlrpc/server.pyi +0 -143
  1148. jaclang/vendor/mypy/typeshed/stdlib/xxlimited.pyi +0 -22
  1149. jaclang/vendor/mypy/typeshed/stdlib/zipapp.pyi +0 -20
  1150. jaclang/vendor/mypy/typeshed/stdlib/zipfile/__init__.pyi +0 -306
  1151. jaclang/vendor/mypy/typeshed/stdlib/zipfile/_path.pyi +0 -95
  1152. jaclang/vendor/mypy/typeshed/stdlib/zipimport.pyi +0 -32
  1153. jaclang/vendor/mypy/typeshed/stdlib/zlib.pyi +0 -56
  1154. jaclang/vendor/mypy/typeshed/stdlib/zoneinfo/__init__.pyi +0 -38
  1155. jaclang/vendor/mypy/typeshed/stubs/mypy-extensions/mypy_extensions.pyi +0 -218
  1156. jaclang/vendor/mypy/typestate.py +0 -323
  1157. jaclang/vendor/mypy/typetraverser.py +0 -148
  1158. jaclang/vendor/mypy/typevars.py +0 -93
  1159. jaclang/vendor/mypy/typevartuples.py +0 -32
  1160. jaclang/vendor/mypy/util.py +0 -869
  1161. jaclang/vendor/mypy/version.py +0 -1
  1162. jaclang/vendor/mypy/visitor.py +0 -621
  1163. jaclang/vendor/mypy/xml/mypy-html.css +0 -104
  1164. jaclang/vendor/mypy/xml/mypy-html.xslt +0 -81
  1165. jaclang/vendor/mypy/xml/mypy-txt.xslt +0 -100
  1166. jaclang/vendor/mypy/xml/mypy.xsd +0 -50
  1167. jaclang/vendor/mypy-1.10.0.dist-info/LICENSE +0 -229
  1168. jaclang/vendor/mypy-1.10.0.dist-info/METADATA +0 -48
  1169. jaclang/vendor/mypy-1.10.0.dist-info/RECORD +0 -1241
  1170. jaclang/vendor/mypy-1.10.0.dist-info/WHEEL +0 -6
  1171. jaclang/vendor/mypy-1.10.0.dist-info/entry_points.txt +0 -6
  1172. jaclang/vendor/mypy-1.10.0.dist-info/top_level.txt +0 -3
  1173. jaclang/vendor/mypy_extensions-1.0.0.dist-info/LICENSE +0 -27
  1174. jaclang/vendor/mypy_extensions-1.0.0.dist-info/METADATA +0 -29
  1175. jaclang/vendor/mypy_extensions-1.0.0.dist-info/RECORD +0 -6
  1176. jaclang/vendor/mypy_extensions-1.0.0.dist-info/top_level.txt +0 -1
  1177. jaclang/vendor/mypy_extensions.py +0 -213
  1178. jaclang/vendor/mypyc/README.md +0 -133
  1179. jaclang/vendor/mypyc/__init__.py +0 -0
  1180. jaclang/vendor/mypyc/__main__.py +0 -57
  1181. jaclang/vendor/mypyc/analysis/__init__.py +0 -0
  1182. jaclang/vendor/mypyc/analysis/attrdefined.py +0 -436
  1183. jaclang/vendor/mypyc/analysis/blockfreq.py +0 -32
  1184. jaclang/vendor/mypyc/analysis/dataflow.py +0 -628
  1185. jaclang/vendor/mypyc/analysis/ircheck.py +0 -433
  1186. jaclang/vendor/mypyc/analysis/selfleaks.py +0 -211
  1187. jaclang/vendor/mypyc/build.py +0 -616
  1188. jaclang/vendor/mypyc/codegen/__init__.py +0 -0
  1189. jaclang/vendor/mypyc/codegen/cstring.py +0 -54
  1190. jaclang/vendor/mypyc/codegen/emit.py +0 -1193
  1191. jaclang/vendor/mypyc/codegen/emitclass.py +0 -1060
  1192. jaclang/vendor/mypyc/codegen/emitfunc.py +0 -852
  1193. jaclang/vendor/mypyc/codegen/emitmodule.py +0 -1136
  1194. jaclang/vendor/mypyc/codegen/emitwrapper.py +0 -979
  1195. jaclang/vendor/mypyc/codegen/literals.py +0 -302
  1196. jaclang/vendor/mypyc/common.py +0 -136
  1197. jaclang/vendor/mypyc/crash.py +0 -31
  1198. jaclang/vendor/mypyc/doc/Makefile +0 -20
  1199. jaclang/vendor/mypyc/doc/bool_operations.rst +0 -27
  1200. jaclang/vendor/mypyc/doc/compilation_units.rst +0 -20
  1201. jaclang/vendor/mypyc/doc/conf.py +0 -59
  1202. jaclang/vendor/mypyc/doc/cpython-timings.md +0 -25
  1203. jaclang/vendor/mypyc/doc/dev-intro.md +0 -548
  1204. jaclang/vendor/mypyc/doc/dict_operations.rst +0 -59
  1205. jaclang/vendor/mypyc/doc/differences_from_python.rst +0 -332
  1206. jaclang/vendor/mypyc/doc/float_operations.rst +0 -50
  1207. jaclang/vendor/mypyc/doc/future.md +0 -42
  1208. jaclang/vendor/mypyc/doc/getting_started.rst +0 -240
  1209. jaclang/vendor/mypyc/doc/index.rst +0 -61
  1210. jaclang/vendor/mypyc/doc/int_operations.rst +0 -162
  1211. jaclang/vendor/mypyc/doc/introduction.rst +0 -150
  1212. jaclang/vendor/mypyc/doc/list_operations.rst +0 -65
  1213. jaclang/vendor/mypyc/doc/make.bat +0 -35
  1214. jaclang/vendor/mypyc/doc/native_classes.rst +0 -206
  1215. jaclang/vendor/mypyc/doc/native_operations.rst +0 -55
  1216. jaclang/vendor/mypyc/doc/performance_tips_and_tricks.rst +0 -244
  1217. jaclang/vendor/mypyc/doc/set_operations.rst +0 -47
  1218. jaclang/vendor/mypyc/doc/str_operations.rst +0 -35
  1219. jaclang/vendor/mypyc/doc/tuple_operations.rst +0 -33
  1220. jaclang/vendor/mypyc/doc/using_type_annotations.rst +0 -398
  1221. jaclang/vendor/mypyc/errors.py +0 -29
  1222. jaclang/vendor/mypyc/external/googletest/LICENSE +0 -28
  1223. jaclang/vendor/mypyc/external/googletest/README.md +0 -280
  1224. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-death-test.h +0 -294
  1225. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-message.h +0 -250
  1226. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-param-test.h +0 -1444
  1227. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-param-test.h.pump +0 -510
  1228. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-printers.h +0 -993
  1229. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-spi.h +0 -232
  1230. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-test-part.h +0 -179
  1231. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-typed-test.h +0 -263
  1232. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest.h +0 -2236
  1233. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest_pred_impl.h +0 -358
  1234. jaclang/vendor/mypyc/external/googletest/include/gtest/gtest_prod.h +0 -58
  1235. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/custom/gtest-port.h +0 -69
  1236. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/custom/gtest-printers.h +0 -42
  1237. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/custom/gtest.h +0 -41
  1238. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-death-test-internal.h +0 -319
  1239. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-filepath.h +0 -206
  1240. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-internal.h +0 -1238
  1241. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-linked_ptr.h +0 -243
  1242. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-param-util-generated.h +0 -5146
  1243. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +0 -286
  1244. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-param-util.h +0 -731
  1245. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-port-arch.h +0 -93
  1246. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-port.h +0 -2560
  1247. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-string.h +0 -167
  1248. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-tuple.h +0 -1020
  1249. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-tuple.h.pump +0 -347
  1250. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-type-util.h +0 -3331
  1251. jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-type-util.h.pump +0 -297
  1252. jaclang/vendor/mypyc/external/googletest/make/Makefile +0 -61
  1253. jaclang/vendor/mypyc/external/googletest/src/gtest-all.cc +0 -48
  1254. jaclang/vendor/mypyc/external/googletest/src/gtest-death-test.cc +0 -1342
  1255. jaclang/vendor/mypyc/external/googletest/src/gtest-filepath.cc +0 -387
  1256. jaclang/vendor/mypyc/external/googletest/src/gtest-internal-inl.h +0 -1183
  1257. jaclang/vendor/mypyc/external/googletest/src/gtest-port.cc +0 -1259
  1258. jaclang/vendor/mypyc/external/googletest/src/gtest-printers.cc +0 -373
  1259. jaclang/vendor/mypyc/external/googletest/src/gtest-test-part.cc +0 -110
  1260. jaclang/vendor/mypyc/external/googletest/src/gtest-typed-test.cc +0 -118
  1261. jaclang/vendor/mypyc/external/googletest/src/gtest.cc +0 -5388
  1262. jaclang/vendor/mypyc/external/googletest/src/gtest_main.cc +0 -38
  1263. jaclang/vendor/mypyc/ir/__init__.py +0 -0
  1264. jaclang/vendor/mypyc/ir/class_ir.py +0 -499
  1265. jaclang/vendor/mypyc/ir/func_ir.py +0 -370
  1266. jaclang/vendor/mypyc/ir/module_ir.py +0 -88
  1267. jaclang/vendor/mypyc/ir/ops.py +0 -1727
  1268. jaclang/vendor/mypyc/ir/pprint.py +0 -516
  1269. jaclang/vendor/mypyc/ir/rtypes.py +0 -1038
  1270. jaclang/vendor/mypyc/irbuild/__init__.py +0 -0
  1271. jaclang/vendor/mypyc/irbuild/ast_helpers.py +0 -123
  1272. jaclang/vendor/mypyc/irbuild/builder.py +0 -1394
  1273. jaclang/vendor/mypyc/irbuild/callable_class.py +0 -173
  1274. jaclang/vendor/mypyc/irbuild/classdef.py +0 -850
  1275. jaclang/vendor/mypyc/irbuild/constant_fold.py +0 -95
  1276. jaclang/vendor/mypyc/irbuild/context.py +0 -186
  1277. jaclang/vendor/mypyc/irbuild/env_class.py +0 -223
  1278. jaclang/vendor/mypyc/irbuild/expression.py +0 -1070
  1279. jaclang/vendor/mypyc/irbuild/for_helpers.py +0 -1075
  1280. jaclang/vendor/mypyc/irbuild/format_str_tokenizer.py +0 -250
  1281. jaclang/vendor/mypyc/irbuild/function.py +0 -1088
  1282. jaclang/vendor/mypyc/irbuild/generator.py +0 -346
  1283. jaclang/vendor/mypyc/irbuild/ll_builder.py +0 -2389
  1284. jaclang/vendor/mypyc/irbuild/main.py +0 -153
  1285. jaclang/vendor/mypyc/irbuild/mapper.py +0 -221
  1286. jaclang/vendor/mypyc/irbuild/match.py +0 -355
  1287. jaclang/vendor/mypyc/irbuild/nonlocalcontrol.py +0 -197
  1288. jaclang/vendor/mypyc/irbuild/prebuildvisitor.py +0 -203
  1289. jaclang/vendor/mypyc/irbuild/prepare.py +0 -609
  1290. jaclang/vendor/mypyc/irbuild/specialize.py +0 -822
  1291. jaclang/vendor/mypyc/irbuild/statement.py +0 -1017
  1292. jaclang/vendor/mypyc/irbuild/targets.py +0 -57
  1293. jaclang/vendor/mypyc/irbuild/util.py +0 -189
  1294. jaclang/vendor/mypyc/irbuild/visitor.py +0 -401
  1295. jaclang/vendor/mypyc/irbuild/vtable.py +0 -82
  1296. jaclang/vendor/mypyc/lib-rt/CPy.h +0 -638
  1297. jaclang/vendor/mypyc/lib-rt/bytes_ops.c +0 -143
  1298. jaclang/vendor/mypyc/lib-rt/dict_ops.c +0 -446
  1299. jaclang/vendor/mypyc/lib-rt/exc_ops.c +0 -259
  1300. jaclang/vendor/mypyc/lib-rt/float_ops.c +0 -192
  1301. jaclang/vendor/mypyc/lib-rt/generic_ops.c +0 -64
  1302. jaclang/vendor/mypyc/lib-rt/getargs.c +0 -450
  1303. jaclang/vendor/mypyc/lib-rt/getargsfast.c +0 -569
  1304. jaclang/vendor/mypyc/lib-rt/init.c +0 -13
  1305. jaclang/vendor/mypyc/lib-rt/int_ops.c +0 -803
  1306. jaclang/vendor/mypyc/lib-rt/list_ops.c +0 -335
  1307. jaclang/vendor/mypyc/lib-rt/misc_ops.c +0 -942
  1308. jaclang/vendor/mypyc/lib-rt/module_shim.tmpl +0 -18
  1309. jaclang/vendor/mypyc/lib-rt/mypyc_util.h +0 -118
  1310. jaclang/vendor/mypyc/lib-rt/pythoncapi_compat.h +0 -497
  1311. jaclang/vendor/mypyc/lib-rt/pythonsupport.h +0 -533
  1312. jaclang/vendor/mypyc/lib-rt/set_ops.c +0 -17
  1313. jaclang/vendor/mypyc/lib-rt/setup.py +0 -70
  1314. jaclang/vendor/mypyc/lib-rt/str_ops.c +0 -241
  1315. jaclang/vendor/mypyc/lib-rt/test_capi.cc +0 -585
  1316. jaclang/vendor/mypyc/lib-rt/tuple_ops.c +0 -61
  1317. jaclang/vendor/mypyc/lower/__init__.py +0 -0
  1318. jaclang/vendor/mypyc/lower/int_ops.py +0 -113
  1319. jaclang/vendor/mypyc/lower/list_ops.py +0 -45
  1320. jaclang/vendor/mypyc/lower/misc_ops.py +0 -12
  1321. jaclang/vendor/mypyc/lower/registry.py +0 -26
  1322. jaclang/vendor/mypyc/namegen.py +0 -115
  1323. jaclang/vendor/mypyc/options.py +0 -32
  1324. jaclang/vendor/mypyc/primitives/__init__.py +0 -0
  1325. jaclang/vendor/mypyc/primitives/bytes_ops.py +0 -101
  1326. jaclang/vendor/mypyc/primitives/dict_ops.py +0 -325
  1327. jaclang/vendor/mypyc/primitives/exc_ops.py +0 -101
  1328. jaclang/vendor/mypyc/primitives/float_ops.py +0 -168
  1329. jaclang/vendor/mypyc/primitives/generic_ops.py +0 -384
  1330. jaclang/vendor/mypyc/primitives/int_ops.py +0 -303
  1331. jaclang/vendor/mypyc/primitives/list_ops.py +0 -310
  1332. jaclang/vendor/mypyc/primitives/misc_ops.py +0 -267
  1333. jaclang/vendor/mypyc/primitives/registry.py +0 -360
  1334. jaclang/vendor/mypyc/primitives/set_ops.py +0 -121
  1335. jaclang/vendor/mypyc/primitives/str_ops.py +0 -229
  1336. jaclang/vendor/mypyc/primitives/tuple_ops.py +0 -83
  1337. jaclang/vendor/mypyc/rt_subtype.py +0 -77
  1338. jaclang/vendor/mypyc/sametype.py +0 -83
  1339. jaclang/vendor/mypyc/subtype.py +0 -88
  1340. jaclang/vendor/mypyc/test/__init__.py +0 -0
  1341. jaclang/vendor/mypyc/test/config.py +0 -13
  1342. jaclang/vendor/mypyc/test/test_alwaysdefined.py +0 -46
  1343. jaclang/vendor/mypyc/test/test_analysis.py +0 -77
  1344. jaclang/vendor/mypyc/test/test_cheader.py +0 -53
  1345. jaclang/vendor/mypyc/test/test_commandline.py +0 -82
  1346. jaclang/vendor/mypyc/test/test_emit.py +0 -69
  1347. jaclang/vendor/mypyc/test/test_emitclass.py +0 -35
  1348. jaclang/vendor/mypyc/test/test_emitfunc.py +0 -928
  1349. jaclang/vendor/mypyc/test/test_emitwrapper.py +0 -60
  1350. jaclang/vendor/mypyc/test/test_exceptions.py +0 -56
  1351. jaclang/vendor/mypyc/test/test_external.py +0 -49
  1352. jaclang/vendor/mypyc/test/test_irbuild.py +0 -87
  1353. jaclang/vendor/mypyc/test/test_ircheck.py +0 -199
  1354. jaclang/vendor/mypyc/test/test_literals.py +0 -90
  1355. jaclang/vendor/mypyc/test/test_lowering.py +0 -56
  1356. jaclang/vendor/mypyc/test/test_namegen.py +0 -48
  1357. jaclang/vendor/mypyc/test/test_optimizations.py +0 -68
  1358. jaclang/vendor/mypyc/test/test_pprint.py +0 -42
  1359. jaclang/vendor/mypyc/test/test_rarray.py +0 -48
  1360. jaclang/vendor/mypyc/test/test_refcount.py +0 -59
  1361. jaclang/vendor/mypyc/test/test_run.py +0 -426
  1362. jaclang/vendor/mypyc/test/test_serialization.py +0 -108
  1363. jaclang/vendor/mypyc/test/test_struct.py +0 -112
  1364. jaclang/vendor/mypyc/test/test_tuplename.py +0 -33
  1365. jaclang/vendor/mypyc/test/test_typeops.py +0 -97
  1366. jaclang/vendor/mypyc/test/testutil.py +0 -283
  1367. jaclang/vendor/mypyc/test-data/alwaysdefined.test +0 -732
  1368. jaclang/vendor/mypyc/test-data/analysis.test +0 -470
  1369. jaclang/vendor/mypyc/test-data/commandline.test +0 -245
  1370. jaclang/vendor/mypyc/test-data/driver/driver.py +0 -48
  1371. jaclang/vendor/mypyc/test-data/exceptions-freq.test +0 -125
  1372. jaclang/vendor/mypyc/test-data/exceptions.test +0 -699
  1373. jaclang/vendor/mypyc/test-data/fixtures/ir.py +0 -373
  1374. jaclang/vendor/mypyc/test-data/fixtures/testutil.py +0 -103
  1375. jaclang/vendor/mypyc/test-data/fixtures/typing-full.pyi +0 -169
  1376. jaclang/vendor/mypyc/test-data/irbuild-any.test +0 -236
  1377. jaclang/vendor/mypyc/test-data/irbuild-basic.test +0 -3399
  1378. jaclang/vendor/mypyc/test-data/irbuild-bool.test +0 -424
  1379. jaclang/vendor/mypyc/test-data/irbuild-bytes.test +0 -181
  1380. jaclang/vendor/mypyc/test-data/irbuild-classes.test +0 -1302
  1381. jaclang/vendor/mypyc/test-data/irbuild-constant-fold.test +0 -480
  1382. jaclang/vendor/mypyc/test-data/irbuild-dict.test +0 -584
  1383. jaclang/vendor/mypyc/test-data/irbuild-dunders.test +0 -215
  1384. jaclang/vendor/mypyc/test-data/irbuild-float.test +0 -497
  1385. jaclang/vendor/mypyc/test-data/irbuild-generics.test +0 -150
  1386. jaclang/vendor/mypyc/test-data/irbuild-glue-methods.test +0 -437
  1387. jaclang/vendor/mypyc/test-data/irbuild-i16.test +0 -526
  1388. jaclang/vendor/mypyc/test-data/irbuild-i32.test +0 -598
  1389. jaclang/vendor/mypyc/test-data/irbuild-i64.test +0 -2144
  1390. jaclang/vendor/mypyc/test-data/irbuild-int.test +0 -194
  1391. jaclang/vendor/mypyc/test-data/irbuild-isinstance.test +0 -109
  1392. jaclang/vendor/mypyc/test-data/irbuild-lists.test +0 -513
  1393. jaclang/vendor/mypyc/test-data/irbuild-match.test +0 -1717
  1394. jaclang/vendor/mypyc/test-data/irbuild-math.test +0 -64
  1395. jaclang/vendor/mypyc/test-data/irbuild-nested.test +0 -807
  1396. jaclang/vendor/mypyc/test-data/irbuild-optional.test +0 -536
  1397. jaclang/vendor/mypyc/test-data/irbuild-set.test +0 -806
  1398. jaclang/vendor/mypyc/test-data/irbuild-singledispatch.test +0 -257
  1399. jaclang/vendor/mypyc/test-data/irbuild-statements.test +0 -1060
  1400. jaclang/vendor/mypyc/test-data/irbuild-str.test +0 -312
  1401. jaclang/vendor/mypyc/test-data/irbuild-strip-asserts.test +0 -12
  1402. jaclang/vendor/mypyc/test-data/irbuild-try.test +0 -523
  1403. jaclang/vendor/mypyc/test-data/irbuild-tuple.test +0 -386
  1404. jaclang/vendor/mypyc/test-data/irbuild-u8.test +0 -543
  1405. jaclang/vendor/mypyc/test-data/irbuild-unreachable.test +0 -241
  1406. jaclang/vendor/mypyc/test-data/irbuild-vectorcall.test +0 -153
  1407. jaclang/vendor/mypyc/test-data/lowering-int.test +0 -377
  1408. jaclang/vendor/mypyc/test-data/lowering-list.test +0 -33
  1409. jaclang/vendor/mypyc/test-data/opt-copy-propagation.test +0 -400
  1410. jaclang/vendor/mypyc/test-data/opt-flag-elimination.test +0 -296
  1411. jaclang/vendor/mypyc/test-data/refcount.test +0 -1482
  1412. jaclang/vendor/mypyc/test-data/run-async.test +0 -173
  1413. jaclang/vendor/mypyc/test-data/run-attrs.test +0 -318
  1414. jaclang/vendor/mypyc/test-data/run-bench.test +0 -196
  1415. jaclang/vendor/mypyc/test-data/run-bools.test +0 -229
  1416. jaclang/vendor/mypyc/test-data/run-bytes.test +0 -302
  1417. jaclang/vendor/mypyc/test-data/run-classes.test +0 -2505
  1418. jaclang/vendor/mypyc/test-data/run-dicts.test +0 -334
  1419. jaclang/vendor/mypyc/test-data/run-dunders.test +0 -945
  1420. jaclang/vendor/mypyc/test-data/run-exceptions.test +0 -448
  1421. jaclang/vendor/mypyc/test-data/run-floats.test +0 -516
  1422. jaclang/vendor/mypyc/test-data/run-functions.test +0 -1310
  1423. jaclang/vendor/mypyc/test-data/run-generators.test +0 -682
  1424. jaclang/vendor/mypyc/test-data/run-i16.test +0 -338
  1425. jaclang/vendor/mypyc/test-data/run-i32.test +0 -336
  1426. jaclang/vendor/mypyc/test-data/run-i64.test +0 -1519
  1427. jaclang/vendor/mypyc/test-data/run-imports.test +0 -265
  1428. jaclang/vendor/mypyc/test-data/run-integers.test +0 -540
  1429. jaclang/vendor/mypyc/test-data/run-lists.test +0 -411
  1430. jaclang/vendor/mypyc/test-data/run-loops.test +0 -485
  1431. jaclang/vendor/mypyc/test-data/run-match.test +0 -283
  1432. jaclang/vendor/mypyc/test-data/run-math.test +0 -106
  1433. jaclang/vendor/mypyc/test-data/run-misc.test +0 -1170
  1434. jaclang/vendor/mypyc/test-data/run-multimodule.test +0 -887
  1435. jaclang/vendor/mypyc/test-data/run-mypy-sim.test +0 -138
  1436. jaclang/vendor/mypyc/test-data/run-primitives.test +0 -375
  1437. jaclang/vendor/mypyc/test-data/run-python37.test +0 -159
  1438. jaclang/vendor/mypyc/test-data/run-python38.test +0 -88
  1439. jaclang/vendor/mypyc/test-data/run-sets.test +0 -150
  1440. jaclang/vendor/mypyc/test-data/run-singledispatch.test +0 -698
  1441. jaclang/vendor/mypyc/test-data/run-strings.test +0 -641
  1442. jaclang/vendor/mypyc/test-data/run-traits.test +0 -411
  1443. jaclang/vendor/mypyc/test-data/run-tuples.test +0 -258
  1444. jaclang/vendor/mypyc/test-data/run-u8.test +0 -303
  1445. jaclang/vendor/mypyc/transform/__init__.py +0 -0
  1446. jaclang/vendor/mypyc/transform/copy_propagation.py +0 -94
  1447. jaclang/vendor/mypyc/transform/exceptions.py +0 -182
  1448. jaclang/vendor/mypyc/transform/flag_elimination.py +0 -108
  1449. jaclang/vendor/mypyc/transform/ir_transform.py +0 -368
  1450. jaclang/vendor/mypyc/transform/lower.py +0 -33
  1451. jaclang/vendor/mypyc/transform/refcount.py +0 -294
  1452. jaclang/vendor/mypyc/transform/uninit.py +0 -190
  1453. jaclang/vendor/typing_extensions-4.12.2.dist-info/LICENSE +0 -279
  1454. jaclang/vendor/typing_extensions-4.12.2.dist-info/METADATA +0 -67
  1455. jaclang/vendor/typing_extensions-4.12.2.dist-info/RECORD +0 -5
  1456. jaclang/vendor/typing_extensions-4.12.2.dist-info/WHEEL +0 -4
  1457. jaclang/vendor/typing_extensions.py +0 -3641
  1458. jaclang-0.7.34.dist-info/RECORD +0 -1563
  1459. /jaclang/{vendor/mypy/dmypy → compiler/larkparse}/__init__.py +0 -0
  1460. /jaclang/{tests → compiler/passes/main/tests}/fixtures/access_checker.jac +0 -0
  1461. /jaclang/{vendor/mypy/plugins/__init__.py → langserve/tests/fixtures/deep_check_crash.jac} +0 -0
  1462. /jaclang/{vendor/mypy/server/__init__.py → langserve/tests/server_test/code_test.py} +0 -0
  1463. /jaclang/{plugin → runtimelib}/tests/__init__.py +0 -0
  1464. /jaclang/{plugin → runtimelib}/tests/fixtures/traversing_save.jac +0 -0
  1465. /jaclang/{vendor/mypy/test → tests}/__init__.py +0 -0
  1466. /jaclang/{vendor/mypy/test/meta → tests/fixtures}/__init__.py +0 -0
  1467. /jaclang/tests/fixtures/{architype_def_bug.jac → archetype_def_bug.jac} +0 -0
  1468. /jaclang/vendor/{mypy/typeshed/stdlib/concurrent/__init__.pyi → attrs-25.3.0.dist-info/REQUESTED} +0 -0
  1469. /jaclang/vendor/{attrs-23.2.0.dist-info → attrs-25.3.0.dist-info}/licenses/LICENSE +0 -0
  1470. /jaclang/vendor/{mypy/typeshed/stdlib/distutils/command/__init__.pyi → cattrs-24.1.3.dist-info/REQUESTED} +0 -0
  1471. /jaclang/vendor/{cattrs-23.2.3.dist-info → cattrs-24.1.3.dist-info}/licenses/LICENSE +0 -0
  1472. /jaclang/vendor/{mypy/typeshed/stdlib/distutils/command/bdist_packager.pyi → lark-1.2.2.dist-info/REQUESTED} +0 -0
  1473. /jaclang/vendor/{lark-1.1.9.dist-info → lark-1.2.2.dist-info}/entry_points.txt +0 -0
  1474. /jaclang/vendor/{lark-1.1.9.dist-info → lark-1.2.2.dist-info}/top_level.txt +0 -0
  1475. /jaclang/vendor/{mypy/typeshed/stdlib/email/mime/__init__.pyi → lsprotocol-2023.0.1.dist-info/REQUESTED} +0 -0
  1476. /jaclang/vendor/lsprotocol-2023.0.1.dist-info/{LICENSE → licenses/LICENSE} +0 -0
  1477. /jaclang/vendor/{mypy/typeshed/stdlib/lib2to3/__init__.pyi → pluggy-1.5.0.dist-info/REQUESTED} +0 -0
  1478. /jaclang/vendor/pluggy-1.5.0.dist-info/{LICENSE → licenses/LICENSE} +0 -0
  1479. /jaclang/vendor/{mypy/typeshed/stdlib/lib2to3/fixes/__init__.pyi → pygls-1.3.1.dist-info/REQUESTED} +0 -0
  1480. {jaclang-0.7.34.dist-info → jaclang-0.8.0.dist-info}/entry_points.txt +0 -0
@@ -1,3562 +0,0 @@
1
- """Facilities to analyze entire programs, including imported modules.
2
-
3
- Parse and analyze the source files of a program in the correct order
4
- (based on file dependencies), and collect the results.
5
-
6
- This module only directs a build, which is performed in multiple passes per
7
- file. The individual passes are implemented in separate modules.
8
-
9
- The function build() is the main interface to this module.
10
- """
11
-
12
- # TODO: More consistent terminology, e.g. path/fnam, module/id, state/file
13
-
14
- from __future__ import annotations
15
-
16
- import collections
17
- import contextlib
18
- import errno
19
- import gc
20
- import json
21
- import os
22
- import platform
23
- import re
24
- import stat
25
- import sys
26
- import time
27
- import types
28
- from typing import (
29
- TYPE_CHECKING,
30
- AbstractSet,
31
- Any,
32
- Callable,
33
- ClassVar,
34
- Dict,
35
- Final,
36
- Iterator,
37
- Mapping,
38
- NamedTuple,
39
- NoReturn,
40
- Sequence,
41
- TextIO,
42
- )
43
- from typing_extensions import TypeAlias as _TypeAlias, TypedDict
44
-
45
- import mypy.semanal_main
46
- from mypy.checker import TypeChecker
47
- from mypy.errors import CompileError, ErrorInfo, Errors, report_internal_error
48
- from mypy.graph_utils import prepare_sccs, strongly_connected_components, topsort
49
- from mypy.indirection import TypeIndirectionVisitor
50
- from mypy.messages import MessageBuilder
51
- from mypy.nodes import Import, ImportAll, ImportBase, ImportFrom, MypyFile, SymbolTable, TypeInfo
52
- from mypy.partially_defined import PossiblyUndefinedVariableVisitor
53
- from mypy.semanal import SemanticAnalyzer
54
- from mypy.semanal_pass1 import SemanticAnalyzerPreAnalysis
55
- from mypy.util import (
56
- DecodeError,
57
- decode_python_encoding,
58
- get_mypy_comments,
59
- hash_digest,
60
- is_stub_package_file,
61
- is_sub_path,
62
- is_typeshed_file,
63
- module_prefix,
64
- read_py_file,
65
- time_ref,
66
- time_spent_us,
67
- )
68
-
69
- if TYPE_CHECKING:
70
- from mypy.report import Reports # Avoid unconditional slow import
71
-
72
- from mypy import errorcodes as codes
73
- from mypy.config_parser import parse_mypy_comments
74
- from mypy.fixup import fixup_module
75
- from mypy.freetree import free_tree
76
- from mypy.fscache import FileSystemCache
77
- from mypy.metastore import FilesystemMetadataStore, MetadataStore, SqliteMetadataStore
78
- from mypy.modulefinder import (
79
- BuildSource as BuildSource,
80
- BuildSourceSet as BuildSourceSet,
81
- FindModuleCache,
82
- ModuleNotFoundReason,
83
- ModuleSearchResult,
84
- SearchPaths,
85
- compute_search_paths,
86
- )
87
- from mypy.nodes import Expression
88
- from mypy.options import Options
89
- from mypy.parse import parse
90
- from mypy.plugin import ChainedPlugin, Plugin, ReportConfigContext
91
- from mypy.plugins.default import DefaultPlugin
92
- from mypy.renaming import LimitedVariableRenameVisitor, VariableRenameVisitor
93
- from mypy.stats import dump_type_stats
94
- from mypy.stubinfo import legacy_bundled_packages, non_bundled_packages, stub_distribution_name
95
- from mypy.types import Type
96
- from mypy.typestate import reset_global_state, type_state
97
- from mypy.version import __version__
98
-
99
- # Switch to True to produce debug output related to fine-grained incremental
100
- # mode only that is useful during development. This produces only a subset of
101
- # output compared to --verbose output. We use a global flag to enable this so
102
- # that it's easy to enable this when running tests.
103
- DEBUG_FINE_GRAINED: Final = False
104
-
105
- # These modules are special and should always come from typeshed.
106
- CORE_BUILTIN_MODULES: Final = {
107
- "builtins",
108
- "typing",
109
- "types",
110
- "typing_extensions",
111
- "mypy_extensions",
112
- "_typeshed",
113
- "_collections_abc",
114
- "collections",
115
- "collections.abc",
116
- "sys",
117
- "abc",
118
- }
119
-
120
-
121
- Graph: _TypeAlias = Dict[str, "State"]
122
-
123
-
124
- # TODO: Get rid of BuildResult. We might as well return a BuildManager.
125
- class BuildResult:
126
- """The result of a successful build.
127
-
128
- Attributes:
129
- manager: The build manager.
130
- files: Dictionary from module name to related AST node.
131
- types: Dictionary from parse tree node to its inferred type.
132
- used_cache: Whether the build took advantage of a pre-existing cache
133
- errors: List of error messages.
134
- """
135
-
136
- def __init__(self, manager: BuildManager, graph: Graph) -> None:
137
- self.manager = manager
138
- self.graph = graph
139
- self.files = manager.modules
140
- self.types = manager.all_types # Non-empty if export_types True in options
141
- self.used_cache = manager.cache_enabled
142
- self.errors: list[str] = [] # Filled in by build if desired
143
-
144
-
145
- def build(
146
- sources: list[BuildSource],
147
- options: Options,
148
- alt_lib_path: str | None = None,
149
- flush_errors: Callable[[str | None, list[str], bool], None] | None = None,
150
- fscache: FileSystemCache | None = None,
151
- stdout: TextIO | None = None,
152
- stderr: TextIO | None = None,
153
- extra_plugins: Sequence[Plugin] | None = None,
154
- ) -> BuildResult:
155
- """Analyze a program.
156
-
157
- A single call to build performs parsing, semantic analysis and optionally
158
- type checking for the program *and* all imported modules, recursively.
159
-
160
- Return BuildResult if successful or only non-blocking errors were found;
161
- otherwise raise CompileError.
162
-
163
- If a flush_errors callback is provided, all error messages will be
164
- passed to it and the errors and messages fields of BuildResult and
165
- CompileError (respectively) will be empty. Otherwise those fields will
166
- report any error messages.
167
-
168
- Args:
169
- sources: list of sources to build
170
- options: build options
171
- alt_lib_path: an additional directory for looking up library modules
172
- (takes precedence over other directories)
173
- flush_errors: optional function to flush errors after a file is processed
174
- fscache: optionally a file-system cacher
175
-
176
- """
177
- # If we were not given a flush_errors, we use one that will populate those
178
- # fields for callers that want the traditional API.
179
- messages = []
180
-
181
- def default_flush_errors(
182
- filename: str | None, new_messages: list[str], is_serious: bool
183
- ) -> None:
184
- messages.extend(new_messages)
185
-
186
- flush_errors = flush_errors or default_flush_errors
187
- stdout = stdout or sys.stdout
188
- stderr = stderr or sys.stderr
189
- extra_plugins = extra_plugins or []
190
-
191
- try:
192
- result = _build(
193
- sources, options, alt_lib_path, flush_errors, fscache, stdout, stderr, extra_plugins
194
- )
195
- result.errors = messages
196
- return result
197
- except CompileError as e:
198
- # CompileErrors raised from an errors object carry all of the
199
- # messages that have not been reported out by error streaming.
200
- # Patch it up to contain either none or all none of the messages,
201
- # depending on whether we are flushing errors.
202
- serious = not e.use_stdout
203
- flush_errors(None, e.messages, serious)
204
- e.messages = messages
205
- raise
206
-
207
-
208
- def _build(
209
- sources: list[BuildSource],
210
- options: Options,
211
- alt_lib_path: str | None,
212
- flush_errors: Callable[[str | None, list[str], bool], None],
213
- fscache: FileSystemCache | None,
214
- stdout: TextIO,
215
- stderr: TextIO,
216
- extra_plugins: Sequence[Plugin],
217
- ) -> BuildResult:
218
- if platform.python_implementation() == "CPython":
219
- # This seems the most reasonable place to tune garbage collection.
220
- gc.set_threshold(150 * 1000)
221
-
222
- data_dir = default_data_dir()
223
- fscache = fscache or FileSystemCache()
224
-
225
- search_paths = compute_search_paths(sources, options, data_dir, alt_lib_path)
226
-
227
- reports = None
228
- if options.report_dirs:
229
- # Import lazily to avoid slowing down startup.
230
- from mypy.report import Reports
231
-
232
- reports = Reports(data_dir, options.report_dirs)
233
-
234
- source_set = BuildSourceSet(sources)
235
- cached_read = fscache.read
236
- errors = Errors(options, read_source=lambda path: read_py_file(path, cached_read))
237
- plugin, snapshot = load_plugins(options, errors, stdout, extra_plugins)
238
-
239
- # Add catch-all .gitignore to cache dir if we created it
240
- cache_dir_existed = os.path.isdir(options.cache_dir)
241
-
242
- # Construct a build manager object to hold state during the build.
243
- #
244
- # Ignore current directory prefix in error messages.
245
- manager = BuildManager(
246
- data_dir,
247
- search_paths,
248
- ignore_prefix=os.getcwd(),
249
- source_set=source_set,
250
- reports=reports,
251
- options=options,
252
- version_id=__version__,
253
- plugin=plugin,
254
- plugins_snapshot=snapshot,
255
- errors=errors,
256
- flush_errors=flush_errors,
257
- fscache=fscache,
258
- stdout=stdout,
259
- stderr=stderr,
260
- )
261
- if manager.verbosity() >= 2:
262
- manager.trace(repr(options))
263
-
264
- reset_global_state()
265
- try:
266
- graph = dispatch(sources, manager, stdout)
267
- if not options.fine_grained_incremental:
268
- type_state.reset_all_subtype_caches()
269
- if options.timing_stats is not None:
270
- dump_timing_stats(options.timing_stats, graph)
271
- if options.line_checking_stats is not None:
272
- dump_line_checking_stats(options.line_checking_stats, graph)
273
- return BuildResult(manager, graph)
274
- finally:
275
- t0 = time.time()
276
- manager.metastore.commit()
277
- manager.add_stats(cache_commit_time=time.time() - t0)
278
- manager.log(
279
- "Build finished in %.3f seconds with %d modules, and %d errors"
280
- % (
281
- time.time() - manager.start_time,
282
- len(manager.modules),
283
- manager.errors.num_messages(),
284
- )
285
- )
286
- manager.dump_stats()
287
- if reports is not None:
288
- # Finish the HTML or XML reports even if CompileError was raised.
289
- reports.finish()
290
- if not cache_dir_existed and os.path.isdir(options.cache_dir):
291
- add_catch_all_gitignore(options.cache_dir)
292
- exclude_from_backups(options.cache_dir)
293
- if os.path.isdir(options.cache_dir):
294
- record_missing_stub_packages(options.cache_dir, manager.missing_stub_packages)
295
-
296
-
297
- def default_data_dir() -> str:
298
- """Returns directory containing typeshed directory."""
299
- return os.path.dirname(__file__)
300
-
301
-
302
- def normpath(path: str, options: Options) -> str:
303
- """Convert path to absolute; but to relative in bazel mode.
304
-
305
- (Bazel's distributed cache doesn't like filesystem metadata to
306
- end up in output files.)
307
- """
308
- # TODO: Could we always use relpath? (A worry in non-bazel
309
- # mode would be that a moved file may change its full module
310
- # name without changing its size, mtime or hash.)
311
- if options.bazel:
312
- return os.path.relpath(path)
313
- else:
314
- return os.path.abspath(path)
315
-
316
-
317
- class CacheMeta(NamedTuple):
318
- id: str
319
- path: str
320
- mtime: int
321
- size: int
322
- hash: str
323
- dependencies: list[str] # names of imported modules
324
- data_mtime: int # mtime of data_json
325
- data_json: str # path of <id>.data.json
326
- suppressed: list[str] # dependencies that weren't imported
327
- options: dict[str, object] | None # build options
328
- # dep_prios and dep_lines are in parallel with dependencies + suppressed
329
- dep_prios: list[int]
330
- dep_lines: list[int]
331
- interface_hash: str # hash representing the public interface
332
- version_id: str # mypy version for cache invalidation
333
- ignore_all: bool # if errors were ignored
334
- plugin_data: Any # config data from plugins
335
-
336
-
337
- # NOTE: dependencies + suppressed == all reachable imports;
338
- # suppressed contains those reachable imports that were prevented by
339
- # silent mode or simply not found.
340
-
341
-
342
- # Metadata for the fine-grained dependencies file associated with a module.
343
- class FgDepMeta(TypedDict):
344
- path: str
345
- mtime: int
346
-
347
-
348
- def cache_meta_from_dict(meta: dict[str, Any], data_json: str) -> CacheMeta:
349
- """Build a CacheMeta object from a json metadata dictionary
350
-
351
- Args:
352
- meta: JSON metadata read from the metadata cache file
353
- data_json: Path to the .data.json file containing the AST trees
354
- """
355
- sentinel: Any = None # Values to be validated by the caller
356
- return CacheMeta(
357
- meta.get("id", sentinel),
358
- meta.get("path", sentinel),
359
- int(meta["mtime"]) if "mtime" in meta else sentinel,
360
- meta.get("size", sentinel),
361
- meta.get("hash", sentinel),
362
- meta.get("dependencies", []),
363
- int(meta["data_mtime"]) if "data_mtime" in meta else sentinel,
364
- data_json,
365
- meta.get("suppressed", []),
366
- meta.get("options"),
367
- meta.get("dep_prios", []),
368
- meta.get("dep_lines", []),
369
- meta.get("interface_hash", ""),
370
- meta.get("version_id", sentinel),
371
- meta.get("ignore_all", True),
372
- meta.get("plugin_data", None),
373
- )
374
-
375
-
376
- # Priorities used for imports. (Here, top-level includes inside a class.)
377
- # These are used to determine a more predictable order in which the
378
- # nodes in an import cycle are processed.
379
- PRI_HIGH: Final = 5 # top-level "from X import blah"
380
- PRI_MED: Final = 10 # top-level "import X"
381
- PRI_LOW: Final = 20 # either form inside a function
382
- PRI_MYPY: Final = 25 # inside "if MYPY" or "if TYPE_CHECKING"
383
- PRI_INDIRECT: Final = 30 # an indirect dependency
384
- PRI_ALL: Final = 99 # include all priorities
385
-
386
-
387
- def import_priority(imp: ImportBase, toplevel_priority: int) -> int:
388
- """Compute import priority from an import node."""
389
- if not imp.is_top_level:
390
- # Inside a function
391
- return PRI_LOW
392
- if imp.is_mypy_only:
393
- # Inside "if MYPY" or "if typing.TYPE_CHECKING"
394
- return max(PRI_MYPY, toplevel_priority)
395
- # A regular import; priority determined by argument.
396
- return toplevel_priority
397
-
398
-
399
- def load_plugins_from_config(
400
- options: Options, errors: Errors, stdout: TextIO
401
- ) -> tuple[list[Plugin], dict[str, str]]:
402
- """Load all configured plugins.
403
-
404
- Return a list of all the loaded plugins from the config file.
405
- The second return value is a snapshot of versions/hashes of loaded user
406
- plugins (for cache validation).
407
- """
408
- import importlib
409
-
410
- snapshot: dict[str, str] = {}
411
-
412
- if not options.config_file:
413
- return [], snapshot
414
-
415
- line = find_config_file_line_number(options.config_file, "mypy", "plugins")
416
- if line == -1:
417
- line = 1 # We need to pick some line number that doesn't look too confusing
418
-
419
- def plugin_error(message: str) -> NoReturn:
420
- errors.report(line, 0, message)
421
- errors.raise_error(use_stdout=False)
422
-
423
- custom_plugins: list[Plugin] = []
424
- errors.set_file(options.config_file, None, options)
425
- for plugin_path in options.plugins:
426
- func_name = "plugin"
427
- plugin_dir: str | None = None
428
- if ":" in os.path.basename(plugin_path):
429
- plugin_path, func_name = plugin_path.rsplit(":", 1)
430
- if plugin_path.endswith(".py"):
431
- # Plugin paths can be relative to the config file location.
432
- plugin_path = os.path.join(os.path.dirname(options.config_file), plugin_path)
433
- if not os.path.isfile(plugin_path):
434
- plugin_error(f'Can\'t find plugin "{plugin_path}"')
435
- # Use an absolute path to avoid populating the cache entry
436
- # for 'tmp' during tests, since it will be different in
437
- # different tests.
438
- plugin_dir = os.path.abspath(os.path.dirname(plugin_path))
439
- fnam = os.path.basename(plugin_path)
440
- module_name = fnam[:-3]
441
- sys.path.insert(0, plugin_dir)
442
- elif re.search(r"[\\/]", plugin_path):
443
- fnam = os.path.basename(plugin_path)
444
- plugin_error(f'Plugin "{fnam}" does not have a .py extension')
445
- else:
446
- module_name = plugin_path
447
-
448
- try:
449
- module = importlib.import_module(module_name)
450
- except Exception as exc:
451
- plugin_error(f'Error importing plugin "{plugin_path}": {exc}')
452
- finally:
453
- if plugin_dir is not None:
454
- assert sys.path[0] == plugin_dir
455
- del sys.path[0]
456
-
457
- if not hasattr(module, func_name):
458
- plugin_error(
459
- 'Plugin "{}" does not define entry point function "{}"'.format(
460
- plugin_path, func_name
461
- )
462
- )
463
-
464
- try:
465
- plugin_type = getattr(module, func_name)(__version__)
466
- except Exception:
467
- print(f"Error calling the plugin(version) entry point of {plugin_path}\n", file=stdout)
468
- raise # Propagate to display traceback
469
-
470
- if not isinstance(plugin_type, type):
471
- plugin_error(
472
- 'Type object expected as the return value of "plugin"; got {!r} (in {})'.format(
473
- plugin_type, plugin_path
474
- )
475
- )
476
- if not issubclass(plugin_type, Plugin):
477
- plugin_error(
478
- 'Return value of "plugin" must be a subclass of "mypy.plugin.Plugin" '
479
- "(in {})".format(plugin_path)
480
- )
481
- try:
482
- custom_plugins.append(plugin_type(options))
483
- snapshot[module_name] = take_module_snapshot(module)
484
- except Exception:
485
- print(f"Error constructing plugin instance of {plugin_type.__name__}\n", file=stdout)
486
- raise # Propagate to display traceback
487
-
488
- return custom_plugins, snapshot
489
-
490
-
491
- def load_plugins(
492
- options: Options, errors: Errors, stdout: TextIO, extra_plugins: Sequence[Plugin]
493
- ) -> tuple[Plugin, dict[str, str]]:
494
- """Load all configured plugins.
495
-
496
- Return a plugin that encapsulates all plugins chained together. Always
497
- at least include the default plugin (it's last in the chain).
498
- The second return value is a snapshot of versions/hashes of loaded user
499
- plugins (for cache validation).
500
- """
501
- custom_plugins, snapshot = load_plugins_from_config(options, errors, stdout)
502
-
503
- custom_plugins += extra_plugins
504
-
505
- default_plugin: Plugin = DefaultPlugin(options)
506
- if not custom_plugins:
507
- return default_plugin, snapshot
508
-
509
- # Custom plugins take precedence over the default plugin.
510
- return ChainedPlugin(options, custom_plugins + [default_plugin]), snapshot
511
-
512
-
513
- def take_module_snapshot(module: types.ModuleType) -> str:
514
- """Take plugin module snapshot by recording its version and hash.
515
-
516
- We record _both_ hash and the version to detect more possible changes
517
- (e.g. if there is a change in modules imported by a plugin).
518
- """
519
- if hasattr(module, "__file__"):
520
- assert module.__file__ is not None
521
- with open(module.__file__, "rb") as f:
522
- digest = hash_digest(f.read())
523
- else:
524
- digest = "unknown"
525
- ver = getattr(module, "__version__", "none")
526
- return f"{ver}:{digest}"
527
-
528
-
529
- def find_config_file_line_number(path: str, section: str, setting_name: str) -> int:
530
- """Return the approximate location of setting_name within mypy config file.
531
-
532
- Return -1 if can't determine the line unambiguously.
533
- """
534
- in_desired_section = False
535
- try:
536
- results = []
537
- with open(path, encoding="UTF-8") as f:
538
- for i, line in enumerate(f):
539
- line = line.strip()
540
- if line.startswith("[") and line.endswith("]"):
541
- current_section = line[1:-1].strip()
542
- in_desired_section = current_section == section
543
- elif in_desired_section and re.match(rf"{setting_name}\s*=", line):
544
- results.append(i + 1)
545
- if len(results) == 1:
546
- return results[0]
547
- except OSError:
548
- pass
549
- return -1
550
-
551
-
552
- class BuildManager:
553
- """This class holds shared state for building a mypy program.
554
-
555
- It is used to coordinate parsing, import processing, semantic
556
- analysis and type checking. The actual build steps are carried
557
- out by dispatch().
558
-
559
- Attributes:
560
- data_dir: Mypy data directory (contains stubs)
561
- search_paths: SearchPaths instance indicating where to look for modules
562
- modules: Mapping of module ID to MypyFile (shared by the passes)
563
- semantic_analyzer:
564
- Semantic analyzer, pass 2
565
- all_types: Map {Expression: Type} from all modules (enabled by export_types)
566
- options: Build options
567
- missing_modules: Set of modules that could not be imported encountered so far
568
- stale_modules: Set of modules that needed to be rechecked (only used by tests)
569
- fg_deps_meta: Metadata for fine-grained dependencies caches associated with modules
570
- fg_deps: A fine-grained dependency map
571
- version_id: The current mypy version (based on commit id when possible)
572
- plugin: Active mypy plugin(s)
573
- plugins_snapshot:
574
- Snapshot of currently active user plugins (versions and hashes)
575
- old_plugins_snapshot:
576
- Plugins snapshot from previous incremental run (or None in
577
- non-incremental mode and if cache was not found)
578
- errors: Used for reporting all errors
579
- flush_errors: A function for processing errors after each SCC
580
- cache_enabled: Whether cache is being read. This is set based on options,
581
- but is disabled if fine-grained cache loading fails
582
- and after an initial fine-grained load. This doesn't
583
- determine whether we write cache files or not.
584
- quickstart_state:
585
- A cache of filename -> mtime/size/hash info used to avoid
586
- needing to hash source files when using a cache with mismatching mtimes
587
- stats: Dict with various instrumentation numbers, it is used
588
- not only for debugging, but also required for correctness,
589
- in particular to check consistency of the fine-grained dependency cache.
590
- fscache: A file system cacher
591
- ast_cache: AST cache to speed up mypy daemon
592
- """
593
-
594
- def __init__(
595
- self,
596
- data_dir: str,
597
- search_paths: SearchPaths,
598
- ignore_prefix: str,
599
- source_set: BuildSourceSet,
600
- reports: Reports | None,
601
- options: Options,
602
- version_id: str,
603
- plugin: Plugin,
604
- plugins_snapshot: dict[str, str],
605
- errors: Errors,
606
- flush_errors: Callable[[str | None, list[str], bool], None],
607
- fscache: FileSystemCache,
608
- stdout: TextIO,
609
- stderr: TextIO,
610
- ) -> None:
611
- self.stats: dict[str, Any] = {} # Values are ints or floats
612
- self.stdout = stdout
613
- self.stderr = stderr
614
- self.start_time = time.time()
615
- self.data_dir = data_dir
616
- self.errors = errors
617
- self.errors.set_ignore_prefix(ignore_prefix)
618
- self.search_paths = search_paths
619
- self.source_set = source_set
620
- self.reports = reports
621
- self.options = options
622
- self.version_id = version_id
623
- self.modules: dict[str, MypyFile] = {}
624
- self.missing_modules: set[str] = set()
625
- self.fg_deps_meta: dict[str, FgDepMeta] = {}
626
- # fg_deps holds the dependencies of every module that has been
627
- # processed. We store this in BuildManager so that we can compute
628
- # dependencies as we go, which allows us to free ASTs and type information,
629
- # saving a ton of memory on net.
630
- self.fg_deps: dict[str, set[str]] = {}
631
- # Always convert the plugin to a ChainedPlugin so that it can be manipulated if needed
632
- if not isinstance(plugin, ChainedPlugin):
633
- plugin = ChainedPlugin(options, [plugin])
634
- self.plugin = plugin
635
- # Set of namespaces (module or class) that are being populated during semantic
636
- # analysis and may have missing definitions.
637
- self.incomplete_namespaces: set[str] = set()
638
- self.semantic_analyzer = SemanticAnalyzer(
639
- self.modules,
640
- self.missing_modules,
641
- self.incomplete_namespaces,
642
- self.errors,
643
- self.plugin,
644
- )
645
- self.all_types: dict[Expression, Type] = {} # Enabled by export_types
646
- self.indirection_detector = TypeIndirectionVisitor()
647
- self.stale_modules: set[str] = set()
648
- self.rechecked_modules: set[str] = set()
649
- self.flush_errors = flush_errors
650
- has_reporters = reports is not None and reports.reporters
651
- self.cache_enabled = (
652
- options.incremental
653
- and (not options.fine_grained_incremental or options.use_fine_grained_cache)
654
- and not has_reporters
655
- )
656
- self.fscache = fscache
657
- self.find_module_cache = FindModuleCache(
658
- self.search_paths, self.fscache, self.options, source_set=self.source_set
659
- )
660
- for module in CORE_BUILTIN_MODULES:
661
- if options.use_builtins_fixtures:
662
- continue
663
- path = self.find_module_cache.find_module(module)
664
- if not isinstance(path, str):
665
- raise CompileError(
666
- [f"Failed to find builtin module {module}, perhaps typeshed is broken?"]
667
- )
668
- if is_typeshed_file(options.abs_custom_typeshed_dir, path) or is_stub_package_file(
669
- path
670
- ):
671
- continue
672
-
673
- raise CompileError(
674
- [
675
- f'mypy: "{os.path.relpath(path)}" shadows library module "{module}"',
676
- f'note: A user-defined top-level module with name "{module}" is not supported',
677
- ]
678
- )
679
-
680
- self.metastore = create_metastore(options)
681
-
682
- # a mapping from source files to their corresponding shadow files
683
- # for efficient lookup
684
- self.shadow_map: dict[str, str] = {}
685
- if self.options.shadow_file is not None:
686
- self.shadow_map = dict(self.options.shadow_file)
687
- # a mapping from each file being typechecked to its possible shadow file
688
- self.shadow_equivalence_map: dict[str, str | None] = {}
689
- self.plugin = plugin
690
- self.plugins_snapshot = plugins_snapshot
691
- self.old_plugins_snapshot = read_plugins_snapshot(self)
692
- self.quickstart_state = read_quickstart_file(options, self.stdout)
693
- # Fine grained targets (module top levels and top level functions) processed by
694
- # the semantic analyzer, used only for testing. Currently used only by the new
695
- # semantic analyzer. Tuple of module and target name.
696
- self.processed_targets: list[tuple[str, str]] = []
697
- # Missing stub packages encountered.
698
- self.missing_stub_packages: set[str] = set()
699
- # Cache for mypy ASTs that have completed semantic analysis
700
- # pass 1. When multiple files are added to the build in a
701
- # single daemon increment, only one of the files gets added
702
- # per step and the others are discarded. This gets repeated
703
- # until all the files have been added. This means that a
704
- # new file can be processed O(n**2) times. This cache
705
- # avoids most of this redundant work.
706
- self.ast_cache: dict[str, tuple[MypyFile, list[ErrorInfo]]] = {}
707
-
708
- def dump_stats(self) -> None:
709
- if self.options.dump_build_stats:
710
- print("Stats:")
711
- for key, value in sorted(self.stats_summary().items()):
712
- print(f"{key + ':':24}{value}")
713
-
714
- def use_fine_grained_cache(self) -> bool:
715
- return self.cache_enabled and self.options.use_fine_grained_cache
716
-
717
- def maybe_swap_for_shadow_path(self, path: str) -> str:
718
- if not self.shadow_map:
719
- return path
720
-
721
- path = normpath(path, self.options)
722
-
723
- previously_checked = path in self.shadow_equivalence_map
724
- if not previously_checked:
725
- for source, shadow in self.shadow_map.items():
726
- if self.fscache.samefile(path, source):
727
- self.shadow_equivalence_map[path] = shadow
728
- break
729
- else:
730
- self.shadow_equivalence_map[path] = None
731
-
732
- shadow_file = self.shadow_equivalence_map.get(path)
733
- return shadow_file if shadow_file else path
734
-
735
- def get_stat(self, path: str) -> os.stat_result:
736
- return self.fscache.stat(self.maybe_swap_for_shadow_path(path))
737
-
738
- def getmtime(self, path: str) -> int:
739
- """Return a file's mtime; but 0 in bazel mode.
740
-
741
- (Bazel's distributed cache doesn't like filesystem metadata to
742
- end up in output files.)
743
- """
744
- if self.options.bazel:
745
- return 0
746
- else:
747
- return int(self.metastore.getmtime(path))
748
-
749
- def all_imported_modules_in_file(self, file: MypyFile) -> list[tuple[int, str, int]]:
750
- """Find all reachable import statements in a file.
751
-
752
- Return list of tuples (priority, module id, import line number)
753
- for all modules imported in file; lower numbers == higher priority.
754
-
755
- Can generate blocking errors on bogus relative imports.
756
- """
757
-
758
- def correct_rel_imp(imp: ImportFrom | ImportAll) -> str:
759
- """Function to correct for relative imports."""
760
- file_id = file.fullname
761
- rel = imp.relative
762
- if rel == 0:
763
- return imp.id
764
- if os.path.basename(file.path).startswith("__init__."):
765
- rel -= 1
766
- if rel != 0:
767
- file_id = ".".join(file_id.split(".")[:-rel])
768
- new_id = file_id + "." + imp.id if imp.id else file_id
769
-
770
- if not new_id:
771
- self.errors.set_file(file.path, file.name, self.options)
772
- self.errors.report(
773
- imp.line, 0, "No parent module -- cannot perform relative import", blocker=True
774
- )
775
-
776
- return new_id
777
-
778
- res: list[tuple[int, str, int]] = []
779
- for imp in file.imports:
780
- if not imp.is_unreachable:
781
- if isinstance(imp, Import):
782
- pri = import_priority(imp, PRI_MED)
783
- ancestor_pri = import_priority(imp, PRI_LOW)
784
- for id, _ in imp.ids:
785
- res.append((pri, id, imp.line))
786
- ancestor_parts = id.split(".")[:-1]
787
- ancestors = []
788
- for part in ancestor_parts:
789
- ancestors.append(part)
790
- res.append((ancestor_pri, ".".join(ancestors), imp.line))
791
- elif isinstance(imp, ImportFrom):
792
- cur_id = correct_rel_imp(imp)
793
- all_are_submodules = True
794
- # Also add any imported names that are submodules.
795
- pri = import_priority(imp, PRI_MED)
796
- for name, __ in imp.names:
797
- sub_id = cur_id + "." + name
798
- if self.is_module(sub_id):
799
- res.append((pri, sub_id, imp.line))
800
- else:
801
- all_are_submodules = False
802
- # Add cur_id as a dependency, even if all of the
803
- # imports are submodules. Processing import from will try
804
- # to look through cur_id, so we should depend on it.
805
- # As a workaround for for some bugs in cycle handling (#4498),
806
- # if all of the imports are submodules, do the import at a lower
807
- # priority.
808
- pri = import_priority(imp, PRI_HIGH if not all_are_submodules else PRI_LOW)
809
- res.append((pri, cur_id, imp.line))
810
- elif isinstance(imp, ImportAll):
811
- pri = import_priority(imp, PRI_HIGH)
812
- res.append((pri, correct_rel_imp(imp), imp.line))
813
-
814
- # Sort such that module (e.g. foo.bar.baz) comes before its ancestors (e.g. foo
815
- # and foo.bar) so that, if FindModuleCache finds the target module in a
816
- # package marked with py.typed underneath a namespace package installed in
817
- # site-packages, (gasp), that cache's knowledge of the ancestors
818
- # (aka FindModuleCache.ns_ancestors) can be primed when it is asked to find
819
- # the parent.
820
- res.sort(key=lambda x: -x[1].count("."))
821
- return res
822
-
823
- def is_module(self, id: str) -> bool:
824
- """Is there a file in the file system corresponding to module id?"""
825
- return find_module_simple(id, self) is not None
826
-
827
- def parse_file(
828
- self, id: str, path: str, source: str, ignore_errors: bool, options: Options
829
- ) -> MypyFile:
830
- """Parse the source of a file with the given name.
831
-
832
- Raise CompileError if there is a parse error.
833
- """
834
- t0 = time.time()
835
- if ignore_errors:
836
- self.errors.ignored_files.add(path)
837
- tree = parse(source, path, id, self.errors, options=options)
838
- tree._fullname = id
839
- self.add_stats(
840
- files_parsed=1,
841
- modules_parsed=int(not tree.is_stub),
842
- stubs_parsed=int(tree.is_stub),
843
- parse_time=time.time() - t0,
844
- )
845
-
846
- if self.errors.is_blockers():
847
- self.log("Bailing due to parse errors")
848
- self.errors.raise_error()
849
-
850
- self.errors.set_file_ignored_lines(path, tree.ignored_lines, ignore_errors)
851
- return tree
852
-
853
- def load_fine_grained_deps(self, id: str) -> dict[str, set[str]]:
854
- t0 = time.time()
855
- if id in self.fg_deps_meta:
856
- # TODO: Assert deps file wasn't changed.
857
- deps = json.loads(self.metastore.read(self.fg_deps_meta[id]["path"]))
858
- else:
859
- deps = {}
860
- val = {k: set(v) for k, v in deps.items()}
861
- self.add_stats(load_fg_deps_time=time.time() - t0)
862
- return val
863
-
864
- def report_file(
865
- self, file: MypyFile, type_map: dict[Expression, Type], options: Options
866
- ) -> None:
867
- if self.reports is not None and self.source_set.is_source(file):
868
- self.reports.file(file, self.modules, type_map, options)
869
-
870
- def verbosity(self) -> int:
871
- return self.options.verbosity
872
-
873
- def log(self, *message: str) -> None:
874
- if self.verbosity() >= 1:
875
- if message:
876
- print("LOG: ", *message, file=self.stderr)
877
- else:
878
- print(file=self.stderr)
879
- self.stderr.flush()
880
-
881
- def log_fine_grained(self, *message: str) -> None:
882
- import mypy.build
883
-
884
- if self.verbosity() >= 1:
885
- self.log("fine-grained:", *message)
886
- elif mypy.build.DEBUG_FINE_GRAINED:
887
- # Output log in a simplified format that is quick to browse.
888
- if message:
889
- print(*message, file=self.stderr)
890
- else:
891
- print(file=self.stderr)
892
- self.stderr.flush()
893
-
894
- def trace(self, *message: str) -> None:
895
- if self.verbosity() >= 2:
896
- print("TRACE:", *message, file=self.stderr)
897
- self.stderr.flush()
898
-
899
- def add_stats(self, **kwds: Any) -> None:
900
- for key, value in kwds.items():
901
- if key in self.stats:
902
- self.stats[key] += value
903
- else:
904
- self.stats[key] = value
905
-
906
- def stats_summary(self) -> Mapping[str, object]:
907
- return self.stats
908
-
909
-
910
- def deps_to_json(x: dict[str, set[str]]) -> str:
911
- return json.dumps({k: list(v) for k, v in x.items()}, separators=(",", ":"))
912
-
913
-
914
- # File for storing metadata about all the fine-grained dependency caches
915
- DEPS_META_FILE: Final = "@deps.meta.json"
916
- # File for storing fine-grained dependencies that didn't a parent in the build
917
- DEPS_ROOT_FILE: Final = "@root.deps.json"
918
-
919
- # The name of the fake module used to store fine-grained dependencies that
920
- # have no other place to go.
921
- FAKE_ROOT_MODULE: Final = "@root"
922
-
923
-
924
- def write_deps_cache(
925
- rdeps: dict[str, dict[str, set[str]]], manager: BuildManager, graph: Graph
926
- ) -> None:
927
- """Write cache files for fine-grained dependencies.
928
-
929
- Serialize fine-grained dependencies map for fine grained mode.
930
-
931
- Dependencies on some module 'm' is stored in the dependency cache
932
- file m.deps.json. This entails some spooky action at a distance:
933
- if module 'n' depends on 'm', that produces entries in m.deps.json.
934
- When there is a dependency on a module that does not exist in the
935
- build, it is stored with its first existing parent module. If no
936
- such module exists, it is stored with the fake module FAKE_ROOT_MODULE.
937
-
938
- This means that the validity of the fine-grained dependency caches
939
- are a global property, so we store validity checking information for
940
- fine-grained dependencies in a global cache file:
941
- * We take a snapshot of current sources to later check consistency
942
- between the fine-grained dependency cache and module cache metadata
943
- * We store the mtime of all of the dependency files to verify they
944
- haven't changed
945
- """
946
- metastore = manager.metastore
947
-
948
- error = False
949
-
950
- fg_deps_meta = manager.fg_deps_meta.copy()
951
-
952
- for id in rdeps:
953
- if id != FAKE_ROOT_MODULE:
954
- _, _, deps_json = get_cache_names(id, graph[id].xpath, manager.options)
955
- else:
956
- deps_json = DEPS_ROOT_FILE
957
- assert deps_json
958
- manager.log("Writing deps cache", deps_json)
959
- if not manager.metastore.write(deps_json, deps_to_json(rdeps[id])):
960
- manager.log(f"Error writing fine-grained deps JSON file {deps_json}")
961
- error = True
962
- else:
963
- fg_deps_meta[id] = {"path": deps_json, "mtime": manager.getmtime(deps_json)}
964
-
965
- meta_snapshot: dict[str, str] = {}
966
- for id, st in graph.items():
967
- # If we didn't parse a file (so it doesn't have a
968
- # source_hash), then it must be a module with a fresh cache,
969
- # so use the hash from that.
970
- if st.source_hash:
971
- hash = st.source_hash
972
- else:
973
- assert st.meta, "Module must be either parsed or cached"
974
- hash = st.meta.hash
975
- meta_snapshot[id] = hash
976
-
977
- meta = {"snapshot": meta_snapshot, "deps_meta": fg_deps_meta}
978
-
979
- if not metastore.write(DEPS_META_FILE, json.dumps(meta, separators=(",", ":"))):
980
- manager.log(f"Error writing fine-grained deps meta JSON file {DEPS_META_FILE}")
981
- error = True
982
-
983
- if error:
984
- manager.errors.set_file(_cache_dir_prefix(manager.options), None, manager.options)
985
- manager.errors.report(0, 0, "Error writing fine-grained dependencies cache", blocker=True)
986
-
987
-
988
- def invert_deps(deps: dict[str, set[str]], graph: Graph) -> dict[str, dict[str, set[str]]]:
989
- """Splits fine-grained dependencies based on the module of the trigger.
990
-
991
- Returns a dictionary from module ids to all dependencies on that
992
- module. Dependencies not associated with a module in the build will be
993
- associated with the nearest parent module that is in the build, or the
994
- fake module FAKE_ROOT_MODULE if none are.
995
- """
996
- # Lazy import to speed up startup
997
- from mypy.server.target import trigger_to_target
998
-
999
- # Prepopulate the map for all the modules that have been processed,
1000
- # so that we always generate files for processed modules (even if
1001
- # there aren't any dependencies to them.)
1002
- rdeps: dict[str, dict[str, set[str]]] = {id: {} for id, st in graph.items() if st.tree}
1003
- for trigger, targets in deps.items():
1004
- module = module_prefix(graph, trigger_to_target(trigger))
1005
- if not module or not graph[module].tree:
1006
- module = FAKE_ROOT_MODULE
1007
-
1008
- mod_rdeps = rdeps.setdefault(module, {})
1009
- mod_rdeps.setdefault(trigger, set()).update(targets)
1010
-
1011
- return rdeps
1012
-
1013
-
1014
- def generate_deps_for_cache(manager: BuildManager, graph: Graph) -> dict[str, dict[str, set[str]]]:
1015
- """Generate fine-grained dependencies into a form suitable for serializing.
1016
-
1017
- This does a couple things:
1018
- 1. Splits fine-grained deps based on the module of the trigger
1019
- 2. For each module we generated fine-grained deps for, load any previous
1020
- deps and merge them in.
1021
-
1022
- Returns a dictionary from module ids to all dependencies on that
1023
- module. Dependencies not associated with a module in the build will be
1024
- associated with the nearest parent module that is in the build, or the
1025
- fake module FAKE_ROOT_MODULE if none are.
1026
- """
1027
- from mypy.server.deps import merge_dependencies # Lazy import to speed up startup
1028
-
1029
- # Split the dependencies out into based on the module that is depended on.
1030
- rdeps = invert_deps(manager.fg_deps, graph)
1031
-
1032
- # We can't just clobber existing dependency information, so we
1033
- # load the deps for every module we've generated new dependencies
1034
- # to and merge the new deps into them.
1035
- for module, mdeps in rdeps.items():
1036
- old_deps = manager.load_fine_grained_deps(module)
1037
- merge_dependencies(old_deps, mdeps)
1038
-
1039
- return rdeps
1040
-
1041
-
1042
- PLUGIN_SNAPSHOT_FILE: Final = "@plugins_snapshot.json"
1043
-
1044
-
1045
- def write_plugins_snapshot(manager: BuildManager) -> None:
1046
- """Write snapshot of versions and hashes of currently active plugins."""
1047
- snapshot = json.dumps(manager.plugins_snapshot, separators=(",", ":"))
1048
- if not manager.metastore.write(PLUGIN_SNAPSHOT_FILE, snapshot):
1049
- manager.errors.set_file(_cache_dir_prefix(manager.options), None, manager.options)
1050
- manager.errors.report(0, 0, "Error writing plugins snapshot", blocker=True)
1051
-
1052
-
1053
- def read_plugins_snapshot(manager: BuildManager) -> dict[str, str] | None:
1054
- """Read cached snapshot of versions and hashes of plugins from previous run."""
1055
- snapshot = _load_json_file(
1056
- PLUGIN_SNAPSHOT_FILE,
1057
- manager,
1058
- log_success="Plugins snapshot ",
1059
- log_error="Could not load plugins snapshot: ",
1060
- )
1061
- if snapshot is None:
1062
- return None
1063
- if not isinstance(snapshot, dict):
1064
- manager.log(f"Could not load plugins snapshot: cache is not a dict: {type(snapshot)}")
1065
- return None
1066
- return snapshot
1067
-
1068
-
1069
- def read_quickstart_file(
1070
- options: Options, stdout: TextIO
1071
- ) -> dict[str, tuple[float, int, str]] | None:
1072
- quickstart: dict[str, tuple[float, int, str]] | None = None
1073
- if options.quickstart_file:
1074
- # This is very "best effort". If the file is missing or malformed,
1075
- # just ignore it.
1076
- raw_quickstart: dict[str, Any] = {}
1077
- try:
1078
- with open(options.quickstart_file) as f:
1079
- raw_quickstart = json.load(f)
1080
-
1081
- quickstart = {}
1082
- for file, (x, y, z) in raw_quickstart.items():
1083
- quickstart[file] = (x, y, z)
1084
- except Exception as e:
1085
- print(f"Warning: Failed to load quickstart file: {str(e)}\n", file=stdout)
1086
- return quickstart
1087
-
1088
-
1089
- def read_deps_cache(manager: BuildManager, graph: Graph) -> dict[str, FgDepMeta] | None:
1090
- """Read and validate the fine-grained dependencies cache.
1091
-
1092
- See the write_deps_cache documentation for more information on
1093
- the details of the cache.
1094
-
1095
- Returns None if the cache was invalid in some way.
1096
- """
1097
- deps_meta = _load_json_file(
1098
- DEPS_META_FILE,
1099
- manager,
1100
- log_success="Deps meta ",
1101
- log_error="Could not load fine-grained dependency metadata: ",
1102
- )
1103
- if deps_meta is None:
1104
- return None
1105
- meta_snapshot = deps_meta["snapshot"]
1106
- # Take a snapshot of the source hashes from all of the metas we found.
1107
- # (Including the ones we rejected because they were out of date.)
1108
- # We use this to verify that they match up with the proto_deps.
1109
- current_meta_snapshot = {
1110
- id: st.meta_source_hash for id, st in graph.items() if st.meta_source_hash is not None
1111
- }
1112
-
1113
- common = set(meta_snapshot.keys()) & set(current_meta_snapshot.keys())
1114
- if any(meta_snapshot[id] != current_meta_snapshot[id] for id in common):
1115
- # TODO: invalidate also if options changed (like --strict-optional)?
1116
- manager.log("Fine-grained dependencies cache inconsistent, ignoring")
1117
- return None
1118
-
1119
- module_deps_metas = deps_meta["deps_meta"]
1120
- assert isinstance(module_deps_metas, dict)
1121
- if not manager.options.skip_cache_mtime_checks:
1122
- for meta in module_deps_metas.values():
1123
- try:
1124
- matched = manager.getmtime(meta["path"]) == meta["mtime"]
1125
- except FileNotFoundError:
1126
- matched = False
1127
- if not matched:
1128
- manager.log(f"Invalid or missing fine-grained deps cache: {meta['path']}")
1129
- return None
1130
-
1131
- return module_deps_metas
1132
-
1133
-
1134
- def _load_json_file(
1135
- file: str, manager: BuildManager, log_success: str, log_error: str
1136
- ) -> dict[str, Any] | None:
1137
- """A simple helper to read a JSON file with logging."""
1138
- t0 = time.time()
1139
- try:
1140
- data = manager.metastore.read(file)
1141
- except OSError:
1142
- manager.log(log_error + file)
1143
- return None
1144
- manager.add_stats(metastore_read_time=time.time() - t0)
1145
- # Only bother to compute the log message if we are logging it, since it could be big
1146
- if manager.verbosity() >= 2:
1147
- manager.trace(log_success + data.rstrip())
1148
- try:
1149
- t1 = time.time()
1150
- result = json.loads(data)
1151
- manager.add_stats(data_json_load_time=time.time() - t1)
1152
- except json.JSONDecodeError:
1153
- manager.errors.set_file(file, None, manager.options)
1154
- manager.errors.report(
1155
- -1,
1156
- -1,
1157
- "Error reading JSON file;"
1158
- " you likely have a bad cache.\n"
1159
- "Try removing the {cache_dir} directory"
1160
- " and run mypy again.".format(cache_dir=manager.options.cache_dir),
1161
- blocker=True,
1162
- )
1163
- return None
1164
- else:
1165
- assert isinstance(result, dict)
1166
- return result
1167
-
1168
-
1169
- def _cache_dir_prefix(options: Options) -> str:
1170
- """Get current cache directory (or file if id is given)."""
1171
- if options.bazel:
1172
- # This is needed so the cache map works.
1173
- return os.curdir
1174
- cache_dir = options.cache_dir
1175
- pyversion = options.python_version
1176
- base = os.path.join(cache_dir, "%d.%d" % pyversion)
1177
- return base
1178
-
1179
-
1180
- def add_catch_all_gitignore(target_dir: str) -> None:
1181
- """Add catch-all .gitignore to an existing directory.
1182
-
1183
- No-op if the .gitignore already exists.
1184
- """
1185
- gitignore = os.path.join(target_dir, ".gitignore")
1186
- try:
1187
- with open(gitignore, "x") as f:
1188
- print("# Automatically created by mypy", file=f)
1189
- print("*", file=f)
1190
- except FileExistsError:
1191
- pass
1192
-
1193
-
1194
- def exclude_from_backups(target_dir: str) -> None:
1195
- """Exclude the directory from various archives and backups supporting CACHEDIR.TAG.
1196
-
1197
- If the CACHEDIR.TAG file exists the function is a no-op.
1198
- """
1199
- cachedir_tag = os.path.join(target_dir, "CACHEDIR.TAG")
1200
- try:
1201
- with open(cachedir_tag, "x") as f:
1202
- f.write(
1203
- """Signature: 8a477f597d28d172789f06886806bc55
1204
- # This file is a cache directory tag automatically created by mypy.
1205
- # For information about cache directory tags see https://bford.info/cachedir/
1206
- """
1207
- )
1208
- except FileExistsError:
1209
- pass
1210
-
1211
-
1212
- def create_metastore(options: Options) -> MetadataStore:
1213
- """Create the appropriate metadata store."""
1214
- if options.sqlite_cache:
1215
- mds: MetadataStore = SqliteMetadataStore(_cache_dir_prefix(options))
1216
- else:
1217
- mds = FilesystemMetadataStore(_cache_dir_prefix(options))
1218
- return mds
1219
-
1220
-
1221
- def get_cache_names(id: str, path: str, options: Options) -> tuple[str, str, str | None]:
1222
- """Return the file names for the cache files.
1223
-
1224
- Args:
1225
- id: module ID
1226
- path: module path
1227
- cache_dir: cache directory
1228
- pyversion: Python version (major, minor)
1229
-
1230
- Returns:
1231
- A tuple with the file names to be used for the meta JSON, the
1232
- data JSON, and the fine-grained deps JSON, respectively.
1233
- """
1234
- if options.cache_map:
1235
- pair = options.cache_map.get(normpath(path, options))
1236
- else:
1237
- pair = None
1238
- if pair is not None:
1239
- # The cache map paths were specified relative to the base directory,
1240
- # but the filesystem metastore APIs operates relative to the cache
1241
- # prefix directory.
1242
- # Solve this by rewriting the paths as relative to the root dir.
1243
- # This only makes sense when using the filesystem backed cache.
1244
- root = _cache_dir_prefix(options)
1245
- return (os.path.relpath(pair[0], root), os.path.relpath(pair[1], root), None)
1246
- prefix = os.path.join(*id.split("."))
1247
- is_package = os.path.basename(path).startswith("__init__.py")
1248
- if is_package:
1249
- prefix = os.path.join(prefix, "__init__")
1250
-
1251
- deps_json = None
1252
- if options.cache_fine_grained:
1253
- deps_json = prefix + ".deps.json"
1254
- return (prefix + ".meta.json", prefix + ".data.json", deps_json)
1255
-
1256
-
1257
- def find_cache_meta(id: str, path: str, manager: BuildManager) -> CacheMeta | None:
1258
- """Find cache data for a module.
1259
-
1260
- Args:
1261
- id: module ID
1262
- path: module path
1263
- manager: the build manager (for pyversion, log/trace, and build options)
1264
-
1265
- Returns:
1266
- A CacheMeta instance if the cache data was found and appears
1267
- valid; otherwise None.
1268
- """
1269
- # TODO: May need to take more build options into account
1270
- meta_json, data_json, _ = get_cache_names(id, path, manager.options)
1271
- manager.trace(f"Looking for {id} at {meta_json}")
1272
- t0 = time.time()
1273
- meta = _load_json_file(
1274
- meta_json, manager, log_success=f"Meta {id} ", log_error=f"Could not load cache for {id}: "
1275
- )
1276
- t1 = time.time()
1277
- if meta is None:
1278
- return None
1279
- if not isinstance(meta, dict):
1280
- manager.log(f"Could not load cache for {id}: meta cache is not a dict: {repr(meta)}")
1281
- return None
1282
- m = cache_meta_from_dict(meta, data_json)
1283
- t2 = time.time()
1284
- manager.add_stats(
1285
- load_meta_time=t2 - t0, load_meta_load_time=t1 - t0, load_meta_from_dict_time=t2 - t1
1286
- )
1287
-
1288
- # Don't check for path match, that is dealt with in validate_meta().
1289
- #
1290
- # TODO: these `type: ignore`s wouldn't be necessary
1291
- # if the type annotations for CacheMeta were more accurate
1292
- # (all of these attributes can be `None`)
1293
- if (
1294
- m.id != id
1295
- or m.mtime is None # type: ignore[redundant-expr]
1296
- or m.size is None # type: ignore[redundant-expr]
1297
- or m.dependencies is None # type: ignore[redundant-expr]
1298
- or m.data_mtime is None
1299
- ):
1300
- manager.log(f"Metadata abandoned for {id}: attributes are missing")
1301
- return None
1302
-
1303
- # Ignore cache if generated by an older mypy version.
1304
- if (
1305
- (m.version_id != manager.version_id and not manager.options.skip_version_check)
1306
- or m.options is None
1307
- or len(m.dependencies) + len(m.suppressed) != len(m.dep_prios)
1308
- or len(m.dependencies) + len(m.suppressed) != len(m.dep_lines)
1309
- ):
1310
- manager.log(f"Metadata abandoned for {id}: new attributes are missing")
1311
- return None
1312
-
1313
- # Ignore cache if (relevant) options aren't the same.
1314
- # Note that it's fine to mutilate cached_options since it's only used here.
1315
- cached_options = m.options
1316
- current_options = manager.options.clone_for_module(id).select_options_affecting_cache()
1317
- if manager.options.skip_version_check:
1318
- # When we're lax about version we're also lax about platform.
1319
- cached_options["platform"] = current_options["platform"]
1320
- if "debug_cache" in cached_options:
1321
- # Older versions included debug_cache, but it's silly to compare it.
1322
- del cached_options["debug_cache"]
1323
- if cached_options != current_options:
1324
- manager.log(f"Metadata abandoned for {id}: options differ")
1325
- if manager.options.verbosity >= 2:
1326
- for key in sorted(set(cached_options) | set(current_options)):
1327
- if cached_options.get(key) != current_options.get(key):
1328
- manager.trace(
1329
- " {}: {} != {}".format(
1330
- key, cached_options.get(key), current_options.get(key)
1331
- )
1332
- )
1333
- return None
1334
- if manager.old_plugins_snapshot and manager.plugins_snapshot:
1335
- # Check if plugins are still the same.
1336
- if manager.plugins_snapshot != manager.old_plugins_snapshot:
1337
- manager.log(f"Metadata abandoned for {id}: plugins differ")
1338
- return None
1339
- # So that plugins can return data with tuples in it without
1340
- # things silently always invalidating modules, we round-trip
1341
- # the config data. This isn't beautiful.
1342
- plugin_data = json.loads(
1343
- json.dumps(manager.plugin.report_config_data(ReportConfigContext(id, path, is_check=True)))
1344
- )
1345
- if m.plugin_data != plugin_data:
1346
- manager.log(f"Metadata abandoned for {id}: plugin configuration differs")
1347
- return None
1348
-
1349
- manager.add_stats(fresh_metas=1)
1350
- return m
1351
-
1352
-
1353
- def validate_meta(
1354
- meta: CacheMeta | None, id: str, path: str | None, ignore_all: bool, manager: BuildManager
1355
- ) -> CacheMeta | None:
1356
- """Checks whether the cached AST of this module can be used.
1357
-
1358
- Returns:
1359
- None, if the cached AST is unusable.
1360
- Original meta, if mtime/size matched.
1361
- Meta with mtime updated to match source file, if hash/size matched but mtime/path didn't.
1362
- """
1363
- # This requires two steps. The first one is obvious: we check that the module source file
1364
- # contents is the same as it was when the cache data file was created. The second one is not
1365
- # too obvious: we check that the cache data file mtime has not changed; it is needed because
1366
- # we use cache data file mtime to propagate information about changes in the dependencies.
1367
-
1368
- if meta is None:
1369
- manager.log(f"Metadata not found for {id}")
1370
- return None
1371
-
1372
- if meta.ignore_all and not ignore_all:
1373
- manager.log(f"Metadata abandoned for {id}: errors were previously ignored")
1374
- return None
1375
-
1376
- t0 = time.time()
1377
- bazel = manager.options.bazel
1378
- assert path is not None, "Internal error: meta was provided without a path"
1379
- if not manager.options.skip_cache_mtime_checks:
1380
- # Check data_json; assume if its mtime matches it's good.
1381
- try:
1382
- data_mtime = manager.getmtime(meta.data_json)
1383
- except OSError:
1384
- manager.log(f"Metadata abandoned for {id}: failed to stat data_json")
1385
- return None
1386
- if data_mtime != meta.data_mtime:
1387
- manager.log(f"Metadata abandoned for {id}: data cache is modified")
1388
- return None
1389
-
1390
- if bazel:
1391
- # Normalize path under bazel to make sure it isn't absolute
1392
- path = normpath(path, manager.options)
1393
- try:
1394
- st = manager.get_stat(path)
1395
- except OSError:
1396
- return None
1397
- if not stat.S_ISDIR(st.st_mode) and not stat.S_ISREG(st.st_mode):
1398
- manager.log(f"Metadata abandoned for {id}: file or directory {path} does not exist")
1399
- return None
1400
-
1401
- manager.add_stats(validate_stat_time=time.time() - t0)
1402
-
1403
- # When we are using a fine-grained cache, we want our initial
1404
- # build() to load all of the cache information and then do a
1405
- # fine-grained incremental update to catch anything that has
1406
- # changed since the cache was generated. We *don't* want to do a
1407
- # coarse-grained incremental rebuild, so we accept the cache
1408
- # metadata even if it doesn't match the source file.
1409
- #
1410
- # We still *do* the mtime/hash checks, however, to enable
1411
- # fine-grained mode to take advantage of the mtime-updating
1412
- # optimization when mtimes differ but hashes match. There is
1413
- # essentially no extra time cost to computing the hash here, since
1414
- # it will be cached and will be needed for finding changed files
1415
- # later anyways.
1416
- fine_grained_cache = manager.use_fine_grained_cache()
1417
-
1418
- size = st.st_size
1419
- # Bazel ensures the cache is valid.
1420
- if size != meta.size and not bazel and not fine_grained_cache:
1421
- manager.log(f"Metadata abandoned for {id}: file {path} has different size")
1422
- return None
1423
-
1424
- # Bazel ensures the cache is valid.
1425
- mtime = 0 if bazel else int(st.st_mtime)
1426
- if not bazel and (mtime != meta.mtime or path != meta.path):
1427
- if manager.quickstart_state and path in manager.quickstart_state:
1428
- # If the mtime and the size of the file recorded in the quickstart dump matches
1429
- # what we see on disk, we know (assume) that the hash matches the quickstart
1430
- # data as well. If that hash matches the hash in the metadata, then we know
1431
- # the file is up to date even though the mtime is wrong, without needing to hash it.
1432
- qmtime, qsize, qhash = manager.quickstart_state[path]
1433
- if int(qmtime) == mtime and qsize == size and qhash == meta.hash:
1434
- manager.log(f"Metadata fresh (by quickstart) for {id}: file {path}")
1435
- meta = meta._replace(mtime=mtime, path=path)
1436
- return meta
1437
-
1438
- t0 = time.time()
1439
- try:
1440
- # dir means it is a namespace package
1441
- if stat.S_ISDIR(st.st_mode):
1442
- source_hash = ""
1443
- else:
1444
- source_hash = manager.fscache.hash_digest(path)
1445
- except (OSError, UnicodeDecodeError, DecodeError):
1446
- return None
1447
- manager.add_stats(validate_hash_time=time.time() - t0)
1448
- if source_hash != meta.hash:
1449
- if fine_grained_cache:
1450
- manager.log(f"Using stale metadata for {id}: file {path}")
1451
- return meta
1452
- else:
1453
- manager.log(f"Metadata abandoned for {id}: file {path} has different hash")
1454
- return None
1455
- else:
1456
- t0 = time.time()
1457
- # Optimization: update mtime and path (otherwise, this mismatch will reappear).
1458
- meta = meta._replace(mtime=mtime, path=path)
1459
- # Construct a dict we can pass to json.dumps() (compare to write_cache()).
1460
- meta_dict = {
1461
- "id": id,
1462
- "path": path,
1463
- "mtime": mtime,
1464
- "size": size,
1465
- "hash": source_hash,
1466
- "data_mtime": meta.data_mtime,
1467
- "dependencies": meta.dependencies,
1468
- "suppressed": meta.suppressed,
1469
- "options": (manager.options.clone_for_module(id).select_options_affecting_cache()),
1470
- "dep_prios": meta.dep_prios,
1471
- "dep_lines": meta.dep_lines,
1472
- "interface_hash": meta.interface_hash,
1473
- "version_id": manager.version_id,
1474
- "ignore_all": meta.ignore_all,
1475
- "plugin_data": meta.plugin_data,
1476
- }
1477
- if manager.options.debug_cache:
1478
- meta_str = json.dumps(meta_dict, indent=2, sort_keys=True)
1479
- else:
1480
- meta_str = json.dumps(meta_dict, separators=(",", ":"))
1481
- meta_json, _, _ = get_cache_names(id, path, manager.options)
1482
- manager.log(
1483
- "Updating mtime for {}: file {}, meta {}, mtime {}".format(
1484
- id, path, meta_json, meta.mtime
1485
- )
1486
- )
1487
- t1 = time.time()
1488
- manager.metastore.write(meta_json, meta_str) # Ignore errors, just an optimization.
1489
- manager.add_stats(validate_update_time=time.time() - t1, validate_munging_time=t1 - t0)
1490
- return meta
1491
-
1492
- # It's a match on (id, path, size, hash, mtime).
1493
- manager.log(f"Metadata fresh for {id}: file {path}")
1494
- return meta
1495
-
1496
-
1497
- def compute_hash(text: str) -> str:
1498
- # We use a crypto hash instead of the builtin hash(...) function
1499
- # because the output of hash(...) can differ between runs due to
1500
- # hash randomization (enabled by default in Python 3.3). See the
1501
- # note in
1502
- # https://docs.python.org/3/reference/datamodel.html#object.__hash__.
1503
- return hash_digest(text.encode("utf-8"))
1504
-
1505
-
1506
- def json_dumps(obj: Any, debug_cache: bool) -> str:
1507
- if debug_cache:
1508
- return json.dumps(obj, indent=2, sort_keys=True)
1509
- else:
1510
- return json.dumps(obj, sort_keys=True, separators=(",", ":"))
1511
-
1512
-
1513
- def write_cache(
1514
- id: str,
1515
- path: str,
1516
- tree: MypyFile,
1517
- dependencies: list[str],
1518
- suppressed: list[str],
1519
- dep_prios: list[int],
1520
- dep_lines: list[int],
1521
- old_interface_hash: str,
1522
- source_hash: str,
1523
- ignore_all: bool,
1524
- manager: BuildManager,
1525
- ) -> tuple[str, CacheMeta | None]:
1526
- """Write cache files for a module.
1527
-
1528
- Note that this mypy's behavior is still correct when any given
1529
- write_cache() call is replaced with a no-op, so error handling
1530
- code that bails without writing anything is okay.
1531
-
1532
- Args:
1533
- id: module ID
1534
- path: module path
1535
- tree: the fully checked module data
1536
- dependencies: module IDs on which this module depends
1537
- suppressed: module IDs which were suppressed as dependencies
1538
- dep_prios: priorities (parallel array to dependencies)
1539
- dep_lines: import line locations (parallel array to dependencies)
1540
- old_interface_hash: the hash from the previous version of the data cache file
1541
- source_hash: the hash of the source code
1542
- ignore_all: the ignore_all flag for this module
1543
- manager: the build manager (for pyversion, log/trace)
1544
-
1545
- Returns:
1546
- A tuple containing the interface hash and CacheMeta
1547
- corresponding to the metadata that was written (the latter may
1548
- be None if the cache could not be written).
1549
- """
1550
- metastore = manager.metastore
1551
- # For Bazel we use relative paths and zero mtimes.
1552
- bazel = manager.options.bazel
1553
-
1554
- # Obtain file paths.
1555
- meta_json, data_json, _ = get_cache_names(id, path, manager.options)
1556
- manager.log(f"Writing {id} {path} {meta_json} {data_json}")
1557
-
1558
- # Update tree.path so that in bazel mode it's made relative (since
1559
- # sometimes paths leak out).
1560
- if bazel:
1561
- tree.path = path
1562
-
1563
- # Serialize data and analyze interface
1564
- data = tree.serialize()
1565
- data_str = json_dumps(data, manager.options.debug_cache)
1566
- interface_hash = compute_hash(data_str)
1567
-
1568
- plugin_data = manager.plugin.report_config_data(ReportConfigContext(id, path, is_check=False))
1569
-
1570
- # Obtain and set up metadata
1571
- try:
1572
- st = manager.get_stat(path)
1573
- except OSError as err:
1574
- manager.log(f"Cannot get stat for {path}: {err}")
1575
- # Remove apparently-invalid cache files.
1576
- # (This is purely an optimization.)
1577
- for filename in [data_json, meta_json]:
1578
- try:
1579
- os.remove(filename)
1580
- except OSError:
1581
- pass
1582
- # Still return the interface hash we computed.
1583
- return interface_hash, None
1584
-
1585
- # Write data cache file, if applicable
1586
- # Note that for Bazel we don't record the data file's mtime.
1587
- if old_interface_hash == interface_hash:
1588
- manager.trace(f"Interface for {id} is unchanged")
1589
- else:
1590
- manager.trace(f"Interface for {id} has changed")
1591
- if not metastore.write(data_json, data_str):
1592
- # Most likely the error is the replace() call
1593
- # (see https://github.com/python/mypy/issues/3215).
1594
- manager.log(f"Error writing data JSON file {data_json}")
1595
- # Let's continue without writing the meta file. Analysis:
1596
- # If the replace failed, we've changed nothing except left
1597
- # behind an extraneous temporary file; if the replace
1598
- # worked but the getmtime() call failed, the meta file
1599
- # will be considered invalid on the next run because the
1600
- # data_mtime field won't match the data file's mtime.
1601
- # Both have the effect of slowing down the next run a
1602
- # little bit due to an out-of-date cache file.
1603
- return interface_hash, None
1604
-
1605
- try:
1606
- data_mtime = manager.getmtime(data_json)
1607
- except OSError:
1608
- manager.log(f"Error in os.stat({data_json!r}), skipping cache write")
1609
- return interface_hash, None
1610
-
1611
- mtime = 0 if bazel else int(st.st_mtime)
1612
- size = st.st_size
1613
- # Note that the options we store in the cache are the options as
1614
- # specified by the command line/config file and *don't* reflect
1615
- # updates made by inline config directives in the file. This is
1616
- # important, or otherwise the options would never match when
1617
- # verifying the cache.
1618
- options = manager.options.clone_for_module(id)
1619
- assert source_hash is not None
1620
- meta = {
1621
- "id": id,
1622
- "path": path,
1623
- "mtime": mtime,
1624
- "size": size,
1625
- "hash": source_hash,
1626
- "data_mtime": data_mtime,
1627
- "dependencies": dependencies,
1628
- "suppressed": suppressed,
1629
- "options": options.select_options_affecting_cache(),
1630
- "dep_prios": dep_prios,
1631
- "dep_lines": dep_lines,
1632
- "interface_hash": interface_hash,
1633
- "version_id": manager.version_id,
1634
- "ignore_all": ignore_all,
1635
- "plugin_data": plugin_data,
1636
- }
1637
-
1638
- # Write meta cache file
1639
- meta_str = json_dumps(meta, manager.options.debug_cache)
1640
- if not metastore.write(meta_json, meta_str):
1641
- # Most likely the error is the replace() call
1642
- # (see https://github.com/python/mypy/issues/3215).
1643
- # The next run will simply find the cache entry out of date.
1644
- manager.log(f"Error writing meta JSON file {meta_json}")
1645
-
1646
- return interface_hash, cache_meta_from_dict(meta, data_json)
1647
-
1648
-
1649
- def delete_cache(id: str, path: str, manager: BuildManager) -> None:
1650
- """Delete cache files for a module.
1651
-
1652
- The cache files for a module are deleted when mypy finds errors there.
1653
- This avoids inconsistent states with cache files from different mypy runs,
1654
- see #4043 for an example.
1655
- """
1656
- # We don't delete .deps files on errors, since the dependencies
1657
- # are mostly generated from other files and the metadata is
1658
- # tracked separately.
1659
- meta_path, data_path, _ = get_cache_names(id, path, manager.options)
1660
- cache_paths = [meta_path, data_path]
1661
- manager.log(f"Deleting {id} {path} {' '.join(x for x in cache_paths if x)}")
1662
-
1663
- for filename in cache_paths:
1664
- try:
1665
- manager.metastore.remove(filename)
1666
- except OSError as e:
1667
- if e.errno != errno.ENOENT:
1668
- manager.log(f"Error deleting cache file {filename}: {e.strerror}")
1669
-
1670
-
1671
- """Dependency manager.
1672
-
1673
- Design
1674
- ======
1675
-
1676
- Ideally
1677
- -------
1678
-
1679
- A. Collapse cycles (each SCC -- strongly connected component --
1680
- becomes one "supernode").
1681
-
1682
- B. Topologically sort nodes based on dependencies.
1683
-
1684
- C. Process from leaves towards roots.
1685
-
1686
- Wrinkles
1687
- --------
1688
-
1689
- a. Need to parse source modules to determine dependencies.
1690
-
1691
- b. Processing order for modules within an SCC.
1692
-
1693
- c. Must order mtimes of files to decide whether to re-process; depends
1694
- on clock never resetting.
1695
-
1696
- d. from P import M; checks filesystem whether module P.M exists in
1697
- filesystem.
1698
-
1699
- e. Race conditions, where somebody modifies a file while we're
1700
- processing. Solved by using a FileSystemCache.
1701
-
1702
-
1703
- Steps
1704
- -----
1705
-
1706
- 1. For each explicitly given module find the source file location.
1707
-
1708
- 2. For each such module load and check the cache metadata, and decide
1709
- whether it's valid.
1710
-
1711
- 3. Now recursively (or iteratively) find dependencies and add those to
1712
- the graph:
1713
-
1714
- - for cached nodes use the list of dependencies from the cache
1715
- metadata (this will be valid even if we later end up re-parsing
1716
- the same source);
1717
-
1718
- - for uncached nodes parse the file and process all imports found,
1719
- taking care of (a) above.
1720
-
1721
- Step 3 should also address (d) above.
1722
-
1723
- Once step 3 terminates we have the entire dependency graph, and for
1724
- each module we've either loaded the cache metadata or parsed the
1725
- source code. (However, we may still need to parse those modules for
1726
- which we have cache metadata but that depend, directly or indirectly,
1727
- on at least one module for which the cache metadata is stale.)
1728
-
1729
- Now we can execute steps A-C from the first section. Finding SCCs for
1730
- step A shouldn't be hard; there's a recipe here:
1731
- https://code.activestate.com/recipes/578507/. There's also a plethora
1732
- of topsort recipes, e.g. https://code.activestate.com/recipes/577413/.
1733
-
1734
- For single nodes, processing is simple. If the node was cached, we
1735
- deserialize the cache data and fix up cross-references. Otherwise, we
1736
- do semantic analysis followed by type checking. We also handle (c)
1737
- above; if a module has valid cache data *but* any of its
1738
- dependencies was processed from source, then the module should be
1739
- processed from source.
1740
-
1741
- A relatively simple optimization (outside SCCs) we might do in the
1742
- future is as follows: if a node's cache data is valid, but one or more
1743
- of its dependencies are out of date so we have to re-parse the node
1744
- from source, once we have fully type-checked the node, we can decide
1745
- whether its symbol table actually changed compared to the cache data
1746
- (by reading the cache data and comparing it to the data we would be
1747
- writing). If there is no change we can declare the node up to date,
1748
- and any node that depends (and for which we have cached data, and
1749
- whose other dependencies are up to date) on it won't need to be
1750
- re-parsed from source.
1751
-
1752
- Import cycles
1753
- -------------
1754
-
1755
- Finally we have to decide how to handle (c), import cycles. Here
1756
- we'll need a modified version of the original state machine
1757
- (build.py), but we only need to do this per SCC, and we won't have to
1758
- deal with changes to the list of nodes while we're processing it.
1759
-
1760
- If all nodes in the SCC have valid cache metadata and all dependencies
1761
- outside the SCC are still valid, we can proceed as follows:
1762
-
1763
- 1. Load cache data for all nodes in the SCC.
1764
-
1765
- 2. Fix up cross-references for all nodes in the SCC.
1766
-
1767
- Otherwise, the simplest (but potentially slow) way to proceed is to
1768
- invalidate all cache data in the SCC and re-parse all nodes in the SCC
1769
- from source. We can do this as follows:
1770
-
1771
- 1. Parse source for all nodes in the SCC.
1772
-
1773
- 2. Semantic analysis for all nodes in the SCC.
1774
-
1775
- 3. Type check all nodes in the SCC.
1776
-
1777
- (If there are more passes the process is the same -- each pass should
1778
- be done for all nodes before starting the next pass for any nodes in
1779
- the SCC.)
1780
-
1781
- We could process the nodes in the SCC in any order. For sentimental
1782
- reasons, I've decided to process them in the reverse order in which we
1783
- encountered them when originally constructing the graph. That's how
1784
- the old build.py deals with cycles, and at least this reproduces the
1785
- previous implementation more accurately.
1786
-
1787
- Can we do better than re-parsing all nodes in the SCC when any of its
1788
- dependencies are out of date? It's doubtful. The optimization
1789
- mentioned at the end of the previous section would require re-parsing
1790
- and type-checking a node and then comparing its symbol table to the
1791
- cached data; but because the node is part of a cycle we can't
1792
- technically type-check it until the semantic analysis of all other
1793
- nodes in the cycle has completed. (This is an important issue because
1794
- Dropbox has a very large cycle in production code. But I'd like to
1795
- deal with it later.)
1796
-
1797
- Additional wrinkles
1798
- -------------------
1799
-
1800
- During implementation more wrinkles were found.
1801
-
1802
- - When a submodule of a package (e.g. x.y) is encountered, the parent
1803
- package (e.g. x) must also be loaded, but it is not strictly a
1804
- dependency. See State.add_ancestors() below.
1805
- """
1806
-
1807
-
1808
- class ModuleNotFound(Exception):
1809
- """Control flow exception to signal that a module was not found."""
1810
-
1811
-
1812
- class State:
1813
- """The state for a module.
1814
-
1815
- The source is only used for the -c command line option; in that
1816
- case path is None. Otherwise source is None and path isn't.
1817
- """
1818
-
1819
- manager: BuildManager
1820
- order_counter: ClassVar[int] = 0
1821
- order: int # Order in which modules were encountered
1822
- id: str # Fully qualified module name
1823
- path: str | None = None # Path to module source
1824
- abspath: str | None = None # Absolute path to module source
1825
- xpath: str # Path or '<string>'
1826
- source: str | None = None # Module source code
1827
- source_hash: str | None = None # Hash calculated based on the source code
1828
- meta_source_hash: str | None = None # Hash of the source given in the meta, if any
1829
- meta: CacheMeta | None = None
1830
- data: str | None = None
1831
- tree: MypyFile | None = None
1832
- # We keep both a list and set of dependencies. A set because it makes it efficient to
1833
- # prevent duplicates and the list because I am afraid of changing the order of
1834
- # iteration over dependencies.
1835
- # They should be managed with add_dependency and suppress_dependency.
1836
- dependencies: list[str] # Modules directly imported by the module
1837
- dependencies_set: set[str] # The same but as a set for deduplication purposes
1838
- suppressed: list[str] # Suppressed/missing dependencies
1839
- suppressed_set: set[str] # Suppressed/missing dependencies
1840
- priorities: dict[str, int]
1841
-
1842
- # Map each dependency to the line number where it is first imported
1843
- dep_line_map: dict[str, int]
1844
-
1845
- # Parent package, its parent, etc.
1846
- ancestors: list[str] | None = None
1847
-
1848
- # List of (path, line number) tuples giving context for import
1849
- import_context: list[tuple[str, int]]
1850
-
1851
- # The State from which this module was imported, if any
1852
- caller_state: State | None = None
1853
-
1854
- # If caller_state is set, the line number in the caller where the import occurred
1855
- caller_line = 0
1856
-
1857
- # If True, indicate that the public interface of this module is unchanged
1858
- externally_same = True
1859
-
1860
- # Contains a hash of the public interface in incremental mode
1861
- interface_hash: str = ""
1862
-
1863
- # Options, specialized for this file
1864
- options: Options
1865
-
1866
- # Whether to ignore all errors
1867
- ignore_all = False
1868
-
1869
- # Whether the module has an error or any of its dependencies have one.
1870
- transitive_error = False
1871
-
1872
- # Errors reported before semantic analysis, to allow fine-grained
1873
- # mode to keep reporting them.
1874
- early_errors: list[ErrorInfo]
1875
-
1876
- # Type checker used for checking this file. Use type_checker() for
1877
- # access and to construct this on demand.
1878
- _type_checker: TypeChecker | None = None
1879
-
1880
- fine_grained_deps_loaded = False
1881
-
1882
- # Cumulative time spent on this file, in microseconds (for profiling stats)
1883
- time_spent_us: int = 0
1884
-
1885
- # Per-line type-checking time (cumulative time spent type-checking expressions
1886
- # on a given source code line).
1887
- per_line_checking_time_ns: dict[int, int]
1888
-
1889
- def __init__(
1890
- self,
1891
- id: str | None,
1892
- path: str | None,
1893
- source: str | None,
1894
- manager: BuildManager,
1895
- caller_state: State | None = None,
1896
- caller_line: int = 0,
1897
- ancestor_for: State | None = None,
1898
- root_source: bool = False,
1899
- # If `temporary` is True, this State is being created to just
1900
- # quickly parse/load the tree, without an intention to further
1901
- # process it. With this flag, any changes to external state as well
1902
- # as error reporting should be avoided.
1903
- temporary: bool = False,
1904
- ) -> None:
1905
- if not temporary:
1906
- assert id or path or source is not None, "Neither id, path nor source given"
1907
- self.manager = manager
1908
- State.order_counter += 1
1909
- self.order = State.order_counter
1910
- self.caller_state = caller_state
1911
- self.caller_line = caller_line
1912
- if caller_state:
1913
- self.import_context = caller_state.import_context.copy()
1914
- self.import_context.append((caller_state.xpath, caller_line))
1915
- else:
1916
- self.import_context = []
1917
- self.id = id or "__main__"
1918
- self.options = manager.options.clone_for_module(self.id)
1919
- self.early_errors = []
1920
- self._type_checker = None
1921
- if not path and source is None:
1922
- assert id is not None
1923
- try:
1924
- path, follow_imports = find_module_and_diagnose(
1925
- manager,
1926
- id,
1927
- self.options,
1928
- caller_state,
1929
- caller_line,
1930
- ancestor_for,
1931
- root_source,
1932
- skip_diagnose=temporary,
1933
- )
1934
- except ModuleNotFound:
1935
- if not temporary:
1936
- manager.missing_modules.add(id)
1937
- raise
1938
- if follow_imports == "silent":
1939
- self.ignore_all = True
1940
- elif path and is_silent_import_module(manager, path) and not root_source:
1941
- self.ignore_all = True
1942
- self.path = path
1943
- if path:
1944
- self.abspath = os.path.abspath(path)
1945
- self.xpath = path or "<string>"
1946
- if path and source is None and self.manager.cache_enabled:
1947
- self.meta = find_cache_meta(self.id, path, manager)
1948
- # TODO: Get mtime if not cached.
1949
- if self.meta is not None:
1950
- self.interface_hash = self.meta.interface_hash
1951
- self.meta_source_hash = self.meta.hash
1952
- if path and source is None and self.manager.fscache.isdir(path):
1953
- source = ""
1954
- self.source = source
1955
- self.add_ancestors()
1956
- self.per_line_checking_time_ns = collections.defaultdict(int)
1957
- t0 = time.time()
1958
- self.meta = validate_meta(self.meta, self.id, self.path, self.ignore_all, manager)
1959
- self.manager.add_stats(validate_meta_time=time.time() - t0)
1960
- if self.meta:
1961
- # Make copies, since we may modify these and want to
1962
- # compare them to the originals later.
1963
- self.dependencies = list(self.meta.dependencies)
1964
- self.dependencies_set = set(self.dependencies)
1965
- self.suppressed = list(self.meta.suppressed)
1966
- self.suppressed_set = set(self.suppressed)
1967
- all_deps = self.dependencies + self.suppressed
1968
- assert len(all_deps) == len(self.meta.dep_prios)
1969
- self.priorities = {id: pri for id, pri in zip(all_deps, self.meta.dep_prios)}
1970
- assert len(all_deps) == len(self.meta.dep_lines)
1971
- self.dep_line_map = {id: line for id, line in zip(all_deps, self.meta.dep_lines)}
1972
- if temporary:
1973
- self.load_tree(temporary=True)
1974
- if not manager.use_fine_grained_cache():
1975
- # Special case: if there were a previously missing package imported here
1976
- # and it is not present, then we need to re-calculate dependencies.
1977
- # This is to support patterns like this:
1978
- # from missing_package import missing_module # type: ignore
1979
- # At first mypy doesn't know that `missing_module` is a module
1980
- # (it may be a variable, a class, or a function), so it is not added to
1981
- # suppressed dependencies. Therefore, when the package with module is added,
1982
- # we need to re-calculate dependencies.
1983
- # NOTE: see comment below for why we skip this in fine grained mode.
1984
- if exist_added_packages(self.suppressed, manager, self.options):
1985
- self.parse_file() # This is safe because the cache is anyway stale.
1986
- self.compute_dependencies()
1987
- else:
1988
- # When doing a fine-grained cache load, pretend we only
1989
- # know about modules that have cache information and defer
1990
- # handling new modules until the fine-grained update.
1991
- if manager.use_fine_grained_cache():
1992
- manager.log(f"Deferring module to fine-grained update {path} ({id})")
1993
- raise ModuleNotFound
1994
-
1995
- # Parse the file (and then some) to get the dependencies.
1996
- self.parse_file(temporary=temporary)
1997
- self.compute_dependencies()
1998
-
1999
- @property
2000
- def xmeta(self) -> CacheMeta:
2001
- assert self.meta, "missing meta on allegedly fresh module"
2002
- return self.meta
2003
-
2004
- def add_ancestors(self) -> None:
2005
- if self.path is not None:
2006
- _, name = os.path.split(self.path)
2007
- base, _ = os.path.splitext(name)
2008
- if "." in base:
2009
- # This is just a weird filename, don't add anything
2010
- self.ancestors = []
2011
- return
2012
- # All parent packages are new ancestors.
2013
- ancestors = []
2014
- parent = self.id
2015
- while "." in parent:
2016
- parent, _ = parent.rsplit(".", 1)
2017
- ancestors.append(parent)
2018
- self.ancestors = ancestors
2019
-
2020
- def is_fresh(self) -> bool:
2021
- """Return whether the cache data for this file is fresh."""
2022
- # NOTE: self.dependencies may differ from
2023
- # self.meta.dependencies when a dependency is dropped due to
2024
- # suppression by silent mode. However when a suppressed
2025
- # dependency is added back we find out later in the process.
2026
- return (
2027
- self.meta is not None
2028
- and self.is_interface_fresh()
2029
- and self.dependencies == self.meta.dependencies
2030
- )
2031
-
2032
- def is_interface_fresh(self) -> bool:
2033
- return self.externally_same
2034
-
2035
- def mark_as_rechecked(self) -> None:
2036
- """Marks this module as having been fully re-analyzed by the type-checker."""
2037
- self.manager.rechecked_modules.add(self.id)
2038
-
2039
- def mark_interface_stale(self, *, on_errors: bool = False) -> None:
2040
- """Marks this module as having a stale public interface, and discards the cache data."""
2041
- self.externally_same = False
2042
- if not on_errors:
2043
- self.manager.stale_modules.add(self.id)
2044
-
2045
- def check_blockers(self) -> None:
2046
- """Raise CompileError if a blocking error is detected."""
2047
- if self.manager.errors.is_blockers():
2048
- self.manager.log("Bailing due to blocking errors")
2049
- self.manager.errors.raise_error()
2050
-
2051
- @contextlib.contextmanager
2052
- def wrap_context(self, check_blockers: bool = True) -> Iterator[None]:
2053
- """Temporarily change the error import context to match this state.
2054
-
2055
- Also report an internal error if an unexpected exception was raised
2056
- and raise an exception on a blocking error, unless
2057
- check_blockers is False. Skipping blocking error reporting is used
2058
- in the semantic analyzer so that we can report all blocking errors
2059
- for a file (across multiple targets) to maintain backward
2060
- compatibility.
2061
- """
2062
- save_import_context = self.manager.errors.import_context()
2063
- self.manager.errors.set_import_context(self.import_context)
2064
- try:
2065
- yield
2066
- except CompileError:
2067
- raise
2068
- except Exception as err:
2069
- report_internal_error(
2070
- err,
2071
- self.path,
2072
- 0,
2073
- self.manager.errors,
2074
- self.options,
2075
- self.manager.stdout,
2076
- self.manager.stderr,
2077
- )
2078
- self.manager.errors.set_import_context(save_import_context)
2079
- # TODO: Move this away once we've removed the old semantic analyzer?
2080
- if check_blockers:
2081
- self.check_blockers()
2082
-
2083
- def load_fine_grained_deps(self) -> dict[str, set[str]]:
2084
- return self.manager.load_fine_grained_deps(self.id)
2085
-
2086
- def load_tree(self, temporary: bool = False) -> None:
2087
- assert (
2088
- self.meta is not None
2089
- ), "Internal error: this method must be called only for cached modules"
2090
-
2091
- data = _load_json_file(
2092
- self.meta.data_json, self.manager, "Load tree ", "Could not load tree: "
2093
- )
2094
- if data is None:
2095
- return
2096
-
2097
- t0 = time.time()
2098
- # TODO: Assert data file wasn't changed.
2099
- self.tree = MypyFile.deserialize(data)
2100
- t1 = time.time()
2101
- self.manager.add_stats(deserialize_time=t1 - t0)
2102
- if not temporary:
2103
- self.manager.modules[self.id] = self.tree
2104
- self.manager.add_stats(fresh_trees=1)
2105
-
2106
- def fix_cross_refs(self) -> None:
2107
- assert self.tree is not None, "Internal error: method must be called on parsed file only"
2108
- # We need to set allow_missing when doing a fine grained cache
2109
- # load because we need to gracefully handle missing modules.
2110
- fixup_module(self.tree, self.manager.modules, self.options.use_fine_grained_cache)
2111
-
2112
- # Methods for processing modules from source code.
2113
-
2114
- def parse_file(self, *, temporary: bool = False) -> None:
2115
- """Parse file and run first pass of semantic analysis.
2116
-
2117
- Everything done here is local to the file. Don't depend on imported
2118
- modules in any way. Also record module dependencies based on imports.
2119
- """
2120
- if self.tree is not None:
2121
- # The file was already parsed (in __init__()).
2122
- return
2123
-
2124
- manager = self.manager
2125
-
2126
- # Can we reuse a previously parsed AST? This avoids redundant work in daemon.
2127
- cached = self.id in manager.ast_cache
2128
- modules = manager.modules
2129
- if not cached:
2130
- manager.log(f"Parsing {self.xpath} ({self.id})")
2131
- else:
2132
- manager.log(f"Using cached AST for {self.xpath} ({self.id})")
2133
-
2134
- t0 = time_ref()
2135
-
2136
- with self.wrap_context():
2137
- source = self.source
2138
- self.source = None # We won't need it again.
2139
- if self.path and source is None:
2140
- try:
2141
- path = manager.maybe_swap_for_shadow_path(self.path)
2142
- source = decode_python_encoding(manager.fscache.read(path))
2143
- self.source_hash = manager.fscache.hash_digest(path)
2144
- except OSError as ioerr:
2145
- # ioerr.strerror differs for os.stat failures between Windows and
2146
- # other systems, but os.strerror(ioerr.errno) does not, so we use that.
2147
- # (We want the error messages to be platform-independent so that the
2148
- # tests have predictable output.)
2149
- raise CompileError(
2150
- [
2151
- "mypy: can't read file '{}': {}".format(
2152
- self.path, os.strerror(ioerr.errno)
2153
- )
2154
- ],
2155
- module_with_blocker=self.id,
2156
- ) from ioerr
2157
- except (UnicodeDecodeError, DecodeError) as decodeerr:
2158
- if self.path.endswith(".pyd"):
2159
- err = f"mypy: stubgen does not support .pyd files: '{self.path}'"
2160
- else:
2161
- err = f"mypy: can't decode file '{self.path}': {str(decodeerr)}"
2162
- raise CompileError([err], module_with_blocker=self.id) from decodeerr
2163
- elif self.path and self.manager.fscache.isdir(self.path):
2164
- source = ""
2165
- self.source_hash = ""
2166
- else:
2167
- assert source is not None
2168
- self.source_hash = compute_hash(source)
2169
-
2170
- self.parse_inline_configuration(source)
2171
- if not cached:
2172
- self.tree = manager.parse_file(
2173
- self.id,
2174
- self.xpath,
2175
- source,
2176
- ignore_errors=self.ignore_all or self.options.ignore_errors,
2177
- options=self.options,
2178
- )
2179
-
2180
- else:
2181
- # Reuse a cached AST
2182
- self.tree = manager.ast_cache[self.id][0]
2183
- manager.errors.set_file_ignored_lines(
2184
- self.xpath,
2185
- self.tree.ignored_lines,
2186
- self.ignore_all or self.options.ignore_errors,
2187
- )
2188
-
2189
- self.time_spent_us += time_spent_us(t0)
2190
-
2191
- if not cached:
2192
- # Make a copy of any errors produced during parse time so that
2193
- # fine-grained mode can repeat them when the module is
2194
- # reprocessed.
2195
- self.early_errors = list(manager.errors.error_info_map.get(self.xpath, []))
2196
- else:
2197
- self.early_errors = manager.ast_cache[self.id][1]
2198
-
2199
- if not temporary:
2200
- modules[self.id] = self.tree
2201
-
2202
- if not cached:
2203
- self.semantic_analysis_pass1()
2204
-
2205
- if not temporary:
2206
- self.check_blockers()
2207
-
2208
- manager.ast_cache[self.id] = (self.tree, self.early_errors)
2209
-
2210
- def parse_inline_configuration(self, source: str) -> None:
2211
- """Check for inline mypy: options directive and parse them."""
2212
- flags = get_mypy_comments(source)
2213
- if flags:
2214
- changes, config_errors = parse_mypy_comments(flags, self.options)
2215
- self.options = self.options.apply_changes(changes)
2216
- self.manager.errors.set_file(self.xpath, self.id, self.options)
2217
- for lineno, error in config_errors:
2218
- self.manager.errors.report(lineno, 0, error)
2219
-
2220
- def semantic_analysis_pass1(self) -> None:
2221
- """Perform pass 1 of semantic analysis, which happens immediately after parsing.
2222
-
2223
- This pass can't assume that any other modules have been processed yet.
2224
- """
2225
- options = self.options
2226
- assert self.tree is not None
2227
-
2228
- t0 = time_ref()
2229
-
2230
- # Do the first pass of semantic analysis: analyze the reachability
2231
- # of blocks and import statements. We must do this before
2232
- # processing imports, since this may mark some import statements as
2233
- # unreachable.
2234
- #
2235
- # TODO: This should not be considered as a semantic analysis
2236
- # pass -- it's an independent pass.
2237
- analyzer = SemanticAnalyzerPreAnalysis()
2238
- with self.wrap_context():
2239
- analyzer.visit_file(self.tree, self.xpath, self.id, options)
2240
- self.manager.errors.set_skipped_lines(self.xpath, self.tree.skipped_lines)
2241
- # TODO: Do this while constructing the AST?
2242
- self.tree.names = SymbolTable()
2243
- if not self.tree.is_stub:
2244
- # Always perform some low-key variable renaming
2245
- self.tree.accept(LimitedVariableRenameVisitor())
2246
- if options.allow_redefinition:
2247
- # Perform more renaming across the AST to allow variable redefinitions
2248
- self.tree.accept(VariableRenameVisitor())
2249
- self.time_spent_us += time_spent_us(t0)
2250
-
2251
- def add_dependency(self, dep: str) -> None:
2252
- if dep not in self.dependencies_set:
2253
- self.dependencies.append(dep)
2254
- self.dependencies_set.add(dep)
2255
- if dep in self.suppressed_set:
2256
- self.suppressed.remove(dep)
2257
- self.suppressed_set.remove(dep)
2258
-
2259
- def suppress_dependency(self, dep: str) -> None:
2260
- if dep in self.dependencies_set:
2261
- self.dependencies.remove(dep)
2262
- self.dependencies_set.remove(dep)
2263
- if dep not in self.suppressed_set:
2264
- self.suppressed.append(dep)
2265
- self.suppressed_set.add(dep)
2266
-
2267
- def compute_dependencies(self) -> None:
2268
- """Compute a module's dependencies after parsing it.
2269
-
2270
- This is used when we parse a file that we didn't have
2271
- up-to-date cache information for. When we have an up-to-date
2272
- cache, we just use the cached info.
2273
- """
2274
- manager = self.manager
2275
- assert self.tree is not None
2276
-
2277
- # Compute (direct) dependencies.
2278
- # Add all direct imports (this is why we needed the first pass).
2279
- # Also keep track of each dependency's source line.
2280
- # Missing dependencies will be moved from dependencies to
2281
- # suppressed when they fail to be loaded in load_graph.
2282
-
2283
- self.dependencies = []
2284
- self.dependencies_set = set()
2285
- self.suppressed = []
2286
- self.suppressed_set = set()
2287
- self.priorities = {} # id -> priority
2288
- self.dep_line_map = {} # id -> line
2289
- dep_entries = manager.all_imported_modules_in_file(
2290
- self.tree
2291
- ) + self.manager.plugin.get_additional_deps(self.tree)
2292
- for pri, id, line in dep_entries:
2293
- self.priorities[id] = min(pri, self.priorities.get(id, PRI_ALL))
2294
- if id == self.id:
2295
- continue
2296
- self.add_dependency(id)
2297
- if id not in self.dep_line_map:
2298
- self.dep_line_map[id] = line
2299
- # Every module implicitly depends on builtins.
2300
- if self.id != "builtins":
2301
- self.add_dependency("builtins")
2302
-
2303
- self.check_blockers() # Can fail due to bogus relative imports
2304
-
2305
- def type_check_first_pass(self) -> None:
2306
- if self.options.semantic_analysis_only:
2307
- return
2308
- t0 = time_ref()
2309
- with self.wrap_context():
2310
- self.type_checker().check_first_pass()
2311
- self.time_spent_us += time_spent_us(t0)
2312
-
2313
- def type_checker(self) -> TypeChecker:
2314
- if not self._type_checker:
2315
- assert self.tree is not None, "Internal error: must be called on parsed file only"
2316
- manager = self.manager
2317
- self._type_checker = TypeChecker(
2318
- manager.errors,
2319
- manager.modules,
2320
- self.options,
2321
- self.tree,
2322
- self.xpath,
2323
- manager.plugin,
2324
- self.per_line_checking_time_ns,
2325
- )
2326
- return self._type_checker
2327
-
2328
- def type_map(self) -> dict[Expression, Type]:
2329
- # We can extract the master type map directly since at this
2330
- # point no temporary type maps can be active.
2331
- assert len(self.type_checker()._type_maps) == 1
2332
- return self.type_checker()._type_maps[0]
2333
-
2334
- def type_check_second_pass(self) -> bool:
2335
- if self.options.semantic_analysis_only:
2336
- return False
2337
- t0 = time_ref()
2338
- with self.wrap_context():
2339
- result = self.type_checker().check_second_pass()
2340
- self.time_spent_us += time_spent_us(t0)
2341
- return result
2342
-
2343
- def detect_possibly_undefined_vars(self) -> None:
2344
- assert self.tree is not None, "Internal error: method must be called on parsed file only"
2345
- if self.tree.is_stub:
2346
- # We skip stub files because they aren't actually executed.
2347
- return
2348
- manager = self.manager
2349
- manager.errors.set_file(self.xpath, self.tree.fullname, options=self.options)
2350
- if manager.errors.is_error_code_enabled(
2351
- codes.POSSIBLY_UNDEFINED
2352
- ) or manager.errors.is_error_code_enabled(codes.USED_BEFORE_DEF):
2353
- self.tree.accept(
2354
- PossiblyUndefinedVariableVisitor(
2355
- MessageBuilder(manager.errors, manager.modules),
2356
- self.type_map(),
2357
- self.options,
2358
- self.tree.names,
2359
- )
2360
- )
2361
-
2362
- def finish_passes(self) -> None:
2363
- assert self.tree is not None, "Internal error: method must be called on parsed file only"
2364
- manager = self.manager
2365
- if self.options.semantic_analysis_only:
2366
- return
2367
- t0 = time_ref()
2368
- with self.wrap_context():
2369
- # Some tests (and tools) want to look at the set of all types.
2370
- options = manager.options
2371
- if options.export_types:
2372
- manager.all_types.update(self.type_map())
2373
-
2374
- # We should always patch indirect dependencies, even in full (non-incremental) builds,
2375
- # because the cache still may be written, and it must be correct.
2376
- # TODO: find a more robust way to traverse *all* relevant types?
2377
- expr_types = set(self.type_map().values())
2378
- symbol_types = set()
2379
- for _, sym, _ in self.tree.local_definitions():
2380
- if sym.type is not None:
2381
- symbol_types.add(sym.type)
2382
- if isinstance(sym.node, TypeInfo):
2383
- # TypeInfo symbols have some extra relevant types.
2384
- symbol_types.update(sym.node.bases)
2385
- if sym.node.metaclass_type:
2386
- symbol_types.add(sym.node.metaclass_type)
2387
- if sym.node.typeddict_type:
2388
- symbol_types.add(sym.node.typeddict_type)
2389
- if sym.node.tuple_type:
2390
- symbol_types.add(sym.node.tuple_type)
2391
- self._patch_indirect_dependencies(
2392
- self.type_checker().module_refs, expr_types | symbol_types
2393
- )
2394
-
2395
- if self.options.dump_inference_stats:
2396
- dump_type_stats(
2397
- self.tree,
2398
- self.xpath,
2399
- modules=self.manager.modules,
2400
- inferred=True,
2401
- typemap=self.type_map(),
2402
- )
2403
- manager.report_file(self.tree, self.type_map(), self.options)
2404
-
2405
- self.update_fine_grained_deps(self.manager.fg_deps)
2406
-
2407
- if manager.options.export_ref_info:
2408
- write_undocumented_ref_info(
2409
- self, manager.metastore, manager.options, self.type_map()
2410
- )
2411
-
2412
- self.free_state()
2413
- if not manager.options.fine_grained_incremental and not manager.options.preserve_asts:
2414
- free_tree(self.tree)
2415
- self.time_spent_us += time_spent_us(t0)
2416
-
2417
- def free_state(self) -> None:
2418
- if self._type_checker:
2419
- self._type_checker.reset()
2420
- self._type_checker = None
2421
-
2422
- def _patch_indirect_dependencies(self, module_refs: set[str], types: set[Type]) -> None:
2423
- assert None not in types
2424
- valid = self.valid_references()
2425
-
2426
- encountered = self.manager.indirection_detector.find_modules(types) | module_refs
2427
- extra = encountered - valid
2428
-
2429
- for dep in sorted(extra):
2430
- if dep not in self.manager.modules:
2431
- continue
2432
- if dep not in self.suppressed_set and dep not in self.manager.missing_modules:
2433
- self.add_dependency(dep)
2434
- self.priorities[dep] = PRI_INDIRECT
2435
- elif dep not in self.suppressed_set and dep in self.manager.missing_modules:
2436
- self.suppress_dependency(dep)
2437
-
2438
- def compute_fine_grained_deps(self) -> dict[str, set[str]]:
2439
- assert self.tree is not None
2440
- if self.id in ("builtins", "typing", "types", "sys", "_typeshed"):
2441
- # We don't track changes to core parts of typeshed -- the
2442
- # assumption is that they are only changed as part of mypy
2443
- # updates, which will invalidate everything anyway. These
2444
- # will always be processed in the initial non-fine-grained
2445
- # build. Other modules may be brought in as a result of an
2446
- # fine-grained increment, and we may need these
2447
- # dependencies then to handle cyclic imports.
2448
- return {}
2449
- from mypy.server.deps import get_dependencies # Lazy import to speed up startup
2450
-
2451
- return get_dependencies(
2452
- target=self.tree,
2453
- type_map=self.type_map(),
2454
- python_version=self.options.python_version,
2455
- options=self.manager.options,
2456
- )
2457
-
2458
- def update_fine_grained_deps(self, deps: dict[str, set[str]]) -> None:
2459
- options = self.manager.options
2460
- if options.cache_fine_grained or options.fine_grained_incremental:
2461
- from mypy.server.deps import merge_dependencies # Lazy import to speed up startup
2462
-
2463
- merge_dependencies(self.compute_fine_grained_deps(), deps)
2464
- type_state.update_protocol_deps(deps)
2465
-
2466
- def valid_references(self) -> set[str]:
2467
- assert self.ancestors is not None
2468
- valid_refs = set(self.dependencies + self.suppressed + self.ancestors)
2469
- valid_refs.add(self.id)
2470
-
2471
- if "os" in valid_refs:
2472
- valid_refs.add("os.path")
2473
-
2474
- return valid_refs
2475
-
2476
- def write_cache(self) -> None:
2477
- assert self.tree is not None, "Internal error: method must be called on parsed file only"
2478
- # We don't support writing cache files in fine-grained incremental mode.
2479
- if (
2480
- not self.path
2481
- or self.options.cache_dir == os.devnull
2482
- or self.options.fine_grained_incremental
2483
- ):
2484
- if self.options.debug_serialize:
2485
- try:
2486
- self.tree.serialize()
2487
- except Exception:
2488
- print(f"Error serializing {self.id}", file=self.manager.stdout)
2489
- raise # Propagate to display traceback
2490
- return
2491
- is_errors = self.transitive_error
2492
- if is_errors:
2493
- delete_cache(self.id, self.path, self.manager)
2494
- self.meta = None
2495
- self.mark_interface_stale(on_errors=True)
2496
- return
2497
- dep_prios = self.dependency_priorities()
2498
- dep_lines = self.dependency_lines()
2499
- assert self.source_hash is not None
2500
- assert len(set(self.dependencies)) == len(
2501
- self.dependencies
2502
- ), f"Duplicates in dependencies list for {self.id} ({self.dependencies})"
2503
- new_interface_hash, self.meta = write_cache(
2504
- self.id,
2505
- self.path,
2506
- self.tree,
2507
- list(self.dependencies),
2508
- list(self.suppressed),
2509
- dep_prios,
2510
- dep_lines,
2511
- self.interface_hash,
2512
- self.source_hash,
2513
- self.ignore_all,
2514
- self.manager,
2515
- )
2516
- if new_interface_hash == self.interface_hash:
2517
- self.manager.log(f"Cached module {self.id} has same interface")
2518
- else:
2519
- self.manager.log(f"Cached module {self.id} has changed interface")
2520
- self.mark_interface_stale()
2521
- self.interface_hash = new_interface_hash
2522
-
2523
- def verify_dependencies(self, suppressed_only: bool = False) -> None:
2524
- """Report errors for import targets in modules that don't exist.
2525
-
2526
- If suppressed_only is set, only check suppressed dependencies.
2527
- """
2528
- manager = self.manager
2529
- assert self.ancestors is not None
2530
- if suppressed_only:
2531
- all_deps = self.suppressed
2532
- else:
2533
- # Strip out indirect dependencies. See comment in build.load_graph().
2534
- dependencies = [
2535
- dep for dep in self.dependencies if self.priorities.get(dep) != PRI_INDIRECT
2536
- ]
2537
- all_deps = dependencies + self.suppressed + self.ancestors
2538
- for dep in all_deps:
2539
- if dep in manager.modules:
2540
- continue
2541
- options = manager.options.clone_for_module(dep)
2542
- if options.ignore_missing_imports:
2543
- continue
2544
- line = self.dep_line_map.get(dep, 1)
2545
- try:
2546
- if dep in self.ancestors:
2547
- state: State | None = None
2548
- ancestor: State | None = self
2549
- else:
2550
- state, ancestor = self, None
2551
- # Called just for its side effects of producing diagnostics.
2552
- find_module_and_diagnose(
2553
- manager,
2554
- dep,
2555
- options,
2556
- caller_state=state,
2557
- caller_line=line,
2558
- ancestor_for=ancestor,
2559
- )
2560
- except (ModuleNotFound, CompileError):
2561
- # Swallow up any ModuleNotFounds or CompilerErrors while generating
2562
- # a diagnostic. CompileErrors may get generated in
2563
- # fine-grained mode when an __init__.py is deleted, if a module
2564
- # that was in that package has targets reprocessed before
2565
- # it is renamed.
2566
- pass
2567
-
2568
- def dependency_priorities(self) -> list[int]:
2569
- return [self.priorities.get(dep, PRI_HIGH) for dep in self.dependencies + self.suppressed]
2570
-
2571
- def dependency_lines(self) -> list[int]:
2572
- return [self.dep_line_map.get(dep, 1) for dep in self.dependencies + self.suppressed]
2573
-
2574
- def generate_unused_ignore_notes(self) -> None:
2575
- if (
2576
- self.options.warn_unused_ignores
2577
- or codes.UNUSED_IGNORE in self.options.enabled_error_codes
2578
- ) and codes.UNUSED_IGNORE not in self.options.disabled_error_codes:
2579
- # If this file was initially loaded from the cache, it may have suppressed
2580
- # dependencies due to imports with ignores on them. We need to generate
2581
- # those errors to avoid spuriously flagging them as unused ignores.
2582
- if self.meta:
2583
- self.verify_dependencies(suppressed_only=True)
2584
- self.manager.errors.generate_unused_ignore_errors(self.xpath)
2585
-
2586
- def generate_ignore_without_code_notes(self) -> None:
2587
- if self.manager.errors.is_error_code_enabled(codes.IGNORE_WITHOUT_CODE):
2588
- self.manager.errors.generate_ignore_without_code_errors(
2589
- self.xpath, self.options.warn_unused_ignores
2590
- )
2591
-
2592
-
2593
- # Module import and diagnostic glue
2594
-
2595
-
2596
- def find_module_and_diagnose(
2597
- manager: BuildManager,
2598
- id: str,
2599
- options: Options,
2600
- caller_state: State | None = None,
2601
- caller_line: int = 0,
2602
- ancestor_for: State | None = None,
2603
- root_source: bool = False,
2604
- skip_diagnose: bool = False,
2605
- ) -> tuple[str, str]:
2606
- """Find a module by name, respecting follow_imports and producing diagnostics.
2607
-
2608
- If the module is not found, then the ModuleNotFound exception is raised.
2609
-
2610
- Args:
2611
- id: module to find
2612
- options: the options for the module being loaded
2613
- caller_state: the state of the importing module, if applicable
2614
- caller_line: the line number of the import
2615
- ancestor_for: the child module this is an ancestor of, if applicable
2616
- root_source: whether this source was specified on the command line
2617
- skip_diagnose: skip any error diagnosis and reporting (but ModuleNotFound is
2618
- still raised if the module is missing)
2619
-
2620
- The specified value of follow_imports for a module can be overridden
2621
- if the module is specified on the command line or if it is a stub,
2622
- so we compute and return the "effective" follow_imports of the module.
2623
-
2624
- Returns a tuple containing (file path, target's effective follow_imports setting)
2625
- """
2626
- result = find_module_with_reason(id, manager)
2627
- if isinstance(result, str):
2628
- # For non-stubs, look at options.follow_imports:
2629
- # - normal (default) -> fully analyze
2630
- # - silent -> analyze but silence errors
2631
- # - skip -> don't analyze, make the type Any
2632
- follow_imports = options.follow_imports
2633
- if (
2634
- root_source # Honor top-level modules
2635
- or (
2636
- result.endswith(".pyi") # Stubs are always normal
2637
- and not options.follow_imports_for_stubs # except when they aren't
2638
- )
2639
- or id in CORE_BUILTIN_MODULES # core is always normal
2640
- ):
2641
- follow_imports = "normal"
2642
- if skip_diagnose:
2643
- pass
2644
- elif follow_imports == "silent":
2645
- # Still import it, but silence non-blocker errors.
2646
- manager.log(f"Silencing {result} ({id})")
2647
- elif follow_imports == "skip" or follow_imports == "error":
2648
- # In 'error' mode, produce special error messages.
2649
- if id not in manager.missing_modules:
2650
- manager.log(f"Skipping {result} ({id})")
2651
- if follow_imports == "error":
2652
- if ancestor_for:
2653
- skipping_ancestor(manager, id, result, ancestor_for)
2654
- else:
2655
- skipping_module(manager, caller_line, caller_state, id, result)
2656
- raise ModuleNotFound
2657
- if is_silent_import_module(manager, result) and not root_source:
2658
- follow_imports = "silent"
2659
- return (result, follow_imports)
2660
- else:
2661
- # Could not find a module. Typically the reason is a
2662
- # misspelled module name, missing stub, module not in
2663
- # search path or the module has not been installed.
2664
-
2665
- ignore_missing_imports = options.ignore_missing_imports
2666
-
2667
- id_components = id.split(".")
2668
- # Don't honor a global (not per-module) ignore_missing_imports
2669
- # setting for modules that used to have bundled stubs, as
2670
- # otherwise updating mypy can silently result in new false
2671
- # negatives. (Unless there are stubs but they are incomplete.)
2672
- global_ignore_missing_imports = manager.options.ignore_missing_imports
2673
- if (
2674
- any(
2675
- ".".join(id_components[:i]) in legacy_bundled_packages
2676
- for i in range(len(id_components), 0, -1)
2677
- )
2678
- and global_ignore_missing_imports
2679
- and not options.ignore_missing_imports_per_module
2680
- and result is ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED
2681
- ):
2682
- ignore_missing_imports = False
2683
-
2684
- if skip_diagnose:
2685
- raise ModuleNotFound
2686
- if caller_state:
2687
- if not (ignore_missing_imports or in_partial_package(id, manager)):
2688
- module_not_found(manager, caller_line, caller_state, id, result)
2689
- raise ModuleNotFound
2690
- elif root_source:
2691
- # If we can't find a root source it's always fatal.
2692
- # TODO: This might hide non-fatal errors from
2693
- # root sources processed earlier.
2694
- raise CompileError([f"mypy: can't find module '{id}'"])
2695
- else:
2696
- raise ModuleNotFound
2697
-
2698
-
2699
- def exist_added_packages(suppressed: list[str], manager: BuildManager, options: Options) -> bool:
2700
- """Find if there are any newly added packages that were previously suppressed.
2701
-
2702
- Exclude everything not in build for follow-imports=skip.
2703
- """
2704
- for dep in suppressed:
2705
- if dep in manager.source_set.source_modules:
2706
- # We don't need to add any special logic for this. If a module
2707
- # is added to build, importers will be invalidated by normal mechanism.
2708
- continue
2709
- path = find_module_simple(dep, manager)
2710
- if not path:
2711
- continue
2712
- if options.follow_imports == "skip" and (
2713
- not path.endswith(".pyi") or options.follow_imports_for_stubs
2714
- ):
2715
- continue
2716
- if "__init__.py" in path:
2717
- # It is better to have a bit lenient test, this will only slightly reduce
2718
- # performance, while having a too strict test may affect correctness.
2719
- return True
2720
- return False
2721
-
2722
-
2723
- def find_module_simple(id: str, manager: BuildManager) -> str | None:
2724
- """Find a filesystem path for module `id` or `None` if not found."""
2725
- x = find_module_with_reason(id, manager)
2726
- if isinstance(x, ModuleNotFoundReason):
2727
- return None
2728
- return x
2729
-
2730
-
2731
- def find_module_with_reason(id: str, manager: BuildManager) -> ModuleSearchResult:
2732
- """Find a filesystem path for module `id` or the reason it can't be found."""
2733
- t0 = time.time()
2734
- x = manager.find_module_cache.find_module(id)
2735
- manager.add_stats(find_module_time=time.time() - t0, find_module_calls=1)
2736
- return x
2737
-
2738
-
2739
- def in_partial_package(id: str, manager: BuildManager) -> bool:
2740
- """Check if a missing module can potentially be a part of a package.
2741
-
2742
- This checks if there is any existing parent __init__.pyi stub that
2743
- defines a module-level __getattr__ (a.k.a. partial stub package).
2744
- """
2745
- while "." in id:
2746
- parent, _ = id.rsplit(".", 1)
2747
- if parent in manager.modules:
2748
- parent_mod: MypyFile | None = manager.modules[parent]
2749
- else:
2750
- # Parent is not in build, try quickly if we can find it.
2751
- try:
2752
- parent_st = State(
2753
- id=parent, path=None, source=None, manager=manager, temporary=True
2754
- )
2755
- except (ModuleNotFound, CompileError):
2756
- parent_mod = None
2757
- else:
2758
- parent_mod = parent_st.tree
2759
- if parent_mod is not None:
2760
- # Bail out soon, complete subpackage found
2761
- return parent_mod.is_partial_stub_package
2762
- id = parent
2763
- return False
2764
-
2765
-
2766
- def module_not_found(
2767
- manager: BuildManager,
2768
- line: int,
2769
- caller_state: State,
2770
- target: str,
2771
- reason: ModuleNotFoundReason,
2772
- ) -> None:
2773
- errors = manager.errors
2774
- save_import_context = errors.import_context()
2775
- errors.set_import_context(caller_state.import_context)
2776
- errors.set_file(caller_state.xpath, caller_state.id, caller_state.options)
2777
- if target == "builtins":
2778
- errors.report(
2779
- line, 0, "Cannot find 'builtins' module. Typeshed appears broken!", blocker=True
2780
- )
2781
- errors.raise_error()
2782
- else:
2783
- daemon = manager.options.fine_grained_incremental
2784
- msg, notes = reason.error_message_templates(daemon)
2785
- if reason == ModuleNotFoundReason.NOT_FOUND:
2786
- code = codes.IMPORT_NOT_FOUND
2787
- elif (
2788
- reason == ModuleNotFoundReason.FOUND_WITHOUT_TYPE_HINTS
2789
- or reason == ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED
2790
- ):
2791
- code = codes.IMPORT_UNTYPED
2792
- else:
2793
- code = codes.IMPORT
2794
- errors.report(line, 0, msg.format(module=target), code=code)
2795
-
2796
- components = target.split(".")
2797
- for i in range(len(components), 0, -1):
2798
- module = ".".join(components[:i])
2799
- if module in legacy_bundled_packages or module in non_bundled_packages:
2800
- break
2801
-
2802
- for note in notes:
2803
- if "{stub_dist}" in note:
2804
- note = note.format(stub_dist=stub_distribution_name(module))
2805
- errors.report(line, 0, note, severity="note", only_once=True, code=code)
2806
- if reason is ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED:
2807
- manager.missing_stub_packages.add(stub_distribution_name(module))
2808
- errors.set_import_context(save_import_context)
2809
-
2810
-
2811
- def skipping_module(
2812
- manager: BuildManager, line: int, caller_state: State | None, id: str, path: str
2813
- ) -> None:
2814
- """Produce an error for an import ignored due to --follow_imports=error"""
2815
- assert caller_state, (id, path)
2816
- save_import_context = manager.errors.import_context()
2817
- manager.errors.set_import_context(caller_state.import_context)
2818
- manager.errors.set_file(caller_state.xpath, caller_state.id, manager.options)
2819
- manager.errors.report(line, 0, f'Import of "{id}" ignored', severity="error")
2820
- manager.errors.report(
2821
- line,
2822
- 0,
2823
- "(Using --follow-imports=error, module not passed on command line)",
2824
- severity="note",
2825
- only_once=True,
2826
- )
2827
- manager.errors.set_import_context(save_import_context)
2828
-
2829
-
2830
- def skipping_ancestor(manager: BuildManager, id: str, path: str, ancestor_for: State) -> None:
2831
- """Produce an error for an ancestor ignored due to --follow_imports=error"""
2832
- # TODO: Read the path (the __init__.py file) and return
2833
- # immediately if it's empty or only contains comments.
2834
- # But beware, some package may be the ancestor of many modules,
2835
- # so we'd need to cache the decision.
2836
- manager.errors.set_import_context([])
2837
- manager.errors.set_file(ancestor_for.xpath, ancestor_for.id, manager.options)
2838
- manager.errors.report(
2839
- -1, -1, f'Ancestor package "{id}" ignored', severity="error", only_once=True
2840
- )
2841
- manager.errors.report(
2842
- -1,
2843
- -1,
2844
- "(Using --follow-imports=error, submodule passed on command line)",
2845
- severity="note",
2846
- only_once=True,
2847
- )
2848
-
2849
-
2850
- def log_configuration(manager: BuildManager, sources: list[BuildSource]) -> None:
2851
- """Output useful configuration information to LOG and TRACE"""
2852
-
2853
- manager.log()
2854
- configuration_vars = [
2855
- ("Mypy Version", __version__),
2856
- ("Config File", (manager.options.config_file or "Default")),
2857
- ("Configured Executable", manager.options.python_executable or "None"),
2858
- ("Current Executable", sys.executable),
2859
- ("Cache Dir", manager.options.cache_dir),
2860
- ("Compiled", str(not __file__.endswith(".py"))),
2861
- ("Exclude", manager.options.exclude),
2862
- ]
2863
-
2864
- for conf_name, conf_value in configuration_vars:
2865
- manager.log(f"{conf_name + ':':24}{conf_value}")
2866
-
2867
- for source in sources:
2868
- manager.log(f"{'Found source:':24}{source}")
2869
-
2870
- # Complete list of searched paths can get very long, put them under TRACE
2871
- for path_type, paths in manager.search_paths._asdict().items():
2872
- if not paths:
2873
- manager.trace(f"No {path_type}")
2874
- continue
2875
-
2876
- manager.trace(f"{path_type}:")
2877
-
2878
- for pth in paths:
2879
- manager.trace(f" {pth}")
2880
-
2881
-
2882
- # The driver
2883
-
2884
-
2885
- def dispatch(sources: list[BuildSource], manager: BuildManager, stdout: TextIO) -> Graph:
2886
- log_configuration(manager, sources)
2887
-
2888
- t0 = time.time()
2889
- graph = load_graph(sources, manager)
2890
-
2891
- # This is a kind of unfortunate hack to work around some of fine-grained's
2892
- # fragility: if we have loaded less than 50% of the specified files from
2893
- # cache in fine-grained cache mode, load the graph again honestly.
2894
- # In this case, we just turn the cache off entirely, so we don't need
2895
- # to worry about some files being loaded and some from cache and so
2896
- # that fine-grained mode never *writes* to the cache.
2897
- if manager.use_fine_grained_cache() and len(graph) < 0.50 * len(sources):
2898
- manager.log("Redoing load_graph without cache because too much was missing")
2899
- manager.cache_enabled = False
2900
- graph = load_graph(sources, manager)
2901
-
2902
- t1 = time.time()
2903
- manager.add_stats(
2904
- graph_size=len(graph),
2905
- stubs_found=sum(g.path is not None and g.path.endswith(".pyi") for g in graph.values()),
2906
- graph_load_time=(t1 - t0),
2907
- fm_cache_size=len(manager.find_module_cache.results),
2908
- )
2909
- if not graph:
2910
- print("Nothing to do?!", file=stdout)
2911
- return graph
2912
- manager.log(f"Loaded graph with {len(graph)} nodes ({t1 - t0:.3f} sec)")
2913
- if manager.options.dump_graph:
2914
- dump_graph(graph, stdout)
2915
- return graph
2916
-
2917
- # Fine grained dependencies that didn't have an associated module in the build
2918
- # are serialized separately, so we read them after we load the graph.
2919
- # We need to read them both for running in daemon mode and if we are generating
2920
- # a fine-grained cache (so that we can properly update them incrementally).
2921
- # The `read_deps_cache` will also validate
2922
- # the deps cache against the loaded individual cache files.
2923
- if manager.options.cache_fine_grained or manager.use_fine_grained_cache():
2924
- t2 = time.time()
2925
- fg_deps_meta = read_deps_cache(manager, graph)
2926
- manager.add_stats(load_fg_deps_time=time.time() - t2)
2927
- if fg_deps_meta is not None:
2928
- manager.fg_deps_meta = fg_deps_meta
2929
- elif manager.stats.get("fresh_metas", 0) > 0:
2930
- # Clear the stats so we don't infinite loop because of positive fresh_metas
2931
- manager.stats.clear()
2932
- # There were some cache files read, but no fine-grained dependencies loaded.
2933
- manager.log("Error reading fine-grained dependencies cache -- aborting cache load")
2934
- manager.cache_enabled = False
2935
- manager.log("Falling back to full run -- reloading graph...")
2936
- return dispatch(sources, manager, stdout)
2937
-
2938
- # If we are loading a fine-grained incremental mode cache, we
2939
- # don't want to do a real incremental reprocess of the
2940
- # graph---we'll handle it all later.
2941
- if not manager.use_fine_grained_cache():
2942
- process_graph(graph, manager)
2943
- # Update plugins snapshot.
2944
- write_plugins_snapshot(manager)
2945
- manager.old_plugins_snapshot = manager.plugins_snapshot
2946
- if manager.options.cache_fine_grained or manager.options.fine_grained_incremental:
2947
- # If we are running a daemon or are going to write cache for further fine grained use,
2948
- # then we need to collect fine grained protocol dependencies.
2949
- # Since these are a global property of the program, they are calculated after we
2950
- # processed the whole graph.
2951
- type_state.add_all_protocol_deps(manager.fg_deps)
2952
- if not manager.options.fine_grained_incremental:
2953
- rdeps = generate_deps_for_cache(manager, graph)
2954
- write_deps_cache(rdeps, manager, graph)
2955
-
2956
- if manager.options.dump_deps:
2957
- # This speeds up startup a little when not using the daemon mode.
2958
- from mypy.server.deps import dump_all_dependencies
2959
-
2960
- dump_all_dependencies(
2961
- manager.modules, manager.all_types, manager.options.python_version, manager.options
2962
- )
2963
-
2964
- return graph
2965
-
2966
-
2967
- class NodeInfo:
2968
- """Some info about a node in the graph of SCCs."""
2969
-
2970
- def __init__(self, index: int, scc: list[str]) -> None:
2971
- self.node_id = "n%d" % index
2972
- self.scc = scc
2973
- self.sizes: dict[str, int] = {} # mod -> size in bytes
2974
- self.deps: dict[str, int] = {} # node_id -> pri
2975
-
2976
- def dumps(self) -> str:
2977
- """Convert to JSON string."""
2978
- total_size = sum(self.sizes.values())
2979
- return "[{}, {}, {},\n {},\n {}]".format(
2980
- json.dumps(self.node_id),
2981
- json.dumps(total_size),
2982
- json.dumps(self.scc),
2983
- json.dumps(self.sizes),
2984
- json.dumps(self.deps),
2985
- )
2986
-
2987
-
2988
- def dump_timing_stats(path: str, graph: Graph) -> None:
2989
- """Dump timing stats for each file in the given graph."""
2990
- with open(path, "w") as f:
2991
- for id in sorted(graph):
2992
- f.write(f"{id} {graph[id].time_spent_us}\n")
2993
-
2994
-
2995
- def dump_line_checking_stats(path: str, graph: Graph) -> None:
2996
- """Dump per-line expression type checking stats."""
2997
- with open(path, "w") as f:
2998
- for id in sorted(graph):
2999
- if not graph[id].per_line_checking_time_ns:
3000
- continue
3001
- f.write(f"{id}:\n")
3002
- for line in sorted(graph[id].per_line_checking_time_ns):
3003
- line_time = graph[id].per_line_checking_time_ns[line]
3004
- f.write(f"{line:>5} {line_time/1000:8.1f}\n")
3005
-
3006
-
3007
- def dump_graph(graph: Graph, stdout: TextIO | None = None) -> None:
3008
- """Dump the graph as a JSON string to stdout.
3009
-
3010
- This copies some of the work by process_graph()
3011
- (sorted_components() and order_ascc()).
3012
- """
3013
- stdout = stdout or sys.stdout
3014
- nodes = []
3015
- sccs = sorted_components(graph)
3016
- for i, ascc in enumerate(sccs):
3017
- scc = order_ascc(graph, ascc)
3018
- node = NodeInfo(i, scc)
3019
- nodes.append(node)
3020
- inv_nodes = {} # module -> node_id
3021
- for node in nodes:
3022
- for mod in node.scc:
3023
- inv_nodes[mod] = node.node_id
3024
- for node in nodes:
3025
- for mod in node.scc:
3026
- state = graph[mod]
3027
- size = 0
3028
- if state.path:
3029
- try:
3030
- size = os.path.getsize(state.path)
3031
- except OSError:
3032
- pass
3033
- node.sizes[mod] = size
3034
- for dep in state.dependencies:
3035
- if dep in state.priorities:
3036
- pri = state.priorities[dep]
3037
- if dep in inv_nodes:
3038
- dep_id = inv_nodes[dep]
3039
- if dep_id != node.node_id and (
3040
- dep_id not in node.deps or pri < node.deps[dep_id]
3041
- ):
3042
- node.deps[dep_id] = pri
3043
- print("[" + ",\n ".join(node.dumps() for node in nodes) + "\n]", file=stdout)
3044
-
3045
-
3046
- def load_graph(
3047
- sources: list[BuildSource],
3048
- manager: BuildManager,
3049
- old_graph: Graph | None = None,
3050
- new_modules: list[State] | None = None,
3051
- ) -> Graph:
3052
- """Given some source files, load the full dependency graph.
3053
-
3054
- If an old_graph is passed in, it is used as the starting point and
3055
- modified during graph loading.
3056
-
3057
- If a new_modules is passed in, any modules that are loaded are
3058
- added to the list. This is an argument and not a return value
3059
- so that the caller can access it even if load_graph fails.
3060
-
3061
- As this may need to parse files, this can raise CompileError in case
3062
- there are syntax errors.
3063
- """
3064
-
3065
- graph: Graph = old_graph if old_graph is not None else {}
3066
-
3067
- # The deque is used to implement breadth-first traversal.
3068
- # TODO: Consider whether to go depth-first instead. This may
3069
- # affect the order in which we process files within import cycles.
3070
- new = new_modules if new_modules is not None else []
3071
- entry_points: set[str] = set()
3072
- # Seed the graph with the initial root sources.
3073
- for bs in sources:
3074
- try:
3075
- st = State(
3076
- id=bs.module,
3077
- path=bs.path,
3078
- source=bs.text,
3079
- manager=manager,
3080
- root_source=not bs.followed,
3081
- )
3082
- except ModuleNotFound:
3083
- continue
3084
- if st.id in graph:
3085
- manager.errors.set_file(st.xpath, st.id, manager.options)
3086
- manager.errors.report(
3087
- -1,
3088
- -1,
3089
- f'Duplicate module named "{st.id}" (also at "{graph[st.id].xpath}")',
3090
- blocker=True,
3091
- )
3092
- manager.errors.report(
3093
- -1,
3094
- -1,
3095
- "See https://mypy.readthedocs.io/en/stable/running_mypy.html#mapping-file-paths-to-modules "
3096
- "for more info",
3097
- severity="note",
3098
- )
3099
- manager.errors.report(
3100
- -1,
3101
- -1,
3102
- "Common resolutions include: a) using `--exclude` to avoid checking one of them, "
3103
- "b) adding `__init__.py` somewhere, c) using `--explicit-package-bases` or "
3104
- "adjusting MYPYPATH",
3105
- severity="note",
3106
- )
3107
-
3108
- manager.errors.raise_error()
3109
- graph[st.id] = st
3110
- new.append(st)
3111
- entry_points.add(bs.module)
3112
-
3113
- # Note: Running this each time could be slow in the daemon. If it's a problem, we
3114
- # can do more work to maintain this incrementally.
3115
- seen_files = {st.abspath: st for st in graph.values() if st.path}
3116
-
3117
- # Collect dependencies. We go breadth-first.
3118
- # More nodes might get added to new as we go, but that's fine.
3119
- for st in new:
3120
- assert st.ancestors is not None
3121
- # Strip out indirect dependencies. These will be dealt with
3122
- # when they show up as direct dependencies, and there's a
3123
- # scenario where they hurt:
3124
- # - Suppose A imports B and B imports C.
3125
- # - Suppose on the next round:
3126
- # - C is deleted;
3127
- # - B is updated to remove the dependency on C;
3128
- # - A is unchanged.
3129
- # - In this case A's cached *direct* dependencies are still valid
3130
- # (since direct dependencies reflect the imports found in the source)
3131
- # but A's cached *indirect* dependency on C is wrong.
3132
- dependencies = [dep for dep in st.dependencies if st.priorities.get(dep) != PRI_INDIRECT]
3133
- if not manager.use_fine_grained_cache():
3134
- # TODO: Ideally we could skip here modules that appeared in st.suppressed
3135
- # because they are not in build with `follow-imports=skip`.
3136
- # This way we could avoid overhead of cloning options in `State.__init__()`
3137
- # below to get the option value. This is quite minor performance loss however.
3138
- added = [dep for dep in st.suppressed if find_module_simple(dep, manager)]
3139
- else:
3140
- # During initial loading we don't care about newly added modules,
3141
- # they will be taken care of during fine grained update. See also
3142
- # comment about this in `State.__init__()`.
3143
- added = []
3144
- for dep in st.ancestors + dependencies + st.suppressed:
3145
- ignored = dep in st.suppressed_set and dep not in entry_points
3146
- if ignored and dep not in added:
3147
- manager.missing_modules.add(dep)
3148
- elif dep not in graph:
3149
- try:
3150
- if dep in st.ancestors:
3151
- # TODO: Why not 'if dep not in st.dependencies' ?
3152
- # Ancestors don't have import context.
3153
- newst = State(
3154
- id=dep, path=None, source=None, manager=manager, ancestor_for=st
3155
- )
3156
- else:
3157
- newst = State(
3158
- id=dep,
3159
- path=None,
3160
- source=None,
3161
- manager=manager,
3162
- caller_state=st,
3163
- caller_line=st.dep_line_map.get(dep, 1),
3164
- )
3165
- except ModuleNotFound:
3166
- if dep in st.dependencies_set:
3167
- st.suppress_dependency(dep)
3168
- else:
3169
- if newst.path:
3170
- newst_path = os.path.abspath(newst.path)
3171
-
3172
- if newst_path in seen_files:
3173
- manager.errors.report(
3174
- -1,
3175
- 0,
3176
- "Source file found twice under different module names: "
3177
- '"{}" and "{}"'.format(seen_files[newst_path].id, newst.id),
3178
- blocker=True,
3179
- )
3180
- manager.errors.report(
3181
- -1,
3182
- 0,
3183
- "See https://mypy.readthedocs.io/en/stable/running_mypy.html#mapping-file-paths-to-modules "
3184
- "for more info",
3185
- severity="note",
3186
- )
3187
- manager.errors.report(
3188
- -1,
3189
- 0,
3190
- "Common resolutions include: a) adding `__init__.py` somewhere, "
3191
- "b) using `--explicit-package-bases` or adjusting MYPYPATH",
3192
- severity="note",
3193
- )
3194
- manager.errors.raise_error()
3195
-
3196
- seen_files[newst_path] = newst
3197
-
3198
- assert newst.id not in graph, newst.id
3199
- graph[newst.id] = newst
3200
- new.append(newst)
3201
- if dep in graph and dep in st.suppressed_set:
3202
- # Previously suppressed file is now visible
3203
- st.add_dependency(dep)
3204
- manager.plugin.set_modules(manager.modules)
3205
- return graph
3206
-
3207
-
3208
- def process_graph(graph: Graph, manager: BuildManager) -> None:
3209
- """Process everything in dependency order."""
3210
- sccs = sorted_components(graph)
3211
- manager.log("Found %d SCCs; largest has %d nodes" % (len(sccs), max(len(scc) for scc in sccs)))
3212
-
3213
- fresh_scc_queue: list[list[str]] = []
3214
-
3215
- # We're processing SCCs from leaves (those without further
3216
- # dependencies) to roots (those from which everything else can be
3217
- # reached).
3218
- for ascc in sccs:
3219
- # Order the SCC's nodes using a heuristic.
3220
- # Note that ascc is a set, and scc is a list.
3221
- scc = order_ascc(graph, ascc)
3222
- # Make the order of the SCC that includes 'builtins' and 'typing',
3223
- # among other things, predictable. Various things may break if
3224
- # the order changes.
3225
- if "builtins" in ascc:
3226
- scc = sorted(scc, reverse=True)
3227
- # If builtins is in the list, move it last. (This is a bit of
3228
- # a hack, but it's necessary because the builtins module is
3229
- # part of a small cycle involving at least {builtins, abc,
3230
- # typing}. Of these, builtins must be processed last or else
3231
- # some builtin objects will be incompletely processed.)
3232
- scc.remove("builtins")
3233
- scc.append("builtins")
3234
- if manager.options.verbosity >= 2:
3235
- for id in scc:
3236
- manager.trace(
3237
- f"Priorities for {id}:",
3238
- " ".join(
3239
- "%s:%d" % (x, graph[id].priorities[x])
3240
- for x in graph[id].dependencies
3241
- if x in ascc and x in graph[id].priorities
3242
- ),
3243
- )
3244
- # Because the SCCs are presented in topological sort order, we
3245
- # don't need to look at dependencies recursively for staleness
3246
- # -- the immediate dependencies are sufficient.
3247
- stale_scc = {id for id in scc if not graph[id].is_fresh()}
3248
- fresh = not stale_scc
3249
- deps = set()
3250
- for id in scc:
3251
- deps.update(graph[id].dependencies)
3252
- deps -= ascc
3253
- stale_deps = {id for id in deps if id in graph and not graph[id].is_interface_fresh()}
3254
- fresh = fresh and not stale_deps
3255
- undeps = set()
3256
- if fresh:
3257
- # Check if any dependencies that were suppressed according
3258
- # to the cache have been added back in this run.
3259
- # NOTE: Newly suppressed dependencies are handled by is_fresh().
3260
- for id in scc:
3261
- undeps.update(graph[id].suppressed)
3262
- undeps &= graph.keys()
3263
- if undeps:
3264
- fresh = False
3265
- if fresh:
3266
- # All cache files are fresh. Check that no dependency's
3267
- # cache file is newer than any scc node's cache file.
3268
- oldest_in_scc = min(graph[id].xmeta.data_mtime for id in scc)
3269
- viable = {id for id in stale_deps if graph[id].meta is not None}
3270
- newest_in_deps = (
3271
- 0 if not viable else max(graph[dep].xmeta.data_mtime for dep in viable)
3272
- )
3273
- if manager.options.verbosity >= 3: # Dump all mtimes for extreme debugging.
3274
- all_ids = sorted(ascc | viable, key=lambda id: graph[id].xmeta.data_mtime)
3275
- for id in all_ids:
3276
- if id in scc:
3277
- if graph[id].xmeta.data_mtime < newest_in_deps:
3278
- key = "*id:"
3279
- else:
3280
- key = "id:"
3281
- else:
3282
- if graph[id].xmeta.data_mtime > oldest_in_scc:
3283
- key = "+dep:"
3284
- else:
3285
- key = "dep:"
3286
- manager.trace(" %5s %.0f %s" % (key, graph[id].xmeta.data_mtime, id))
3287
- # If equal, give the benefit of the doubt, due to 1-sec time granularity
3288
- # (on some platforms).
3289
- if oldest_in_scc < newest_in_deps:
3290
- fresh = False
3291
- fresh_msg = f"out of date by {newest_in_deps - oldest_in_scc:.0f} seconds"
3292
- else:
3293
- fresh_msg = "fresh"
3294
- elif undeps:
3295
- fresh_msg = f"stale due to changed suppression ({' '.join(sorted(undeps))})"
3296
- elif stale_scc:
3297
- fresh_msg = "inherently stale"
3298
- if stale_scc != ascc:
3299
- fresh_msg += f" ({' '.join(sorted(stale_scc))})"
3300
- if stale_deps:
3301
- fresh_msg += f" with stale deps ({' '.join(sorted(stale_deps))})"
3302
- else:
3303
- fresh_msg = f"stale due to deps ({' '.join(sorted(stale_deps))})"
3304
-
3305
- # Initialize transitive_error for all SCC members from union
3306
- # of transitive_error of dependencies.
3307
- if any(graph[dep].transitive_error for dep in deps if dep in graph):
3308
- for id in scc:
3309
- graph[id].transitive_error = True
3310
-
3311
- scc_str = " ".join(scc)
3312
- if fresh:
3313
- manager.trace(f"Queuing {fresh_msg} SCC ({scc_str})")
3314
- fresh_scc_queue.append(scc)
3315
- else:
3316
- if fresh_scc_queue:
3317
- manager.log(f"Processing {len(fresh_scc_queue)} queued fresh SCCs")
3318
- # Defer processing fresh SCCs until we actually run into a stale SCC
3319
- # and need the earlier modules to be loaded.
3320
- #
3321
- # Note that `process_graph` may end with us not having processed every
3322
- # single fresh SCC. This is intentional -- we don't need those modules
3323
- # loaded if there are no more stale SCCs to be rechecked.
3324
- #
3325
- # Also note we shouldn't have to worry about transitive_error here,
3326
- # since modules with transitive errors aren't written to the cache,
3327
- # and if any dependencies were changed, this SCC would be stale.
3328
- # (Also, in quick_and_dirty mode we don't care about transitive errors.)
3329
- #
3330
- # TODO: see if it's possible to determine if we need to process only a
3331
- # _subset_ of the past SCCs instead of having to process them all.
3332
- for prev_scc in fresh_scc_queue:
3333
- process_fresh_modules(graph, prev_scc, manager)
3334
- fresh_scc_queue = []
3335
- size = len(scc)
3336
- if size == 1:
3337
- manager.log(f"Processing SCC singleton ({scc_str}) as {fresh_msg}")
3338
- else:
3339
- manager.log("Processing SCC of size %d (%s) as %s" % (size, scc_str, fresh_msg))
3340
- process_stale_scc(graph, scc, manager)
3341
-
3342
- sccs_left = len(fresh_scc_queue)
3343
- nodes_left = sum(len(scc) for scc in fresh_scc_queue)
3344
- manager.add_stats(sccs_left=sccs_left, nodes_left=nodes_left)
3345
- if sccs_left:
3346
- manager.log(
3347
- "{} fresh SCCs ({} nodes) left in queue (and will remain unprocessed)".format(
3348
- sccs_left, nodes_left
3349
- )
3350
- )
3351
- manager.trace(str(fresh_scc_queue))
3352
- else:
3353
- manager.log("No fresh SCCs left in queue")
3354
-
3355
-
3356
- def order_ascc(graph: Graph, ascc: AbstractSet[str], pri_max: int = PRI_ALL) -> list[str]:
3357
- """Come up with the ideal processing order within an SCC.
3358
-
3359
- Using the priorities assigned by all_imported_modules_in_file(),
3360
- try to reduce the cycle to a DAG, by omitting arcs representing
3361
- dependencies of lower priority.
3362
-
3363
- In the simplest case, if we have A <--> B where A has a top-level
3364
- "import B" (medium priority) but B only has the reverse "import A"
3365
- inside a function (low priority), we turn the cycle into a DAG by
3366
- dropping the B --> A arc, which leaves only A --> B.
3367
-
3368
- If all arcs have the same priority, we fall back to sorting by
3369
- reverse global order (the order in which modules were first
3370
- encountered).
3371
-
3372
- The algorithm is recursive, as follows: when as arcs of different
3373
- priorities are present, drop all arcs of the lowest priority,
3374
- identify SCCs in the resulting graph, and apply the algorithm to
3375
- each SCC thus found. The recursion is bounded because at each
3376
- recursion the spread in priorities is (at least) one less.
3377
-
3378
- In practice there are only a few priority levels (less than a
3379
- dozen) and in the worst case we just carry out the same algorithm
3380
- for finding SCCs N times. Thus the complexity is no worse than
3381
- the complexity of the original SCC-finding algorithm -- see
3382
- strongly_connected_components() below for a reference.
3383
- """
3384
- if len(ascc) == 1:
3385
- return list(ascc)
3386
- pri_spread = set()
3387
- for id in ascc:
3388
- state = graph[id]
3389
- for dep in state.dependencies:
3390
- if dep in ascc:
3391
- pri = state.priorities.get(dep, PRI_HIGH)
3392
- if pri < pri_max:
3393
- pri_spread.add(pri)
3394
- if len(pri_spread) == 1:
3395
- # Filtered dependencies are uniform -- order by global order.
3396
- return sorted(ascc, key=lambda id: -graph[id].order)
3397
- pri_max = max(pri_spread)
3398
- sccs = sorted_components(graph, ascc, pri_max)
3399
- # The recursion is bounded by the len(pri_spread) check above.
3400
- return [s for ss in sccs for s in order_ascc(graph, ss, pri_max)]
3401
-
3402
-
3403
- def process_fresh_modules(graph: Graph, modules: list[str], manager: BuildManager) -> None:
3404
- """Process the modules in one group of modules from their cached data.
3405
-
3406
- This can be used to process an SCC of modules
3407
- This involves loading the tree from JSON and then doing various cleanups.
3408
- """
3409
- t0 = time.time()
3410
- for id in modules:
3411
- graph[id].load_tree()
3412
- t1 = time.time()
3413
- for id in modules:
3414
- graph[id].fix_cross_refs()
3415
- t2 = time.time()
3416
- manager.add_stats(process_fresh_time=t2 - t0, load_tree_time=t1 - t0)
3417
-
3418
-
3419
- def process_stale_scc(graph: Graph, scc: list[str], manager: BuildManager) -> None:
3420
- """Process the modules in one SCC from source code.
3421
-
3422
- Exception: If quick_and_dirty is set, use the cache for fresh modules.
3423
- """
3424
- stale = scc
3425
- for id in stale:
3426
- # We may already have parsed the module, or not.
3427
- # If the former, parse_file() is a no-op.
3428
- graph[id].parse_file()
3429
- if "typing" in scc:
3430
- # For historical reasons we need to manually add typing aliases
3431
- # for built-in generic collections, see docstring of
3432
- # SemanticAnalyzerPass2.add_builtin_aliases for details.
3433
- typing_mod = graph["typing"].tree
3434
- assert typing_mod, "The typing module was not parsed"
3435
- mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
3436
-
3437
- # Track what modules aren't yet done so we can finish them as soon
3438
- # as possible, saving memory.
3439
- unfinished_modules = set(stale)
3440
- for id in stale:
3441
- graph[id].type_check_first_pass()
3442
- if not graph[id].type_checker().deferred_nodes:
3443
- unfinished_modules.discard(id)
3444
- graph[id].detect_possibly_undefined_vars()
3445
- graph[id].finish_passes()
3446
-
3447
- while unfinished_modules:
3448
- for id in stale:
3449
- if id not in unfinished_modules:
3450
- continue
3451
- if not graph[id].type_check_second_pass():
3452
- unfinished_modules.discard(id)
3453
- graph[id].detect_possibly_undefined_vars()
3454
- graph[id].finish_passes()
3455
- for id in stale:
3456
- graph[id].generate_unused_ignore_notes()
3457
- graph[id].generate_ignore_without_code_notes()
3458
- if any(manager.errors.is_errors_for_file(graph[id].xpath) for id in stale):
3459
- for id in stale:
3460
- graph[id].transitive_error = True
3461
- for id in stale:
3462
- manager.flush_errors(
3463
- manager.errors.simplify_path(graph[id].xpath),
3464
- manager.errors.file_messages(graph[id].xpath),
3465
- False,
3466
- )
3467
- graph[id].write_cache()
3468
- graph[id].mark_as_rechecked()
3469
-
3470
-
3471
- def sorted_components(
3472
- graph: Graph, vertices: AbstractSet[str] | None = None, pri_max: int = PRI_ALL
3473
- ) -> list[AbstractSet[str]]:
3474
- """Return the graph's SCCs, topologically sorted by dependencies.
3475
-
3476
- The sort order is from leaves (nodes without dependencies) to
3477
- roots (nodes on which no other nodes depend).
3478
-
3479
- This works for a subset of the full dependency graph too;
3480
- dependencies that aren't present in graph.keys() are ignored.
3481
- """
3482
- # Compute SCCs.
3483
- if vertices is None:
3484
- vertices = set(graph)
3485
- edges = {id: deps_filtered(graph, vertices, id, pri_max) for id in vertices}
3486
- sccs = list(strongly_connected_components(vertices, edges))
3487
- # Topsort.
3488
- res = []
3489
- for ready in topsort(prepare_sccs(sccs, edges)):
3490
- # Sort the sets in ready by reversed smallest State.order. Examples:
3491
- #
3492
- # - If ready is [{x}, {y}], x.order == 1, y.order == 2, we get
3493
- # [{y}, {x}].
3494
- #
3495
- # - If ready is [{a, b}, {c, d}], a.order == 1, b.order == 3,
3496
- # c.order == 2, d.order == 4, the sort keys become [1, 2]
3497
- # and the result is [{c, d}, {a, b}].
3498
- res.extend(sorted(ready, key=lambda scc: -min(graph[id].order for id in scc)))
3499
- return res
3500
-
3501
-
3502
- def deps_filtered(graph: Graph, vertices: AbstractSet[str], id: str, pri_max: int) -> list[str]:
3503
- """Filter dependencies for id with pri < pri_max."""
3504
- if id not in vertices:
3505
- return []
3506
- state = graph[id]
3507
- return [
3508
- dep
3509
- for dep in state.dependencies
3510
- if dep in vertices and state.priorities.get(dep, PRI_HIGH) < pri_max
3511
- ]
3512
-
3513
-
3514
- def missing_stubs_file(cache_dir: str) -> str:
3515
- return os.path.join(cache_dir, "missing_stubs")
3516
-
3517
-
3518
- def record_missing_stub_packages(cache_dir: str, missing_stub_packages: set[str]) -> None:
3519
- """Write a file containing missing stub packages.
3520
-
3521
- This allows a subsequent "mypy --install-types" run (without other arguments)
3522
- to install missing stub packages.
3523
- """
3524
- fnam = missing_stubs_file(cache_dir)
3525
- if missing_stub_packages:
3526
- with open(fnam, "w") as f:
3527
- for pkg in sorted(missing_stub_packages):
3528
- f.write(f"{pkg}\n")
3529
- else:
3530
- if os.path.isfile(fnam):
3531
- os.remove(fnam)
3532
-
3533
-
3534
- def is_silent_import_module(manager: BuildManager, path: str) -> bool:
3535
- if manager.options.no_silence_site_packages:
3536
- return False
3537
- # Silence errors in site-package dirs and typeshed
3538
- return any(
3539
- is_sub_path(path, dir)
3540
- for dir in manager.search_paths.package_path + manager.search_paths.typeshed_path
3541
- )
3542
-
3543
-
3544
- def write_undocumented_ref_info(
3545
- state: State, metastore: MetadataStore, options: Options, type_map: dict[Expression, Type]
3546
- ) -> None:
3547
- # This exports some dependency information in a rather ad-hoc fashion, which
3548
- # can be helpful for some tools. This is all highly experimental and could be
3549
- # removed at any time.
3550
-
3551
- from mypy.refinfo import get_undocumented_ref_info_json
3552
-
3553
- if not state.tree:
3554
- # We need a full AST for this.
3555
- return
3556
-
3557
- _, data_file, _ = get_cache_names(state.id, state.xpath, options)
3558
- ref_info_file = ".".join(data_file.split(".")[:-2]) + ".refs.json"
3559
- assert not ref_info_file.startswith(".")
3560
-
3561
- deps_json = get_undocumented_ref_info_json(state.tree, type_map)
3562
- metastore.write(ref_info_file, json.dumps(deps_json, separators=(",", ":")))