jaclang 0.6.1__py3-none-any.whl → 0.6.5__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.
- jaclang/__init__.py +1 -9
- jaclang/cli/.gitignore +3 -0
- jaclang/cli/cli.md +190 -0
- jaclang/cli/cli.py +25 -4
- jaclang/compiler/.gitignore +1 -0
- jaclang/compiler/__init__.py +1 -0
- jaclang/compiler/absyntree.py +7 -7
- jaclang/compiler/compile.py +4 -4
- jaclang/compiler/jac.lark +1 -0
- jaclang/compiler/parser.py +15 -2
- jaclang/compiler/passes/main/def_impl_match_pass.py +4 -0
- jaclang/compiler/passes/main/fuse_typeinfo_pass.py +10 -1
- jaclang/compiler/passes/main/import_pass.py +47 -33
- jaclang/compiler/passes/main/pyast_load_pass.py +33 -6
- jaclang/compiler/passes/main/tests/fixtures/autoimpl.impl/getme.impl.jac +3 -0
- jaclang/compiler/passes/main/tests/fixtures/autoimpl.impl.jac +3 -0
- jaclang/compiler/passes/main/tests/fixtures/autoimpl.jac +9 -0
- jaclang/compiler/passes/main/tests/fixtures/autoimpl.something.else.impl.jac +3 -0
- jaclang/compiler/passes/main/tests/fixtures/base.jac +13 -0
- jaclang/compiler/passes/main/tests/fixtures/base2.jac +14 -0
- jaclang/compiler/passes/main/tests/fixtures/blip.jac +2 -0
- jaclang/compiler/passes/main/tests/fixtures/codegentext.jac +31 -0
- jaclang/compiler/passes/main/tests/fixtures/decls.jac +10 -0
- jaclang/compiler/passes/main/tests/fixtures/defs_and_uses.jac +44 -0
- jaclang/compiler/passes/main/tests/fixtures/fstrings.jac +4 -0
- jaclang/compiler/passes/main/tests/fixtures/func.jac +18 -0
- jaclang/compiler/passes/main/tests/fixtures/func2.jac +8 -0
- jaclang/compiler/passes/main/tests/fixtures/game1.jac +15 -0
- jaclang/compiler/passes/main/tests/fixtures/impl/defs1.jac +8 -0
- jaclang/compiler/passes/main/tests/fixtures/impl/defs2.jac +8 -0
- jaclang/compiler/passes/main/tests/fixtures/impl/imps.jac +11 -0
- jaclang/compiler/passes/main/tests/fixtures/multi_def_err.jac +7 -0
- jaclang/compiler/passes/main/tests/fixtures/registry.jac +36 -0
- jaclang/compiler/passes/main/tests/fixtures/type_info.jac +31 -0
- jaclang/compiler/passes/main/tests/test_type_check_pass.py +15 -0
- jaclang/compiler/passes/tool/tests/fixtures/corelib.jac +480 -0
- jaclang/compiler/passes/tool/tests/fixtures/corelib_fmt.jac +480 -0
- jaclang/compiler/passes/tool/tests/fixtures/genai/essay_review.jac +36 -0
- jaclang/compiler/passes/tool/tests/fixtures/genai/expert_answer.jac +17 -0
- jaclang/compiler/passes/tool/tests/fixtures/genai/joke_gen.jac +32 -0
- jaclang/compiler/passes/tool/tests/fixtures/genai/odd_word_out.jac +27 -0
- jaclang/compiler/passes/tool/tests/fixtures/genai/personality_finder.jac +35 -0
- jaclang/compiler/passes/tool/tests/fixtures/genai/text_to_type.jac +25 -0
- jaclang/compiler/passes/tool/tests/fixtures/genai/translator.jac +13 -0
- jaclang/compiler/passes/tool/tests/fixtures/genai/wikipedia.jac +63 -0
- jaclang/compiler/passes/tool/tests/fixtures/multi_def_err.dot +39 -0
- jaclang/compiler/passes/tool/tests/fixtures/multi_def_err.jac +7 -0
- jaclang/compiler/passes/tool/tests/fixtures/multi_def_err.txt +20 -0
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/ability_impl_long_comprehension.jac +15 -0
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/call_with_many_parameters.jac +24 -0
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/entry_main.jac +4 -0
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/long_line_nested_dict_access.jac +10 -0
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/multiline_fstrings.jac +16 -0
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/nested_dict.jac +15 -0
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/nested_loop_and_incrementer.jac +13 -0
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/simple_walker.jac +25 -0
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/try_block_and_walker_spawn_and_fstrings.jac +26 -0
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/tuple_iteration_and_not_negation.jac +20 -0
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/type_annotation.jac +3 -0
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/walker_decl_only.jac +12 -0
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/walker_with_default_values_types_and_docstrings.jac +18 -0
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/walker_with_inline_ability_impl.jac +8 -0
- jaclang/compiler/passes/tool/tests/fixtures/simple_walk.jac +47 -0
- jaclang/compiler/passes/tool/tests/fixtures/simple_walk_fmt.jac +47 -0
- jaclang/compiler/passes/utils/mypy_ast_build.py +8 -0
- jaclang/compiler/tests/fixtures/fam.jac +67 -0
- jaclang/compiler/tests/fixtures/hello_world.jac +5 -0
- jaclang/compiler/tests/fixtures/kwesc.jac +5 -0
- jaclang/compiler/tests/fixtures/mod_doc_test.jac +1 -0
- jaclang/compiler/tests/fixtures/staticcheck.jac +20 -0
- jaclang/compiler/tests/fixtures/stuff.jac +6 -0
- jaclang/langserve/__init__.py +1 -0
- jaclang/langserve/server.py +108 -0
- jaclang/langserve/tests/__init__.py +1 -0
- jaclang/langserve/tests/defaults.py +226 -0
- jaclang/langserve/tests/fixtures/hello.jac +1 -0
- jaclang/langserve/tests/pylsp_jsonrpc/__init__.py +2 -0
- jaclang/langserve/tests/pylsp_jsonrpc/dispatchers.py +37 -0
- jaclang/langserve/tests/pylsp_jsonrpc/endpoint.py +294 -0
- jaclang/langserve/tests/pylsp_jsonrpc/exceptions.py +114 -0
- jaclang/langserve/tests/pylsp_jsonrpc/streams.py +113 -0
- jaclang/langserve/tests/session.py +255 -0
- jaclang/langserve/tests/test_server.py +36 -0
- jaclang/langserve/utils.py +53 -0
- jaclang/plugin/tests/fixtures/impl_match.jac +9 -0
- jaclang/plugin/tests/fixtures/impl_match_impl.jac +3 -0
- jaclang/plugin/tests/fixtures/simple_node_connection.jac +55 -0
- jaclang/plugin/tests/fixtures/simple_persistent.jac +41 -0
- jaclang/settings.py +5 -0
- jaclang/tests/fixtures/abc.jac +73 -0
- jaclang/tests/fixtures/access_checker.jac +19 -0
- jaclang/tests/fixtures/access_modifier.jac +49 -0
- jaclang/tests/fixtures/aott_raise.jac +25 -0
- jaclang/tests/fixtures/arithmetic_bug.jac +13 -0
- jaclang/tests/fixtures/assign_compr.jac +15 -0
- jaclang/tests/fixtures/assign_compr_dup.jac +15 -0
- jaclang/tests/fixtures/builtin_dotgen.jac +41 -0
- jaclang/tests/fixtures/chandra_bugs.jac +11 -0
- jaclang/tests/fixtures/chandra_bugs2.jac +26 -0
- jaclang/tests/fixtures/circle_pysolo.py +91 -0
- jaclang/tests/fixtures/deep/deeper/deep_outer_import.jac +9 -0
- jaclang/tests/fixtures/deep/deeper/deep_outer_import2.jac +9 -0
- jaclang/tests/fixtures/deep/deeper/snd_lev.jac +6 -0
- jaclang/tests/fixtures/deep/mycode.jac +4 -0
- jaclang/tests/fixtures/deep/one_lev.jac +6 -0
- jaclang/tests/fixtures/deep/one_lev_dup.jac +6 -0
- jaclang/tests/fixtures/deep/one_lev_dup_py.py +6 -0
- jaclang/tests/fixtures/deep_convert.jac +5 -0
- jaclang/tests/fixtures/deep_convo.py +6 -0
- jaclang/tests/fixtures/deep_import.jac +7 -0
- jaclang/tests/fixtures/deferred_field.jac +13 -0
- jaclang/tests/fixtures/disconn.jac +29 -0
- jaclang/tests/fixtures/edge_node_walk.jac +46 -0
- jaclang/tests/fixtures/edge_ops.jac +45 -0
- jaclang/tests/fixtures/edges_walk.jac +38 -0
- jaclang/tests/fixtures/enum_inside_archtype.jac +20 -0
- jaclang/tests/fixtures/err.jac +5 -0
- jaclang/tests/fixtures/err2.jac +5 -0
- jaclang/tests/fixtures/game1.jac +15 -0
- jaclang/tests/fixtures/gendot_bubble_sort.jac +77 -0
- jaclang/tests/fixtures/guess_game.jac +47 -0
- jaclang/tests/fixtures/has_goodness.jac +15 -0
- jaclang/tests/fixtures/hashcheck.jac +12 -0
- jaclang/tests/fixtures/hashcheck_dup.jac +12 -0
- jaclang/tests/fixtures/hello.jac +5 -0
- jaclang/tests/fixtures/hello_nc.jac +5 -0
- jaclang/tests/fixtures/ignore.jac +43 -0
- jaclang/tests/fixtures/ignore_dup.jac +43 -0
- jaclang/tests/fixtures/impl_grab.impl.jac +4 -0
- jaclang/tests/fixtures/impl_grab.jac +2 -0
- jaclang/tests/fixtures/inherit_check.jac +33 -0
- jaclang/tests/fixtures/jacsamp.jac +6 -0
- jaclang/tests/fixtures/jp_importer.jac +17 -0
- jaclang/tests/fixtures/lambda.jac +6 -0
- jaclang/tests/fixtures/maxfail_run_test.jac +5 -0
- jaclang/tests/fixtures/mtest.impl.jac +6 -0
- jaclang/tests/fixtures/mtest.jac +6 -0
- jaclang/tests/fixtures/needs_import.jac +18 -0
- jaclang/tests/fixtures/needs_import_1.jac +6 -0
- jaclang/tests/fixtures/needs_import_2.jac +6 -0
- jaclang/tests/fixtures/needs_import_3.jac +6 -0
- jaclang/tests/fixtures/needs_import_dup.jac +18 -0
- jaclang/tests/fixtures/package_import.jac +6 -0
- jaclang/tests/fixtures/pyfunc.py +11 -0
- jaclang/tests/fixtures/pyfunc_1.py +311 -0
- jaclang/tests/fixtures/pyfunc_2.py +279 -0
- jaclang/tests/fixtures/pyfunc_3.py +310 -0
- jaclang/tests/fixtures/random_check.jac +62 -0
- jaclang/tests/fixtures/raw_byte_string.jac +18 -0
- jaclang/tests/fixtures/registry.jac +37 -0
- jaclang/tests/fixtures/run_test.jac +5 -0
- jaclang/tests/fixtures/semstr.jac +33 -0
- jaclang/tests/fixtures/simple_archs.jac +26 -0
- jaclang/tests/fixtures/slice_vals.jac +7 -0
- jaclang/tests/fixtures/sub_abil_sep.jac +15 -0
- jaclang/tests/fixtures/sub_abil_sep_multilev.jac +17 -0
- jaclang/tests/fixtures/try_finally.jac +34 -0
- jaclang/tests/fixtures/tupleunpack.jac +6 -0
- jaclang/tests/fixtures/tuplytuples.jac +8 -0
- jaclang/tests/fixtures/type_info.jac +15 -0
- jaclang/tests/fixtures/with_context.jac +30 -0
- jaclang/tests/fixtures/with_llm_function.jac +33 -0
- jaclang/tests/fixtures/with_llm_lower.jac +45 -0
- jaclang/tests/fixtures/with_llm_method.jac +51 -0
- jaclang/tests/fixtures/with_llm_type.jac +52 -0
- jaclang/tests/test_cli.py +239 -0
- jaclang/tests/test_language.py +831 -0
- jaclang/tests/test_man_code.py +148 -0
- jaclang/tests/test_reference.py +95 -0
- jaclang/tests/test_settings.py +46 -0
- jaclang/utils/helpers.py +11 -0
- jaclang/utils/tests/test_lang_tools.py +17 -0
- jaclang/utils/treeprinter.py +12 -4
- jaclang/vendor/__init__.py +12 -1
- jaclang/vendor/attr/__init__.py +134 -0
- jaclang/vendor/attr/__init__.pyi +555 -0
- jaclang/vendor/attr/_cmp.py +150 -0
- jaclang/vendor/attr/_cmp.pyi +13 -0
- jaclang/vendor/attr/_compat.py +87 -0
- jaclang/vendor/attr/_config.py +31 -0
- jaclang/vendor/attr/_funcs.py +483 -0
- jaclang/vendor/attr/_make.py +3119 -0
- jaclang/vendor/attr/_next_gen.py +229 -0
- jaclang/vendor/attr/_typing_compat.pyi +15 -0
- jaclang/vendor/attr/_version_info.py +86 -0
- jaclang/vendor/attr/_version_info.pyi +9 -0
- jaclang/vendor/attr/converters.py +144 -0
- jaclang/vendor/attr/converters.pyi +13 -0
- jaclang/vendor/attr/exceptions.py +95 -0
- jaclang/vendor/attr/exceptions.pyi +17 -0
- jaclang/vendor/attr/filters.py +66 -0
- jaclang/vendor/attr/filters.pyi +6 -0
- jaclang/vendor/attr/setters.py +73 -0
- jaclang/vendor/attr/setters.pyi +19 -0
- jaclang/vendor/attr/validators.py +681 -0
- jaclang/vendor/attr/validators.pyi +88 -0
- jaclang/vendor/attrs/__init__.py +65 -0
- jaclang/vendor/attrs/__init__.pyi +67 -0
- jaclang/vendor/attrs/converters.py +3 -0
- jaclang/vendor/attrs/exceptions.py +3 -0
- jaclang/vendor/attrs/filters.py +3 -0
- jaclang/vendor/attrs/py.typed +0 -0
- jaclang/vendor/attrs/setters.py +3 -0
- jaclang/vendor/attrs/validators.py +3 -0
- jaclang/vendor/attrs-23.2.0.dist-info/METADATA +202 -0
- jaclang/vendor/attrs-23.2.0.dist-info/RECORD +35 -0
- jaclang/vendor/attrs-23.2.0.dist-info/WHEEL +4 -0
- jaclang/vendor/attrs-23.2.0.dist-info/licenses/LICENSE +21 -0
- jaclang/vendor/cattr/__init__.py +25 -0
- jaclang/vendor/cattr/converters.py +8 -0
- jaclang/vendor/cattr/disambiguators.py +3 -0
- jaclang/vendor/cattr/dispatch.py +3 -0
- jaclang/vendor/cattr/errors.py +15 -0
- jaclang/vendor/cattr/gen.py +21 -0
- jaclang/vendor/cattr/preconf/__init__.py +3 -0
- jaclang/vendor/cattr/preconf/bson.py +4 -0
- jaclang/vendor/cattr/preconf/json.py +4 -0
- jaclang/vendor/cattr/preconf/msgpack.py +4 -0
- jaclang/vendor/cattr/preconf/orjson.py +4 -0
- jaclang/vendor/cattr/preconf/pyyaml.py +4 -0
- jaclang/vendor/cattr/preconf/tomlkit.py +4 -0
- jaclang/vendor/cattr/preconf/ujson.py +4 -0
- jaclang/vendor/cattr/py.typed +0 -0
- jaclang/vendor/cattrs/__init__.py +55 -0
- jaclang/vendor/cattrs/_compat.py +465 -0
- jaclang/vendor/cattrs/_generics.py +22 -0
- jaclang/vendor/cattrs/converters.py +1101 -0
- jaclang/vendor/cattrs/disambiguators.py +132 -0
- jaclang/vendor/cattrs/dispatch.py +164 -0
- jaclang/vendor/cattrs/errors.py +129 -0
- jaclang/vendor/cattrs/fns.py +17 -0
- jaclang/vendor/cattrs/gen/__init__.py +890 -0
- jaclang/vendor/cattrs/gen/_consts.py +19 -0
- jaclang/vendor/cattrs/gen/_generics.py +43 -0
- jaclang/vendor/cattrs/gen/_lc.py +28 -0
- jaclang/vendor/cattrs/gen/_shared.py +51 -0
- jaclang/vendor/cattrs/gen/typeddicts.py +624 -0
- jaclang/vendor/cattrs/preconf/__init__.py +7 -0
- jaclang/vendor/cattrs/preconf/bson.py +107 -0
- jaclang/vendor/cattrs/preconf/cbor2.py +47 -0
- jaclang/vendor/cattrs/preconf/json.py +52 -0
- jaclang/vendor/cattrs/preconf/msgpack.py +51 -0
- jaclang/vendor/cattrs/preconf/orjson.py +82 -0
- jaclang/vendor/cattrs/preconf/pyyaml.py +60 -0
- jaclang/vendor/cattrs/preconf/tomlkit.py +85 -0
- jaclang/vendor/cattrs/preconf/ujson.py +52 -0
- jaclang/vendor/cattrs/py.typed +0 -0
- jaclang/vendor/cattrs/strategies/__init__.py +11 -0
- jaclang/vendor/cattrs/strategies/_class_methods.py +64 -0
- jaclang/vendor/cattrs/strategies/_subclasses.py +224 -0
- jaclang/vendor/cattrs/strategies/_unions.py +235 -0
- jaclang/vendor/cattrs/v.py +111 -0
- jaclang/vendor/cattrs-23.2.3.dist-info/METADATA +221 -0
- jaclang/vendor/cattrs-23.2.3.dist-info/RECORD +48 -0
- jaclang/vendor/cattrs-23.2.3.dist-info/WHEEL +4 -0
- jaclang/vendor/cattrs-23.2.3.dist-info/licenses/LICENSE +11 -0
- jaclang/vendor/lark/__init__.py +38 -38
- jaclang/vendor/lark/__pyinstaller/__init__.py +6 -7
- jaclang/vendor/lark/__pyinstaller/hook-lark.py +14 -14
- jaclang/vendor/lark/ast_utils.py +59 -70
- jaclang/vendor/lark/common.py +89 -113
- jaclang/vendor/lark/exceptions.py +292 -352
- jaclang/vendor/lark/grammar.py +130 -158
- jaclang/vendor/lark/grammars/common.lark +59 -59
- jaclang/vendor/lark/grammars/lark.lark +62 -62
- jaclang/vendor/lark/grammars/python.lark +302 -302
- jaclang/vendor/lark/grammars/unicode.lark +7 -7
- jaclang/vendor/lark/indenter.py +112 -118
- jaclang/vendor/lark/lark.py +661 -800
- jaclang/vendor/lark/lexer.py +678 -829
- jaclang/vendor/lark/load_grammar.py +1428 -1673
- jaclang/vendor/lark/parse_tree_builder.py +391 -466
- jaclang/vendor/lark/parser_frontends.py +257 -305
- jaclang/vendor/lark/parsers/cyk.py +340 -391
- jaclang/vendor/lark/parsers/earley.py +308 -385
- jaclang/vendor/lark/parsers/earley_common.py +42 -59
- jaclang/vendor/lark/parsers/earley_forest.py +810 -923
- jaclang/vendor/lark/parsers/grammar_analysis.py +203 -239
- jaclang/vendor/lark/parsers/lalr_analysis.py +332 -378
- jaclang/vendor/lark/parsers/lalr_interactive_parser.py +157 -171
- jaclang/vendor/lark/parsers/lalr_parser.py +122 -145
- jaclang/vendor/lark/parsers/lalr_parser_state.py +110 -141
- jaclang/vendor/lark/parsers/xearley.py +165 -209
- jaclang/vendor/lark/reconstruct.py +107 -131
- jaclang/vendor/lark/tools/__init__.py +71 -93
- jaclang/vendor/lark/tools/nearley.py +202 -240
- jaclang/vendor/lark/tools/serialize.py +32 -35
- jaclang/vendor/lark/tools/standalone.py +196 -225
- jaclang/vendor/lark/tree.py +272 -302
- jaclang/vendor/lark/tree_matcher.py +186 -194
- jaclang/vendor/lark/tree_templates.py +18 -26
- jaclang/vendor/lark/utils.py +361 -393
- jaclang/vendor/lark/visitors.py +593 -645
- jaclang/vendor/lark-1.1.9.dist-info/LICENSE +18 -0
- jaclang/vendor/lark-1.1.9.dist-info/METADATA +47 -0
- jaclang/vendor/lark-1.1.9.dist-info/RECORD +46 -0
- jaclang/vendor/lark-1.1.9.dist-info/WHEEL +5 -0
- jaclang/vendor/lark-1.1.9.dist-info/entry_points.txt +2 -0
- jaclang/vendor/lark-1.1.9.dist-info/top_level.txt +1 -0
- jaclang/vendor/lsprotocol/__init__.py +2 -0
- jaclang/vendor/lsprotocol/_hooks.py +1237 -0
- jaclang/vendor/lsprotocol/converters.py +17 -0
- jaclang/vendor/lsprotocol/py.typed +0 -0
- jaclang/vendor/lsprotocol/types.py +12898 -0
- jaclang/vendor/lsprotocol/validators.py +47 -0
- jaclang/vendor/lsprotocol-2023.0.1.dist-info/LICENSE +21 -0
- jaclang/vendor/lsprotocol-2023.0.1.dist-info/METADATA +65 -0
- jaclang/vendor/lsprotocol-2023.0.1.dist-info/RECORD +10 -0
- jaclang/vendor/lsprotocol-2023.0.1.dist-info/WHEEL +4 -0
- jaclang/vendor/mypy/api.py +1 -3
- jaclang/vendor/mypy/applytype.py +24 -24
- jaclang/vendor/mypy/argmap.py +5 -9
- jaclang/vendor/mypy/binder.py +11 -42
- jaclang/vendor/mypy/build.py +78 -260
- jaclang/vendor/mypy/checker.py +394 -930
- jaclang/vendor/mypy/checkexpr.py +210 -640
- jaclang/vendor/mypy/checkmember.py +44 -94
- jaclang/vendor/mypy/checkpattern.py +32 -104
- jaclang/vendor/mypy/checkstrformat.py +38 -131
- jaclang/vendor/mypy/config_parser.py +8 -31
- jaclang/vendor/mypy/constant_fold.py +1 -3
- jaclang/vendor/mypy/constraints.py +94 -253
- jaclang/vendor/mypy/copytype.py +3 -13
- jaclang/vendor/mypy/defaults.py +2 -4
- jaclang/vendor/mypy/dmypy/client.py +30 -102
- jaclang/vendor/mypy/dmypy_server.py +31 -118
- jaclang/vendor/mypy/erasetype.py +6 -18
- jaclang/vendor/mypy/errorcodes.py +26 -64
- jaclang/vendor/mypy/errors.py +23 -117
- jaclang/vendor/mypy/evalexpr.py +1 -3
- jaclang/vendor/mypy/expandtype.py +37 -40
- jaclang/vendor/mypy/exprtotype.py +14 -27
- jaclang/vendor/mypy/fastparse.py +66 -215
- jaclang/vendor/mypy/find_sources.py +4 -14
- jaclang/vendor/mypy/fixup.py +5 -10
- jaclang/vendor/mypy/indirection.py +1 -3
- jaclang/vendor/mypy/infer.py +2 -6
- jaclang/vendor/mypy/inspections.py +3 -13
- jaclang/vendor/mypy/ipc.py +7 -28
- jaclang/vendor/mypy/join.py +20 -39
- jaclang/vendor/mypy/literals.py +2 -10
- jaclang/vendor/mypy/main.py +39 -138
- jaclang/vendor/mypy/maptype.py +2 -6
- jaclang/vendor/mypy/meet.py +23 -77
- jaclang/vendor/mypy/message_registry.py +33 -88
- jaclang/vendor/mypy/messages.py +146 -447
- jaclang/vendor/mypy/metastore.py +2 -6
- jaclang/vendor/mypy/modulefinder.py +29 -76
- jaclang/vendor/mypy/moduleinspect.py +5 -17
- jaclang/vendor/mypy/mro.py +1 -3
- jaclang/vendor/mypy/nodes.py +35 -119
- jaclang/vendor/mypy/operators.py +2 -11
- jaclang/vendor/mypy/options.py +3 -9
- jaclang/vendor/mypy/parse.py +1 -3
- jaclang/vendor/mypy/plugin.py +25 -75
- jaclang/vendor/mypy/plugins/attrs.py +53 -119
- jaclang/vendor/mypy/plugins/common.py +9 -29
- jaclang/vendor/mypy/plugins/ctypes.py +5 -15
- jaclang/vendor/mypy/plugins/dataclasses.py +42 -107
- jaclang/vendor/mypy/plugins/default.py +26 -45
- jaclang/vendor/mypy/plugins/enums.py +4 -17
- jaclang/vendor/mypy/plugins/functools.py +2 -11
- jaclang/vendor/mypy/plugins/proper_plugin.py +2 -6
- jaclang/vendor/mypy/plugins/singledispatch.py +7 -33
- jaclang/vendor/mypy/reachability.py +2 -8
- jaclang/vendor/mypy/refinfo.py +1 -3
- jaclang/vendor/mypy/report.py +23 -52
- jaclang/vendor/mypy/semanal.py +385 -693
- jaclang/vendor/mypy/semanal_classprop.py +9 -34
- jaclang/vendor/mypy/semanal_enum.py +7 -19
- jaclang/vendor/mypy/semanal_infer.py +1 -3
- jaclang/vendor/mypy/semanal_main.py +5 -25
- jaclang/vendor/mypy/semanal_namedtuple.py +17 -56
- jaclang/vendor/mypy/semanal_newtype.py +8 -27
- jaclang/vendor/mypy/semanal_pass1.py +2 -6
- jaclang/vendor/mypy/semanal_shared.py +9 -27
- jaclang/vendor/mypy/semanal_typeargs.py +12 -41
- jaclang/vendor/mypy/semanal_typeddict.py +18 -59
- jaclang/vendor/mypy/server/astdiff.py +9 -34
- jaclang/vendor/mypy/server/astmerge.py +2 -6
- jaclang/vendor/mypy/server/deps.py +22 -71
- jaclang/vendor/mypy/server/mergecheck.py +1 -3
- jaclang/vendor/mypy/server/objgraph.py +2 -8
- jaclang/vendor/mypy/server/update.py +18 -54
- jaclang/vendor/mypy/solve.py +4 -17
- jaclang/vendor/mypy/split_namespace.py +1 -3
- jaclang/vendor/mypy/stats.py +6 -24
- jaclang/vendor/mypy/strconv.py +8 -31
- jaclang/vendor/mypy/stubdoc.py +8 -38
- jaclang/vendor/mypy/stubgen.py +79 -144
- jaclang/vendor/mypy/stubgenc.py +22 -69
- jaclang/vendor/mypy/stubtest.py +62 -167
- jaclang/vendor/mypy/stubutil.py +45 -61
- jaclang/vendor/mypy/subtypes.py +57 -133
- jaclang/vendor/mypy/suggestions.py +19 -53
- jaclang/vendor/mypy/test/data.py +13 -40
- jaclang/vendor/mypy/test/helpers.py +18 -43
- jaclang/vendor/mypy/test/meta/_pytest.py +2 -13
- jaclang/vendor/mypy/test/meta/test_parse_data.py +5 -9
- jaclang/vendor/mypy/test/meta/test_update_data.py +1 -3
- jaclang/vendor/mypy/test/test_find_sources.py +14 -32
- jaclang/vendor/mypy/test/test_ref_info.py +3 -9
- jaclang/vendor/mypy/test/testargs.py +1 -4
- jaclang/vendor/mypy/test/testcheck.py +14 -47
- jaclang/vendor/mypy/test/testcmdline.py +3 -14
- jaclang/vendor/mypy/test/testconstraints.py +8 -26
- jaclang/vendor/mypy/test/testdaemon.py +2 -9
- jaclang/vendor/mypy/test/testdeps.py +4 -12
- jaclang/vendor/mypy/test/testdiff.py +2 -6
- jaclang/vendor/mypy/test/testerrorstream.py +1 -3
- jaclang/vendor/mypy/test/testfinegrained.py +18 -56
- jaclang/vendor/mypy/test/testgraph.py +3 -18
- jaclang/vendor/mypy/test/testinfer.py +13 -55
- jaclang/vendor/mypy/test/testipc.py +3 -9
- jaclang/vendor/mypy/test/testmerge.py +5 -17
- jaclang/vendor/mypy/test/testmodulefinder.py +8 -30
- jaclang/vendor/mypy/test/testmypyc.py +1 -3
- jaclang/vendor/mypy/test/testparse.py +1 -3
- jaclang/vendor/mypy/test/testpep561.py +4 -13
- jaclang/vendor/mypy/test/testpythoneval.py +2 -6
- jaclang/vendor/mypy/test/testreports.py +1 -2
- jaclang/vendor/mypy/test/testsemanal.py +3 -10
- jaclang/vendor/mypy/test/testsolve.py +5 -15
- jaclang/vendor/mypy/test/teststubgen.py +69 -210
- jaclang/vendor/mypy/test/teststubtest.py +123 -163
- jaclang/vendor/mypy/test/testsubtypes.py +14 -34
- jaclang/vendor/mypy/test/testtransform.py +2 -8
- jaclang/vendor/mypy/test/testtypegen.py +2 -8
- jaclang/vendor/mypy/test/testtypes.py +77 -253
- jaclang/vendor/mypy/test/testutil.py +1 -3
- jaclang/vendor/mypy/test/typefixture.py +11 -38
- jaclang/vendor/mypy/test/update_data.py +4 -15
- jaclang/vendor/mypy/test/visitors.py +1 -9
- jaclang/vendor/mypy/treetransform.py +8 -25
- jaclang/vendor/mypy/tvar_scope.py +23 -3
- jaclang/vendor/mypy/type_visitor.py +3 -10
- jaclang/vendor/mypy/typeanal.py +183 -309
- jaclang/vendor/mypy/typeops.py +27 -73
- jaclang/vendor/mypy/types.py +77 -185
- jaclang/vendor/mypy/types_utils.py +7 -20
- jaclang/vendor/mypy/typeshed/LICENSE +237 -0
- jaclang/vendor/mypy/typeshed/stdlib/VERSIONS +309 -0
- jaclang/vendor/mypy/typeshed/stdlib/__future__.pyi +36 -0
- jaclang/vendor/mypy/typeshed/stdlib/__main__.pyi +3 -0
- jaclang/vendor/mypy/typeshed/stdlib/_ast.pyi +591 -0
- jaclang/vendor/mypy/typeshed/stdlib/_bisect.pyi +84 -0
- jaclang/vendor/mypy/typeshed/stdlib/_bootlocale.pyi +1 -0
- jaclang/vendor/mypy/typeshed/stdlib/_codecs.pyi +133 -0
- jaclang/vendor/mypy/typeshed/stdlib/_collections_abc.pyi +94 -0
- jaclang/vendor/mypy/typeshed/stdlib/_compat_pickle.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/_compression.pyi +25 -0
- jaclang/vendor/mypy/typeshed/stdlib/_csv.pyi +90 -0
- jaclang/vendor/mypy/typeshed/stdlib/_ctypes.pyi +207 -0
- jaclang/vendor/mypy/typeshed/stdlib/_curses.pyi +566 -0
- jaclang/vendor/mypy/typeshed/stdlib/_decimal.pyi +281 -0
- jaclang/vendor/mypy/typeshed/stdlib/_dummy_thread.pyi +33 -0
- jaclang/vendor/mypy/typeshed/stdlib/_dummy_threading.pyi +164 -0
- jaclang/vendor/mypy/typeshed/stdlib/_heapq.pyi +11 -0
- jaclang/vendor/mypy/typeshed/stdlib/_imp.pyi +28 -0
- jaclang/vendor/mypy/typeshed/stdlib/_json.pyi +49 -0
- jaclang/vendor/mypy/typeshed/stdlib/_locale.pyi +100 -0
- jaclang/vendor/mypy/typeshed/stdlib/_lsprof.pyi +35 -0
- jaclang/vendor/mypy/typeshed/stdlib/_markupbase.pyi +16 -0
- jaclang/vendor/mypy/typeshed/stdlib/_msi.pyi +92 -0
- jaclang/vendor/mypy/typeshed/stdlib/_operator.pyi +147 -0
- jaclang/vendor/mypy/typeshed/stdlib/_osx_support.pyi +34 -0
- jaclang/vendor/mypy/typeshed/stdlib/_posixsubprocess.pyi +33 -0
- jaclang/vendor/mypy/typeshed/stdlib/_py_abc.pyi +14 -0
- jaclang/vendor/mypy/typeshed/stdlib/_pydecimal.pyi +43 -0
- jaclang/vendor/mypy/typeshed/stdlib/_random.pyi +12 -0
- jaclang/vendor/mypy/typeshed/stdlib/_sitebuiltins.pyi +16 -0
- jaclang/vendor/mypy/typeshed/stdlib/_socket.pyi +803 -0
- jaclang/vendor/mypy/typeshed/stdlib/_stat.pyi +103 -0
- jaclang/vendor/mypy/typeshed/stdlib/_thread.pyi +59 -0
- jaclang/vendor/mypy/typeshed/stdlib/_threading_local.pyi +17 -0
- jaclang/vendor/mypy/typeshed/stdlib/_tkinter.pyi +121 -0
- jaclang/vendor/mypy/typeshed/stdlib/_tracemalloc.pyi +17 -0
- jaclang/vendor/mypy/typeshed/stdlib/_typeshed/__init__.pyi +347 -0
- jaclang/vendor/mypy/typeshed/stdlib/_typeshed/dbapi.pyi +37 -0
- jaclang/vendor/mypy/typeshed/stdlib/_typeshed/wsgi.pyi +44 -0
- jaclang/vendor/mypy/typeshed/stdlib/_typeshed/xml.pyi +9 -0
- jaclang/vendor/mypy/typeshed/stdlib/_warnings.pyi +55 -0
- jaclang/vendor/mypy/typeshed/stdlib/_weakref.pyi +41 -0
- jaclang/vendor/mypy/typeshed/stdlib/_weakrefset.pyi +51 -0
- jaclang/vendor/mypy/typeshed/stdlib/_winapi.pyi +255 -0
- jaclang/vendor/mypy/typeshed/stdlib/abc.pyi +51 -0
- jaclang/vendor/mypy/typeshed/stdlib/aifc.pyi +91 -0
- jaclang/vendor/mypy/typeshed/stdlib/antigravity.pyi +3 -0
- jaclang/vendor/mypy/typeshed/stdlib/argparse.pyi +595 -0
- jaclang/vendor/mypy/typeshed/stdlib/array.pyi +92 -0
- jaclang/vendor/mypy/typeshed/stdlib/ast.pyi +277 -0
- jaclang/vendor/mypy/typeshed/stdlib/asynchat.pyi +21 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/__init__.pyi +41 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_events.pyi +440 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_futures.pyi +19 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_subprocess.pyi +63 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_tasks.pyi +9 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/constants.pyi +20 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/coroutines.pyi +26 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/events.pyi +580 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/exceptions.pyi +43 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/format_helpers.pyi +20 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/futures.pyi +57 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/locks.pyi +121 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/log.pyi +3 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/mixins.pyi +9 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/proactor_events.pyi +64 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/protocols.pyi +34 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/queues.pyi +47 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/runners.pyi +32 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/selector_events.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/sslproto.pyi +165 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/staggered.pyi +10 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/streams.pyi +153 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/subprocess.pyi +229 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/taskgroups.pyi +25 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/tasks.pyi +497 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/threads.pyi +9 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/timeouts.pyi +19 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/transports.pyi +47 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/trsock.pyi +94 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/unix_events.pyi +196 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/windows_events.pyi +85 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/windows_utils.pyi +49 -0
- jaclang/vendor/mypy/typeshed/stdlib/asyncore.pyi +90 -0
- jaclang/vendor/mypy/typeshed/stdlib/atexit.pyi +12 -0
- jaclang/vendor/mypy/typeshed/stdlib/audioop.pyi +43 -0
- jaclang/vendor/mypy/typeshed/stdlib/base64.pyi +59 -0
- jaclang/vendor/mypy/typeshed/stdlib/bdb.pyi +102 -0
- jaclang/vendor/mypy/typeshed/stdlib/binascii.pyi +36 -0
- jaclang/vendor/mypy/typeshed/stdlib/binhex.pyi +45 -0
- jaclang/vendor/mypy/typeshed/stdlib/bisect.pyi +4 -0
- jaclang/vendor/mypy/typeshed/stdlib/builtins.pyi +1936 -0
- jaclang/vendor/mypy/typeshed/stdlib/bz2.pyi +146 -0
- jaclang/vendor/mypy/typeshed/stdlib/cProfile.pyi +31 -0
- jaclang/vendor/mypy/typeshed/stdlib/calendar.pyi +208 -0
- jaclang/vendor/mypy/typeshed/stdlib/cgi.pyi +118 -0
- jaclang/vendor/mypy/typeshed/stdlib/cgitb.pyi +32 -0
- jaclang/vendor/mypy/typeshed/stdlib/chunk.pyi +20 -0
- jaclang/vendor/mypy/typeshed/stdlib/cmath.pyi +36 -0
- jaclang/vendor/mypy/typeshed/stdlib/cmd.pyi +45 -0
- jaclang/vendor/mypy/typeshed/stdlib/code.pyi +33 -0
- jaclang/vendor/mypy/typeshed/stdlib/codecs.pyi +285 -0
- jaclang/vendor/mypy/typeshed/stdlib/codeop.pyi +13 -0
- jaclang/vendor/mypy/typeshed/stdlib/collections/__init__.pyi +485 -0
- jaclang/vendor/mypy/typeshed/stdlib/collections/abc.pyi +2 -0
- jaclang/vendor/mypy/typeshed/stdlib/colorsys.pyi +13 -0
- jaclang/vendor/mypy/typeshed/stdlib/compileall.pyi +111 -0
- jaclang/vendor/mypy/typeshed/stdlib/concurrent/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/__init__.pyi +32 -0
- jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/_base.pyi +126 -0
- jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/process.pyi +233 -0
- jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/thread.pyi +80 -0
- jaclang/vendor/mypy/typeshed/stdlib/configparser.pyi +313 -0
- jaclang/vendor/mypy/typeshed/stdlib/contextlib.pyi +208 -0
- jaclang/vendor/mypy/typeshed/stdlib/contextvars.pyi +63 -0
- jaclang/vendor/mypy/typeshed/stdlib/copy.pyi +16 -0
- jaclang/vendor/mypy/typeshed/stdlib/copyreg.pyi +21 -0
- jaclang/vendor/mypy/typeshed/stdlib/crypt.pyi +12 -0
- jaclang/vendor/mypy/typeshed/stdlib/csv.pyi +147 -0
- jaclang/vendor/mypy/typeshed/stdlib/ctypes/__init__.pyi +187 -0
- jaclang/vendor/mypy/typeshed/stdlib/ctypes/_endian.pyi +19 -0
- jaclang/vendor/mypy/typeshed/stdlib/ctypes/util.pyi +6 -0
- jaclang/vendor/mypy/typeshed/stdlib/ctypes/wintypes.pyi +298 -0
- jaclang/vendor/mypy/typeshed/stdlib/curses/__init__.pyi +22 -0
- jaclang/vendor/mypy/typeshed/stdlib/curses/ascii.pyi +62 -0
- jaclang/vendor/mypy/typeshed/stdlib/curses/has_key.pyi +1 -0
- jaclang/vendor/mypy/typeshed/stdlib/curses/panel.pyi +22 -0
- jaclang/vendor/mypy/typeshed/stdlib/curses/textpad.pyi +11 -0
- jaclang/vendor/mypy/typeshed/stdlib/dataclasses.pyi +315 -0
- jaclang/vendor/mypy/typeshed/stdlib/datetime.pyi +295 -0
- jaclang/vendor/mypy/typeshed/stdlib/dbm/__init__.pyi +95 -0
- jaclang/vendor/mypy/typeshed/stdlib/dbm/dumb.pyi +31 -0
- jaclang/vendor/mypy/typeshed/stdlib/dbm/gnu.pyi +41 -0
- jaclang/vendor/mypy/typeshed/stdlib/dbm/ndbm.pyi +37 -0
- jaclang/vendor/mypy/typeshed/stdlib/decimal.pyi +2 -0
- jaclang/vendor/mypy/typeshed/stdlib/difflib.pyi +140 -0
- jaclang/vendor/mypy/typeshed/stdlib/dis.pyi +144 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/__init__.pyi +5 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/archive_util.pyi +20 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/bcppcompiler.pyi +3 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/ccompiler.pyi +152 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/cmd.pyi +66 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist.pyi +25 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_dumb.pyi +21 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_msi.pyi +45 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_packager.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_rpm.pyi +52 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_wininst.pyi +16 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build.pyi +31 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_clib.pyi +27 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_ext.pyi +50 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_py.pyi +44 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_scripts.pyi +24 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/check.pyi +39 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/clean.pyi +17 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/config.pyi +83 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install.pyi +63 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_data.pyi +19 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_egg_info.pyi +18 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_headers.pyi +16 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_lib.pyi +25 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_scripts.pyi +18 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/register.pyi +18 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/sdist.pyi +42 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/upload.pyi +17 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/config.pyi +17 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/core.pyi +57 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/cygwinccompiler.pyi +20 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/debug.pyi +1 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/dep_util.pyi +3 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/dir_util.pyi +13 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/dist.pyi +146 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/errors.pyi +19 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/extension.pyi +36 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/fancy_getopt.pyi +34 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/file_util.pyi +14 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/filelist.pyi +50 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/log.pyi +25 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/msvccompiler.pyi +3 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/spawn.pyi +2 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/sysconfig.pyi +31 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/text_file.pyi +21 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/unixccompiler.pyi +3 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/util.pyi +46 -0
- jaclang/vendor/mypy/typeshed/stdlib/distutils/version.pyi +36 -0
- jaclang/vendor/mypy/typeshed/stdlib/doctest.pyi +248 -0
- jaclang/vendor/mypy/typeshed/stdlib/dummy_threading.pyi +2 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/__init__.pyi +29 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/_header_value_parser.pyi +392 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/_policybase.pyi +51 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/base64mime.pyi +13 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/charset.pyi +34 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/contentmanager.pyi +11 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/encoders.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/errors.pyi +39 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/feedparser.pyi +23 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/generator.pyi +40 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/header.pyi +31 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/headerregistry.pyi +178 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/iterators.pyi +12 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/message.pyi +165 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/application.pyi +17 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/audio.pyi +17 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/base.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/image.pyi +17 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/message.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/multipart.pyi +18 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/nonmultipart.pyi +5 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/text.pyi +9 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/parser.pyi +26 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/policy.pyi +38 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/quoprimime.pyi +28 -0
- jaclang/vendor/mypy/typeshed/stdlib/email/utils.pyi +70 -0
- jaclang/vendor/mypy/typeshed/stdlib/encodings/__init__.pyi +10 -0
- jaclang/vendor/mypy/typeshed/stdlib/encodings/utf_8.pyi +21 -0
- jaclang/vendor/mypy/typeshed/stdlib/encodings/utf_8_sig.pyi +22 -0
- jaclang/vendor/mypy/typeshed/stdlib/ensurepip/__init__.pyi +12 -0
- jaclang/vendor/mypy/typeshed/stdlib/enum.pyi +320 -0
- jaclang/vendor/mypy/typeshed/stdlib/errno.pyi +222 -0
- jaclang/vendor/mypy/typeshed/stdlib/faulthandler.pyi +13 -0
- jaclang/vendor/mypy/typeshed/stdlib/fcntl.pyi +127 -0
- jaclang/vendor/mypy/typeshed/stdlib/filecmp.pyi +57 -0
- jaclang/vendor/mypy/typeshed/stdlib/fileinput.pyi +213 -0
- jaclang/vendor/mypy/typeshed/stdlib/fnmatch.pyi +9 -0
- jaclang/vendor/mypy/typeshed/stdlib/formatter.pyi +88 -0
- jaclang/vendor/mypy/typeshed/stdlib/fractions.pyi +150 -0
- jaclang/vendor/mypy/typeshed/stdlib/ftplib.pyi +178 -0
- jaclang/vendor/mypy/typeshed/stdlib/functools.pyi +213 -0
- jaclang/vendor/mypy/typeshed/stdlib/gc.pyi +37 -0
- jaclang/vendor/mypy/typeshed/stdlib/genericpath.pyi +52 -0
- jaclang/vendor/mypy/typeshed/stdlib/getopt.pyi +11 -0
- jaclang/vendor/mypy/typeshed/stdlib/getpass.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/gettext.pyi +169 -0
- jaclang/vendor/mypy/typeshed/stdlib/glob.pyi +42 -0
- jaclang/vendor/mypy/typeshed/stdlib/graphlib.pyi +28 -0
- jaclang/vendor/mypy/typeshed/stdlib/grp.pyi +22 -0
- jaclang/vendor/mypy/typeshed/stdlib/gzip.pyi +160 -0
- jaclang/vendor/mypy/typeshed/stdlib/hashlib.pyi +167 -0
- jaclang/vendor/mypy/typeshed/stdlib/heapq.pyi +17 -0
- jaclang/vendor/mypy/typeshed/stdlib/hmac.pyi +38 -0
- jaclang/vendor/mypy/typeshed/stdlib/html/__init__.pyi +6 -0
- jaclang/vendor/mypy/typeshed/stdlib/html/entities.pyi +6 -0
- jaclang/vendor/mypy/typeshed/stdlib/html/parser.pyi +34 -0
- jaclang/vendor/mypy/typeshed/stdlib/http/__init__.pyi +105 -0
- jaclang/vendor/mypy/typeshed/stdlib/http/client.pyi +259 -0
- jaclang/vendor/mypy/typeshed/stdlib/http/cookiejar.pyi +159 -0
- jaclang/vendor/mypy/typeshed/stdlib/http/cookies.pyi +60 -0
- jaclang/vendor/mypy/typeshed/stdlib/http/server.pyi +83 -0
- jaclang/vendor/mypy/typeshed/stdlib/imaplib.pyi +168 -0
- jaclang/vendor/mypy/typeshed/stdlib/imghdr.pyi +17 -0
- jaclang/vendor/mypy/typeshed/stdlib/imp.pyi +62 -0
- jaclang/vendor/mypy/typeshed/stdlib/importlib/__init__.pyi +24 -0
- jaclang/vendor/mypy/typeshed/stdlib/importlib/_abc.pyi +15 -0
- jaclang/vendor/mypy/typeshed/stdlib/importlib/abc.pyi +172 -0
- jaclang/vendor/mypy/typeshed/stdlib/importlib/machinery.pyi +179 -0
- jaclang/vendor/mypy/typeshed/stdlib/importlib/metadata/__init__.pyi +285 -0
- jaclang/vendor/mypy/typeshed/stdlib/importlib/metadata/_meta.pyi +49 -0
- jaclang/vendor/mypy/typeshed/stdlib/importlib/readers.pyi +68 -0
- jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/__init__.pyi +46 -0
- jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/abc.pyi +12 -0
- jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/readers.pyi +14 -0
- jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/simple.pyi +56 -0
- jaclang/vendor/mypy/typeshed/stdlib/importlib/simple.pyi +11 -0
- jaclang/vendor/mypy/typeshed/stdlib/importlib/util.pyi +43 -0
- jaclang/vendor/mypy/typeshed/stdlib/inspect.pyi +632 -0
- jaclang/vendor/mypy/typeshed/stdlib/io.pyi +238 -0
- jaclang/vendor/mypy/typeshed/stdlib/ipaddress.pyi +208 -0
- jaclang/vendor/mypy/typeshed/stdlib/itertools.pyi +273 -0
- jaclang/vendor/mypy/typeshed/stdlib/json/__init__.pyi +61 -0
- jaclang/vendor/mypy/typeshed/stdlib/json/decoder.pyi +32 -0
- jaclang/vendor/mypy/typeshed/stdlib/json/encoder.pyi +40 -0
- jaclang/vendor/mypy/typeshed/stdlib/json/tool.pyi +1 -0
- jaclang/vendor/mypy/typeshed/stdlib/keyword.pyi +21 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/btm_matcher.pyi +28 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixer_base.pyi +42 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_apply.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_asserts.pyi +10 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_basestring.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_buffer.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_dict.pyi +16 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_except.pyi +14 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_exec.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_execfile.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_exitfunc.pyi +13 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_filter.pyi +9 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_funcattrs.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_future.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_getcwdu.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_has_key.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_idioms.pyi +15 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_import.pyi +16 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_imports.pyi +21 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_imports2.pyi +6 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_input.pyi +11 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_intern.pyi +9 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_isinstance.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_itertools.pyi +9 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_itertools_imports.pyi +7 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_long.pyi +7 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_map.pyi +9 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_metaclass.pyi +17 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_methodattrs.pyi +10 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_ne.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_next.pyi +19 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_nonzero.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_numliterals.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_operator.pyi +12 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_paren.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_print.pyi +12 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_raise.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_raw_input.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_reduce.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_reload.pyi +9 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_renames.pyi +17 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_repr.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_set_literal.pyi +7 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_standarderror.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_sys_exc.pyi +9 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_throw.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_tuple_params.pyi +17 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_types.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_unicode.pyi +12 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_urllib.pyi +15 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_ws_comma.pyi +12 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_xrange.pyi +20 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_xreadlines.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_zip.pyi +9 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/main.pyi +42 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/__init__.pyi +9 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/driver.pyi +27 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/grammar.pyi +24 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/literals.pyi +7 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/parse.pyi +30 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/pgen.pyi +50 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/token.pyi +67 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/tokenize.pyi +96 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pygram.pyi +114 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pytree.pyi +117 -0
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/refactor.pyi +82 -0
- jaclang/vendor/mypy/typeshed/stdlib/linecache.pyi +23 -0
- jaclang/vendor/mypy/typeshed/stdlib/locale.pyi +152 -0
- jaclang/vendor/mypy/typeshed/stdlib/logging/__init__.pyi +658 -0
- jaclang/vendor/mypy/typeshed/stdlib/logging/config.pyi +134 -0
- jaclang/vendor/mypy/typeshed/stdlib/logging/handlers.pyi +275 -0
- jaclang/vendor/mypy/typeshed/stdlib/lzma.pyi +197 -0
- jaclang/vendor/mypy/typeshed/stdlib/mailbox.pyi +256 -0
- jaclang/vendor/mypy/typeshed/stdlib/mailcap.pyi +11 -0
- jaclang/vendor/mypy/typeshed/stdlib/marshal.pyi +33 -0
- jaclang/vendor/mypy/typeshed/stdlib/math.pyi +125 -0
- jaclang/vendor/mypy/typeshed/stdlib/mimetypes.pyi +46 -0
- jaclang/vendor/mypy/typeshed/stdlib/mmap.pyi +113 -0
- jaclang/vendor/mypy/typeshed/stdlib/modulefinder.pyi +66 -0
- jaclang/vendor/mypy/typeshed/stdlib/msilib/__init__.pyi +177 -0
- jaclang/vendor/mypy/typeshed/stdlib/msilib/schema.pyi +94 -0
- jaclang/vendor/mypy/typeshed/stdlib/msilib/sequence.pyi +13 -0
- jaclang/vendor/mypy/typeshed/stdlib/msilib/text.pyi +7 -0
- jaclang/vendor/mypy/typeshed/stdlib/msvcrt.pyi +32 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/__init__.pyi +90 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/connection.pyi +75 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/context.pyi +189 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/dummy/__init__.pyi +77 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/dummy/connection.pyi +39 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/forkserver.pyi +31 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/heap.pyi +36 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/managers.pyi +212 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/pool.pyi +103 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_fork.pyi +23 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_forkserver.pyi +16 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_spawn_posix.pyi +20 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_spawn_win32.pyi +30 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/process.pyi +39 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/queues.pyi +41 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/reduction.pyi +90 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/resource_sharer.pyi +20 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/resource_tracker.pyi +18 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/shared_memory.pyi +40 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/sharedctypes.pyi +107 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/spawn.pyi +32 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/synchronize.pyi +54 -0
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/util.pyi +98 -0
- jaclang/vendor/mypy/typeshed/stdlib/netrc.pyi +23 -0
- jaclang/vendor/mypy/typeshed/stdlib/nis.pyi +9 -0
- jaclang/vendor/mypy/typeshed/stdlib/nntplib.pyi +125 -0
- jaclang/vendor/mypy/typeshed/stdlib/nt.pyi +111 -0
- jaclang/vendor/mypy/typeshed/stdlib/ntpath.pyi +119 -0
- jaclang/vendor/mypy/typeshed/stdlib/nturl2path.pyi +2 -0
- jaclang/vendor/mypy/typeshed/stdlib/numbers.pyi +209 -0
- jaclang/vendor/mypy/typeshed/stdlib/opcode.pyi +59 -0
- jaclang/vendor/mypy/typeshed/stdlib/operator.pyi +110 -0
- jaclang/vendor/mypy/typeshed/stdlib/optparse.pyi +255 -0
- jaclang/vendor/mypy/typeshed/stdlib/os/__init__.pyi +1157 -0
- jaclang/vendor/mypy/typeshed/stdlib/os/path.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/ossaudiodev.pyi +131 -0
- jaclang/vendor/mypy/typeshed/stdlib/parser.pyi +24 -0
- jaclang/vendor/mypy/typeshed/stdlib/pathlib.pyi +232 -0
- jaclang/vendor/mypy/typeshed/stdlib/pdb.pyi +181 -0
- jaclang/vendor/mypy/typeshed/stdlib/pickle.pyi +271 -0
- jaclang/vendor/mypy/typeshed/stdlib/pickletools.pyi +167 -0
- jaclang/vendor/mypy/typeshed/stdlib/pipes.pyi +16 -0
- jaclang/vendor/mypy/typeshed/stdlib/pkgutil.pyi +53 -0
- jaclang/vendor/mypy/typeshed/stdlib/platform.pyi +42 -0
- jaclang/vendor/mypy/typeshed/stdlib/plistlib.pyi +113 -0
- jaclang/vendor/mypy/typeshed/stdlib/poplib.pyi +71 -0
- jaclang/vendor/mypy/typeshed/stdlib/posix.pyi +361 -0
- jaclang/vendor/mypy/typeshed/stdlib/posixpath.pyi +161 -0
- jaclang/vendor/mypy/typeshed/stdlib/pprint.pyi +112 -0
- jaclang/vendor/mypy/typeshed/stdlib/profile.pyi +31 -0
- jaclang/vendor/mypy/typeshed/stdlib/pstats.pyi +80 -0
- jaclang/vendor/mypy/typeshed/stdlib/pty.pyi +19 -0
- jaclang/vendor/mypy/typeshed/stdlib/pwd.pyi +28 -0
- jaclang/vendor/mypy/typeshed/stdlib/py_compile.pyi +34 -0
- jaclang/vendor/mypy/typeshed/stdlib/pyclbr.pyi +74 -0
- jaclang/vendor/mypy/typeshed/stdlib/pydoc.pyi +261 -0
- jaclang/vendor/mypy/typeshed/stdlib/pydoc_data/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/pydoc_data/topics.pyi +1 -0
- jaclang/vendor/mypy/typeshed/stdlib/pyexpat/__init__.pyi +85 -0
- jaclang/vendor/mypy/typeshed/stdlib/pyexpat/errors.pyi +49 -0
- jaclang/vendor/mypy/typeshed/stdlib/pyexpat/model.pyi +11 -0
- jaclang/vendor/mypy/typeshed/stdlib/queue.pyi +66 -0
- jaclang/vendor/mypy/typeshed/stdlib/quopri.pyi +11 -0
- jaclang/vendor/mypy/typeshed/stdlib/random.pyi +138 -0
- jaclang/vendor/mypy/typeshed/stdlib/re.pyi +290 -0
- jaclang/vendor/mypy/typeshed/stdlib/readline.pyi +36 -0
- jaclang/vendor/mypy/typeshed/stdlib/reprlib.pyi +65 -0
- jaclang/vendor/mypy/typeshed/stdlib/resource.pyi +94 -0
- jaclang/vendor/mypy/typeshed/stdlib/rlcompleter.pyi +9 -0
- jaclang/vendor/mypy/typeshed/stdlib/runpy.pyi +24 -0
- jaclang/vendor/mypy/typeshed/stdlib/sched.pyi +42 -0
- jaclang/vendor/mypy/typeshed/stdlib/secrets.pyi +15 -0
- jaclang/vendor/mypy/typeshed/stdlib/select.pyi +155 -0
- jaclang/vendor/mypy/typeshed/stdlib/selectors.pyi +67 -0
- jaclang/vendor/mypy/typeshed/stdlib/shelve.pyi +46 -0
- jaclang/vendor/mypy/typeshed/stdlib/shlex.pyi +63 -0
- jaclang/vendor/mypy/typeshed/stdlib/shutil.pyi +185 -0
- jaclang/vendor/mypy/typeshed/stdlib/signal.pyi +188 -0
- jaclang/vendor/mypy/typeshed/stdlib/site.pyi +27 -0
- jaclang/vendor/mypy/typeshed/stdlib/smtpd.pyi +91 -0
- jaclang/vendor/mypy/typeshed/stdlib/smtplib.pyi +204 -0
- jaclang/vendor/mypy/typeshed/stdlib/sndhdr.pyi +14 -0
- jaclang/vendor/mypy/typeshed/stdlib/socket.pyi +825 -0
- jaclang/vendor/mypy/typeshed/stdlib/socketserver.pyi +168 -0
- jaclang/vendor/mypy/typeshed/stdlib/spwd.pyi +41 -0
- jaclang/vendor/mypy/typeshed/stdlib/sqlite3/__init__.pyi +1 -0
- jaclang/vendor/mypy/typeshed/stdlib/sqlite3/dbapi2.pyi +551 -0
- jaclang/vendor/mypy/typeshed/stdlib/sre_compile.pyi +11 -0
- jaclang/vendor/mypy/typeshed/stdlib/sre_constants.pyi +130 -0
- jaclang/vendor/mypy/typeshed/stdlib/sre_parse.pyi +104 -0
- jaclang/vendor/mypy/typeshed/stdlib/ssl.pyi +537 -0
- jaclang/vendor/mypy/typeshed/stdlib/stat.pyi +1 -0
- jaclang/vendor/mypy/typeshed/stdlib/statistics.pyi +132 -0
- jaclang/vendor/mypy/typeshed/stdlib/string.pyi +83 -0
- jaclang/vendor/mypy/typeshed/stdlib/stringprep.pyi +27 -0
- jaclang/vendor/mypy/typeshed/stdlib/struct.pyi +26 -0
- jaclang/vendor/mypy/typeshed/stdlib/subprocess.pyi +2615 -0
- jaclang/vendor/mypy/typeshed/stdlib/sunau.pyi +86 -0
- jaclang/vendor/mypy/typeshed/stdlib/symbol.pyi +93 -0
- jaclang/vendor/mypy/typeshed/stdlib/symtable.pyi +58 -0
- jaclang/vendor/mypy/typeshed/stdlib/sys/__init__.pyi +373 -0
- jaclang/vendor/mypy/typeshed/stdlib/sys/_monitoring.pyi +52 -0
- jaclang/vendor/mypy/typeshed/stdlib/sysconfig.pyi +48 -0
- jaclang/vendor/mypy/typeshed/stdlib/syslog.pyi +46 -0
- jaclang/vendor/mypy/typeshed/stdlib/tabnanny.pyi +16 -0
- jaclang/vendor/mypy/typeshed/stdlib/tarfile.pyi +441 -0
- jaclang/vendor/mypy/typeshed/stdlib/telnetlib.pyi +122 -0
- jaclang/vendor/mypy/typeshed/stdlib/tempfile.pyi +477 -0
- jaclang/vendor/mypy/typeshed/stdlib/termios.pyi +267 -0
- jaclang/vendor/mypy/typeshed/stdlib/textwrap.pyi +103 -0
- jaclang/vendor/mypy/typeshed/stdlib/this.pyi +2 -0
- jaclang/vendor/mypy/typeshed/stdlib/threading.pyi +187 -0
- jaclang/vendor/mypy/typeshed/stdlib/time.pyi +108 -0
- jaclang/vendor/mypy/typeshed/stdlib/timeit.pyi +32 -0
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/__init__.pyi +3654 -0
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/colorchooser.pyi +20 -0
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/commondialog.pyi +14 -0
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/constants.pyi +80 -0
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/dialog.pyi +16 -0
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/dnd.pyi +20 -0
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/filedialog.pyi +151 -0
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/font.pyi +116 -0
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/messagebox.pyi +44 -0
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/scrolledtext.pyi +9 -0
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/simpledialog.pyi +54 -0
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/tix.pyi +299 -0
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/ttk.pyi +1204 -0
- jaclang/vendor/mypy/typeshed/stdlib/token.pyi +159 -0
- jaclang/vendor/mypy/typeshed/stdlib/tokenize.pyi +177 -0
- jaclang/vendor/mypy/typeshed/stdlib/tomllib.pyi +10 -0
- jaclang/vendor/mypy/typeshed/stdlib/trace.pyi +79 -0
- jaclang/vendor/mypy/typeshed/stdlib/traceback.pyi +262 -0
- jaclang/vendor/mypy/typeshed/stdlib/tracemalloc.pyi +124 -0
- jaclang/vendor/mypy/typeshed/stdlib/tty.pyi +30 -0
- jaclang/vendor/mypy/typeshed/stdlib/turtle.pyi +713 -0
- jaclang/vendor/mypy/typeshed/stdlib/types.pyi +614 -0
- jaclang/vendor/mypy/typeshed/stdlib/typing.pyi +976 -0
- jaclang/vendor/mypy/typeshed/stdlib/typing_extensions.pyi +509 -0
- jaclang/vendor/mypy/typeshed/stdlib/unicodedata.pyi +73 -0
- jaclang/vendor/mypy/typeshed/stdlib/unittest/__init__.pyi +67 -0
- jaclang/vendor/mypy/typeshed/stdlib/unittest/_log.pyi +27 -0
- jaclang/vendor/mypy/typeshed/stdlib/unittest/async_case.pyi +21 -0
- jaclang/vendor/mypy/typeshed/stdlib/unittest/case.pyi +342 -0
- jaclang/vendor/mypy/typeshed/stdlib/unittest/loader.pyi +51 -0
- jaclang/vendor/mypy/typeshed/stdlib/unittest/main.pyi +69 -0
- jaclang/vendor/mypy/typeshed/stdlib/unittest/mock.pyi +430 -0
- jaclang/vendor/mypy/typeshed/stdlib/unittest/result.pyi +47 -0
- jaclang/vendor/mypy/typeshed/stdlib/unittest/runner.pyi +72 -0
- jaclang/vendor/mypy/typeshed/stdlib/unittest/signals.pyi +15 -0
- jaclang/vendor/mypy/typeshed/stdlib/unittest/suite.pyi +22 -0
- jaclang/vendor/mypy/typeshed/stdlib/unittest/util.pyi +23 -0
- jaclang/vendor/mypy/typeshed/stdlib/urllib/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/urllib/error.pyi +23 -0
- jaclang/vendor/mypy/typeshed/stdlib/urllib/parse.pyi +210 -0
- jaclang/vendor/mypy/typeshed/stdlib/urllib/request.pyi +400 -0
- jaclang/vendor/mypy/typeshed/stdlib/urllib/response.pyi +43 -0
- jaclang/vendor/mypy/typeshed/stdlib/urllib/robotparser.pyi +20 -0
- jaclang/vendor/mypy/typeshed/stdlib/uu.pyi +13 -0
- jaclang/vendor/mypy/typeshed/stdlib/uuid.pyi +100 -0
- jaclang/vendor/mypy/typeshed/stdlib/warnings.pyi +112 -0
- jaclang/vendor/mypy/typeshed/stdlib/wave.pyi +85 -0
- jaclang/vendor/mypy/typeshed/stdlib/weakref.pyi +149 -0
- jaclang/vendor/mypy/typeshed/stdlib/webbrowser.pyi +74 -0
- jaclang/vendor/mypy/typeshed/stdlib/winreg.pyi +132 -0
- jaclang/vendor/mypy/typeshed/stdlib/winsound.pyi +28 -0
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/handlers.pyi +91 -0
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/headers.pyi +26 -0
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/simple_server.pyi +37 -0
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/types.pyi +32 -0
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/util.pyi +24 -0
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/validate.pyi +50 -0
- jaclang/vendor/mypy/typeshed/stdlib/xdrlib.pyi +57 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/__init__.pyi +1 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/NodeFilter.pyi +19 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/__init__.pyi +69 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/domreg.pyi +8 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/expatbuilder.pyi +100 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/minicompat.pyi +22 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/minidom.pyi +404 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/pulldom.pyi +94 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/xmlbuilder.pyi +108 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/etree/ElementInclude.pyi +28 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/etree/ElementPath.pyi +34 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/etree/ElementTree.pyi +327 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/etree/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/etree/cElementTree.pyi +1 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/__init__.pyi +1 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/expat/__init__.pyi +1 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/expat/errors.pyi +1 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/expat/model.pyi +1 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/sax/__init__.pyi +25 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/sax/_exceptions.pyi +19 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/sax/handler.pyi +55 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/sax/saxutils.pyi +60 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/sax/xmlreader.pyi +87 -0
- jaclang/vendor/mypy/typeshed/stdlib/xmlrpc/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/xmlrpc/client.pyi +296 -0
- jaclang/vendor/mypy/typeshed/stdlib/xmlrpc/server.pyi +143 -0
- jaclang/vendor/mypy/typeshed/stdlib/xxlimited.pyi +22 -0
- jaclang/vendor/mypy/typeshed/stdlib/zipapp.pyi +20 -0
- jaclang/vendor/mypy/typeshed/stdlib/zipfile/__init__.pyi +306 -0
- jaclang/vendor/mypy/typeshed/stdlib/zipfile/_path.pyi +95 -0
- jaclang/vendor/mypy/typeshed/stdlib/zipimport.pyi +32 -0
- jaclang/vendor/mypy/typeshed/stdlib/zlib.pyi +56 -0
- jaclang/vendor/mypy/typeshed/stdlib/zoneinfo/__init__.pyi +38 -0
- jaclang/vendor/mypy/typeshed/stubs/mypy-extensions/mypy_extensions.pyi +218 -0
- jaclang/vendor/mypy/typestate.py +5 -15
- jaclang/vendor/mypy/typetraverser.py +9 -3
- jaclang/vendor/mypy/typevars.py +2 -8
- jaclang/vendor/mypy/util.py +14 -45
- jaclang/vendor/mypy/version.py +1 -19
- jaclang/vendor/mypy/visitor.py +3 -9
- jaclang/vendor/mypy/xml/mypy-html.css +104 -0
- jaclang/vendor/mypy/xml/mypy-html.xslt +81 -0
- jaclang/vendor/mypy/xml/mypy-txt.xslt +100 -0
- jaclang/vendor/mypy/xml/mypy.xsd +50 -0
- jaclang/vendor/mypy-1.10.0.dist-info/LICENSE +229 -0
- jaclang/vendor/mypy-1.10.0.dist-info/METADATA +48 -0
- jaclang/vendor/mypy-1.10.0.dist-info/RECORD +1241 -0
- jaclang/vendor/mypy-1.10.0.dist-info/WHEEL +6 -0
- jaclang/vendor/mypy-1.10.0.dist-info/entry_points.txt +6 -0
- jaclang/vendor/mypy-1.10.0.dist-info/top_level.txt +3 -0
- jaclang/vendor/mypy_extensions-1.0.0.dist-info/LICENSE +27 -0
- jaclang/vendor/mypy_extensions-1.0.0.dist-info/METADATA +29 -0
- jaclang/vendor/mypy_extensions-1.0.0.dist-info/RECORD +6 -0
- jaclang/vendor/mypy_extensions-1.0.0.dist-info/WHEEL +5 -0
- jaclang/vendor/mypy_extensions-1.0.0.dist-info/top_level.txt +1 -0
- jaclang/vendor/mypy_extensions.py +21 -40
- jaclang/vendor/mypyc/README.md +133 -0
- jaclang/vendor/mypyc/__main__.py +1 -3
- jaclang/vendor/mypyc/analysis/attrdefined.py +6 -22
- jaclang/vendor/mypyc/analysis/dataflow.py +5 -3
- jaclang/vendor/mypyc/analysis/ircheck.py +13 -26
- jaclang/vendor/mypyc/analysis/selfleaks.py +4 -0
- jaclang/vendor/mypyc/build.py +6 -19
- jaclang/vendor/mypyc/codegen/emit.py +20 -73
- jaclang/vendor/mypyc/codegen/emitclass.py +22 -72
- jaclang/vendor/mypyc/codegen/emitfunc.py +20 -62
- jaclang/vendor/mypyc/codegen/emitmodule.py +50 -117
- jaclang/vendor/mypyc/codegen/emitwrapper.py +22 -78
- jaclang/vendor/mypyc/codegen/literals.py +1 -3
- jaclang/vendor/mypyc/common.py +1 -3
- jaclang/vendor/mypyc/doc/Makefile +20 -0
- jaclang/vendor/mypyc/doc/bool_operations.rst +27 -0
- jaclang/vendor/mypyc/doc/compilation_units.rst +20 -0
- jaclang/vendor/mypyc/doc/conf.py +59 -0
- jaclang/vendor/mypyc/doc/cpython-timings.md +25 -0
- jaclang/vendor/mypyc/doc/dev-intro.md +548 -0
- jaclang/vendor/mypyc/doc/dict_operations.rst +59 -0
- jaclang/vendor/mypyc/doc/differences_from_python.rst +332 -0
- jaclang/vendor/mypyc/doc/float_operations.rst +50 -0
- jaclang/vendor/mypyc/doc/future.md +42 -0
- jaclang/vendor/mypyc/doc/getting_started.rst +240 -0
- jaclang/vendor/mypyc/doc/index.rst +61 -0
- jaclang/vendor/mypyc/doc/int_operations.rst +162 -0
- jaclang/vendor/mypyc/doc/introduction.rst +150 -0
- jaclang/vendor/mypyc/doc/list_operations.rst +65 -0
- jaclang/vendor/mypyc/doc/make.bat +35 -0
- jaclang/vendor/mypyc/doc/native_classes.rst +206 -0
- jaclang/vendor/mypyc/doc/native_operations.rst +55 -0
- jaclang/vendor/mypyc/doc/performance_tips_and_tricks.rst +244 -0
- jaclang/vendor/mypyc/doc/set_operations.rst +47 -0
- jaclang/vendor/mypyc/doc/str_operations.rst +35 -0
- jaclang/vendor/mypyc/doc/tuple_operations.rst +33 -0
- jaclang/vendor/mypyc/doc/using_type_annotations.rst +398 -0
- jaclang/vendor/mypyc/external/googletest/LICENSE +28 -0
- jaclang/vendor/mypyc/external/googletest/README.md +280 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-death-test.h +294 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-message.h +250 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-param-test.h +1444 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-param-test.h.pump +510 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-printers.h +993 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-spi.h +232 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-test-part.h +179 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-typed-test.h +263 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest.h +2236 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest_pred_impl.h +358 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest_prod.h +58 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/custom/gtest-port.h +69 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/custom/gtest-printers.h +42 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/custom/gtest.h +41 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-death-test-internal.h +319 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-filepath.h +206 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-internal.h +1238 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-linked_ptr.h +243 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-param-util-generated.h +5146 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +286 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-param-util.h +731 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-port-arch.h +93 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-port.h +2560 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-string.h +167 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-tuple.h +1020 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-tuple.h.pump +347 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-type-util.h +3331 -0
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-type-util.h.pump +297 -0
- jaclang/vendor/mypyc/external/googletest/make/Makefile +61 -0
- jaclang/vendor/mypyc/external/googletest/src/gtest-all.cc +48 -0
- jaclang/vendor/mypyc/external/googletest/src/gtest-death-test.cc +1342 -0
- jaclang/vendor/mypyc/external/googletest/src/gtest-filepath.cc +387 -0
- jaclang/vendor/mypyc/external/googletest/src/gtest-internal-inl.h +1183 -0
- jaclang/vendor/mypyc/external/googletest/src/gtest-port.cc +1259 -0
- jaclang/vendor/mypyc/external/googletest/src/gtest-printers.cc +373 -0
- jaclang/vendor/mypyc/external/googletest/src/gtest-test-part.cc +110 -0
- jaclang/vendor/mypyc/external/googletest/src/gtest-typed-test.cc +118 -0
- jaclang/vendor/mypyc/external/googletest/src/gtest.cc +5388 -0
- jaclang/vendor/mypyc/external/googletest/src/gtest_main.cc +38 -0
- jaclang/vendor/mypyc/ir/class_ir.py +8 -24
- jaclang/vendor/mypyc/ir/func_ir.py +3 -16
- jaclang/vendor/mypyc/ir/module_ir.py +2 -6
- jaclang/vendor/mypyc/ir/ops.py +103 -66
- jaclang/vendor/mypyc/ir/pprint.py +35 -55
- jaclang/vendor/mypyc/ir/rtypes.py +16 -48
- jaclang/vendor/mypyc/irbuild/ast_helpers.py +4 -1
- jaclang/vendor/mypyc/irbuild/builder.py +46 -148
- jaclang/vendor/mypyc/irbuild/callable_class.py +5 -19
- jaclang/vendor/mypyc/irbuild/classdef.py +27 -83
- jaclang/vendor/mypyc/irbuild/env_class.py +3 -9
- jaclang/vendor/mypyc/irbuild/expression.py +42 -100
- jaclang/vendor/mypyc/irbuild/for_helpers.py +56 -105
- jaclang/vendor/mypyc/irbuild/format_str_tokenizer.py +1 -4
- jaclang/vendor/mypyc/irbuild/function.py +40 -132
- jaclang/vendor/mypyc/irbuild/generator.py +14 -49
- jaclang/vendor/mypyc/irbuild/ll_builder.py +197 -426
- jaclang/vendor/mypyc/irbuild/mapper.py +2 -13
- jaclang/vendor/mypyc/irbuild/match.py +11 -36
- jaclang/vendor/mypyc/irbuild/nonlocalcontrol.py +2 -7
- jaclang/vendor/mypyc/irbuild/prebuildvisitor.py +1 -4
- jaclang/vendor/mypyc/irbuild/prepare.py +25 -83
- jaclang/vendor/mypyc/irbuild/specialize.py +22 -72
- jaclang/vendor/mypyc/irbuild/statement.py +30 -96
- jaclang/vendor/mypyc/irbuild/targets.py +1 -3
- jaclang/vendor/mypyc/irbuild/util.py +2 -8
- jaclang/vendor/mypyc/irbuild/vtable.py +1 -3
- jaclang/vendor/mypyc/lib-rt/CPy.h +638 -0
- jaclang/vendor/mypyc/lib-rt/bytes_ops.c +143 -0
- jaclang/vendor/mypyc/lib-rt/dict_ops.c +446 -0
- jaclang/vendor/mypyc/lib-rt/exc_ops.c +259 -0
- jaclang/vendor/mypyc/lib-rt/float_ops.c +192 -0
- jaclang/vendor/mypyc/lib-rt/generic_ops.c +64 -0
- jaclang/vendor/mypyc/lib-rt/getargs.c +450 -0
- jaclang/vendor/mypyc/lib-rt/getargsfast.c +569 -0
- jaclang/vendor/mypyc/lib-rt/init.c +13 -0
- jaclang/vendor/mypyc/lib-rt/int_ops.c +803 -0
- jaclang/vendor/mypyc/lib-rt/list_ops.c +335 -0
- jaclang/vendor/mypyc/lib-rt/misc_ops.c +942 -0
- jaclang/vendor/mypyc/lib-rt/module_shim.tmpl +18 -0
- jaclang/vendor/mypyc/lib-rt/mypyc_util.h +118 -0
- jaclang/vendor/mypyc/lib-rt/pythoncapi_compat.h +497 -0
- jaclang/vendor/mypyc/lib-rt/pythonsupport.h +533 -0
- jaclang/vendor/mypyc/lib-rt/set_ops.c +17 -0
- jaclang/vendor/mypyc/lib-rt/setup.py +70 -0
- jaclang/vendor/mypyc/lib-rt/str_ops.c +241 -0
- jaclang/vendor/mypyc/lib-rt/test_capi.cc +585 -0
- jaclang/vendor/mypyc/lib-rt/tuple_ops.c +61 -0
- jaclang/vendor/mypyc/lower/__init__.py +0 -0
- jaclang/vendor/mypyc/lower/int_ops.py +113 -0
- jaclang/vendor/mypyc/lower/list_ops.py +45 -0
- jaclang/vendor/mypyc/lower/misc_ops.py +12 -0
- jaclang/vendor/mypyc/lower/registry.py +26 -0
- jaclang/vendor/mypyc/options.py +1 -3
- jaclang/vendor/mypyc/primitives/dict_ops.py +1 -4
- jaclang/vendor/mypyc/primitives/exc_ops.py +3 -12
- jaclang/vendor/mypyc/primitives/int_ops.py +22 -32
- jaclang/vendor/mypyc/primitives/list_ops.py +10 -0
- jaclang/vendor/mypyc/primitives/misc_ops.py +28 -22
- jaclang/vendor/mypyc/primitives/registry.py +56 -19
- jaclang/vendor/mypyc/primitives/set_ops.py +1 -3
- jaclang/vendor/mypyc/rt_subtype.py +1 -2
- jaclang/vendor/mypyc/sametype.py +2 -5
- jaclang/vendor/mypyc/subtype.py +3 -12
- jaclang/vendor/mypyc/test/test_alwaysdefined.py +2 -6
- jaclang/vendor/mypyc/test/test_analysis.py +8 -24
- jaclang/vendor/mypyc/test/test_cheader.py +12 -4
- jaclang/vendor/mypyc/test/test_emit.py +4 -14
- jaclang/vendor/mypyc/test/test_emitclass.py +1 -8
- jaclang/vendor/mypyc/test/test_emitfunc.py +30 -77
- jaclang/vendor/mypyc/test/test_emitwrapper.py +1 -3
- jaclang/vendor/mypyc/test/test_exceptions.py +4 -12
- jaclang/vendor/mypyc/test/test_external.py +1 -5
- jaclang/vendor/mypyc/test/test_irbuild.py +2 -6
- jaclang/vendor/mypyc/test/test_ircheck.py +6 -17
- jaclang/vendor/mypyc/test/test_literals.py +1 -4
- jaclang/vendor/mypyc/test/test_lowering.py +56 -0
- jaclang/vendor/mypyc/test/test_namegen.py +1 -4
- jaclang/vendor/mypyc/test/test_optimizations.py +68 -0
- jaclang/vendor/mypyc/test/test_refcount.py +3 -9
- jaclang/vendor/mypyc/test/test_run.py +12 -38
- jaclang/vendor/mypyc/test/test_serialization.py +1 -3
- jaclang/vendor/mypyc/test/test_struct.py +3 -11
- jaclang/vendor/mypyc/test/test_tuplename.py +4 -13
- jaclang/vendor/mypyc/test/test_typeops.py +1 -4
- jaclang/vendor/mypyc/test/testutil.py +2 -6
- jaclang/vendor/mypyc/test-data/alwaysdefined.test +732 -0
- jaclang/vendor/mypyc/test-data/analysis.test +470 -0
- jaclang/vendor/mypyc/test-data/commandline.test +245 -0
- jaclang/vendor/mypyc/test-data/driver/driver.py +48 -0
- jaclang/vendor/mypyc/test-data/exceptions-freq.test +125 -0
- jaclang/vendor/mypyc/test-data/exceptions.test +699 -0
- jaclang/vendor/mypyc/test-data/fixtures/ir.py +373 -0
- jaclang/vendor/mypyc/test-data/fixtures/testutil.py +103 -0
- jaclang/vendor/mypyc/test-data/fixtures/typing-full.pyi +169 -0
- jaclang/vendor/mypyc/test-data/irbuild-any.test +236 -0
- jaclang/vendor/mypyc/test-data/irbuild-basic.test +3399 -0
- jaclang/vendor/mypyc/test-data/irbuild-bool.test +424 -0
- jaclang/vendor/mypyc/test-data/irbuild-bytes.test +181 -0
- jaclang/vendor/mypyc/test-data/irbuild-classes.test +1302 -0
- jaclang/vendor/mypyc/test-data/irbuild-constant-fold.test +480 -0
- jaclang/vendor/mypyc/test-data/irbuild-dict.test +584 -0
- jaclang/vendor/mypyc/test-data/irbuild-dunders.test +215 -0
- jaclang/vendor/mypyc/test-data/irbuild-float.test +497 -0
- jaclang/vendor/mypyc/test-data/irbuild-generics.test +150 -0
- jaclang/vendor/mypyc/test-data/irbuild-glue-methods.test +437 -0
- jaclang/vendor/mypyc/test-data/irbuild-i16.test +526 -0
- jaclang/vendor/mypyc/test-data/irbuild-i32.test +598 -0
- jaclang/vendor/mypyc/test-data/irbuild-i64.test +2144 -0
- jaclang/vendor/mypyc/test-data/irbuild-int.test +194 -0
- jaclang/vendor/mypyc/test-data/irbuild-isinstance.test +109 -0
- jaclang/vendor/mypyc/test-data/irbuild-lists.test +513 -0
- jaclang/vendor/mypyc/test-data/irbuild-match.test +1717 -0
- jaclang/vendor/mypyc/test-data/irbuild-math.test +64 -0
- jaclang/vendor/mypyc/test-data/irbuild-nested.test +807 -0
- jaclang/vendor/mypyc/test-data/irbuild-optional.test +536 -0
- jaclang/vendor/mypyc/test-data/irbuild-set.test +806 -0
- jaclang/vendor/mypyc/test-data/irbuild-singledispatch.test +257 -0
- jaclang/vendor/mypyc/test-data/irbuild-statements.test +1060 -0
- jaclang/vendor/mypyc/test-data/irbuild-str.test +312 -0
- jaclang/vendor/mypyc/test-data/irbuild-strip-asserts.test +12 -0
- jaclang/vendor/mypyc/test-data/irbuild-try.test +523 -0
- jaclang/vendor/mypyc/test-data/irbuild-tuple.test +386 -0
- jaclang/vendor/mypyc/test-data/irbuild-u8.test +543 -0
- jaclang/vendor/mypyc/test-data/irbuild-unreachable.test +241 -0
- jaclang/vendor/mypyc/test-data/irbuild-vectorcall.test +153 -0
- jaclang/vendor/mypyc/test-data/lowering-int.test +377 -0
- jaclang/vendor/mypyc/test-data/lowering-list.test +33 -0
- jaclang/vendor/mypyc/test-data/opt-copy-propagation.test +400 -0
- jaclang/vendor/mypyc/test-data/opt-flag-elimination.test +296 -0
- jaclang/vendor/mypyc/test-data/refcount.test +1482 -0
- jaclang/vendor/mypyc/test-data/run-async.test +173 -0
- jaclang/vendor/mypyc/test-data/run-attrs.test +318 -0
- jaclang/vendor/mypyc/test-data/run-bench.test +196 -0
- jaclang/vendor/mypyc/test-data/run-bools.test +229 -0
- jaclang/vendor/mypyc/test-data/run-bytes.test +302 -0
- jaclang/vendor/mypyc/test-data/run-classes.test +2505 -0
- jaclang/vendor/mypyc/test-data/run-dicts.test +334 -0
- jaclang/vendor/mypyc/test-data/run-dunders.test +945 -0
- jaclang/vendor/mypyc/test-data/run-exceptions.test +448 -0
- jaclang/vendor/mypyc/test-data/run-floats.test +516 -0
- jaclang/vendor/mypyc/test-data/run-functions.test +1310 -0
- jaclang/vendor/mypyc/test-data/run-generators.test +682 -0
- jaclang/vendor/mypyc/test-data/run-i16.test +338 -0
- jaclang/vendor/mypyc/test-data/run-i32.test +336 -0
- jaclang/vendor/mypyc/test-data/run-i64.test +1519 -0
- jaclang/vendor/mypyc/test-data/run-imports.test +265 -0
- jaclang/vendor/mypyc/test-data/run-integers.test +540 -0
- jaclang/vendor/mypyc/test-data/run-lists.test +411 -0
- jaclang/vendor/mypyc/test-data/run-loops.test +485 -0
- jaclang/vendor/mypyc/test-data/run-match.test +283 -0
- jaclang/vendor/mypyc/test-data/run-math.test +106 -0
- jaclang/vendor/mypyc/test-data/run-misc.test +1170 -0
- jaclang/vendor/mypyc/test-data/run-multimodule.test +887 -0
- jaclang/vendor/mypyc/test-data/run-mypy-sim.test +138 -0
- jaclang/vendor/mypyc/test-data/run-primitives.test +375 -0
- jaclang/vendor/mypyc/test-data/run-python37.test +159 -0
- jaclang/vendor/mypyc/test-data/run-python38.test +88 -0
- jaclang/vendor/mypyc/test-data/run-sets.test +150 -0
- jaclang/vendor/mypyc/test-data/run-singledispatch.test +698 -0
- jaclang/vendor/mypyc/test-data/run-strings.test +641 -0
- jaclang/vendor/mypyc/test-data/run-traits.test +411 -0
- jaclang/vendor/mypyc/test-data/run-tuples.test +258 -0
- jaclang/vendor/mypyc/test-data/run-u8.test +303 -0
- jaclang/vendor/mypyc/transform/copy_propagation.py +94 -0
- jaclang/vendor/mypyc/transform/exceptions.py +1 -5
- jaclang/vendor/mypyc/transform/flag_elimination.py +108 -0
- jaclang/vendor/mypyc/transform/ir_transform.py +368 -0
- jaclang/vendor/mypyc/transform/lower.py +33 -0
- jaclang/vendor/mypyc/transform/refcount.py +7 -30
- jaclang/vendor/mypyc/transform/uninit.py +4 -15
- jaclang/vendor/pluggy/__init__.py +15 -11
- jaclang/vendor/pluggy/_callers.py +34 -5
- jaclang/vendor/pluggy/_hooks.py +35 -7
- jaclang/vendor/pluggy/_manager.py +26 -3
- jaclang/vendor/pluggy/_result.py +0 -15
- jaclang/vendor/pluggy/_version.py +16 -0
- jaclang/vendor/pluggy/_warnings.py +27 -0
- jaclang/vendor/pluggy-1.5.0.dist-info/LICENSE +21 -0
- jaclang/vendor/pluggy-1.5.0.dist-info/METADATA +155 -0
- jaclang/vendor/pluggy-1.5.0.dist-info/RECORD +14 -0
- jaclang/vendor/pluggy-1.5.0.dist-info/top_level.txt +1 -0
- jaclang/vendor/pygls/__init__.py +25 -0
- jaclang/vendor/pygls/capabilities.py +460 -0
- jaclang/vendor/pygls/client.py +176 -0
- jaclang/vendor/pygls/constants.py +26 -0
- jaclang/vendor/pygls/exceptions.py +215 -0
- jaclang/vendor/pygls/feature_manager.py +244 -0
- jaclang/vendor/pygls/lsp/__init__.py +139 -0
- jaclang/vendor/pygls/lsp/client.py +1961 -0
- jaclang/vendor/pygls/progress.py +79 -0
- jaclang/vendor/pygls/protocol/__init__.py +78 -0
- jaclang/vendor/pygls/protocol/json_rpc.py +560 -0
- jaclang/vendor/pygls/protocol/language_server.py +569 -0
- jaclang/vendor/pygls/protocol/lsp_meta.py +51 -0
- jaclang/vendor/pygls/py.typed +2 -0
- jaclang/vendor/pygls/server.py +616 -0
- jaclang/vendor/pygls/uris.py +184 -0
- jaclang/vendor/pygls/workspace/__init__.py +97 -0
- jaclang/vendor/pygls/workspace/position_codec.py +206 -0
- jaclang/vendor/pygls/workspace/text_document.py +238 -0
- jaclang/vendor/pygls/workspace/workspace.py +323 -0
- jaclang/vendor/pygls-1.3.1.dist-info/LICENSE.txt +201 -0
- jaclang/vendor/pygls-1.3.1.dist-info/METADATA +105 -0
- jaclang/vendor/pygls-1.3.1.dist-info/RECORD +24 -0
- jaclang/vendor/pygls-1.3.1.dist-info/WHEEL +4 -0
- jaclang/vendor/typing_extensions-4.12.2.dist-info/LICENSE +279 -0
- jaclang/vendor/typing_extensions-4.12.2.dist-info/METADATA +67 -0
- jaclang/vendor/typing_extensions-4.12.2.dist-info/RECORD +5 -0
- jaclang/vendor/typing_extensions-4.12.2.dist-info/WHEEL +4 -0
- jaclang/vendor/typing_extensions.py +1209 -641
- jaclang-0.6.5.dist-info/METADATA +106 -0
- jaclang-0.6.5.dist-info/RECORD +1476 -0
- jaclang-0.6.5.dist-info/WHEEL +4 -0
- jaclang-0.6.5.dist-info/entry_points.txt +3 -0
- jaclang/compiler/generated/jac_parser.py +0 -4069
- jaclang-0.6.1.dist-info/METADATA +0 -17
- jaclang-0.6.1.dist-info/RECORD +0 -430
- jaclang-0.6.1.dist-info/entry_points.txt +0 -2
- jaclang-0.6.1.dist-info/top_level.txt +0 -1
- /jaclang/{compiler/generated/__init__.py → vendor/attr/py.typed} +0 -0
- {jaclang-0.6.1.dist-info → jaclang/vendor/pluggy-1.5.0.dist-info}/WHEEL +0 -0
jaclang/vendor/mypy/semanal.py
CHANGED
|
@@ -51,18 +51,8 @@ Some important properties:
|
|
|
51
51
|
from __future__ import annotations
|
|
52
52
|
|
|
53
53
|
from contextlib import contextmanager
|
|
54
|
-
from typing import
|
|
55
|
-
|
|
56
|
-
Callable,
|
|
57
|
-
Collection,
|
|
58
|
-
Final,
|
|
59
|
-
Iterable,
|
|
60
|
-
Iterator,
|
|
61
|
-
List,
|
|
62
|
-
TypeVar,
|
|
63
|
-
cast,
|
|
64
|
-
)
|
|
65
|
-
from typing_extensions import TypeAlias as _TypeAlias
|
|
54
|
+
from typing import Any, Callable, Collection, Final, Iterable, Iterator, List, TypeVar, cast
|
|
55
|
+
from typing_extensions import TypeAlias as _TypeAlias, TypeGuard
|
|
66
56
|
|
|
67
57
|
from mypy import errorcodes as codes, message_registry
|
|
68
58
|
from mypy.constant_fold import constant_fold_expr
|
|
@@ -236,6 +226,7 @@ from mypy.typeanal import (
|
|
|
236
226
|
SELF_TYPE_NAMES,
|
|
237
227
|
FindTypeVarVisitor,
|
|
238
228
|
TypeAnalyser,
|
|
229
|
+
TypeVarDefaultTranslator,
|
|
239
230
|
TypeVarLikeList,
|
|
240
231
|
analyze_type_alias,
|
|
241
232
|
check_for_explicit_any,
|
|
@@ -247,11 +238,7 @@ from mypy.typeanal import (
|
|
|
247
238
|
type_constructors,
|
|
248
239
|
validate_instance,
|
|
249
240
|
)
|
|
250
|
-
from mypy.typeops import
|
|
251
|
-
function_type,
|
|
252
|
-
get_type_vars,
|
|
253
|
-
try_getting_str_literals_from_type,
|
|
254
|
-
)
|
|
241
|
+
from mypy.typeops import function_type, get_type_vars, try_getting_str_literals_from_type
|
|
255
242
|
from mypy.types import (
|
|
256
243
|
ASSERT_TYPE_NAMES,
|
|
257
244
|
DATACLASS_TRANSFORM_NAMES,
|
|
@@ -266,6 +253,7 @@ from mypy.types import (
|
|
|
266
253
|
TPDICT_NAMES,
|
|
267
254
|
TYPE_ALIAS_NAMES,
|
|
268
255
|
TYPE_CHECK_ONLY_NAMES,
|
|
256
|
+
TYPE_VAR_LIKE_NAMES,
|
|
269
257
|
TYPED_NAMEDTUPLE_NAMES,
|
|
270
258
|
AnyType,
|
|
271
259
|
CallableType,
|
|
@@ -298,13 +286,7 @@ from mypy.types import (
|
|
|
298
286
|
)
|
|
299
287
|
from mypy.types_utils import is_invalid_recursive_alias, store_argument_type
|
|
300
288
|
from mypy.typevars import fill_typevars
|
|
301
|
-
from mypy.util import
|
|
302
|
-
correct_relative_import,
|
|
303
|
-
is_dunder,
|
|
304
|
-
module_prefix,
|
|
305
|
-
unmangle,
|
|
306
|
-
unnamed_function,
|
|
307
|
-
)
|
|
289
|
+
from mypy.util import correct_relative_import, is_dunder, module_prefix, unmangle, unnamed_function
|
|
308
290
|
from mypy.visitor import NodeVisitor
|
|
309
291
|
|
|
310
292
|
T = TypeVar("T")
|
|
@@ -515,9 +497,7 @@ class SemanticAnalyzer(
|
|
|
515
497
|
def prepare_file(self, file_node: MypyFile) -> None:
|
|
516
498
|
"""Prepare a freshly parsed file for semantic analysis."""
|
|
517
499
|
if "builtins" in self.modules:
|
|
518
|
-
file_node.names["__builtins__"] = SymbolTableNode(
|
|
519
|
-
GDEF, self.modules["builtins"]
|
|
520
|
-
)
|
|
500
|
+
file_node.names["__builtins__"] = SymbolTableNode(GDEF, self.modules["builtins"])
|
|
521
501
|
if file_node.fullname == "builtins":
|
|
522
502
|
self.prepare_builtins_namespace(file_node)
|
|
523
503
|
if file_node.fullname == "typing":
|
|
@@ -525,9 +505,7 @@ class SemanticAnalyzer(
|
|
|
525
505
|
if file_node.fullname == "typing_extensions":
|
|
526
506
|
self.prepare_typing_namespace(file_node, typing_extensions_aliases)
|
|
527
507
|
|
|
528
|
-
def prepare_typing_namespace(
|
|
529
|
-
self, file_node: MypyFile, aliases: dict[str, str]
|
|
530
|
-
) -> None:
|
|
508
|
+
def prepare_typing_namespace(self, file_node: MypyFile, aliases: dict[str, str]) -> None:
|
|
531
509
|
"""Remove dummy alias definitions such as List = TypeAlias(object) from typing.
|
|
532
510
|
|
|
533
511
|
They will be replaced with real aliases when corresponding targets are ready.
|
|
@@ -653,9 +631,7 @@ class SemanticAnalyzer(
|
|
|
653
631
|
# not being subscriptable or typing.List not getting bound
|
|
654
632
|
inst = self.named_type_or_none("builtins.list", [str_type])
|
|
655
633
|
if inst is None:
|
|
656
|
-
assert
|
|
657
|
-
not self.final_iteration
|
|
658
|
-
), "Cannot find builtins.list to add __path__"
|
|
634
|
+
assert not self.final_iteration, "Cannot find builtins.list to add __path__"
|
|
659
635
|
self.defer()
|
|
660
636
|
return
|
|
661
637
|
typ = inst
|
|
@@ -709,9 +685,7 @@ class SemanticAnalyzer(
|
|
|
709
685
|
# This alias is not available on this Python version.
|
|
710
686
|
continue
|
|
711
687
|
name = alias.split(".")[-1]
|
|
712
|
-
if name in tree.names and not isinstance(
|
|
713
|
-
tree.names[name].node, PlaceholderNode
|
|
714
|
-
):
|
|
688
|
+
if name in tree.names and not isinstance(tree.names[name].node, PlaceholderNode):
|
|
715
689
|
continue
|
|
716
690
|
self.create_alias(tree, target_name, alias, name)
|
|
717
691
|
|
|
@@ -735,9 +709,7 @@ class SemanticAnalyzer(
|
|
|
735
709
|
# Now, create a new alias.
|
|
736
710
|
self.create_alias(tree, target_name, alias, name)
|
|
737
711
|
|
|
738
|
-
def create_alias(
|
|
739
|
-
self, tree: MypyFile, target_name: str, alias: str, name: str
|
|
740
|
-
) -> None:
|
|
712
|
+
def create_alias(self, tree: MypyFile, target_name: str, alias: str, name: str) -> None:
|
|
741
713
|
tag = self.track_incomplete_refs()
|
|
742
714
|
n = self.lookup_fully_qualified_or_none(target_name)
|
|
743
715
|
if n:
|
|
@@ -749,11 +721,7 @@ class SemanticAnalyzer(
|
|
|
749
721
|
assert target is not None
|
|
750
722
|
# Transform List to List[Any], etc.
|
|
751
723
|
fix_instance(
|
|
752
|
-
target,
|
|
753
|
-
self.fail,
|
|
754
|
-
self.note,
|
|
755
|
-
disallow_any=False,
|
|
756
|
-
options=self.options,
|
|
724
|
+
target, self.fail, self.note, disallow_any=False, options=self.options
|
|
757
725
|
)
|
|
758
726
|
alias_node = TypeAlias(
|
|
759
727
|
target,
|
|
@@ -800,9 +768,7 @@ class SemanticAnalyzer(
|
|
|
800
768
|
"""
|
|
801
769
|
scope = self.scope
|
|
802
770
|
self.options = options
|
|
803
|
-
self.errors.set_file(
|
|
804
|
-
file_node.path, file_node.fullname, scope=scope, options=options
|
|
805
|
-
)
|
|
771
|
+
self.errors.set_file(file_node.path, file_node.fullname, scope=scope, options=options)
|
|
806
772
|
self.cur_mod_node = file_node
|
|
807
773
|
self.cur_mod_id = file_node.fullname
|
|
808
774
|
with scope.module_scope(self.cur_mod_id):
|
|
@@ -907,10 +873,7 @@ class SemanticAnalyzer(
|
|
|
907
873
|
if isinstance(result, CallableType):
|
|
908
874
|
# type guards need to have a positional argument, to spec
|
|
909
875
|
skip_self = self.is_class_scope() and not defn.is_static
|
|
910
|
-
if
|
|
911
|
-
result.type_guard
|
|
912
|
-
and ARG_POS not in result.arg_kinds[skip_self:]
|
|
913
|
-
):
|
|
876
|
+
if result.type_guard and ARG_POS not in result.arg_kinds[skip_self:]:
|
|
914
877
|
self.fail(
|
|
915
878
|
"TypeGuard functions must have a positional argument",
|
|
916
879
|
result,
|
|
@@ -918,6 +881,13 @@ class SemanticAnalyzer(
|
|
|
918
881
|
)
|
|
919
882
|
# in this case, we just kind of just ... remove the type guard.
|
|
920
883
|
result = result.copy_modified(type_guard=None)
|
|
884
|
+
if result.type_is and ARG_POS not in result.arg_kinds[skip_self:]:
|
|
885
|
+
self.fail(
|
|
886
|
+
'"TypeIs" functions must have a positional argument',
|
|
887
|
+
result,
|
|
888
|
+
code=codes.VALID_TYPE,
|
|
889
|
+
)
|
|
890
|
+
result = result.copy_modified(type_is=None)
|
|
921
891
|
|
|
922
892
|
result = self.remove_unpack_kwargs(defn, result)
|
|
923
893
|
if has_self_type and self.type is not None:
|
|
@@ -942,10 +912,7 @@ class SemanticAnalyzer(
|
|
|
942
912
|
if (
|
|
943
913
|
self.type.is_protocol
|
|
944
914
|
and not self.is_stub_file # Bodies in stub files are always empty.
|
|
945
|
-
and (
|
|
946
|
-
not isinstance(self.scope.function, OverloadedFuncDef)
|
|
947
|
-
or defn.is_property
|
|
948
|
-
)
|
|
915
|
+
and (not isinstance(self.scope.function, OverloadedFuncDef) or defn.is_property)
|
|
949
916
|
and defn.abstract_status != IS_ABSTRACT
|
|
950
917
|
and is_trivial_body(defn.body)
|
|
951
918
|
):
|
|
@@ -972,9 +939,7 @@ class SemanticAnalyzer(
|
|
|
972
939
|
ret_type = self.named_type_or_none(
|
|
973
940
|
"typing.Coroutine", [any_type, any_type, defn.type.ret_type]
|
|
974
941
|
)
|
|
975
|
-
assert
|
|
976
|
-
ret_type is not None
|
|
977
|
-
), "Internal error: typing.Coroutine not found"
|
|
942
|
+
assert ret_type is not None, "Internal error: typing.Coroutine not found"
|
|
978
943
|
defn.type = defn.type.copy_modified(ret_type=ret_type)
|
|
979
944
|
self.wrapped_coro_return_types[defn] = defn.type
|
|
980
945
|
|
|
@@ -994,19 +959,14 @@ class SemanticAnalyzer(
|
|
|
994
959
|
overlap.discard(typ.arg_names[-1])
|
|
995
960
|
if overlap:
|
|
996
961
|
overlapped = ", ".join([f'"{name}"' for name in overlap])
|
|
997
|
-
self.fail(
|
|
998
|
-
f"Overlap between argument names and ** TypedDict items: {overlapped}",
|
|
999
|
-
defn,
|
|
1000
|
-
)
|
|
962
|
+
self.fail(f"Overlap between argument names and ** TypedDict items: {overlapped}", defn)
|
|
1001
963
|
new_arg_types = typ.arg_types[:-1] + [AnyType(TypeOfAny.from_error)]
|
|
1002
964
|
return typ.copy_modified(arg_types=new_arg_types)
|
|
1003
965
|
# OK, everything looks right now, mark the callable type as using unpack.
|
|
1004
966
|
new_arg_types = typ.arg_types[:-1] + [last_type]
|
|
1005
967
|
return typ.copy_modified(arg_types=new_arg_types, unpack_kwargs=True)
|
|
1006
968
|
|
|
1007
|
-
def prepare_method_signature(
|
|
1008
|
-
self, func: FuncDef, info: TypeInfo, has_self_type: bool
|
|
1009
|
-
) -> None:
|
|
969
|
+
def prepare_method_signature(self, func: FuncDef, info: TypeInfo, has_self_type: bool) -> None:
|
|
1010
970
|
"""Check basic signature validity and tweak annotation of self/cls argument."""
|
|
1011
971
|
# Only non-static methods are special, as well as __new__.
|
|
1012
972
|
functype = func.type
|
|
@@ -1032,9 +992,7 @@ class SemanticAnalyzer(
|
|
|
1032
992
|
leading_type = self.class_type(leading_type)
|
|
1033
993
|
func.type = replace_implicit_first_type(functype, leading_type)
|
|
1034
994
|
elif has_self_type and isinstance(func.unanalyzed_type, CallableType):
|
|
1035
|
-
if not isinstance(
|
|
1036
|
-
get_proper_type(func.unanalyzed_type.arg_types[0]), AnyType
|
|
1037
|
-
):
|
|
995
|
+
if not isinstance(get_proper_type(func.unanalyzed_type.arg_types[0]), AnyType):
|
|
1038
996
|
if self.is_expected_self_type(
|
|
1039
997
|
self_type, func.is_class or func.name == "__new__"
|
|
1040
998
|
):
|
|
@@ -1047,8 +1005,7 @@ class SemanticAnalyzer(
|
|
|
1047
1005
|
)
|
|
1048
1006
|
else:
|
|
1049
1007
|
self.fail(
|
|
1050
|
-
"Method cannot have explicit self annotation and Self type",
|
|
1051
|
-
func,
|
|
1008
|
+
"Method cannot have explicit self annotation and Self type", func
|
|
1052
1009
|
)
|
|
1053
1010
|
elif has_self_type:
|
|
1054
1011
|
self.fail("Static methods cannot use Self type", func)
|
|
@@ -1109,9 +1066,7 @@ class SemanticAnalyzer(
|
|
|
1109
1066
|
else:
|
|
1110
1067
|
return False
|
|
1111
1068
|
|
|
1112
|
-
def update_function_type_variables(
|
|
1113
|
-
self, fun_type: CallableType, defn: FuncItem
|
|
1114
|
-
) -> bool:
|
|
1069
|
+
def update_function_type_variables(self, fun_type: CallableType, defn: FuncItem) -> bool:
|
|
1115
1070
|
"""Make any type variables in the signature of defn explicit.
|
|
1116
1071
|
|
|
1117
1072
|
Update the signature of defn to contain type variable definitions
|
|
@@ -1120,9 +1075,7 @@ class SemanticAnalyzer(
|
|
|
1120
1075
|
"""
|
|
1121
1076
|
with self.tvar_scope_frame(self.tvar_scope.method_frame()):
|
|
1122
1077
|
a = self.type_analyzer()
|
|
1123
|
-
fun_type.variables, has_self_type = a.bind_function_type_variables(
|
|
1124
|
-
fun_type, defn
|
|
1125
|
-
)
|
|
1078
|
+
fun_type.variables, has_self_type = a.bind_function_type_variables(fun_type, defn)
|
|
1126
1079
|
if has_self_type and self.type is not None:
|
|
1127
1080
|
self.setup_self_type()
|
|
1128
1081
|
return has_self_type
|
|
@@ -1195,9 +1148,7 @@ class SemanticAnalyzer(
|
|
|
1195
1148
|
# This is an a normal overload. Find the item signatures, the
|
|
1196
1149
|
# implementation (if outside a stub), and any missing @overload
|
|
1197
1150
|
# decorators.
|
|
1198
|
-
types, impl, non_overload_indexes = self.analyze_overload_sigs_and_impl(
|
|
1199
|
-
defn
|
|
1200
|
-
)
|
|
1151
|
+
types, impl, non_overload_indexes = self.analyze_overload_sigs_and_impl(defn)
|
|
1201
1152
|
defn.impl = impl
|
|
1202
1153
|
if non_overload_indexes:
|
|
1203
1154
|
self.handle_missing_overload_decorators(
|
|
@@ -1247,11 +1198,7 @@ class SemanticAnalyzer(
|
|
|
1247
1198
|
if defn.impl is None:
|
|
1248
1199
|
return
|
|
1249
1200
|
impl = defn.impl if isinstance(defn.impl, FuncDef) else defn.impl.func
|
|
1250
|
-
if (
|
|
1251
|
-
is_trivial_body(impl.body)
|
|
1252
|
-
and self.is_class_scope()
|
|
1253
|
-
and not self.is_stub_file
|
|
1254
|
-
):
|
|
1201
|
+
if is_trivial_body(impl.body) and self.is_class_scope() and not self.is_stub_file:
|
|
1255
1202
|
assert self.type is not None
|
|
1256
1203
|
if self.type.is_protocol:
|
|
1257
1204
|
impl.abstract_status = IMPLICITLY_ABSTRACT
|
|
@@ -1276,13 +1223,9 @@ class SemanticAnalyzer(
|
|
|
1276
1223
|
item.accept(self)
|
|
1277
1224
|
# TODO: support decorated overloaded functions properly
|
|
1278
1225
|
if isinstance(item, Decorator):
|
|
1279
|
-
callable = function_type(
|
|
1280
|
-
item.func, self.named_type("builtins.function")
|
|
1281
|
-
)
|
|
1226
|
+
callable = function_type(item.func, self.named_type("builtins.function"))
|
|
1282
1227
|
assert isinstance(callable, CallableType)
|
|
1283
|
-
if not any(
|
|
1284
|
-
refers_to_fullname(dec, OVERLOAD_NAMES) for dec in item.decorators
|
|
1285
|
-
):
|
|
1228
|
+
if not any(refers_to_fullname(dec, OVERLOAD_NAMES) for dec in item.decorators):
|
|
1286
1229
|
if i == len(defn.items) - 1 and not self.is_stub_file:
|
|
1287
1230
|
# Last item outside a stub is impl
|
|
1288
1231
|
impl = item
|
|
@@ -1368,22 +1311,16 @@ class SemanticAnalyzer(
|
|
|
1368
1311
|
# Only show the error once per overload
|
|
1369
1312
|
bad_final = next(ov for ov in defn.items if ov.is_final)
|
|
1370
1313
|
if not self.is_stub_file:
|
|
1371
|
-
self.fail(
|
|
1372
|
-
"@final should be applied only to overload implementation",
|
|
1373
|
-
bad_final,
|
|
1374
|
-
)
|
|
1314
|
+
self.fail("@final should be applied only to overload implementation", bad_final)
|
|
1375
1315
|
elif any(item.is_final for item in defn.items[1:]):
|
|
1376
1316
|
bad_final = next(ov for ov in defn.items[1:] if ov.is_final)
|
|
1377
1317
|
self.fail(
|
|
1378
|
-
"In a stub file @final must be applied only to the first overload",
|
|
1379
|
-
bad_final,
|
|
1318
|
+
"In a stub file @final must be applied only to the first overload", bad_final
|
|
1380
1319
|
)
|
|
1381
1320
|
if defn.impl is not None and defn.impl.is_final:
|
|
1382
1321
|
defn.is_final = True
|
|
1383
1322
|
|
|
1384
|
-
def process_static_or_class_method_in_overload(
|
|
1385
|
-
self, defn: OverloadedFuncDef
|
|
1386
|
-
) -> None:
|
|
1323
|
+
def process_static_or_class_method_in_overload(self, defn: OverloadedFuncDef) -> None:
|
|
1387
1324
|
class_status = []
|
|
1388
1325
|
static_status = []
|
|
1389
1326
|
for item in defn.items:
|
|
@@ -1414,9 +1351,7 @@ class SemanticAnalyzer(
|
|
|
1414
1351
|
defn.is_class = class_status[0]
|
|
1415
1352
|
defn.is_static = static_status[0]
|
|
1416
1353
|
|
|
1417
|
-
def analyze_property_with_multi_part_definition(
|
|
1418
|
-
self, defn: OverloadedFuncDef
|
|
1419
|
-
) -> None:
|
|
1354
|
+
def analyze_property_with_multi_part_definition(self, defn: OverloadedFuncDef) -> None:
|
|
1420
1355
|
"""Analyze a property defined using multiple methods (e.g., using @x.setter).
|
|
1421
1356
|
|
|
1422
1357
|
Assume that the first method (@property) has already been analyzed.
|
|
@@ -1440,14 +1375,11 @@ class SemanticAnalyzer(
|
|
|
1440
1375
|
item.func.abstract_status = first_item.func.abstract_status
|
|
1441
1376
|
else:
|
|
1442
1377
|
self.fail(
|
|
1443
|
-
f"Only supported top decorator is @{first_item.func.name}.setter",
|
|
1444
|
-
item,
|
|
1378
|
+
f"Only supported top decorator is @{first_item.func.name}.setter", item
|
|
1445
1379
|
)
|
|
1446
1380
|
item.func.accept(self)
|
|
1447
1381
|
else:
|
|
1448
|
-
self.fail(
|
|
1449
|
-
f'Unexpected definition for property "{first_item.func.name}"', item
|
|
1450
|
-
)
|
|
1382
|
+
self.fail(f'Unexpected definition for property "{first_item.func.name}"', item)
|
|
1451
1383
|
deleted_items.append(i + 1)
|
|
1452
1384
|
for i in reversed(deleted_items):
|
|
1453
1385
|
del items[i]
|
|
@@ -1485,11 +1417,7 @@ class SemanticAnalyzer(
|
|
|
1485
1417
|
# The first argument of a non-static, non-class method is like 'self'
|
|
1486
1418
|
# (though the name could be different), having the enclosing class's
|
|
1487
1419
|
# instance type.
|
|
1488
|
-
if (
|
|
1489
|
-
is_method
|
|
1490
|
-
and (not defn.is_static or defn.name == "__new__")
|
|
1491
|
-
and defn.arguments
|
|
1492
|
-
):
|
|
1420
|
+
if is_method and (not defn.is_static or defn.name == "__new__") and defn.arguments:
|
|
1493
1421
|
if not defn.is_class:
|
|
1494
1422
|
defn.arguments[0].variable.is_self = True
|
|
1495
1423
|
else:
|
|
@@ -1548,10 +1476,7 @@ class SemanticAnalyzer(
|
|
|
1548
1476
|
# type analyzer sets types of arguments to `Any`, but keeps
|
|
1549
1477
|
# definition types as `UnboundType` for now.
|
|
1550
1478
|
if not (
|
|
1551
|
-
(
|
|
1552
|
-
isinstance(args_defn_type, UnboundType)
|
|
1553
|
-
and args_defn_type.name.endswith(".args")
|
|
1554
|
-
)
|
|
1479
|
+
(isinstance(args_defn_type, UnboundType) and args_defn_type.name.endswith(".args"))
|
|
1555
1480
|
or (
|
|
1556
1481
|
isinstance(kwargs_defn_type, UnboundType)
|
|
1557
1482
|
and kwargs_defn_type.name.endswith(".kwargs")
|
|
@@ -1569,13 +1494,11 @@ class SemanticAnalyzer(
|
|
|
1569
1494
|
or not isinstance(kwargs_type, ParamSpecType)
|
|
1570
1495
|
or args_type.name != kwargs_type.name
|
|
1571
1496
|
):
|
|
1572
|
-
if isinstance(args_defn_type, UnboundType) and args_defn_type.name.endswith(
|
|
1573
|
-
".args"
|
|
1574
|
-
):
|
|
1497
|
+
if isinstance(args_defn_type, UnboundType) and args_defn_type.name.endswith(".args"):
|
|
1575
1498
|
param_name = args_defn_type.name.split(".")[0]
|
|
1576
|
-
elif isinstance(
|
|
1577
|
-
|
|
1578
|
-
)
|
|
1499
|
+
elif isinstance(kwargs_defn_type, UnboundType) and kwargs_defn_type.name.endswith(
|
|
1500
|
+
".kwargs"
|
|
1501
|
+
):
|
|
1579
1502
|
param_name = kwargs_defn_type.name.split(".")[0]
|
|
1580
1503
|
else:
|
|
1581
1504
|
# Fallback for cases that probably should not ever happen:
|
|
@@ -1607,9 +1530,7 @@ class SemanticAnalyzer(
|
|
|
1607
1530
|
removed.append(i)
|
|
1608
1531
|
dec.func.abstract_status = IS_ABSTRACT
|
|
1609
1532
|
self.check_decorated_function_is_method("abstractmethod", dec)
|
|
1610
|
-
elif refers_to_fullname(
|
|
1611
|
-
d, ("asyncio.coroutines.coroutine", "types.coroutine")
|
|
1612
|
-
):
|
|
1533
|
+
elif refers_to_fullname(d, ("asyncio.coroutines.coroutine", "types.coroutine")):
|
|
1613
1534
|
removed.append(i)
|
|
1614
1535
|
dec.func.is_awaitable_coroutine = True
|
|
1615
1536
|
elif refers_to_fullname(d, "builtins.staticmethod"):
|
|
@@ -1663,9 +1584,7 @@ class SemanticAnalyzer(
|
|
|
1663
1584
|
elif isinstance(d, CallExpr) and refers_to_fullname(
|
|
1664
1585
|
d.callee, DATACLASS_TRANSFORM_NAMES
|
|
1665
1586
|
):
|
|
1666
|
-
dec.func.dataclass_transform_spec = self.parse_dataclass_transform_spec(
|
|
1667
|
-
d
|
|
1668
|
-
)
|
|
1587
|
+
dec.func.dataclass_transform_spec = self.parse_dataclass_transform_spec(d)
|
|
1669
1588
|
elif not dec.var.is_property:
|
|
1670
1589
|
# We have seen a "non-trivial" decorator before seeing @property, if
|
|
1671
1590
|
# we will see a @property later, give an error, as we don't support this.
|
|
@@ -1686,9 +1605,7 @@ class SemanticAnalyzer(
|
|
|
1686
1605
|
if dec.func.is_static and dec.func.is_class:
|
|
1687
1606
|
self.fail(message_registry.CLASS_PATTERN_CLASS_OR_STATIC_METHOD, dec)
|
|
1688
1607
|
|
|
1689
|
-
def check_decorated_function_is_method(
|
|
1690
|
-
self, decorator: str, context: Context
|
|
1691
|
-
) -> None:
|
|
1608
|
+
def check_decorated_function_is_method(self, decorator: str, context: Context) -> None:
|
|
1692
1609
|
if not self.type or self.is_func_scope():
|
|
1693
1610
|
self.fail(f'"{decorator}" used with a non-method', context)
|
|
1694
1611
|
|
|
@@ -1711,9 +1628,7 @@ class SemanticAnalyzer(
|
|
|
1711
1628
|
# resolved. We don't want this to cause a deferral, since if there
|
|
1712
1629
|
# are no incomplete references, we'll replace this with a TypeInfo
|
|
1713
1630
|
# before returning.
|
|
1714
|
-
placeholder = PlaceholderNode(
|
|
1715
|
-
fullname, defn, defn.line, becomes_typeinfo=True
|
|
1716
|
-
)
|
|
1631
|
+
placeholder = PlaceholderNode(fullname, defn, defn.line, becomes_typeinfo=True)
|
|
1717
1632
|
self.add_symbol(defn.name, placeholder, defn, can_defer=False)
|
|
1718
1633
|
|
|
1719
1634
|
tag = self.track_incomplete_refs()
|
|
@@ -1861,10 +1776,7 @@ class SemanticAnalyzer(
|
|
|
1861
1776
|
is_named_tuple = True
|
|
1862
1777
|
info: TypeInfo | None = defn.info
|
|
1863
1778
|
else:
|
|
1864
|
-
(
|
|
1865
|
-
is_named_tuple,
|
|
1866
|
-
info,
|
|
1867
|
-
) = self.named_tuple_analyzer.analyze_namedtuple_classdef(
|
|
1779
|
+
is_named_tuple, info = self.named_tuple_analyzer.analyze_namedtuple_classdef(
|
|
1868
1780
|
defn, self.is_stub_file, self.is_func_scope()
|
|
1869
1781
|
)
|
|
1870
1782
|
if is_named_tuple:
|
|
@@ -1965,16 +1877,11 @@ class SemanticAnalyzer(
|
|
|
1965
1877
|
if defn.info.is_protocol:
|
|
1966
1878
|
defn.info.runtime_protocol = True
|
|
1967
1879
|
else:
|
|
1968
|
-
self.fail(
|
|
1969
|
-
"@runtime_checkable can only be used with protocol classes",
|
|
1970
|
-
defn,
|
|
1971
|
-
)
|
|
1880
|
+
self.fail("@runtime_checkable can only be used with protocol classes", defn)
|
|
1972
1881
|
elif isinstance(decorator, CallExpr) and refers_to_fullname(
|
|
1973
1882
|
decorator.callee, DATACLASS_TRANSFORM_NAMES
|
|
1974
1883
|
):
|
|
1975
|
-
defn.info.dataclass_transform_spec = self.parse_dataclass_transform_spec(
|
|
1976
|
-
decorator
|
|
1977
|
-
)
|
|
1884
|
+
defn.info.dataclass_transform_spec = self.parse_dataclass_transform_spec(decorator)
|
|
1978
1885
|
|
|
1979
1886
|
def analyze_class_decorator_common(
|
|
1980
1887
|
self, defn: ClassDef, info: TypeInfo, decorator: Expression
|
|
@@ -2020,10 +1927,7 @@ class SemanticAnalyzer(
|
|
|
2020
1927
|
result = self.analyze_class_typevar_declaration(base)
|
|
2021
1928
|
if result is not None:
|
|
2022
1929
|
if declared_tvars:
|
|
2023
|
-
self.fail(
|
|
2024
|
-
"Only single Generic[...] or Protocol[...] can be in bases",
|
|
2025
|
-
context,
|
|
2026
|
-
)
|
|
1930
|
+
self.fail("Only single Generic[...] or Protocol[...] can be in bases", context)
|
|
2027
1931
|
removed.append(i)
|
|
2028
1932
|
tvars = result[0]
|
|
2029
1933
|
is_protocol |= result[1]
|
|
@@ -2039,9 +1943,7 @@ class SemanticAnalyzer(
|
|
|
2039
1943
|
all_tvars = self.get_all_bases_tvars(base_type_exprs, removed)
|
|
2040
1944
|
if declared_tvars:
|
|
2041
1945
|
if len(remove_dups(declared_tvars)) < len(declared_tvars):
|
|
2042
|
-
self.fail(
|
|
2043
|
-
"Duplicate type variables in Generic[...] or Protocol[...]", context
|
|
2044
|
-
)
|
|
1946
|
+
self.fail("Duplicate type variables in Generic[...] or Protocol[...]", context)
|
|
2045
1947
|
declared_tvars = remove_dups(declared_tvars)
|
|
2046
1948
|
if not set(all_tvars).issubset(set(declared_tvars)):
|
|
2047
1949
|
self.fail(
|
|
@@ -2060,14 +1962,23 @@ class SemanticAnalyzer(
|
|
|
2060
1962
|
defn.removed_base_type_exprs.append(defn.base_type_exprs[i])
|
|
2061
1963
|
del base_type_exprs[i]
|
|
2062
1964
|
tvar_defs: list[TypeVarLikeType] = []
|
|
1965
|
+
last_tvar_name_with_default: str | None = None
|
|
2063
1966
|
for name, tvar_expr in declared_tvars:
|
|
1967
|
+
tvar_expr.default = tvar_expr.default.accept(
|
|
1968
|
+
TypeVarDefaultTranslator(self, tvar_expr.name, context)
|
|
1969
|
+
)
|
|
2064
1970
|
tvar_def = self.tvar_scope.bind_new(name, tvar_expr)
|
|
1971
|
+
if last_tvar_name_with_default is not None and not tvar_def.has_default():
|
|
1972
|
+
self.msg.tvar_without_default_type(
|
|
1973
|
+
tvar_def.name, last_tvar_name_with_default, context
|
|
1974
|
+
)
|
|
1975
|
+
tvar_def.default = AnyType(TypeOfAny.from_error)
|
|
1976
|
+
elif tvar_def.has_default():
|
|
1977
|
+
last_tvar_name_with_default = tvar_def.name
|
|
2065
1978
|
tvar_defs.append(tvar_def)
|
|
2066
1979
|
return base_type_exprs, tvar_defs, is_protocol
|
|
2067
1980
|
|
|
2068
|
-
def analyze_class_typevar_declaration(
|
|
2069
|
-
self, base: Type
|
|
2070
|
-
) -> tuple[TypeVarLikeList, bool] | None:
|
|
1981
|
+
def analyze_class_typevar_declaration(self, base: Type) -> tuple[TypeVarLikeList, bool] | None:
|
|
2071
1982
|
"""Analyze type variables declared using Generic[...] or Protocol[...].
|
|
2072
1983
|
|
|
2073
1984
|
Args:
|
|
@@ -2096,49 +2007,46 @@ class SemanticAnalyzer(
|
|
|
2096
2007
|
if tvar:
|
|
2097
2008
|
if isinstance(tvar[1], TypeVarTupleExpr):
|
|
2098
2009
|
if have_type_var_tuple:
|
|
2099
|
-
self.fail(
|
|
2100
|
-
"Can only use one type var tuple in a class def", base
|
|
2101
|
-
)
|
|
2010
|
+
self.fail("Can only use one type var tuple in a class def", base)
|
|
2102
2011
|
continue
|
|
2103
2012
|
have_type_var_tuple = True
|
|
2104
2013
|
tvars.append(tvar)
|
|
2105
2014
|
elif not self.found_incomplete_ref(tag):
|
|
2106
|
-
self.fail(
|
|
2107
|
-
"Free type variable expected in %s[...]" % sym.node.name, base
|
|
2108
|
-
)
|
|
2015
|
+
self.fail("Free type variable expected in %s[...]" % sym.node.name, base)
|
|
2109
2016
|
return tvars, is_proto
|
|
2110
2017
|
return None
|
|
2111
2018
|
|
|
2112
2019
|
def analyze_unbound_tvar(self, t: Type) -> tuple[str, TypeVarLikeExpr] | None:
|
|
2113
2020
|
if isinstance(t, UnpackType) and isinstance(t.type, UnboundType):
|
|
2114
|
-
return self.analyze_unbound_tvar_impl(t.type,
|
|
2021
|
+
return self.analyze_unbound_tvar_impl(t.type, is_unpacked=True)
|
|
2115
2022
|
if isinstance(t, UnboundType):
|
|
2116
2023
|
sym = self.lookup_qualified(t.name, t)
|
|
2117
2024
|
if sym and sym.fullname in ("typing.Unpack", "typing_extensions.Unpack"):
|
|
2118
2025
|
inner_t = t.args[0]
|
|
2119
2026
|
if isinstance(inner_t, UnboundType):
|
|
2120
|
-
return self.analyze_unbound_tvar_impl(inner_t,
|
|
2027
|
+
return self.analyze_unbound_tvar_impl(inner_t, is_unpacked=True)
|
|
2121
2028
|
return None
|
|
2122
2029
|
return self.analyze_unbound_tvar_impl(t)
|
|
2123
2030
|
return None
|
|
2124
2031
|
|
|
2125
2032
|
def analyze_unbound_tvar_impl(
|
|
2126
|
-
self, t: UnboundType,
|
|
2033
|
+
self, t: UnboundType, is_unpacked: bool = False, is_typealias_param: bool = False
|
|
2127
2034
|
) -> tuple[str, TypeVarLikeExpr] | None:
|
|
2035
|
+
assert not is_unpacked or not is_typealias_param, "Mutually exclusive conditions"
|
|
2128
2036
|
sym = self.lookup_qualified(t.name, t)
|
|
2129
2037
|
if sym and isinstance(sym.node, PlaceholderNode):
|
|
2130
2038
|
self.record_incomplete_ref()
|
|
2131
|
-
if not
|
|
2039
|
+
if not is_unpacked and sym and isinstance(sym.node, ParamSpecExpr):
|
|
2132
2040
|
if sym.fullname and not self.tvar_scope.allow_binding(sym.fullname):
|
|
2133
2041
|
# It's bound by our type variable scope
|
|
2134
2042
|
return None
|
|
2135
2043
|
return t.name, sym.node
|
|
2136
|
-
if
|
|
2044
|
+
if (is_unpacked or is_typealias_param) and sym and isinstance(sym.node, TypeVarTupleExpr):
|
|
2137
2045
|
if sym.fullname and not self.tvar_scope.allow_binding(sym.fullname):
|
|
2138
2046
|
# It's bound by our type variable scope
|
|
2139
2047
|
return None
|
|
2140
2048
|
return t.name, sym.node
|
|
2141
|
-
if sym is None or not isinstance(sym.node, TypeVarExpr) or
|
|
2049
|
+
if sym is None or not isinstance(sym.node, TypeVarExpr) or is_unpacked:
|
|
2142
2050
|
return None
|
|
2143
2051
|
elif sym.fullname and not self.tvar_scope.allow_binding(sym.fullname):
|
|
2144
2052
|
# It's bound by our type variable scope
|
|
@@ -2168,9 +2076,7 @@ class SemanticAnalyzer(
|
|
|
2168
2076
|
tvars.extend(base_tvars)
|
|
2169
2077
|
return remove_dups(tvars)
|
|
2170
2078
|
|
|
2171
|
-
def get_and_bind_all_tvars(
|
|
2172
|
-
self, type_exprs: list[Expression]
|
|
2173
|
-
) -> list[TypeVarLikeType]:
|
|
2079
|
+
def get_and_bind_all_tvars(self, type_exprs: list[Expression]) -> list[TypeVarLikeType]:
|
|
2174
2080
|
"""Return all type variable references in item type expressions.
|
|
2175
2081
|
|
|
2176
2082
|
This is a helper for generic TypedDicts and NamedTuples. Essentially it is
|
|
@@ -2186,9 +2092,7 @@ class SemanticAnalyzer(
|
|
|
2186
2092
|
continue
|
|
2187
2093
|
base_tvars = self.find_type_var_likes(base)
|
|
2188
2094
|
tvars.extend(base_tvars)
|
|
2189
|
-
tvars = remove_dups(
|
|
2190
|
-
tvars
|
|
2191
|
-
) # Variables are defined in order of textual appearance.
|
|
2095
|
+
tvars = remove_dups(tvars) # Variables are defined in order of textual appearance.
|
|
2192
2096
|
tvar_defs = []
|
|
2193
2097
|
for name, tvar_expr in tvars:
|
|
2194
2098
|
tvar_def = self.tvar_scope.bind_new(name, tvar_expr)
|
|
@@ -2342,9 +2246,7 @@ class SemanticAnalyzer(
|
|
|
2342
2246
|
elif isinstance(base, AnyType):
|
|
2343
2247
|
if self.options.disallow_subclassing_any:
|
|
2344
2248
|
if isinstance(base_expr, (NameExpr, MemberExpr)):
|
|
2345
|
-
msg = (
|
|
2346
|
-
f'Class cannot subclass "{base_expr.name}" (has type "Any")'
|
|
2347
|
-
)
|
|
2249
|
+
msg = f'Class cannot subclass "{base_expr.name}" (has type "Any")'
|
|
2348
2250
|
else:
|
|
2349
2251
|
msg = 'Class cannot subclass value of type "Any"'
|
|
2350
2252
|
self.fail(msg, base_expr)
|
|
@@ -2358,20 +2260,14 @@ class SemanticAnalyzer(
|
|
|
2358
2260
|
msg += f' "{name}"'
|
|
2359
2261
|
self.fail(msg, base_expr)
|
|
2360
2262
|
info.fallback_to_any = True
|
|
2361
|
-
if self.options.disallow_any_unimported and has_any_from_unimported_type(
|
|
2362
|
-
base
|
|
2363
|
-
):
|
|
2263
|
+
if self.options.disallow_any_unimported and has_any_from_unimported_type(base):
|
|
2364
2264
|
if isinstance(base_expr, (NameExpr, MemberExpr)):
|
|
2365
2265
|
prefix = f"Base type {base_expr.name}"
|
|
2366
2266
|
else:
|
|
2367
2267
|
prefix = "Base type"
|
|
2368
2268
|
self.msg.unimported_type_becomes_any(prefix, base, base_expr)
|
|
2369
2269
|
check_for_explicit_any(
|
|
2370
|
-
base,
|
|
2371
|
-
self.options,
|
|
2372
|
-
self.is_typeshed_stub_file,
|
|
2373
|
-
self.msg,
|
|
2374
|
-
context=base_expr,
|
|
2270
|
+
base, self.options, self.is_typeshed_stub_file, self.msg, context=base_expr
|
|
2375
2271
|
)
|
|
2376
2272
|
|
|
2377
2273
|
# Add 'object' as implicit base if there is no other base class.
|
|
@@ -2395,11 +2291,7 @@ class SemanticAnalyzer(
|
|
|
2395
2291
|
|
|
2396
2292
|
# There may be an existing valid tuple type from previous semanal iterations.
|
|
2397
2293
|
# Use equality to check if it is the case.
|
|
2398
|
-
if (
|
|
2399
|
-
info.tuple_type
|
|
2400
|
-
and info.tuple_type != base
|
|
2401
|
-
and not has_placeholder(info.tuple_type)
|
|
2402
|
-
):
|
|
2294
|
+
if info.tuple_type and info.tuple_type != base and not has_placeholder(info.tuple_type):
|
|
2403
2295
|
self.fail("Class has two incompatible bases derived from tuple", defn)
|
|
2404
2296
|
defn.has_incompatible_baseclass = True
|
|
2405
2297
|
if info.special_alias and has_placeholder(info.special_alias.target):
|
|
@@ -2409,15 +2301,10 @@ class SemanticAnalyzer(
|
|
|
2409
2301
|
info.update_tuple_type(base)
|
|
2410
2302
|
self.setup_alias_type_vars(defn)
|
|
2411
2303
|
|
|
2412
|
-
if (
|
|
2413
|
-
base.partial_fallback.type.fullname == "builtins.tuple"
|
|
2414
|
-
and not has_placeholder(base)
|
|
2415
|
-
):
|
|
2304
|
+
if base.partial_fallback.type.fullname == "builtins.tuple" and not has_placeholder(base):
|
|
2416
2305
|
# Fallback can only be safely calculated after semantic analysis, since base
|
|
2417
2306
|
# classes may be incomplete. Postpone the calculation.
|
|
2418
|
-
self.schedule_patch(
|
|
2419
|
-
PRIORITY_FALLBACKS, lambda: calculate_tuple_fallback(base)
|
|
2420
|
-
)
|
|
2307
|
+
self.schedule_patch(PRIORITY_FALLBACKS, lambda: calculate_tuple_fallback(base))
|
|
2421
2308
|
|
|
2422
2309
|
return base.partial_fallback
|
|
2423
2310
|
|
|
@@ -2467,9 +2354,7 @@ class SemanticAnalyzer(
|
|
|
2467
2354
|
with_meta_expr: Expression | None = None
|
|
2468
2355
|
if len(defn.base_type_exprs) == 1:
|
|
2469
2356
|
base_expr = defn.base_type_exprs[0]
|
|
2470
|
-
if isinstance(base_expr, CallExpr) and isinstance(
|
|
2471
|
-
base_expr.callee, RefExpr
|
|
2472
|
-
):
|
|
2357
|
+
if isinstance(base_expr, CallExpr) and isinstance(base_expr.callee, RefExpr):
|
|
2473
2358
|
self.analyze_type_expr(base_expr)
|
|
2474
2359
|
if (
|
|
2475
2360
|
base_expr.callee.fullname
|
|
@@ -2557,17 +2442,13 @@ class SemanticAnalyzer(
|
|
|
2557
2442
|
elif isinstance(metaclass_expr, MemberExpr):
|
|
2558
2443
|
metaclass_name = get_member_expr_fullname(metaclass_expr)
|
|
2559
2444
|
if metaclass_name is None:
|
|
2560
|
-
self.fail(
|
|
2561
|
-
f'Dynamic metaclass not supported for "{name}"', metaclass_expr
|
|
2562
|
-
)
|
|
2445
|
+
self.fail(f'Dynamic metaclass not supported for "{name}"', metaclass_expr)
|
|
2563
2446
|
return None, False, True
|
|
2564
2447
|
sym = self.lookup_qualified(metaclass_name, metaclass_expr)
|
|
2565
2448
|
if sym is None:
|
|
2566
2449
|
# Probably a name error - it is already handled elsewhere
|
|
2567
2450
|
return None, False, True
|
|
2568
|
-
if isinstance(sym.node, Var) and isinstance(
|
|
2569
|
-
get_proper_type(sym.node.type), AnyType
|
|
2570
|
-
):
|
|
2451
|
+
if isinstance(sym.node, Var) and isinstance(get_proper_type(sym.node.type), AnyType):
|
|
2571
2452
|
if self.options.disallow_subclassing_any:
|
|
2572
2453
|
self.fail(
|
|
2573
2454
|
f'Class cannot use "{sym.node.name}" as a metaclass (has type "Any")',
|
|
@@ -2588,16 +2469,12 @@ class SemanticAnalyzer(
|
|
|
2588
2469
|
else:
|
|
2589
2470
|
metaclass_info = sym.node
|
|
2590
2471
|
|
|
2591
|
-
if (
|
|
2592
|
-
not isinstance(metaclass_info, TypeInfo)
|
|
2593
|
-
or metaclass_info.tuple_type is not None
|
|
2594
|
-
):
|
|
2472
|
+
if not isinstance(metaclass_info, TypeInfo) or metaclass_info.tuple_type is not None:
|
|
2595
2473
|
self.fail(f'Invalid metaclass "{metaclass_name}"', metaclass_expr)
|
|
2596
2474
|
return None, False, False
|
|
2597
2475
|
if not metaclass_info.is_metaclass():
|
|
2598
2476
|
self.fail(
|
|
2599
|
-
'Metaclasses not inheriting from "type" are not supported',
|
|
2600
|
-
metaclass_expr,
|
|
2477
|
+
'Metaclasses not inheriting from "type" are not supported', metaclass_expr
|
|
2601
2478
|
)
|
|
2602
2479
|
return None, False, False
|
|
2603
2480
|
inst = fill_typevars(metaclass_info)
|
|
@@ -2605,9 +2482,7 @@ class SemanticAnalyzer(
|
|
|
2605
2482
|
declared_metaclass = inst
|
|
2606
2483
|
return declared_metaclass, False, False
|
|
2607
2484
|
|
|
2608
|
-
def recalculate_metaclass(
|
|
2609
|
-
self, defn: ClassDef, declared_metaclass: Instance | None
|
|
2610
|
-
) -> None:
|
|
2485
|
+
def recalculate_metaclass(self, defn: ClassDef, declared_metaclass: Instance | None) -> None:
|
|
2611
2486
|
defn.info.declared_metaclass = declared_metaclass
|
|
2612
2487
|
defn.info.metaclass_type = defn.info.calculate_metaclass_type()
|
|
2613
2488
|
if any(info.is_protocol for info in defn.info.mro):
|
|
@@ -2618,13 +2493,9 @@ class SemanticAnalyzer(
|
|
|
2618
2493
|
# All protocols and their subclasses have ABCMeta metaclass by default.
|
|
2619
2494
|
# TODO: add a metaclass conflict check if there is another metaclass.
|
|
2620
2495
|
abc_meta = self.named_type_or_none("abc.ABCMeta", [])
|
|
2621
|
-
if
|
|
2622
|
-
abc_meta is not None
|
|
2623
|
-
): # May be None in tests with incomplete lib-stub.
|
|
2496
|
+
if abc_meta is not None: # May be None in tests with incomplete lib-stub.
|
|
2624
2497
|
defn.info.metaclass_type = abc_meta
|
|
2625
|
-
if defn.info.metaclass_type and defn.info.metaclass_type.type.has_base(
|
|
2626
|
-
"enum.EnumMeta"
|
|
2627
|
-
):
|
|
2498
|
+
if defn.info.metaclass_type and defn.info.metaclass_type.type.has_base("enum.EnumMeta"):
|
|
2628
2499
|
defn.info.is_enum = True
|
|
2629
2500
|
if defn.type_vars:
|
|
2630
2501
|
self.fail("Enum class cannot be generic", defn)
|
|
@@ -2638,9 +2509,7 @@ class SemanticAnalyzer(
|
|
|
2638
2509
|
for id, as_id in i.ids:
|
|
2639
2510
|
# Modules imported in a stub file without using 'import X as X' won't get exported
|
|
2640
2511
|
# When implicit re-exporting is disabled, we have the same behavior as stubs.
|
|
2641
|
-
use_implicit_reexport =
|
|
2642
|
-
not self.is_stub_file and self.options.implicit_reexport
|
|
2643
|
-
)
|
|
2512
|
+
use_implicit_reexport = not self.is_stub_file and self.options.implicit_reexport
|
|
2644
2513
|
if as_id is not None:
|
|
2645
2514
|
base_id = id
|
|
2646
2515
|
imported_id = as_id
|
|
@@ -2659,10 +2528,7 @@ class SemanticAnalyzer(
|
|
|
2659
2528
|
else:
|
|
2660
2529
|
kind = GDEF
|
|
2661
2530
|
symbol = SymbolTableNode(
|
|
2662
|
-
kind,
|
|
2663
|
-
node,
|
|
2664
|
-
module_public=module_public,
|
|
2665
|
-
module_hidden=not module_public,
|
|
2531
|
+
kind, node, module_public=module_public, module_hidden=not module_public
|
|
2666
2532
|
)
|
|
2667
2533
|
self.add_imported_symbol(
|
|
2668
2534
|
imported_id,
|
|
@@ -2707,9 +2573,7 @@ class SemanticAnalyzer(
|
|
|
2707
2573
|
# Modules imported in a stub file without using 'from Y import X as X' will
|
|
2708
2574
|
# not get exported.
|
|
2709
2575
|
# When implicit re-exporting is disabled, we have the same behavior as stubs.
|
|
2710
|
-
use_implicit_reexport =
|
|
2711
|
-
not self.is_stub_file and self.options.implicit_reexport
|
|
2712
|
-
)
|
|
2576
|
+
use_implicit_reexport = not self.is_stub_file and self.options.implicit_reexport
|
|
2713
2577
|
module_public = use_implicit_reexport or (as_id is not None and id == as_id)
|
|
2714
2578
|
|
|
2715
2579
|
# If the module does not contain a symbol with the name 'id',
|
|
@@ -2726,9 +2590,7 @@ class SemanticAnalyzer(
|
|
|
2726
2590
|
# We store the fullname of the original definition so that we can
|
|
2727
2591
|
# detect whether two imported names refer to the same thing.
|
|
2728
2592
|
fullname = module_id + "." + id
|
|
2729
|
-
gvar = self.create_getattr_var(
|
|
2730
|
-
module.names["__getattr__"], imported_id, fullname
|
|
2731
|
-
)
|
|
2593
|
+
gvar = self.create_getattr_var(module.names["__getattr__"], imported_id, fullname)
|
|
2732
2594
|
if gvar:
|
|
2733
2595
|
self.add_symbol(
|
|
2734
2596
|
imported_id,
|
|
@@ -2741,13 +2603,7 @@ class SemanticAnalyzer(
|
|
|
2741
2603
|
|
|
2742
2604
|
if node:
|
|
2743
2605
|
self.process_imported_symbol(
|
|
2744
|
-
node,
|
|
2745
|
-
module_id,
|
|
2746
|
-
id,
|
|
2747
|
-
imported_id,
|
|
2748
|
-
fullname,
|
|
2749
|
-
module_public,
|
|
2750
|
-
context=imp,
|
|
2606
|
+
node, module_id, id, imported_id, fullname, module_public, context=imp
|
|
2751
2607
|
)
|
|
2752
2608
|
if node.module_hidden:
|
|
2753
2609
|
self.report_missing_module_attribute(
|
|
@@ -2822,11 +2678,7 @@ class SemanticAnalyzer(
|
|
|
2822
2678
|
# NOTE: we take the original node even for final `Var`s. This is to support
|
|
2823
2679
|
# a common pattern when constants are re-exported (same applies to import *).
|
|
2824
2680
|
self.add_imported_symbol(
|
|
2825
|
-
imported_id,
|
|
2826
|
-
node,
|
|
2827
|
-
context,
|
|
2828
|
-
module_public=module_public,
|
|
2829
|
-
module_hidden=module_hidden,
|
|
2681
|
+
imported_id, node, context, module_public=module_public, module_hidden=module_hidden
|
|
2830
2682
|
)
|
|
2831
2683
|
|
|
2832
2684
|
def report_missing_module_attribute(
|
|
@@ -2844,21 +2696,17 @@ class SemanticAnalyzer(
|
|
|
2844
2696
|
# We don't know whether the name will be there, since the namespace
|
|
2845
2697
|
# is incomplete. Defer the current target.
|
|
2846
2698
|
self.mark_incomplete(
|
|
2847
|
-
imported_id,
|
|
2848
|
-
context,
|
|
2849
|
-
module_public=module_public,
|
|
2850
|
-
module_hidden=module_hidden,
|
|
2699
|
+
imported_id, context, module_public=module_public, module_hidden=module_hidden
|
|
2851
2700
|
)
|
|
2852
2701
|
return
|
|
2853
2702
|
message = f'Module "{import_id}" has no attribute "{source_id}"'
|
|
2854
2703
|
# Suggest alternatives, if any match is found.
|
|
2855
2704
|
module = self.modules.get(import_id)
|
|
2856
2705
|
if module:
|
|
2857
|
-
if (
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
message = f'Module "{import_id}" does not explicitly export attribute "{source_id}"'
|
|
2706
|
+
if source_id in module.names.keys() and not module.names[source_id].module_public:
|
|
2707
|
+
message = (
|
|
2708
|
+
f'Module "{import_id}" does not explicitly export attribute "{source_id}"'
|
|
2709
|
+
)
|
|
2862
2710
|
else:
|
|
2863
2711
|
alternatives = set(module.names.keys()).difference({source_id})
|
|
2864
2712
|
matches = best_matches(source_id, alternatives, n=3)
|
|
@@ -2932,10 +2780,7 @@ class SemanticAnalyzer(
|
|
|
2932
2780
|
|
|
2933
2781
|
def correct_relative_import(self, node: ImportFrom | ImportAll) -> str:
|
|
2934
2782
|
import_id, ok = correct_relative_import(
|
|
2935
|
-
self.cur_mod_id,
|
|
2936
|
-
node.relative,
|
|
2937
|
-
node.id,
|
|
2938
|
-
self.cur_mod_node.is_package_init_file(),
|
|
2783
|
+
self.cur_mod_id, node.relative, node.id, self.cur_mod_node.is_package_init_file()
|
|
2939
2784
|
)
|
|
2940
2785
|
if not ok:
|
|
2941
2786
|
self.fail("Relative import climbs too many namespaces", node)
|
|
@@ -2956,9 +2801,7 @@ class SemanticAnalyzer(
|
|
|
2956
2801
|
continue
|
|
2957
2802
|
# if '__all__' exists, all nodes not included have had module_public set to
|
|
2958
2803
|
# False, and we can skip checking '_' because it's been explicitly included.
|
|
2959
|
-
if node.module_public and (
|
|
2960
|
-
not name.startswith("_") or "__all__" in m.names
|
|
2961
|
-
):
|
|
2804
|
+
if node.module_public and (not name.startswith("_") or "__all__" in m.names):
|
|
2962
2805
|
if isinstance(node.node, MypyFile):
|
|
2963
2806
|
# Star import of submodule from a package, add it as a dependency.
|
|
2964
2807
|
self.imports.add(node.node.fullname)
|
|
@@ -2980,9 +2823,7 @@ class SemanticAnalyzer(
|
|
|
2980
2823
|
if self.is_func_scope():
|
|
2981
2824
|
if not self.check_valid_comprehension(s):
|
|
2982
2825
|
return
|
|
2983
|
-
self.analyze_lvalue(
|
|
2984
|
-
s.target, escape_comprehensions=True, has_explicit_value=True
|
|
2985
|
-
)
|
|
2826
|
+
self.analyze_lvalue(s.target, escape_comprehensions=True, has_explicit_value=True)
|
|
2986
2827
|
|
|
2987
2828
|
def check_valid_comprehension(self, s: AssignmentExpr) -> bool:
|
|
2988
2829
|
"""Check that assignment expression is not nested within comprehension at class scope.
|
|
@@ -3026,6 +2867,10 @@ class SemanticAnalyzer(
|
|
|
3026
2867
|
with self.allow_unbound_tvars_set():
|
|
3027
2868
|
s.rvalue.accept(self)
|
|
3028
2869
|
self.basic_type_applications = old_basic_type_applications
|
|
2870
|
+
elif self.can_possibly_be_typevarlike_declaration(s):
|
|
2871
|
+
# Allow unbound tvars inside TypeVarLike defaults to be evaluated later
|
|
2872
|
+
with self.allow_unbound_tvars_set():
|
|
2873
|
+
s.rvalue.accept(self)
|
|
3029
2874
|
else:
|
|
3030
2875
|
s.rvalue.accept(self)
|
|
3031
2876
|
|
|
@@ -3141,21 +2986,13 @@ class SemanticAnalyzer(
|
|
|
3141
2986
|
return False
|
|
3142
2987
|
if isinstance(rv, NameExpr):
|
|
3143
2988
|
n = self.lookup(rv.name, rv)
|
|
3144
|
-
if (
|
|
3145
|
-
n
|
|
3146
|
-
and isinstance(n.node, PlaceholderNode)
|
|
3147
|
-
and not n.node.becomes_typeinfo
|
|
3148
|
-
):
|
|
2989
|
+
if n and isinstance(n.node, PlaceholderNode) and not n.node.becomes_typeinfo:
|
|
3149
2990
|
return True
|
|
3150
2991
|
elif isinstance(rv, MemberExpr):
|
|
3151
2992
|
fname = get_member_expr_fullname(rv)
|
|
3152
2993
|
if fname:
|
|
3153
2994
|
n = self.lookup_qualified(fname, rv, suppress_errors=True)
|
|
3154
|
-
if (
|
|
3155
|
-
n
|
|
3156
|
-
and isinstance(n.node, PlaceholderNode)
|
|
3157
|
-
and not n.node.becomes_typeinfo
|
|
3158
|
-
):
|
|
2995
|
+
if n and isinstance(n.node, PlaceholderNode) and not n.node.becomes_typeinfo:
|
|
3159
2996
|
return True
|
|
3160
2997
|
elif isinstance(rv, IndexExpr) and isinstance(rv.base, RefExpr):
|
|
3161
2998
|
return self.should_wait_rhs(rv.base)
|
|
@@ -3182,9 +3019,9 @@ class SemanticAnalyzer(
|
|
|
3182
3019
|
if isinstance(rv, OpExpr) and rv.op == "|":
|
|
3183
3020
|
if self.is_stub_file:
|
|
3184
3021
|
return True
|
|
3185
|
-
if self.can_be_type_alias(
|
|
3186
|
-
rv.
|
|
3187
|
-
)
|
|
3022
|
+
if self.can_be_type_alias(rv.left, allow_none=True) and self.can_be_type_alias(
|
|
3023
|
+
rv.right, allow_none=True
|
|
3024
|
+
):
|
|
3188
3025
|
return True
|
|
3189
3026
|
return False
|
|
3190
3027
|
|
|
@@ -3210,6 +3047,16 @@ class SemanticAnalyzer(
|
|
|
3210
3047
|
# Something that looks like Foo = Bar[Baz, ...]
|
|
3211
3048
|
return True
|
|
3212
3049
|
|
|
3050
|
+
def can_possibly_be_typevarlike_declaration(self, s: AssignmentStmt) -> bool:
|
|
3051
|
+
"""Check if r.h.s. can be a TypeVarLike declaration."""
|
|
3052
|
+
if len(s.lvalues) != 1 or not isinstance(s.lvalues[0], NameExpr):
|
|
3053
|
+
return False
|
|
3054
|
+
if not isinstance(s.rvalue, CallExpr) or not isinstance(s.rvalue.callee, NameExpr):
|
|
3055
|
+
return False
|
|
3056
|
+
ref = s.rvalue.callee
|
|
3057
|
+
ref.accept(self)
|
|
3058
|
+
return ref.fullname in TYPE_VAR_LIKE_NAMES
|
|
3059
|
+
|
|
3213
3060
|
def is_type_ref(self, rv: Expression, bare: bool = False) -> bool:
|
|
3214
3061
|
"""Does this expression refer to a type?
|
|
3215
3062
|
|
|
@@ -3231,9 +3078,7 @@ class SemanticAnalyzer(
|
|
|
3231
3078
|
if not isinstance(rv, RefExpr):
|
|
3232
3079
|
return False
|
|
3233
3080
|
if isinstance(rv.node, TypeVarLikeExpr):
|
|
3234
|
-
self.fail(
|
|
3235
|
-
f'Type variable "{rv.fullname}" is invalid as target for type alias', rv
|
|
3236
|
-
)
|
|
3081
|
+
self.fail(f'Type variable "{rv.fullname}" is invalid as target for type alias', rv)
|
|
3237
3082
|
return False
|
|
3238
3083
|
|
|
3239
3084
|
if bare:
|
|
@@ -3263,11 +3108,7 @@ class SemanticAnalyzer(
|
|
|
3263
3108
|
# The r.h.s. for variable definitions may not be a type reference but just
|
|
3264
3109
|
# an instance attribute, so suppress the errors.
|
|
3265
3110
|
n = self.lookup_qualified(fname, rv, suppress_errors=True)
|
|
3266
|
-
if (
|
|
3267
|
-
n
|
|
3268
|
-
and isinstance(n.node, PlaceholderNode)
|
|
3269
|
-
and n.node.becomes_typeinfo
|
|
3270
|
-
):
|
|
3111
|
+
if n and isinstance(n.node, PlaceholderNode) and n.node.becomes_typeinfo:
|
|
3271
3112
|
return True
|
|
3272
3113
|
return False
|
|
3273
3114
|
|
|
@@ -3310,18 +3151,14 @@ class SemanticAnalyzer(
|
|
|
3310
3151
|
|
|
3311
3152
|
def analyze_enum_assign(self, s: AssignmentStmt) -> bool:
|
|
3312
3153
|
"""Check if s defines an Enum."""
|
|
3313
|
-
if isinstance(s.rvalue, CallExpr) and isinstance(
|
|
3314
|
-
s.rvalue.analyzed, EnumCallExpr
|
|
3315
|
-
):
|
|
3154
|
+
if isinstance(s.rvalue, CallExpr) and isinstance(s.rvalue.analyzed, EnumCallExpr):
|
|
3316
3155
|
# Already analyzed enum -- nothing to do here.
|
|
3317
3156
|
return True
|
|
3318
3157
|
return self.enum_call_analyzer.process_enum_call(s, self.is_func_scope())
|
|
3319
3158
|
|
|
3320
3159
|
def analyze_namedtuple_assign(self, s: AssignmentStmt) -> bool:
|
|
3321
3160
|
"""Check if s defines a namedtuple."""
|
|
3322
|
-
if isinstance(s.rvalue, CallExpr) and isinstance(
|
|
3323
|
-
s.rvalue.analyzed, NamedTupleExpr
|
|
3324
|
-
):
|
|
3161
|
+
if isinstance(s.rvalue, CallExpr) and isinstance(s.rvalue.analyzed, NamedTupleExpr):
|
|
3325
3162
|
if s.rvalue.analyzed.info.tuple_type and not has_placeholder(
|
|
3326
3163
|
s.rvalue.analyzed.info.tuple_type
|
|
3327
3164
|
):
|
|
@@ -3332,13 +3169,8 @@ class SemanticAnalyzer(
|
|
|
3332
3169
|
if isinstance(lvalue, MemberExpr):
|
|
3333
3170
|
if isinstance(s.rvalue, CallExpr) and isinstance(s.rvalue.callee, RefExpr):
|
|
3334
3171
|
fullname = s.rvalue.callee.fullname
|
|
3335
|
-
if
|
|
3336
|
-
|
|
3337
|
-
or fullname in TYPED_NAMEDTUPLE_NAMES
|
|
3338
|
-
):
|
|
3339
|
-
self.fail(
|
|
3340
|
-
"NamedTuple type as an attribute is not supported", lvalue
|
|
3341
|
-
)
|
|
3172
|
+
if fullname == "collections.namedtuple" or fullname in TYPED_NAMEDTUPLE_NAMES:
|
|
3173
|
+
self.fail("NamedTuple type as an attribute is not supported", lvalue)
|
|
3342
3174
|
return False
|
|
3343
3175
|
name = lvalue.name
|
|
3344
3176
|
namespace = self.qualified_name(name)
|
|
@@ -3367,9 +3199,7 @@ class SemanticAnalyzer(
|
|
|
3367
3199
|
|
|
3368
3200
|
def analyze_typeddict_assign(self, s: AssignmentStmt) -> bool:
|
|
3369
3201
|
"""Check if s defines a typed dict."""
|
|
3370
|
-
if isinstance(s.rvalue, CallExpr) and isinstance(
|
|
3371
|
-
s.rvalue.analyzed, TypedDictExpr
|
|
3372
|
-
):
|
|
3202
|
+
if isinstance(s.rvalue, CallExpr) and isinstance(s.rvalue.analyzed, TypedDictExpr):
|
|
3373
3203
|
if s.rvalue.analyzed.info.typeddict_type and not has_placeholder(
|
|
3374
3204
|
s.rvalue.analyzed.info.typeddict_type
|
|
3375
3205
|
):
|
|
@@ -3480,17 +3310,12 @@ class SemanticAnalyzer(
|
|
|
3480
3310
|
s.type = None
|
|
3481
3311
|
if isinstance(s.rvalue, TempNode) and s.rvalue.no_rhs:
|
|
3482
3312
|
invalid_bare_final = True
|
|
3483
|
-
self.fail(
|
|
3484
|
-
"Type in Final[...] can only be omitted if there is an initializer",
|
|
3485
|
-
s,
|
|
3486
|
-
)
|
|
3313
|
+
self.fail("Type in Final[...] can only be omitted if there is an initializer", s)
|
|
3487
3314
|
else:
|
|
3488
3315
|
s.type = s.unanalyzed_type.args[0]
|
|
3489
3316
|
|
|
3490
3317
|
if s.type is not None and self.is_classvar(s.type):
|
|
3491
|
-
self.fail(
|
|
3492
|
-
"Variable should not be annotated with both ClassVar and Final", s
|
|
3493
|
-
)
|
|
3318
|
+
self.fail("Variable should not be annotated with both ClassVar and Final", s)
|
|
3494
3319
|
return False
|
|
3495
3320
|
|
|
3496
3321
|
if len(s.lvalues) != 1 or not isinstance(s.lvalues[0], RefExpr):
|
|
@@ -3530,18 +3355,13 @@ class SemanticAnalyzer(
|
|
|
3530
3355
|
assert isinstance(lval, RefExpr)
|
|
3531
3356
|
if isinstance(lval, MemberExpr):
|
|
3532
3357
|
if not self.is_self_member_ref(lval):
|
|
3533
|
-
self.fail(
|
|
3534
|
-
"Final can be only applied to a name or an attribute on self", s
|
|
3535
|
-
)
|
|
3358
|
+
self.fail("Final can be only applied to a name or an attribute on self", s)
|
|
3536
3359
|
s.is_final_def = False
|
|
3537
3360
|
return
|
|
3538
3361
|
else:
|
|
3539
3362
|
assert self.function_stack
|
|
3540
3363
|
if self.function_stack[-1].name != "__init__":
|
|
3541
|
-
self.fail(
|
|
3542
|
-
"Can only declare a final attribute in class body or __init__",
|
|
3543
|
-
s,
|
|
3544
|
-
)
|
|
3364
|
+
self.fail("Can only declare a final attribute in class body or __init__", s)
|
|
3545
3365
|
s.is_final_def = False
|
|
3546
3366
|
return
|
|
3547
3367
|
|
|
@@ -3584,9 +3404,7 @@ class SemanticAnalyzer(
|
|
|
3584
3404
|
):
|
|
3585
3405
|
# Double underscored members are writable on an `Enum`.
|
|
3586
3406
|
# (Except read-only `__members__` but that is handled in type checker)
|
|
3587
|
-
cur_node.node.is_final = s.is_final_def = not is_dunder(
|
|
3588
|
-
cur_node.node.name
|
|
3589
|
-
)
|
|
3407
|
+
cur_node.node.is_final = s.is_final_def = not is_dunder(cur_node.node.name)
|
|
3590
3408
|
|
|
3591
3409
|
# Special case: deferred initialization of a final attribute in __init__.
|
|
3592
3410
|
# In this case we just pretend this is a valid final definition to suppress
|
|
@@ -3594,11 +3412,7 @@ class SemanticAnalyzer(
|
|
|
3594
3412
|
if isinstance(lval, MemberExpr) and self.is_self_member_ref(lval):
|
|
3595
3413
|
assert self.type, "Self member outside a class"
|
|
3596
3414
|
cur_node = self.type.names.get(lval.name, None)
|
|
3597
|
-
if (
|
|
3598
|
-
cur_node
|
|
3599
|
-
and isinstance(cur_node.node, Var)
|
|
3600
|
-
and cur_node.node.is_final
|
|
3601
|
-
):
|
|
3415
|
+
if cur_node and isinstance(cur_node.node, Var) and cur_node.node.is_final:
|
|
3602
3416
|
assert self.function_stack
|
|
3603
3417
|
top_function = self.function_stack[-1]
|
|
3604
3418
|
if (
|
|
@@ -3651,11 +3465,7 @@ class SemanticAnalyzer(
|
|
|
3651
3465
|
if len(s.lvalues) == 1 and isinstance(s.lvalues[0], RefExpr):
|
|
3652
3466
|
ref_expr = s.lvalues[0]
|
|
3653
3467
|
safe_literal_inference = True
|
|
3654
|
-
if (
|
|
3655
|
-
self.type
|
|
3656
|
-
and isinstance(ref_expr, NameExpr)
|
|
3657
|
-
and len(self.type.mro) > 1
|
|
3658
|
-
):
|
|
3468
|
+
if self.type and isinstance(ref_expr, NameExpr) and len(self.type.mro) > 1:
|
|
3659
3469
|
# Check if there is a definition in supertype. If yes, we can't safely
|
|
3660
3470
|
# decide here what to infer: int or Literal[42].
|
|
3661
3471
|
safe_literal_inference = self.type.mro[1].get(ref_expr.name) is None
|
|
@@ -3675,9 +3485,7 @@ class SemanticAnalyzer(
|
|
|
3675
3485
|
for lv in s.lvalues
|
|
3676
3486
|
)
|
|
3677
3487
|
|
|
3678
|
-
def analyze_simple_literal_type(
|
|
3679
|
-
self, rvalue: Expression, is_final: bool
|
|
3680
|
-
) -> Type | None:
|
|
3488
|
+
def analyze_simple_literal_type(self, rvalue: Expression, is_final: bool) -> Type | None:
|
|
3681
3489
|
"""Return builtins.int if rvalue is an int literal, etc.
|
|
3682
3490
|
|
|
3683
3491
|
If this is a 'Final' context, we return "Literal[...]" instead.
|
|
@@ -3704,13 +3512,16 @@ class SemanticAnalyzer(
|
|
|
3704
3512
|
|
|
3705
3513
|
typ = self.named_type_or_none(type_name)
|
|
3706
3514
|
if typ and is_final:
|
|
3707
|
-
return typ.copy_modified(
|
|
3708
|
-
last_known_value=LiteralType(value=value, fallback=typ)
|
|
3709
|
-
)
|
|
3515
|
+
return typ.copy_modified(last_known_value=LiteralType(value=value, fallback=typ))
|
|
3710
3516
|
return typ
|
|
3711
3517
|
|
|
3712
3518
|
def analyze_alias(
|
|
3713
|
-
self,
|
|
3519
|
+
self,
|
|
3520
|
+
name: str,
|
|
3521
|
+
rvalue: Expression,
|
|
3522
|
+
allow_placeholder: bool = False,
|
|
3523
|
+
declared_type_vars: TypeVarLikeList | None = None,
|
|
3524
|
+
all_declared_type_params_names: list[str] | None = None,
|
|
3714
3525
|
) -> tuple[Type | None, list[TypeVarLikeType], set[str], list[str], bool]:
|
|
3715
3526
|
"""Check if 'rvalue' is a valid type allowed for aliasing (e.g. not a type variable).
|
|
3716
3527
|
|
|
@@ -3728,18 +3539,28 @@ class SemanticAnalyzer(
|
|
|
3728
3539
|
typ = expr_to_unanalyzed_type(rvalue, self.options, self.is_stub_file)
|
|
3729
3540
|
except TypeTranslationError:
|
|
3730
3541
|
self.fail(
|
|
3731
|
-
"Invalid type alias: expression is not a valid type",
|
|
3732
|
-
rvalue,
|
|
3733
|
-
code=codes.VALID_TYPE,
|
|
3542
|
+
"Invalid type alias: expression is not a valid type", rvalue, code=codes.VALID_TYPE
|
|
3734
3543
|
)
|
|
3735
3544
|
return None, [], set(), [], False
|
|
3736
3545
|
|
|
3737
3546
|
found_type_vars = self.find_type_var_likes(typ)
|
|
3738
3547
|
tvar_defs: list[TypeVarLikeType] = []
|
|
3739
3548
|
namespace = self.qualified_name(name)
|
|
3549
|
+
alias_type_vars = found_type_vars if declared_type_vars is None else declared_type_vars
|
|
3550
|
+
last_tvar_name_with_default: str | None = None
|
|
3740
3551
|
with self.tvar_scope_frame(self.tvar_scope.class_frame(namespace)):
|
|
3741
|
-
for name, tvar_expr in
|
|
3552
|
+
for name, tvar_expr in alias_type_vars:
|
|
3553
|
+
tvar_expr.default = tvar_expr.default.accept(
|
|
3554
|
+
TypeVarDefaultTranslator(self, tvar_expr.name, typ)
|
|
3555
|
+
)
|
|
3742
3556
|
tvar_def = self.tvar_scope.bind_new(name, tvar_expr)
|
|
3557
|
+
if last_tvar_name_with_default is not None and not tvar_def.has_default():
|
|
3558
|
+
self.msg.tvar_without_default_type(
|
|
3559
|
+
tvar_def.name, last_tvar_name_with_default, typ
|
|
3560
|
+
)
|
|
3561
|
+
tvar_def.default = AnyType(TypeOfAny.from_error)
|
|
3562
|
+
elif tvar_def.has_default():
|
|
3563
|
+
last_tvar_name_with_default = tvar_def.name
|
|
3743
3564
|
tvar_defs.append(tvar_def)
|
|
3744
3565
|
|
|
3745
3566
|
analyzed, depends_on = analyze_type_alias(
|
|
@@ -3753,6 +3574,7 @@ class SemanticAnalyzer(
|
|
|
3753
3574
|
in_dynamic_func=dynamic,
|
|
3754
3575
|
global_scope=global_scope,
|
|
3755
3576
|
allowed_alias_tvars=tvar_defs,
|
|
3577
|
+
alias_type_params_names=all_declared_type_params_names,
|
|
3756
3578
|
)
|
|
3757
3579
|
|
|
3758
3580
|
# There can be only one variadic variable at most, the error is reported elsewhere.
|
|
@@ -3765,17 +3587,13 @@ class SemanticAnalyzer(
|
|
|
3765
3587
|
variadic = True
|
|
3766
3588
|
new_tvar_defs.append(td)
|
|
3767
3589
|
|
|
3768
|
-
qualified_tvars = [node.fullname for _name, node in
|
|
3769
|
-
empty_tuple_index = (
|
|
3770
|
-
typ.empty_tuple_index if isinstance(typ, UnboundType) else False
|
|
3771
|
-
)
|
|
3590
|
+
qualified_tvars = [node.fullname for _name, node in alias_type_vars]
|
|
3591
|
+
empty_tuple_index = typ.empty_tuple_index if isinstance(typ, UnboundType) else False
|
|
3772
3592
|
return analyzed, new_tvar_defs, depends_on, qualified_tvars, empty_tuple_index
|
|
3773
3593
|
|
|
3774
3594
|
def is_pep_613(self, s: AssignmentStmt) -> bool:
|
|
3775
3595
|
if s.unanalyzed_type is not None and isinstance(s.unanalyzed_type, UnboundType):
|
|
3776
|
-
lookup = self.lookup_qualified(
|
|
3777
|
-
s.unanalyzed_type.name, s, suppress_errors=True
|
|
3778
|
-
)
|
|
3596
|
+
lookup = self.lookup_qualified(s.unanalyzed_type.name, s, suppress_errors=True)
|
|
3779
3597
|
if lookup and lookup.fullname in TYPE_ALIAS_NAMES:
|
|
3780
3598
|
return True
|
|
3781
3599
|
return False
|
|
@@ -3802,7 +3620,21 @@ class SemanticAnalyzer(
|
|
|
3802
3620
|
# unless using PEP 613 `cls: TypeAlias = A`
|
|
3803
3621
|
return False
|
|
3804
3622
|
|
|
3805
|
-
|
|
3623
|
+
# It can be `A = TypeAliasType('A', ...)` call, in this case,
|
|
3624
|
+
# we just take the second argument and analyze it:
|
|
3625
|
+
type_params: TypeVarLikeList | None
|
|
3626
|
+
all_type_params_names: list[str] | None
|
|
3627
|
+
if self.check_type_alias_type_call(s.rvalue, name=lvalue.name):
|
|
3628
|
+
rvalue = s.rvalue.args[1]
|
|
3629
|
+
pep_695 = True
|
|
3630
|
+
type_params, all_type_params_names = self.analyze_type_alias_type_params(s.rvalue)
|
|
3631
|
+
else:
|
|
3632
|
+
rvalue = s.rvalue
|
|
3633
|
+
pep_695 = False
|
|
3634
|
+
type_params = None
|
|
3635
|
+
all_type_params_names = None
|
|
3636
|
+
|
|
3637
|
+
if isinstance(rvalue, CallExpr) and rvalue.analyzed:
|
|
3806
3638
|
return False
|
|
3807
3639
|
|
|
3808
3640
|
existing = self.current_symbol_table().get(lvalue.name)
|
|
@@ -3814,13 +3646,8 @@ class SemanticAnalyzer(
|
|
|
3814
3646
|
# Don't create an alias in these cases:
|
|
3815
3647
|
if existing and (
|
|
3816
3648
|
isinstance(existing.node, Var) # existing variable
|
|
3817
|
-
or (
|
|
3818
|
-
|
|
3819
|
-
) # existing alias
|
|
3820
|
-
or (
|
|
3821
|
-
isinstance(existing.node, PlaceholderNode)
|
|
3822
|
-
and existing.node.node.line < s.line
|
|
3823
|
-
)
|
|
3649
|
+
or (isinstance(existing.node, TypeAlias) and not s.is_alias_def) # existing alias
|
|
3650
|
+
or (isinstance(existing.node, PlaceholderNode) and existing.node.node.line < s.line)
|
|
3824
3651
|
): # previous incomplete definition
|
|
3825
3652
|
# TODO: find a more robust way to track the order of definitions.
|
|
3826
3653
|
# Note: if is_alias_def=True, this is just a node from previous iteration.
|
|
@@ -3833,7 +3660,7 @@ class SemanticAnalyzer(
|
|
|
3833
3660
|
return False
|
|
3834
3661
|
|
|
3835
3662
|
non_global_scope = self.type or self.is_func_scope()
|
|
3836
|
-
if not pep_613 and isinstance(
|
|
3663
|
+
if not pep_613 and not pep_695 and isinstance(rvalue, RefExpr) and non_global_scope:
|
|
3837
3664
|
# Fourth rule (special case): Non-subscripted right hand side creates a variable
|
|
3838
3665
|
# at class and function scopes. For example:
|
|
3839
3666
|
#
|
|
@@ -3845,8 +3672,7 @@ class SemanticAnalyzer(
|
|
|
3845
3672
|
# without this rule, this typical use case will require a lot of explicit
|
|
3846
3673
|
# annotations (see the second rule).
|
|
3847
3674
|
return False
|
|
3848
|
-
|
|
3849
|
-
if not pep_613 and not self.can_be_type_alias(rvalue):
|
|
3675
|
+
if not pep_613 and not pep_695 and not self.can_be_type_alias(rvalue):
|
|
3850
3676
|
return False
|
|
3851
3677
|
|
|
3852
3678
|
if existing and not isinstance(existing.node, (PlaceholderNode, TypeAlias)):
|
|
@@ -3862,13 +3688,13 @@ class SemanticAnalyzer(
|
|
|
3862
3688
|
empty_tuple_index = False
|
|
3863
3689
|
else:
|
|
3864
3690
|
tag = self.track_incomplete_refs()
|
|
3865
|
-
(
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
)
|
|
3691
|
+
res, alias_tvars, depends_on, qualified_tvars, empty_tuple_index = self.analyze_alias(
|
|
3692
|
+
lvalue.name,
|
|
3693
|
+
rvalue,
|
|
3694
|
+
allow_placeholder=True,
|
|
3695
|
+
declared_type_vars=type_params,
|
|
3696
|
+
all_declared_type_params_names=all_type_params_names,
|
|
3697
|
+
)
|
|
3872
3698
|
if not res:
|
|
3873
3699
|
return False
|
|
3874
3700
|
if not self.is_func_scope():
|
|
@@ -3892,26 +3718,24 @@ class SemanticAnalyzer(
|
|
|
3892
3718
|
# The above are only direct deps on other aliases.
|
|
3893
3719
|
# For subscripted aliases, type deps from expansion are added in deps.py
|
|
3894
3720
|
# (because the type is stored).
|
|
3895
|
-
check_for_explicit_any(
|
|
3896
|
-
res, self.options, self.is_typeshed_stub_file, self.msg, context=s
|
|
3897
|
-
)
|
|
3721
|
+
check_for_explicit_any(res, self.options, self.is_typeshed_stub_file, self.msg, context=s)
|
|
3898
3722
|
# When this type alias gets "inlined", the Any is not explicit anymore,
|
|
3899
3723
|
# so we need to replace it with non-explicit Anys.
|
|
3900
3724
|
res = make_any_non_explicit(res)
|
|
3901
3725
|
# Note: with the new (lazy) type alias representation we only need to set no_args to True
|
|
3902
|
-
# if the expected number of arguments is non-zero, so that aliases like A = List work
|
|
3726
|
+
# if the expected number of arguments is non-zero, so that aliases like `A = List` work
|
|
3727
|
+
# but not aliases like `A = TypeAliasType("A", List)` as these need explicit type params.
|
|
3903
3728
|
# However, eagerly expanding aliases like Text = str is a nice performance optimization.
|
|
3904
3729
|
no_args = (
|
|
3905
3730
|
isinstance(res, ProperType)
|
|
3906
3731
|
and isinstance(res, Instance)
|
|
3907
3732
|
and not res.args
|
|
3908
3733
|
and not empty_tuple_index
|
|
3734
|
+
and not pep_695
|
|
3909
3735
|
)
|
|
3910
3736
|
if isinstance(res, ProperType) and isinstance(res, Instance):
|
|
3911
3737
|
if not validate_instance(res, self.fail, empty_tuple_index):
|
|
3912
|
-
fix_instance(
|
|
3913
|
-
res, self.fail, self.note, disallow_any=False, options=self.options
|
|
3914
|
-
)
|
|
3738
|
+
fix_instance(res, self.fail, self.note, disallow_any=False, options=self.options)
|
|
3915
3739
|
# Aliases defined within functions can't be accessed outside
|
|
3916
3740
|
# the function, since the symbol table will no longer
|
|
3917
3741
|
# exist. Work around by expanding them eagerly when used.
|
|
@@ -3971,11 +3795,95 @@ class SemanticAnalyzer(
|
|
|
3971
3795
|
if self.type.is_protocol:
|
|
3972
3796
|
self.fail("Type aliases are prohibited in protocol bodies", s)
|
|
3973
3797
|
if not lvalue.name[0].isupper():
|
|
3974
|
-
self.note(
|
|
3975
|
-
"Use variable annotation syntax to define protocol members", s
|
|
3976
|
-
)
|
|
3798
|
+
self.note("Use variable annotation syntax to define protocol members", s)
|
|
3977
3799
|
return True
|
|
3978
3800
|
|
|
3801
|
+
def check_type_alias_type_call(self, rvalue: Expression, *, name: str) -> TypeGuard[CallExpr]:
|
|
3802
|
+
if not isinstance(rvalue, CallExpr):
|
|
3803
|
+
return False
|
|
3804
|
+
|
|
3805
|
+
names = ["typing_extensions.TypeAliasType"]
|
|
3806
|
+
if self.options.python_version >= (3, 12):
|
|
3807
|
+
names.append("typing.TypeAliasType")
|
|
3808
|
+
if not refers_to_fullname(rvalue.callee, tuple(names)):
|
|
3809
|
+
return False
|
|
3810
|
+
|
|
3811
|
+
return self.check_typevarlike_name(rvalue, name, rvalue)
|
|
3812
|
+
|
|
3813
|
+
def analyze_type_alias_type_params(
|
|
3814
|
+
self, rvalue: CallExpr
|
|
3815
|
+
) -> tuple[TypeVarLikeList, list[str]]:
|
|
3816
|
+
"""Analyze type_params of TypeAliasType.
|
|
3817
|
+
|
|
3818
|
+
Returns declared unbound type variable expressions and a list of all decalred type
|
|
3819
|
+
variable names for error reporting.
|
|
3820
|
+
"""
|
|
3821
|
+
if "type_params" in rvalue.arg_names:
|
|
3822
|
+
type_params_arg = rvalue.args[rvalue.arg_names.index("type_params")]
|
|
3823
|
+
if not isinstance(type_params_arg, TupleExpr):
|
|
3824
|
+
self.fail(
|
|
3825
|
+
"Tuple literal expected as the type_params argument to TypeAliasType",
|
|
3826
|
+
type_params_arg,
|
|
3827
|
+
)
|
|
3828
|
+
return [], []
|
|
3829
|
+
type_params = type_params_arg.items
|
|
3830
|
+
else:
|
|
3831
|
+
return [], []
|
|
3832
|
+
|
|
3833
|
+
declared_tvars: TypeVarLikeList = []
|
|
3834
|
+
all_declared_tvar_names: list[str] = [] # includes bound type variables
|
|
3835
|
+
have_type_var_tuple = False
|
|
3836
|
+
for tp_expr in type_params:
|
|
3837
|
+
if isinstance(tp_expr, StarExpr):
|
|
3838
|
+
tp_expr.valid = False
|
|
3839
|
+
self.analyze_type_expr(tp_expr)
|
|
3840
|
+
try:
|
|
3841
|
+
base = self.expr_to_unanalyzed_type(tp_expr)
|
|
3842
|
+
except TypeTranslationError:
|
|
3843
|
+
continue
|
|
3844
|
+
if not isinstance(base, UnboundType):
|
|
3845
|
+
continue
|
|
3846
|
+
|
|
3847
|
+
tag = self.track_incomplete_refs()
|
|
3848
|
+
tvar = self.analyze_unbound_tvar_impl(base, is_typealias_param=True)
|
|
3849
|
+
if tvar:
|
|
3850
|
+
if isinstance(tvar[1], TypeVarTupleExpr):
|
|
3851
|
+
if have_type_var_tuple:
|
|
3852
|
+
self.fail(
|
|
3853
|
+
"Can only use one TypeVarTuple in type_params argument to TypeAliasType",
|
|
3854
|
+
base,
|
|
3855
|
+
code=codes.TYPE_VAR,
|
|
3856
|
+
)
|
|
3857
|
+
have_type_var_tuple = True
|
|
3858
|
+
continue
|
|
3859
|
+
have_type_var_tuple = True
|
|
3860
|
+
elif not self.found_incomplete_ref(tag):
|
|
3861
|
+
sym = self.lookup_qualified(base.name, base)
|
|
3862
|
+
if sym and isinstance(sym.node, TypeVarLikeExpr):
|
|
3863
|
+
all_declared_tvar_names.append(sym.node.name) # Error will be reported later
|
|
3864
|
+
else:
|
|
3865
|
+
self.fail(
|
|
3866
|
+
"Free type variable expected in type_params argument to TypeAliasType",
|
|
3867
|
+
base,
|
|
3868
|
+
code=codes.TYPE_VAR,
|
|
3869
|
+
)
|
|
3870
|
+
if sym and sym.fullname in ("typing.Unpack", "typing_extensions.Unpack"):
|
|
3871
|
+
self.note(
|
|
3872
|
+
"Don't Unpack type variables in type_params", base, code=codes.TYPE_VAR
|
|
3873
|
+
)
|
|
3874
|
+
continue
|
|
3875
|
+
if tvar in declared_tvars:
|
|
3876
|
+
self.fail(
|
|
3877
|
+
f'Duplicate type variable "{tvar[0]}" in type_params argument to TypeAliasType',
|
|
3878
|
+
base,
|
|
3879
|
+
code=codes.TYPE_VAR,
|
|
3880
|
+
)
|
|
3881
|
+
continue
|
|
3882
|
+
if tvar:
|
|
3883
|
+
all_declared_tvar_names.append(tvar[0])
|
|
3884
|
+
declared_tvars.append(tvar)
|
|
3885
|
+
return declared_tvars, all_declared_tvar_names
|
|
3886
|
+
|
|
3979
3887
|
def disable_invalid_recursive_aliases(
|
|
3980
3888
|
self, s: AssignmentStmt, current_node: TypeAlias
|
|
3981
3889
|
) -> None:
|
|
@@ -3983,17 +3891,13 @@ class SemanticAnalyzer(
|
|
|
3983
3891
|
messages = []
|
|
3984
3892
|
if is_invalid_recursive_alias({current_node}, current_node.target):
|
|
3985
3893
|
target = (
|
|
3986
|
-
"tuple"
|
|
3987
|
-
if isinstance(get_proper_type(current_node.target), TupleType)
|
|
3988
|
-
else "union"
|
|
3894
|
+
"tuple" if isinstance(get_proper_type(current_node.target), TupleType) else "union"
|
|
3989
3895
|
)
|
|
3990
3896
|
messages.append(f"Invalid recursive alias: a {target} item of itself")
|
|
3991
3897
|
if detect_diverging_alias(
|
|
3992
3898
|
current_node, current_node.target, self.lookup_qualified, self.tvar_scope
|
|
3993
3899
|
):
|
|
3994
|
-
messages.append(
|
|
3995
|
-
"Invalid recursive alias: type variable nesting on right hand side"
|
|
3996
|
-
)
|
|
3900
|
+
messages.append("Invalid recursive alias: type variable nesting on right hand side")
|
|
3997
3901
|
if messages:
|
|
3998
3902
|
current_node.target = AnyType(TypeOfAny.from_error)
|
|
3999
3903
|
s.invalid_recursive_alias = True
|
|
@@ -4020,9 +3924,7 @@ class SemanticAnalyzer(
|
|
|
4020
3924
|
https://www.python.org/dev/peps/pep-0572/#scope-of-the-target
|
|
4021
3925
|
"""
|
|
4022
3926
|
if escape_comprehensions:
|
|
4023
|
-
assert isinstance(
|
|
4024
|
-
lval, NameExpr
|
|
4025
|
-
), "assignment expression target must be NameExpr"
|
|
3927
|
+
assert isinstance(lval, NameExpr), "assignment expression target must be NameExpr"
|
|
4026
3928
|
if isinstance(lval, NameExpr):
|
|
4027
3929
|
self.analyze_name_lvalue(
|
|
4028
3930
|
lval,
|
|
@@ -4032,13 +3934,9 @@ class SemanticAnalyzer(
|
|
|
4032
3934
|
has_explicit_value=has_explicit_value,
|
|
4033
3935
|
)
|
|
4034
3936
|
elif isinstance(lval, MemberExpr):
|
|
4035
|
-
self.analyze_member_lvalue(
|
|
4036
|
-
lval, explicit_type, is_final, has_explicit_value
|
|
4037
|
-
)
|
|
3937
|
+
self.analyze_member_lvalue(lval, explicit_type, is_final, has_explicit_value)
|
|
4038
3938
|
if explicit_type and not self.is_self_member_ref(lval):
|
|
4039
|
-
self.fail(
|
|
4040
|
-
"Type cannot be declared in assignment to non-self attribute", lval
|
|
4041
|
-
)
|
|
3939
|
+
self.fail("Type cannot be declared in assignment to non-self attribute", lval)
|
|
4042
3940
|
elif isinstance(lval, IndexExpr):
|
|
4043
3941
|
if explicit_type:
|
|
4044
3942
|
self.fail("Unexpected type declaration", lval)
|
|
@@ -4093,12 +3991,8 @@ class SemanticAnalyzer(
|
|
|
4093
3991
|
|
|
4094
3992
|
if (not existing or isinstance(existing.node, PlaceholderNode)) and not outer:
|
|
4095
3993
|
# Define new variable.
|
|
4096
|
-
var = self.make_name_lvalue_var(
|
|
4097
|
-
|
|
4098
|
-
)
|
|
4099
|
-
added = self.add_symbol(
|
|
4100
|
-
name, var, lvalue, escape_comprehensions=escape_comprehensions
|
|
4101
|
-
)
|
|
3994
|
+
var = self.make_name_lvalue_var(lvalue, kind, not explicit_type, has_explicit_value)
|
|
3995
|
+
added = self.add_symbol(name, var, lvalue, escape_comprehensions=escape_comprehensions)
|
|
4102
3996
|
# Only bind expression if we successfully added name to symbol table.
|
|
4103
3997
|
if added:
|
|
4104
3998
|
lvalue.is_new_def = True
|
|
@@ -4121,9 +4015,7 @@ class SemanticAnalyzer(
|
|
|
4121
4015
|
|
|
4122
4016
|
def is_final_redefinition(self, kind: int, name: str) -> bool:
|
|
4123
4017
|
if kind == GDEF:
|
|
4124
|
-
return self.is_mangled_global(name) and not self.is_initial_mangled_global(
|
|
4125
|
-
name
|
|
4126
|
-
)
|
|
4018
|
+
return self.is_mangled_global(name) and not self.is_initial_mangled_global(name)
|
|
4127
4019
|
elif kind == MDEF and self.type:
|
|
4128
4020
|
return unmangle(name) + "'" in self.type.names
|
|
4129
4021
|
return False
|
|
@@ -4199,9 +4091,7 @@ class SemanticAnalyzer(
|
|
|
4199
4091
|
self.name_not_defined(lval.name, lval)
|
|
4200
4092
|
self.check_lvalue_validity(lval.node, lval)
|
|
4201
4093
|
|
|
4202
|
-
def analyze_tuple_or_list_lvalue(
|
|
4203
|
-
self, lval: TupleExpr, explicit_type: bool = False
|
|
4204
|
-
) -> None:
|
|
4094
|
+
def analyze_tuple_or_list_lvalue(self, lval: TupleExpr, explicit_type: bool = False) -> None:
|
|
4205
4095
|
"""Analyze an lvalue or assignment target that is a list or tuple."""
|
|
4206
4096
|
items = lval.items
|
|
4207
4097
|
star_exprs = [item for item in items if isinstance(item, StarExpr)]
|
|
@@ -4222,11 +4112,7 @@ class SemanticAnalyzer(
|
|
|
4222
4112
|
)
|
|
4223
4113
|
|
|
4224
4114
|
def analyze_member_lvalue(
|
|
4225
|
-
self,
|
|
4226
|
-
lval: MemberExpr,
|
|
4227
|
-
explicit_type: bool,
|
|
4228
|
-
is_final: bool,
|
|
4229
|
-
has_explicit_value: bool,
|
|
4115
|
+
self, lval: MemberExpr, explicit_type: bool, is_final: bool, has_explicit_value: bool
|
|
4230
4116
|
) -> None:
|
|
4231
4117
|
"""Analyze lvalue that is a member expression.
|
|
4232
4118
|
|
|
@@ -4265,21 +4151,14 @@ class SemanticAnalyzer(
|
|
|
4265
4151
|
# If the attribute of self is not defined, create a new Var, ...
|
|
4266
4152
|
node is None
|
|
4267
4153
|
# ... or if it is defined as abstract in a *superclass*.
|
|
4268
|
-
or (
|
|
4269
|
-
cur_node is None
|
|
4270
|
-
and isinstance(node.node, Var)
|
|
4271
|
-
and node.node.is_abstract_var
|
|
4272
|
-
)
|
|
4154
|
+
or (cur_node is None and isinstance(node.node, Var) and node.node.is_abstract_var)
|
|
4273
4155
|
# ... also an explicit declaration on self also creates a new Var.
|
|
4274
4156
|
# Note that `explicit_type` might have been erased for bare `Final`,
|
|
4275
4157
|
# so we also check if `is_final` is passed.
|
|
4276
4158
|
or (cur_node is None and (explicit_type or is_final))
|
|
4277
4159
|
):
|
|
4278
4160
|
if self.type.is_protocol and node is None:
|
|
4279
|
-
self.fail(
|
|
4280
|
-
"Protocol members cannot be defined via assignment to self",
|
|
4281
|
-
lval,
|
|
4282
|
-
)
|
|
4161
|
+
self.fail("Protocol members cannot be defined via assignment to self", lval)
|
|
4283
4162
|
else:
|
|
4284
4163
|
# Implicit attribute definition in __init__.
|
|
4285
4164
|
lval.is_new_def = True
|
|
@@ -4303,9 +4182,7 @@ class SemanticAnalyzer(
|
|
|
4303
4182
|
node = memberexpr.expr.node
|
|
4304
4183
|
return isinstance(node, Var) and node.is_self
|
|
4305
4184
|
|
|
4306
|
-
def check_lvalue_validity(
|
|
4307
|
-
self, node: Expression | SymbolNode | None, ctx: Context
|
|
4308
|
-
) -> None:
|
|
4185
|
+
def check_lvalue_validity(self, node: Expression | SymbolNode | None, ctx: Context) -> None:
|
|
4309
4186
|
if isinstance(node, TypeVarExpr):
|
|
4310
4187
|
self.fail("Invalid assignment target", ctx)
|
|
4311
4188
|
elif isinstance(node, TypeInfo):
|
|
@@ -4350,9 +4227,7 @@ class SemanticAnalyzer(
|
|
|
4350
4227
|
Return True if this looks like a type variable declaration (but maybe
|
|
4351
4228
|
with errors), otherwise return False.
|
|
4352
4229
|
"""
|
|
4353
|
-
call = self.get_typevarlike_declaration(
|
|
4354
|
-
s, ("typing.TypeVar", "typing_extensions.TypeVar")
|
|
4355
|
-
)
|
|
4230
|
+
call = self.get_typevarlike_declaration(s, ("typing.TypeVar", "typing_extensions.TypeVar"))
|
|
4356
4231
|
if not call:
|
|
4357
4232
|
return False
|
|
4358
4233
|
|
|
@@ -4427,34 +4302,25 @@ class SemanticAnalyzer(
|
|
|
4427
4302
|
if any(has_placeholder(v) for v in values):
|
|
4428
4303
|
self.process_placeholder(None, "TypeVar values", s, force_progress=updated)
|
|
4429
4304
|
elif has_placeholder(upper_bound):
|
|
4430
|
-
self.process_placeholder(
|
|
4431
|
-
None, "TypeVar upper bound", s, force_progress=updated
|
|
4432
|
-
)
|
|
4305
|
+
self.process_placeholder(None, "TypeVar upper bound", s, force_progress=updated)
|
|
4433
4306
|
elif has_placeholder(default):
|
|
4434
4307
|
self.process_placeholder(None, "TypeVar default", s, force_progress=updated)
|
|
4435
4308
|
|
|
4436
4309
|
self.add_symbol(name, call.analyzed, s)
|
|
4437
4310
|
return True
|
|
4438
4311
|
|
|
4439
|
-
def check_typevarlike_name(
|
|
4440
|
-
self, call: CallExpr, name: str, context: Context
|
|
4441
|
-
) -> bool:
|
|
4312
|
+
def check_typevarlike_name(self, call: CallExpr, name: str, context: Context) -> bool:
|
|
4442
4313
|
"""Checks that the name of a TypeVar or ParamSpec matches its variable."""
|
|
4443
4314
|
name = unmangle(name)
|
|
4444
4315
|
assert isinstance(call.callee, RefExpr)
|
|
4445
4316
|
typevarlike_type = (
|
|
4446
|
-
call.callee.name
|
|
4447
|
-
if isinstance(call.callee, NameExpr)
|
|
4448
|
-
else call.callee.fullname
|
|
4317
|
+
call.callee.name if isinstance(call.callee, NameExpr) else call.callee.fullname
|
|
4449
4318
|
)
|
|
4450
4319
|
if len(call.args) < 1:
|
|
4451
4320
|
self.fail(f"Too few arguments for {typevarlike_type}()", context)
|
|
4452
4321
|
return False
|
|
4453
4322
|
if not isinstance(call.args[0], StrExpr) or call.arg_kinds[0] != ARG_POS:
|
|
4454
|
-
self.fail(
|
|
4455
|
-
f"{typevarlike_type}() expects a string literal as first argument",
|
|
4456
|
-
context,
|
|
4457
|
-
)
|
|
4323
|
+
self.fail(f"{typevarlike_type}() expects a string literal as first argument", context)
|
|
4458
4324
|
return False
|
|
4459
4325
|
elif call.args[0].value != name:
|
|
4460
4326
|
msg = 'String argument 1 "{}" to {}(...) does not match variable name "{}"'
|
|
@@ -4498,62 +4364,42 @@ class SemanticAnalyzer(
|
|
|
4498
4364
|
self.fail(message_registry.TYPEVAR_UNEXPECTED_ARGUMENT, context)
|
|
4499
4365
|
return None
|
|
4500
4366
|
if param_name == "covariant":
|
|
4501
|
-
if isinstance(param_value, NameExpr) and param_value.name in (
|
|
4502
|
-
"True",
|
|
4503
|
-
"False",
|
|
4504
|
-
):
|
|
4367
|
+
if isinstance(param_value, NameExpr) and param_value.name in ("True", "False"):
|
|
4505
4368
|
covariant = param_value.name == "True"
|
|
4506
4369
|
else:
|
|
4507
|
-
self.fail(
|
|
4508
|
-
message_registry.TYPEVAR_VARIANCE_DEF.format("covariant"),
|
|
4509
|
-
context,
|
|
4510
|
-
)
|
|
4370
|
+
self.fail(message_registry.TYPEVAR_VARIANCE_DEF.format("covariant"), context)
|
|
4511
4371
|
return None
|
|
4512
4372
|
elif param_name == "contravariant":
|
|
4513
|
-
if isinstance(param_value, NameExpr) and param_value.name in (
|
|
4514
|
-
"True",
|
|
4515
|
-
"False",
|
|
4516
|
-
):
|
|
4373
|
+
if isinstance(param_value, NameExpr) and param_value.name in ("True", "False"):
|
|
4517
4374
|
contravariant = param_value.name == "True"
|
|
4518
4375
|
else:
|
|
4519
4376
|
self.fail(
|
|
4520
|
-
message_registry.TYPEVAR_VARIANCE_DEF.format("contravariant"),
|
|
4521
|
-
context,
|
|
4377
|
+
message_registry.TYPEVAR_VARIANCE_DEF.format("contravariant"), context
|
|
4522
4378
|
)
|
|
4523
4379
|
return None
|
|
4524
4380
|
elif param_name == "bound":
|
|
4525
4381
|
if has_values:
|
|
4526
|
-
self.fail(
|
|
4527
|
-
"TypeVar cannot have both values and an upper bound", context
|
|
4528
|
-
)
|
|
4382
|
+
self.fail("TypeVar cannot have both values and an upper bound", context)
|
|
4529
4383
|
return None
|
|
4530
|
-
tv_arg = self.get_typevarlike_argument(
|
|
4531
|
-
"TypeVar", param_name, param_value, context
|
|
4532
|
-
)
|
|
4384
|
+
tv_arg = self.get_typevarlike_argument("TypeVar", param_name, param_value, context)
|
|
4533
4385
|
if tv_arg is None:
|
|
4534
4386
|
return None
|
|
4535
4387
|
upper_bound = tv_arg
|
|
4536
4388
|
elif param_name == "default":
|
|
4537
4389
|
tv_arg = self.get_typevarlike_argument(
|
|
4538
|
-
"TypeVar",
|
|
4539
|
-
param_name,
|
|
4540
|
-
param_value,
|
|
4541
|
-
context,
|
|
4542
|
-
allow_unbound_tvars=True,
|
|
4390
|
+
"TypeVar", param_name, param_value, context, allow_unbound_tvars=True
|
|
4543
4391
|
)
|
|
4544
4392
|
default = tv_arg or AnyType(TypeOfAny.from_error)
|
|
4545
4393
|
elif param_name == "values":
|
|
4546
4394
|
# Probably using obsolete syntax with values=(...). Explain the current syntax.
|
|
4547
4395
|
self.fail('TypeVar "values" argument not supported', context)
|
|
4548
4396
|
self.fail(
|
|
4549
|
-
"Use TypeVar('T', t, ...) instead of TypeVar('T', values=(t, ...))",
|
|
4550
|
-
context,
|
|
4397
|
+
"Use TypeVar('T', t, ...) instead of TypeVar('T', values=(t, ...))", context
|
|
4551
4398
|
)
|
|
4552
4399
|
return None
|
|
4553
4400
|
else:
|
|
4554
4401
|
self.fail(
|
|
4555
|
-
f'{message_registry.TYPEVAR_UNEXPECTED_ARGUMENT}: "{param_name}"',
|
|
4556
|
-
context,
|
|
4402
|
+
f'{message_registry.TYPEVAR_UNEXPECTED_ARGUMENT}: "{param_name}"', context
|
|
4557
4403
|
)
|
|
4558
4404
|
return None
|
|
4559
4405
|
|
|
@@ -4603,15 +4449,9 @@ class SemanticAnalyzer(
|
|
|
4603
4449
|
# ...
|
|
4604
4450
|
analyzed = PlaceholderType(None, [], context.line)
|
|
4605
4451
|
typ = get_proper_type(analyzed)
|
|
4606
|
-
if (
|
|
4607
|
-
report_invalid_typevar_arg
|
|
4608
|
-
and isinstance(typ, AnyType)
|
|
4609
|
-
and typ.is_from_error
|
|
4610
|
-
):
|
|
4452
|
+
if report_invalid_typevar_arg and isinstance(typ, AnyType) and typ.is_from_error:
|
|
4611
4453
|
self.fail(
|
|
4612
|
-
message_registry.TYPEVAR_ARG_MUST_BE_TYPE.format(
|
|
4613
|
-
typevarlike_name, param_name
|
|
4614
|
-
),
|
|
4454
|
+
message_registry.TYPEVAR_ARG_MUST_BE_TYPE.format(typevarlike_name, param_name),
|
|
4615
4455
|
param_value,
|
|
4616
4456
|
)
|
|
4617
4457
|
# Note: we do not return 'None' here -- we want to continue
|
|
@@ -4620,9 +4460,7 @@ class SemanticAnalyzer(
|
|
|
4620
4460
|
except TypeTranslationError:
|
|
4621
4461
|
if report_invalid_typevar_arg:
|
|
4622
4462
|
self.fail(
|
|
4623
|
-
message_registry.TYPEVAR_ARG_MUST_BE_TYPE.format(
|
|
4624
|
-
typevarlike_name, param_name
|
|
4625
|
-
),
|
|
4463
|
+
message_registry.TYPEVAR_ARG_MUST_BE_TYPE.format(typevarlike_name, param_name),
|
|
4626
4464
|
param_value,
|
|
4627
4465
|
)
|
|
4628
4466
|
return None
|
|
@@ -4683,8 +4521,7 @@ class SemanticAnalyzer(
|
|
|
4683
4521
|
typ = get_proper_type(arg_type)
|
|
4684
4522
|
if isinstance(typ, AnyType) and typ.is_from_error:
|
|
4685
4523
|
self.fail(
|
|
4686
|
-
f"Argument {i} of ParamSpec default must be a type",
|
|
4687
|
-
param_value,
|
|
4524
|
+
f"Argument {i} of ParamSpec default must be a type", param_value
|
|
4688
4525
|
)
|
|
4689
4526
|
elif (
|
|
4690
4527
|
isinstance(default, AnyType)
|
|
@@ -4721,9 +4558,7 @@ class SemanticAnalyzer(
|
|
|
4721
4558
|
updated = default != call.analyzed.default
|
|
4722
4559
|
call.analyzed.default = default
|
|
4723
4560
|
if has_placeholder(default):
|
|
4724
|
-
self.process_placeholder(
|
|
4725
|
-
None, "ParamSpec default", s, force_progress=updated
|
|
4726
|
-
)
|
|
4561
|
+
self.process_placeholder(None, "ParamSpec default", s, force_progress=updated)
|
|
4727
4562
|
|
|
4728
4563
|
self.add_symbol(name, call.analyzed, s)
|
|
4729
4564
|
return True
|
|
@@ -4765,9 +4600,7 @@ class SemanticAnalyzer(
|
|
|
4765
4600
|
)
|
|
4766
4601
|
default = AnyType(TypeOfAny.from_error)
|
|
4767
4602
|
else:
|
|
4768
|
-
self.fail(
|
|
4769
|
-
f'Unexpected keyword argument "{param_name}" for "TypeVarTuple"', s
|
|
4770
|
-
)
|
|
4603
|
+
self.fail(f'Unexpected keyword argument "{param_name}" for "TypeVarTuple"', s)
|
|
4771
4604
|
|
|
4772
4605
|
name = self.extract_typevarlike_name(s, call)
|
|
4773
4606
|
if name is None:
|
|
@@ -4793,16 +4626,12 @@ class SemanticAnalyzer(
|
|
|
4793
4626
|
updated = default != call.analyzed.default
|
|
4794
4627
|
call.analyzed.default = default
|
|
4795
4628
|
if has_placeholder(default):
|
|
4796
|
-
self.process_placeholder(
|
|
4797
|
-
None, "TypeVarTuple default", s, force_progress=updated
|
|
4798
|
-
)
|
|
4629
|
+
self.process_placeholder(None, "TypeVarTuple default", s, force_progress=updated)
|
|
4799
4630
|
|
|
4800
4631
|
self.add_symbol(name, call.analyzed, s)
|
|
4801
4632
|
return True
|
|
4802
4633
|
|
|
4803
|
-
def basic_new_typeinfo(
|
|
4804
|
-
self, name: str, basetype_or_fallback: Instance, line: int
|
|
4805
|
-
) -> TypeInfo:
|
|
4634
|
+
def basic_new_typeinfo(self, name: str, basetype_or_fallback: Instance, line: int) -> TypeInfo:
|
|
4806
4635
|
if self.is_func_scope() and not self.type and "@" not in name:
|
|
4807
4636
|
name += "@" + str(line)
|
|
4808
4637
|
class_def = ClassDef(name, Block([]))
|
|
@@ -4955,16 +4784,11 @@ class SemanticAnalyzer(
|
|
|
4955
4784
|
continue
|
|
4956
4785
|
|
|
4957
4786
|
if lnode:
|
|
4958
|
-
if (
|
|
4959
|
-
isinstance(lnode.node, MypyFile)
|
|
4960
|
-
and lnode.node is not rnode.node
|
|
4961
|
-
):
|
|
4787
|
+
if isinstance(lnode.node, MypyFile) and lnode.node is not rnode.node:
|
|
4962
4788
|
assert isinstance(lval, (NameExpr, MemberExpr))
|
|
4963
4789
|
self.fail(
|
|
4964
4790
|
'Cannot assign multiple modules to name "{}" '
|
|
4965
|
-
'without explicit "types.ModuleType" annotation'.format(
|
|
4966
|
-
lval.name
|
|
4967
|
-
),
|
|
4791
|
+
'without explicit "types.ModuleType" annotation'.format(lval.name),
|
|
4968
4792
|
ctx,
|
|
4969
4793
|
)
|
|
4970
4794
|
# never create module alias except on initial var definition
|
|
@@ -4994,18 +4818,13 @@ class SemanticAnalyzer(
|
|
|
4994
4818
|
):
|
|
4995
4819
|
rvalue = s.rvalue
|
|
4996
4820
|
if not isinstance(rvalue, (ListExpr, TupleExpr)):
|
|
4997
|
-
self.fail(
|
|
4998
|
-
'"__deletable__" must be initialized with a list or tuple expression',
|
|
4999
|
-
s,
|
|
5000
|
-
)
|
|
4821
|
+
self.fail('"__deletable__" must be initialized with a list or tuple expression', s)
|
|
5001
4822
|
return
|
|
5002
4823
|
items = rvalue.items
|
|
5003
4824
|
attrs = []
|
|
5004
4825
|
for item in items:
|
|
5005
4826
|
if not isinstance(item, StrExpr):
|
|
5006
|
-
self.fail(
|
|
5007
|
-
'Invalid "__deletable__" item; string literal expected', item
|
|
5008
|
-
)
|
|
4827
|
+
self.fail('Invalid "__deletable__" item; string literal expected', item)
|
|
5009
4828
|
else:
|
|
5010
4829
|
attrs.append(item.value)
|
|
5011
4830
|
assert self.type
|
|
@@ -5026,9 +4845,7 @@ class SemanticAnalyzer(
|
|
|
5026
4845
|
and s.lvalues[0].kind == MDEF
|
|
5027
4846
|
):
|
|
5028
4847
|
# We understand `__slots__` defined as string, tuple, list, set, and dict:
|
|
5029
|
-
if not isinstance(
|
|
5030
|
-
s.rvalue, (StrExpr, ListExpr, TupleExpr, SetExpr, DictExpr)
|
|
5031
|
-
):
|
|
4848
|
+
if not isinstance(s.rvalue, (StrExpr, ListExpr, TupleExpr, SetExpr, DictExpr)):
|
|
5032
4849
|
# For example, `__slots__` can be defined as a variable,
|
|
5033
4850
|
# we don't support it for now.
|
|
5034
4851
|
return
|
|
@@ -5136,9 +4953,7 @@ class SemanticAnalyzer(
|
|
|
5136
4953
|
def visit_for_stmt(self, s: ForStmt) -> None:
|
|
5137
4954
|
if s.is_async:
|
|
5138
4955
|
if not self.is_func_scope() or not self.function_stack[-1].is_coroutine:
|
|
5139
|
-
self.fail(
|
|
5140
|
-
message_registry.ASYNC_FOR_OUTSIDE_COROUTINE, s, code=codes.SYNTAX
|
|
5141
|
-
)
|
|
4956
|
+
self.fail(message_registry.ASYNC_FOR_OUTSIDE_COROUTINE, s, code=codes.SYNTAX)
|
|
5142
4957
|
|
|
5143
4958
|
self.statement = s
|
|
5144
4959
|
s.expr.accept(self)
|
|
@@ -5149,9 +4964,7 @@ class SemanticAnalyzer(
|
|
|
5149
4964
|
if self.is_classvar(s.index_type):
|
|
5150
4965
|
self.fail_invalid_classvar(s.index)
|
|
5151
4966
|
allow_tuple_literal = isinstance(s.index, TupleExpr)
|
|
5152
|
-
analyzed = self.anal_type(
|
|
5153
|
-
s.index_type, allow_tuple_literal=allow_tuple_literal
|
|
5154
|
-
)
|
|
4967
|
+
analyzed = self.anal_type(s.index_type, allow_tuple_literal=allow_tuple_literal)
|
|
5155
4968
|
if analyzed is not None:
|
|
5156
4969
|
self.store_declared_types(s.index, analyzed)
|
|
5157
4970
|
s.index_type = analyzed
|
|
@@ -5203,9 +5016,7 @@ class SemanticAnalyzer(
|
|
|
5203
5016
|
|
|
5204
5017
|
if s.is_async:
|
|
5205
5018
|
if not self.is_func_scope() or not self.function_stack[-1].is_coroutine:
|
|
5206
|
-
self.fail(
|
|
5207
|
-
message_registry.ASYNC_WITH_OUTSIDE_COROUTINE, s, code=codes.SYNTAX
|
|
5208
|
-
)
|
|
5019
|
+
self.fail(message_registry.ASYNC_WITH_OUTSIDE_COROUTINE, s, code=codes.SYNTAX)
|
|
5209
5020
|
|
|
5210
5021
|
if s.unanalyzed_type:
|
|
5211
5022
|
assert isinstance(s.unanalyzed_type, ProperType)
|
|
@@ -5239,9 +5050,7 @@ class SemanticAnalyzer(
|
|
|
5239
5050
|
if self.is_classvar(t):
|
|
5240
5051
|
self.fail_invalid_classvar(n)
|
|
5241
5052
|
allow_tuple_literal = isinstance(n, TupleExpr)
|
|
5242
|
-
analyzed = self.anal_type(
|
|
5243
|
-
t, allow_tuple_literal=allow_tuple_literal
|
|
5244
|
-
)
|
|
5053
|
+
analyzed = self.anal_type(t, allow_tuple_literal=allow_tuple_literal)
|
|
5245
5054
|
if analyzed is not None:
|
|
5246
5055
|
# TODO: Deal with this better
|
|
5247
5056
|
new_types.append(analyzed)
|
|
@@ -5318,9 +5127,7 @@ class SemanticAnalyzer(
|
|
|
5318
5127
|
def bind_name_expr(self, expr: NameExpr, sym: SymbolTableNode) -> None:
|
|
5319
5128
|
"""Bind name expression to a symbol table node."""
|
|
5320
5129
|
if isinstance(sym.node, TypeVarExpr) and self.tvar_scope.get_binding(sym):
|
|
5321
|
-
self.fail(
|
|
5322
|
-
f'"{expr.name}" is a type variable and only valid in type context', expr
|
|
5323
|
-
)
|
|
5130
|
+
self.fail(f'"{expr.name}" is a type variable and only valid in type context', expr)
|
|
5324
5131
|
elif isinstance(sym.node, PlaceholderNode):
|
|
5325
5132
|
self.process_placeholder(expr.name, "name", expr)
|
|
5326
5133
|
else:
|
|
@@ -5455,9 +5262,7 @@ class SemanticAnalyzer(
|
|
|
5455
5262
|
# type = None # type: Optional[TypeInfo]
|
|
5456
5263
|
if self.type is not None:
|
|
5457
5264
|
local_nodes = [
|
|
5458
|
-
st.node
|
|
5459
|
-
for st in self.type.names.values()
|
|
5460
|
-
if isinstance(st.node, Var)
|
|
5265
|
+
st.node for st in self.type.names.values() if isinstance(st.node, Var)
|
|
5461
5266
|
]
|
|
5462
5267
|
elif self.is_func_scope():
|
|
5463
5268
|
# locals = None # type: List[Optional[SymbolTable]]
|
|
@@ -5465,9 +5270,7 @@ class SemanticAnalyzer(
|
|
|
5465
5270
|
symbol_table = self.locals[-1]
|
|
5466
5271
|
if symbol_table is not None:
|
|
5467
5272
|
local_nodes = [
|
|
5468
|
-
st.node
|
|
5469
|
-
for st in symbol_table.values()
|
|
5470
|
-
if isinstance(st.node, Var)
|
|
5273
|
+
st.node for st in symbol_table.values() if isinstance(st.node, Var)
|
|
5471
5274
|
]
|
|
5472
5275
|
expr.analyzed = RevealExpr(kind=REVEAL_LOCALS, local_nodes=local_nodes)
|
|
5473
5276
|
expr.analyzed.line = expr.line
|
|
@@ -5475,9 +5278,7 @@ class SemanticAnalyzer(
|
|
|
5475
5278
|
expr.analyzed.accept(self)
|
|
5476
5279
|
elif refers_to_fullname(expr.callee, "typing.Any"):
|
|
5477
5280
|
# Special form Any(...) no longer supported.
|
|
5478
|
-
self.fail(
|
|
5479
|
-
"Any(...) is no longer supported. Use cast(Any, ...) instead", expr
|
|
5480
|
-
)
|
|
5281
|
+
self.fail("Any(...) is no longer supported. Use cast(Any, ...) instead", expr)
|
|
5481
5282
|
elif refers_to_fullname(expr.callee, "typing._promote"):
|
|
5482
5283
|
# Special form _promote(...).
|
|
5483
5284
|
if not self.check_fixed_args(expr, 1, "_promote"):
|
|
@@ -5499,6 +5300,12 @@ class SemanticAnalyzer(
|
|
|
5499
5300
|
expr.analyzed = OpExpr("divmod", expr.args[0], expr.args[1])
|
|
5500
5301
|
expr.analyzed.line = expr.line
|
|
5501
5302
|
expr.analyzed.accept(self)
|
|
5303
|
+
elif refers_to_fullname(
|
|
5304
|
+
expr.callee, ("typing.TypeAliasType", "typing_extensions.TypeAliasType")
|
|
5305
|
+
):
|
|
5306
|
+
with self.allow_unbound_tvars_set():
|
|
5307
|
+
for a in expr.args:
|
|
5308
|
+
a.accept(self)
|
|
5502
5309
|
else:
|
|
5503
5310
|
# Normal call expression.
|
|
5504
5311
|
for a in expr.args:
|
|
@@ -5524,9 +5331,7 @@ class SemanticAnalyzer(
|
|
|
5524
5331
|
and expr.args
|
|
5525
5332
|
and isinstance(expr.args[0], StrExpr)
|
|
5526
5333
|
):
|
|
5527
|
-
self.all_exports = [
|
|
5528
|
-
n for n in self.all_exports if n != expr.args[0].value
|
|
5529
|
-
]
|
|
5334
|
+
self.all_exports = [n for n in self.all_exports if n != expr.args[0].value]
|
|
5530
5335
|
|
|
5531
5336
|
def translate_dict_call(self, call: CallExpr) -> DictExpr | None:
|
|
5532
5337
|
"""Translate 'dict(x=y, ...)' to {'x': y, ...} and 'dict()' to {}.
|
|
@@ -5560,9 +5365,7 @@ class SemanticAnalyzer(
|
|
|
5560
5365
|
self.fail('"%s" expects %d argument%s' % (name, numargs, s), expr)
|
|
5561
5366
|
return False
|
|
5562
5367
|
if expr.arg_kinds != [ARG_POS] * numargs:
|
|
5563
|
-
self.fail(
|
|
5564
|
-
f'"{name}" must be called with {numargs} positional argument{s}', expr
|
|
5565
|
-
)
|
|
5368
|
+
self.fail(f'"{name}" must be called with {numargs} positional argument{s}', expr)
|
|
5566
5369
|
return False
|
|
5567
5370
|
return True
|
|
5568
5371
|
|
|
@@ -5605,9 +5408,7 @@ class SemanticAnalyzer(
|
|
|
5605
5408
|
|
|
5606
5409
|
if type_info:
|
|
5607
5410
|
n = type_info.names.get(expr.name)
|
|
5608
|
-
if n is not None and isinstance(
|
|
5609
|
-
n.node, (MypyFile, TypeInfo, TypeAlias)
|
|
5610
|
-
):
|
|
5411
|
+
if n is not None and isinstance(n.node, (MypyFile, TypeInfo, TypeAlias)):
|
|
5611
5412
|
if not n:
|
|
5612
5413
|
return
|
|
5613
5414
|
expr.kind = n.kind
|
|
@@ -5688,9 +5489,7 @@ class SemanticAnalyzer(
|
|
|
5688
5489
|
and n.fullname in get_nongen_builtins(self.options.python_version)
|
|
5689
5490
|
and not self.is_stub_file
|
|
5690
5491
|
):
|
|
5691
|
-
self.fail(
|
|
5692
|
-
no_subscript_builtin_alias(n.fullname, propose_alt=False), expr
|
|
5693
|
-
)
|
|
5492
|
+
self.fail(no_subscript_builtin_alias(n.fullname, propose_alt=False), expr)
|
|
5694
5493
|
|
|
5695
5494
|
def analyze_type_application_args(self, expr: IndexExpr) -> list[Type] | None:
|
|
5696
5495
|
"""Analyze type arguments (index) in a type application.
|
|
@@ -5708,10 +5507,7 @@ class SemanticAnalyzer(
|
|
|
5708
5507
|
types: list[Type] = []
|
|
5709
5508
|
if isinstance(index, TupleExpr):
|
|
5710
5509
|
items = index.items
|
|
5711
|
-
is_tuple = (
|
|
5712
|
-
isinstance(expr.base, RefExpr)
|
|
5713
|
-
and expr.base.fullname == "builtins.tuple"
|
|
5714
|
-
)
|
|
5510
|
+
is_tuple = isinstance(expr.base, RefExpr) and expr.base.fullname == "builtins.tuple"
|
|
5715
5511
|
if is_tuple and len(items) == 2 and isinstance(items[-1], EllipsisExpr):
|
|
5716
5512
|
items = items[:-1]
|
|
5717
5513
|
else:
|
|
@@ -5731,8 +5527,7 @@ class SemanticAnalyzer(
|
|
|
5731
5527
|
num_args = -1
|
|
5732
5528
|
elif isinstance(base, RefExpr) and isinstance(base.node, TypeInfo):
|
|
5733
5529
|
allow_unpack = (
|
|
5734
|
-
base.node.has_type_var_tuple_type
|
|
5735
|
-
or base.node.fullname == "builtins.tuple"
|
|
5530
|
+
base.node.has_type_var_tuple_type or base.node.fullname == "builtins.tuple"
|
|
5736
5531
|
)
|
|
5737
5532
|
has_param_spec = base.node.has_param_spec_type
|
|
5738
5533
|
num_args = len(base.node.type_vars)
|
|
@@ -5764,8 +5559,7 @@ class SemanticAnalyzer(
|
|
|
5764
5559
|
if has_param_spec and num_args == 1 and types:
|
|
5765
5560
|
first_arg = get_proper_type(types[0])
|
|
5766
5561
|
if not (
|
|
5767
|
-
len(types) == 1
|
|
5768
|
-
and isinstance(first_arg, (Parameters, ParamSpecType, AnyType))
|
|
5562
|
+
len(types) == 1 and isinstance(first_arg, (Parameters, ParamSpecType, AnyType))
|
|
5769
5563
|
):
|
|
5770
5564
|
types = [Parameters(types, [ARG_POS] * len(types), [None] * len(types))]
|
|
5771
5565
|
|
|
@@ -5810,33 +5604,21 @@ class SemanticAnalyzer(
|
|
|
5810
5604
|
def visit_list_comprehension(self, expr: ListComprehension) -> None:
|
|
5811
5605
|
if any(expr.generator.is_async):
|
|
5812
5606
|
if not self.is_func_scope() or not self.function_stack[-1].is_coroutine:
|
|
5813
|
-
self.fail(
|
|
5814
|
-
message_registry.ASYNC_FOR_OUTSIDE_COROUTINE,
|
|
5815
|
-
expr,
|
|
5816
|
-
code=codes.SYNTAX,
|
|
5817
|
-
)
|
|
5607
|
+
self.fail(message_registry.ASYNC_FOR_OUTSIDE_COROUTINE, expr, code=codes.SYNTAX)
|
|
5818
5608
|
|
|
5819
5609
|
expr.generator.accept(self)
|
|
5820
5610
|
|
|
5821
5611
|
def visit_set_comprehension(self, expr: SetComprehension) -> None:
|
|
5822
5612
|
if any(expr.generator.is_async):
|
|
5823
5613
|
if not self.is_func_scope() or not self.function_stack[-1].is_coroutine:
|
|
5824
|
-
self.fail(
|
|
5825
|
-
message_registry.ASYNC_FOR_OUTSIDE_COROUTINE,
|
|
5826
|
-
expr,
|
|
5827
|
-
code=codes.SYNTAX,
|
|
5828
|
-
)
|
|
5614
|
+
self.fail(message_registry.ASYNC_FOR_OUTSIDE_COROUTINE, expr, code=codes.SYNTAX)
|
|
5829
5615
|
|
|
5830
5616
|
expr.generator.accept(self)
|
|
5831
5617
|
|
|
5832
5618
|
def visit_dictionary_comprehension(self, expr: DictionaryComprehension) -> None:
|
|
5833
5619
|
if any(expr.is_async):
|
|
5834
5620
|
if not self.is_func_scope() or not self.function_stack[-1].is_coroutine:
|
|
5835
|
-
self.fail(
|
|
5836
|
-
message_registry.ASYNC_FOR_OUTSIDE_COROUTINE,
|
|
5837
|
-
expr,
|
|
5838
|
-
code=codes.SYNTAX,
|
|
5839
|
-
)
|
|
5621
|
+
self.fail(message_registry.ASYNC_FOR_OUTSIDE_COROUTINE, expr, code=codes.SYNTAX)
|
|
5840
5622
|
|
|
5841
5623
|
with self.enter(expr):
|
|
5842
5624
|
self.analyze_comp_for(expr)
|
|
@@ -5886,9 +5668,7 @@ class SemanticAnalyzer(
|
|
|
5886
5668
|
def visit__promote_expr(self, expr: PromoteExpr) -> None:
|
|
5887
5669
|
analyzed = self.anal_type(expr.type)
|
|
5888
5670
|
if analyzed is not None:
|
|
5889
|
-
assert isinstance(
|
|
5890
|
-
analyzed, ProperType
|
|
5891
|
-
), "Cannot use type aliases for promotions"
|
|
5671
|
+
assert isinstance(analyzed, ProperType), "Cannot use type aliases for promotions"
|
|
5892
5672
|
expr.type = analyzed
|
|
5893
5673
|
|
|
5894
5674
|
def visit_yield_expr(self, e: YieldExpr) -> None:
|
|
@@ -5914,12 +5694,7 @@ class SemanticAnalyzer(
|
|
|
5914
5694
|
# We check both because is_function_scope() returns True inside comprehensions.
|
|
5915
5695
|
# This is not a blocker, because some enviroments (like ipython)
|
|
5916
5696
|
# support top level awaits.
|
|
5917
|
-
self.fail(
|
|
5918
|
-
'"await" outside function',
|
|
5919
|
-
expr,
|
|
5920
|
-
serious=True,
|
|
5921
|
-
code=codes.TOP_LEVEL_AWAIT,
|
|
5922
|
-
)
|
|
5697
|
+
self.fail('"await" outside function', expr, serious=True, code=codes.TOP_LEVEL_AWAIT)
|
|
5923
5698
|
elif not self.function_stack[-1].is_coroutine:
|
|
5924
5699
|
self.fail(
|
|
5925
5700
|
'"await" outside coroutine ("async def")',
|
|
@@ -6012,11 +5787,7 @@ class SemanticAnalyzer(
|
|
|
6012
5787
|
implicit_name = True
|
|
6013
5788
|
implicit_node = node
|
|
6014
5789
|
# 2b. Class attributes __qualname__ and __module__
|
|
6015
|
-
if (
|
|
6016
|
-
self.type
|
|
6017
|
-
and not self.is_func_scope()
|
|
6018
|
-
and name in {"__qualname__", "__module__"}
|
|
6019
|
-
):
|
|
5790
|
+
if self.type and not self.is_func_scope() and name in {"__qualname__", "__module__"}:
|
|
6020
5791
|
return SymbolTableNode(MDEF, Var(name, self.str_type()))
|
|
6021
5792
|
# 3. Local (function) scopes
|
|
6022
5793
|
for table in reversed(self.locals):
|
|
@@ -6098,8 +5869,7 @@ class SemanticAnalyzer(
|
|
|
6098
5869
|
"""Check whether the function belongs to the overloaded variants"""
|
|
6099
5870
|
if isinstance(node, OverloadedFuncDef) and isinstance(statement, FuncDef):
|
|
6100
5871
|
in_items = statement in {
|
|
6101
|
-
item.func if isinstance(item, Decorator) else item
|
|
6102
|
-
for item in node.items
|
|
5872
|
+
item.func if isinstance(item, Decorator) else item for item in node.items
|
|
6103
5873
|
}
|
|
6104
5874
|
in_impl = node.impl is not None and (
|
|
6105
5875
|
(isinstance(node.impl, Decorator) and statement is node.impl.func)
|
|
@@ -6294,13 +6064,9 @@ class SemanticAnalyzer(
|
|
|
6294
6064
|
if args:
|
|
6295
6065
|
# TODO: assert len(args) == len(node.defn.type_vars)
|
|
6296
6066
|
return Instance(node, args)
|
|
6297
|
-
return Instance(
|
|
6298
|
-
node, [AnyType(TypeOfAny.special_form)] * len(node.defn.type_vars)
|
|
6299
|
-
)
|
|
6067
|
+
return Instance(node, [AnyType(TypeOfAny.special_form)] * len(node.defn.type_vars))
|
|
6300
6068
|
|
|
6301
|
-
def named_type_or_none(
|
|
6302
|
-
self, fullname: str, args: list[Type] | None = None
|
|
6303
|
-
) -> Instance | None:
|
|
6069
|
+
def named_type_or_none(self, fullname: str, args: list[Type] | None = None) -> Instance | None:
|
|
6304
6070
|
sym = self.lookup_fully_qualified_or_none(fullname)
|
|
6305
6071
|
if not sym or isinstance(sym.node, PlaceholderNode):
|
|
6306
6072
|
return None
|
|
@@ -6312,9 +6078,7 @@ class SemanticAnalyzer(
|
|
|
6312
6078
|
if args is not None:
|
|
6313
6079
|
# TODO: assert len(args) == len(node.defn.type_vars)
|
|
6314
6080
|
return Instance(node, args)
|
|
6315
|
-
return Instance(
|
|
6316
|
-
node, [AnyType(TypeOfAny.unannotated)] * len(node.defn.type_vars)
|
|
6317
|
-
)
|
|
6081
|
+
return Instance(node, [AnyType(TypeOfAny.unannotated)] * len(node.defn.type_vars))
|
|
6318
6082
|
|
|
6319
6083
|
def builtin_type(self, fully_qualified_name: str) -> Instance:
|
|
6320
6084
|
"""Legacy function -- use named_type() instead."""
|
|
@@ -6362,9 +6126,7 @@ class SemanticAnalyzer(
|
|
|
6362
6126
|
symbol = SymbolTableNode(
|
|
6363
6127
|
kind, node, module_public=module_public, module_hidden=module_hidden
|
|
6364
6128
|
)
|
|
6365
|
-
return self.add_symbol_table_node(
|
|
6366
|
-
name, symbol, context, can_defer, escape_comprehensions
|
|
6367
|
-
)
|
|
6129
|
+
return self.add_symbol_table_node(name, symbol, context, can_defer, escape_comprehensions)
|
|
6368
6130
|
|
|
6369
6131
|
def add_symbol_skip_local(self, name: str, node: SymbolNode) -> None:
|
|
6370
6132
|
"""Same as above, but skipping the local namespace.
|
|
@@ -6439,10 +6201,7 @@ class SemanticAnalyzer(
|
|
|
6439
6201
|
if not is_same_symbol(old, new):
|
|
6440
6202
|
if isinstance(new, (FuncDef, Decorator, OverloadedFuncDef, TypeInfo)):
|
|
6441
6203
|
self.add_redefinition(names, name, symbol)
|
|
6442
|
-
if not (
|
|
6443
|
-
isinstance(new, (FuncDef, Decorator))
|
|
6444
|
-
and self.set_original_def(old, new)
|
|
6445
|
-
):
|
|
6204
|
+
if not (isinstance(new, (FuncDef, Decorator)) and self.set_original_def(old, new)):
|
|
6446
6205
|
self.name_already_defined(name, context, existing)
|
|
6447
6206
|
elif name not in self.missing_names[-1] and "*" not in self.missing_names[-1]:
|
|
6448
6207
|
names[name] = symbol
|
|
@@ -6450,9 +6209,7 @@ class SemanticAnalyzer(
|
|
|
6450
6209
|
return True
|
|
6451
6210
|
return False
|
|
6452
6211
|
|
|
6453
|
-
def add_redefinition(
|
|
6454
|
-
self, names: SymbolTable, name: str, symbol: SymbolTableNode
|
|
6455
|
-
) -> None:
|
|
6212
|
+
def add_redefinition(self, names: SymbolTable, name: str, symbol: SymbolTableNode) -> None:
|
|
6456
6213
|
"""Add a symbol table node that reflects a redefinition as a function or a class.
|
|
6457
6214
|
|
|
6458
6215
|
Redefinitions need to be added to the symbol table so that they can be found
|
|
@@ -6483,9 +6240,7 @@ class SemanticAnalyzer(
|
|
|
6483
6240
|
return
|
|
6484
6241
|
i += 1
|
|
6485
6242
|
|
|
6486
|
-
def add_local(
|
|
6487
|
-
self, node: Var | FuncDef | OverloadedFuncDef, context: Context
|
|
6488
|
-
) -> None:
|
|
6243
|
+
def add_local(self, node: Var | FuncDef | OverloadedFuncDef, context: Context) -> None:
|
|
6489
6244
|
"""Add local variable or function."""
|
|
6490
6245
|
assert self.is_func_scope()
|
|
6491
6246
|
name = node.name
|
|
@@ -6552,23 +6307,16 @@ class SemanticAnalyzer(
|
|
|
6552
6307
|
and not isinstance(node.node, PlaceholderNode)
|
|
6553
6308
|
):
|
|
6554
6309
|
# Import can redefine a variable. They get special treatment.
|
|
6555
|
-
if self.process_import_over_existing_name(
|
|
6556
|
-
name, existing_symbol, node, context
|
|
6557
|
-
):
|
|
6310
|
+
if self.process_import_over_existing_name(name, existing_symbol, node, context):
|
|
6558
6311
|
return
|
|
6559
6312
|
|
|
6560
6313
|
symbol_node: SymbolNode | None = node.node
|
|
6561
6314
|
|
|
6562
6315
|
if self.is_class_scope():
|
|
6563
|
-
symbol_node = self._get_node_for_class_scoped_import(
|
|
6564
|
-
name, symbol_node, context
|
|
6565
|
-
)
|
|
6316
|
+
symbol_node = self._get_node_for_class_scoped_import(name, symbol_node, context)
|
|
6566
6317
|
|
|
6567
6318
|
symbol = SymbolTableNode(
|
|
6568
|
-
node.kind,
|
|
6569
|
-
symbol_node,
|
|
6570
|
-
module_public=module_public,
|
|
6571
|
-
module_hidden=module_hidden,
|
|
6319
|
+
node.kind, symbol_node, module_public=module_public, module_hidden=module_hidden
|
|
6572
6320
|
)
|
|
6573
6321
|
self.add_symbol_table_node(name, symbol, context)
|
|
6574
6322
|
|
|
@@ -6588,11 +6336,7 @@ class SemanticAnalyzer(
|
|
|
6588
6336
|
'mod.x'. This is currently used only to track logical dependencies.
|
|
6589
6337
|
"""
|
|
6590
6338
|
existing = self.current_symbol_table().get(name)
|
|
6591
|
-
if (
|
|
6592
|
-
existing
|
|
6593
|
-
and isinstance(existing.node, Var)
|
|
6594
|
-
and existing.node.is_suppressed_import
|
|
6595
|
-
):
|
|
6339
|
+
if existing and isinstance(existing.node, Var) and existing.node.is_suppressed_import:
|
|
6596
6340
|
# This missing import was already added -- nothing to do here.
|
|
6597
6341
|
return
|
|
6598
6342
|
var = Var(name)
|
|
@@ -6608,9 +6352,7 @@ class SemanticAnalyzer(
|
|
|
6608
6352
|
else:
|
|
6609
6353
|
var._fullname = self.qualified_name(name)
|
|
6610
6354
|
var.is_ready = True
|
|
6611
|
-
any_type = AnyType(
|
|
6612
|
-
TypeOfAny.from_unimported_type, missing_import_name=var._fullname
|
|
6613
|
-
)
|
|
6355
|
+
any_type = AnyType(TypeOfAny.from_unimported_type, missing_import_name=var._fullname)
|
|
6614
6356
|
var.type = any_type
|
|
6615
6357
|
var.is_suppressed_import = True
|
|
6616
6358
|
self.add_symbol(
|
|
@@ -6628,9 +6370,7 @@ class SemanticAnalyzer(
|
|
|
6628
6370
|
yield
|
|
6629
6371
|
self.tvar_scope = old_scope
|
|
6630
6372
|
|
|
6631
|
-
def defer(
|
|
6632
|
-
self, debug_context: Context | None = None, force_progress: bool = False
|
|
6633
|
-
) -> None:
|
|
6373
|
+
def defer(self, debug_context: Context | None = None, force_progress: bool = False) -> None:
|
|
6634
6374
|
"""Defer current analysis target to be analyzed again.
|
|
6635
6375
|
|
|
6636
6376
|
This must be called if something in the current target is
|
|
@@ -6654,9 +6394,7 @@ class SemanticAnalyzer(
|
|
|
6654
6394
|
self.deferred = True
|
|
6655
6395
|
# Store debug info for this deferral.
|
|
6656
6396
|
line = (
|
|
6657
|
-
debug_context.line
|
|
6658
|
-
if debug_context
|
|
6659
|
-
else self.statement.line if self.statement else -1
|
|
6397
|
+
debug_context.line if debug_context else self.statement.line if self.statement else -1
|
|
6660
6398
|
)
|
|
6661
6399
|
self.deferral_debug_context.append((self.cur_mod_id, line))
|
|
6662
6400
|
|
|
@@ -6735,9 +6473,7 @@ class SemanticAnalyzer(
|
|
|
6735
6473
|
|
|
6736
6474
|
def cannot_resolve_name(self, name: str | None, kind: str, ctx: Context) -> None:
|
|
6737
6475
|
name_format = f' "{name}"' if name else ""
|
|
6738
|
-
self.fail(
|
|
6739
|
-
f"Cannot resolve {kind}{name_format} (possible cyclic definition)", ctx
|
|
6740
|
-
)
|
|
6476
|
+
self.fail(f"Cannot resolve {kind}{name_format} (possible cyclic definition)", ctx)
|
|
6741
6477
|
if self.is_func_scope():
|
|
6742
6478
|
self.note("Recursive types are not allowed at function scope", ctx)
|
|
6743
6479
|
|
|
@@ -6756,9 +6492,7 @@ class SemanticAnalyzer(
|
|
|
6756
6492
|
"""Enter a function, generator or comprehension scope."""
|
|
6757
6493
|
names = self.saved_locals.setdefault(function, SymbolTable())
|
|
6758
6494
|
self.locals.append(names)
|
|
6759
|
-
is_comprehension = isinstance(
|
|
6760
|
-
function, (GeneratorExpr, DictionaryComprehension)
|
|
6761
|
-
)
|
|
6495
|
+
is_comprehension = isinstance(function, (GeneratorExpr, DictionaryComprehension))
|
|
6762
6496
|
self.is_comprehension_stack.append(is_comprehension)
|
|
6763
6497
|
self.global_decls.append(set())
|
|
6764
6498
|
self.nonlocal_decls.append(set())
|
|
@@ -6805,9 +6539,7 @@ class SemanticAnalyzer(
|
|
|
6805
6539
|
if escape_comprehensions:
|
|
6806
6540
|
assert len(self.locals) == len(self.is_comprehension_stack)
|
|
6807
6541
|
# Retrieve the symbol table from the enclosing non-comprehension scope.
|
|
6808
|
-
for i, is_comprehension in enumerate(
|
|
6809
|
-
reversed(self.is_comprehension_stack)
|
|
6810
|
-
):
|
|
6542
|
+
for i, is_comprehension in enumerate(reversed(self.is_comprehension_stack)):
|
|
6811
6543
|
if not is_comprehension:
|
|
6812
6544
|
if i == len(self.locals) - 1: # The last iteration.
|
|
6813
6545
|
# The caller of the comprehension is in the global space.
|
|
@@ -6841,9 +6573,7 @@ class SemanticAnalyzer(
|
|
|
6841
6573
|
if isinstance(exp, StrExpr):
|
|
6842
6574
|
self.all_exports.append(exp.value)
|
|
6843
6575
|
|
|
6844
|
-
def name_not_defined(
|
|
6845
|
-
self, name: str, ctx: Context, namespace: str | None = None
|
|
6846
|
-
) -> None:
|
|
6576
|
+
def name_not_defined(self, name: str, ctx: Context, namespace: str | None = None) -> None:
|
|
6847
6577
|
incomplete = self.is_incomplete_namespace(namespace or self.cur_mod_id)
|
|
6848
6578
|
if (
|
|
6849
6579
|
namespace is None
|
|
@@ -6885,11 +6615,7 @@ class SemanticAnalyzer(
|
|
|
6885
6615
|
self.note(hint, ctx, code=codes.NAME_DEFINED)
|
|
6886
6616
|
|
|
6887
6617
|
def already_defined(
|
|
6888
|
-
self,
|
|
6889
|
-
name: str,
|
|
6890
|
-
ctx: Context,
|
|
6891
|
-
original_ctx: SymbolTableNode | SymbolNode | None,
|
|
6892
|
-
noun: str,
|
|
6618
|
+
self, name: str, ctx: Context, original_ctx: SymbolTableNode | SymbolNode | None, noun: str
|
|
6893
6619
|
) -> None:
|
|
6894
6620
|
if isinstance(original_ctx, SymbolTableNode):
|
|
6895
6621
|
node: SymbolNode | None = original_ctx.node
|
|
@@ -6898,9 +6624,7 @@ class SemanticAnalyzer(
|
|
|
6898
6624
|
else:
|
|
6899
6625
|
node = None
|
|
6900
6626
|
|
|
6901
|
-
if isinstance(original_ctx, SymbolTableNode) and isinstance(
|
|
6902
|
-
original_ctx.node, MypyFile
|
|
6903
|
-
):
|
|
6627
|
+
if isinstance(original_ctx, SymbolTableNode) and isinstance(original_ctx.node, MypyFile):
|
|
6904
6628
|
# Since this is an import, original_ctx.node points to the module definition.
|
|
6905
6629
|
# Therefore its line number is always 1, which is not useful for this
|
|
6906
6630
|
# error message.
|
|
@@ -6912,24 +6636,16 @@ class SemanticAnalyzer(
|
|
|
6912
6636
|
else:
|
|
6913
6637
|
extra_msg = " (possibly by an import)"
|
|
6914
6638
|
self.fail(
|
|
6915
|
-
f'{noun} "{unmangle(name)}" already defined{extra_msg}',
|
|
6916
|
-
ctx,
|
|
6917
|
-
code=codes.NO_REDEF,
|
|
6639
|
+
f'{noun} "{unmangle(name)}" already defined{extra_msg}', ctx, code=codes.NO_REDEF
|
|
6918
6640
|
)
|
|
6919
6641
|
|
|
6920
6642
|
def name_already_defined(
|
|
6921
|
-
self,
|
|
6922
|
-
name: str,
|
|
6923
|
-
ctx: Context,
|
|
6924
|
-
original_ctx: SymbolTableNode | SymbolNode | None = None,
|
|
6643
|
+
self, name: str, ctx: Context, original_ctx: SymbolTableNode | SymbolNode | None = None
|
|
6925
6644
|
) -> None:
|
|
6926
6645
|
self.already_defined(name, ctx, original_ctx, noun="Name")
|
|
6927
6646
|
|
|
6928
6647
|
def attribute_already_defined(
|
|
6929
|
-
self,
|
|
6930
|
-
name: str,
|
|
6931
|
-
ctx: Context,
|
|
6932
|
-
original_ctx: SymbolTableNode | SymbolNode | None = None,
|
|
6648
|
+
self, name: str, ctx: Context, original_ctx: SymbolTableNode | SymbolNode | None = None
|
|
6933
6649
|
) -> None:
|
|
6934
6650
|
self.already_defined(name, ctx, original_ctx, noun="Attribute")
|
|
6935
6651
|
|
|
@@ -6997,9 +6713,7 @@ class SemanticAnalyzer(
|
|
|
6997
6713
|
try:
|
|
6998
6714
|
node.accept(self)
|
|
6999
6715
|
except Exception as err:
|
|
7000
|
-
report_internal_error(
|
|
7001
|
-
err, self.errors.file, node.line, self.errors, self.options
|
|
7002
|
-
)
|
|
6716
|
+
report_internal_error(err, self.errors.file, node.line, self.errors, self.options)
|
|
7003
6717
|
|
|
7004
6718
|
def expr_to_analyzed_type(
|
|
7005
6719
|
self,
|
|
@@ -7020,13 +6734,8 @@ class SemanticAnalyzer(
|
|
|
7020
6734
|
expr, None, self.is_func_scope()
|
|
7021
6735
|
)
|
|
7022
6736
|
if tvar_defs:
|
|
7023
|
-
self.fail(
|
|
7024
|
-
|
|
7025
|
-
expr,
|
|
7026
|
-
)
|
|
7027
|
-
self.note(
|
|
7028
|
-
"Use either Python 3 class syntax, or the assignment syntax", expr
|
|
7029
|
-
)
|
|
6737
|
+
self.fail("Generic named tuples are not supported for legacy class syntax", expr)
|
|
6738
|
+
self.note("Use either Python 3 class syntax, or the assignment syntax", expr)
|
|
7030
6739
|
if internal_name is None:
|
|
7031
6740
|
# Some form of namedtuple is the only valid type that looks like a call
|
|
7032
6741
|
# expression. This isn't a valid type.
|
|
@@ -7090,15 +6799,11 @@ class SemanticAnalyzer(
|
|
|
7090
6799
|
prohibit_self_type=prohibit_self_type,
|
|
7091
6800
|
allow_type_any=allow_type_any,
|
|
7092
6801
|
)
|
|
7093
|
-
tpan.in_dynamic_func = bool(
|
|
7094
|
-
self.function_stack and self.function_stack[-1].is_dynamic()
|
|
7095
|
-
)
|
|
6802
|
+
tpan.in_dynamic_func = bool(self.function_stack and self.function_stack[-1].is_dynamic())
|
|
7096
6803
|
tpan.global_scope = not self.type and not self.function_stack
|
|
7097
6804
|
return tpan
|
|
7098
6805
|
|
|
7099
|
-
def expr_to_unanalyzed_type(
|
|
7100
|
-
self, node: Expression, allow_unpack: bool = False
|
|
7101
|
-
) -> ProperType:
|
|
6806
|
+
def expr_to_unanalyzed_type(self, node: Expression, allow_unpack: bool = False) -> ProperType:
|
|
7102
6807
|
return expr_to_unanalyzed_type(
|
|
7103
6808
|
node, self.options, self.is_stub_file, allow_unpack=allow_unpack
|
|
7104
6809
|
)
|
|
@@ -7223,11 +6928,7 @@ class SemanticAnalyzer(
|
|
|
7223
6928
|
literal value can be found."""
|
|
7224
6929
|
if isinstance(expr, StrExpr):
|
|
7225
6930
|
return expr.value
|
|
7226
|
-
if (
|
|
7227
|
-
isinstance(expr, RefExpr)
|
|
7228
|
-
and isinstance(expr.node, Var)
|
|
7229
|
-
and expr.node.type is not None
|
|
7230
|
-
):
|
|
6931
|
+
if isinstance(expr, RefExpr) and isinstance(expr.node, Var) and expr.node.type is not None:
|
|
7231
6932
|
values = try_getting_str_literals_from_type(expr.node.type)
|
|
7232
6933
|
if values is not None and len(values) == 1:
|
|
7233
6934
|
return values[0]
|
|
@@ -7235,9 +6936,7 @@ class SemanticAnalyzer(
|
|
|
7235
6936
|
|
|
7236
6937
|
def set_future_import_flags(self, module_name: str) -> None:
|
|
7237
6938
|
if module_name in FUTURE_IMPORTS:
|
|
7238
|
-
self.modules[self.cur_mod_id].future_import_flags.add(
|
|
7239
|
-
FUTURE_IMPORTS[module_name]
|
|
7240
|
-
)
|
|
6939
|
+
self.modules[self.cur_mod_id].future_import_flags.add(FUTURE_IMPORTS[module_name])
|
|
7241
6940
|
|
|
7242
6941
|
def is_future_flag_set(self, flag: str) -> bool:
|
|
7243
6942
|
return self.modules[self.cur_mod_id].is_future_flag_set(flag)
|
|
@@ -7255,8 +6954,8 @@ class SemanticAnalyzer(
|
|
|
7255
6954
|
# field_specifiers is currently the only non-boolean argument; check for it first so
|
|
7256
6955
|
# so the rest of the block can fail through to handling booleans
|
|
7257
6956
|
if name == "field_specifiers":
|
|
7258
|
-
parameters.field_specifiers = (
|
|
7259
|
-
|
|
6957
|
+
parameters.field_specifiers = self.parse_dataclass_transform_field_specifiers(
|
|
6958
|
+
value
|
|
7260
6959
|
)
|
|
7261
6960
|
continue
|
|
7262
6961
|
|
|
@@ -7277,9 +6976,7 @@ class SemanticAnalyzer(
|
|
|
7277
6976
|
|
|
7278
6977
|
return parameters
|
|
7279
6978
|
|
|
7280
|
-
def parse_dataclass_transform_field_specifiers(
|
|
7281
|
-
self, arg: Expression
|
|
7282
|
-
) -> tuple[str, ...]:
|
|
6979
|
+
def parse_dataclass_transform_field_specifiers(self, arg: Expression) -> tuple[str, ...]:
|
|
7283
6980
|
if not isinstance(arg, TupleExpr):
|
|
7284
6981
|
self.fail('"field_specifiers" argument must be a tuple literal', arg)
|
|
7285
6982
|
return ()
|
|
@@ -7367,9 +7064,7 @@ class MakeAnyNonExplicit(TrivialSyntheticTypeTranslator):
|
|
|
7367
7064
|
return t.copy_modified(args=[a.accept(self) for a in t.args])
|
|
7368
7065
|
|
|
7369
7066
|
|
|
7370
|
-
def apply_semantic_analyzer_patches(
|
|
7371
|
-
patches: list[tuple[int, Callable[[], None]]]
|
|
7372
|
-
) -> None:
|
|
7067
|
+
def apply_semantic_analyzer_patches(patches: list[tuple[int, Callable[[], None]]]) -> None:
|
|
7373
7068
|
"""Call patch callbacks in the right order.
|
|
7374
7069
|
|
|
7375
7070
|
This should happen after semantic analyzer pass 3.
|
|
@@ -7485,10 +7180,7 @@ def is_trivial_body(block: Block) -> bool:
|
|
|
7485
7180
|
if isinstance(expr, CallExpr):
|
|
7486
7181
|
expr = expr.callee
|
|
7487
7182
|
|
|
7488
|
-
return (
|
|
7489
|
-
isinstance(expr, NameExpr)
|
|
7490
|
-
and expr.fullname == "builtins.NotImplementedError"
|
|
7491
|
-
)
|
|
7183
|
+
return isinstance(expr, NameExpr) and expr.fullname == "builtins.NotImplementedError"
|
|
7492
7184
|
|
|
7493
7185
|
return isinstance(stmt, PassStmt) or (
|
|
7494
7186
|
isinstance(stmt, ExpressionStmt) and isinstance(stmt.expr, EllipsisExpr)
|