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/checkexpr.py
CHANGED
|
@@ -7,34 +7,16 @@ import itertools
|
|
|
7
7
|
import time
|
|
8
8
|
from collections import defaultdict
|
|
9
9
|
from contextlib import contextmanager
|
|
10
|
-
from typing import
|
|
11
|
-
Callable,
|
|
12
|
-
ClassVar,
|
|
13
|
-
Final,
|
|
14
|
-
Iterable,
|
|
15
|
-
Iterator,
|
|
16
|
-
List,
|
|
17
|
-
Optional,
|
|
18
|
-
Sequence,
|
|
19
|
-
cast,
|
|
20
|
-
)
|
|
10
|
+
from typing import Callable, ClassVar, Final, Iterable, Iterator, List, Optional, Sequence, cast
|
|
21
11
|
from typing_extensions import TypeAlias as _TypeAlias, assert_never, overload
|
|
22
12
|
|
|
23
13
|
import mypy.checker
|
|
24
14
|
import mypy.errorcodes as codes
|
|
25
15
|
from mypy import applytype, erasetype, join, message_registry, nodes, operators, types
|
|
26
16
|
from mypy.argmap import ArgTypeExpander, map_actuals_to_formals, map_formals_to_actuals
|
|
27
|
-
from mypy.checkmember import
|
|
28
|
-
analyze_member_access,
|
|
29
|
-
freeze_all_type_vars,
|
|
30
|
-
type_object_type,
|
|
31
|
-
)
|
|
17
|
+
from mypy.checkmember import analyze_member_access, freeze_all_type_vars, type_object_type
|
|
32
18
|
from mypy.checkstrformat import StringFormatterChecker
|
|
33
|
-
from mypy.erasetype import
|
|
34
|
-
erase_type,
|
|
35
|
-
remove_instance_last_known_values,
|
|
36
|
-
replace_meta_vars,
|
|
37
|
-
)
|
|
19
|
+
from mypy.erasetype import erase_type, remove_instance_last_known_values, replace_meta_vars
|
|
38
20
|
from mypy.errors import ErrorWatcher, report_internal_error
|
|
39
21
|
from mypy.expandtype import (
|
|
40
22
|
expand_type,
|
|
@@ -42,11 +24,7 @@ from mypy.expandtype import (
|
|
|
42
24
|
freshen_all_functions_type_vars,
|
|
43
25
|
freshen_function_type_vars,
|
|
44
26
|
)
|
|
45
|
-
from mypy.infer import
|
|
46
|
-
ArgumentInferContext,
|
|
47
|
-
infer_function_type_arguments,
|
|
48
|
-
infer_type_arguments,
|
|
49
|
-
)
|
|
27
|
+
from mypy.infer import ArgumentInferContext, infer_function_type_arguments, infer_type_arguments
|
|
50
28
|
from mypy.literals import literal
|
|
51
29
|
from mypy.maptype import map_instance_to_supertype
|
|
52
30
|
from mypy.meet import is_overlapping_types, narrow_declared_type
|
|
@@ -220,19 +198,7 @@ from mypy.visitor import ExpressionVisitor
|
|
|
220
198
|
# Type of callback user for checking individual function arguments. See
|
|
221
199
|
# check_args() below for details.
|
|
222
200
|
ArgChecker: _TypeAlias = Callable[
|
|
223
|
-
[
|
|
224
|
-
Type,
|
|
225
|
-
Type,
|
|
226
|
-
ArgKind,
|
|
227
|
-
Type,
|
|
228
|
-
int,
|
|
229
|
-
int,
|
|
230
|
-
CallableType,
|
|
231
|
-
Optional[Type],
|
|
232
|
-
Context,
|
|
233
|
-
Context,
|
|
234
|
-
],
|
|
235
|
-
None,
|
|
201
|
+
[Type, Type, ArgKind, Type, int, int, CallableType, Optional[Type], Context, Context], None
|
|
236
202
|
]
|
|
237
203
|
|
|
238
204
|
# Maximum nesting level for math union in overloads, setting this to large values
|
|
@@ -272,8 +238,7 @@ def allow_fast_container_literal(t: Type) -> bool:
|
|
|
272
238
|
return False
|
|
273
239
|
t = get_proper_type(t)
|
|
274
240
|
return isinstance(t, Instance) or (
|
|
275
|
-
isinstance(t, TupleType)
|
|
276
|
-
and all(allow_fast_container_literal(it) for it in t.items)
|
|
241
|
+
isinstance(t, TupleType) and all(allow_fast_container_literal(it) for it in t.items)
|
|
277
242
|
)
|
|
278
243
|
|
|
279
244
|
|
|
@@ -291,9 +256,7 @@ def extract_refexpr_names(expr: RefExpr) -> set[str]:
|
|
|
291
256
|
output.add(expr.fullname)
|
|
292
257
|
|
|
293
258
|
if isinstance(expr, NameExpr):
|
|
294
|
-
is_suppressed_import = (
|
|
295
|
-
isinstance(expr.node, Var) and expr.node.is_suppressed_import
|
|
296
|
-
)
|
|
259
|
+
is_suppressed_import = isinstance(expr.node, Var) and expr.node.is_suppressed_import
|
|
297
260
|
if isinstance(expr.node, TypeInfo):
|
|
298
261
|
# Reference to a class or a nested class
|
|
299
262
|
output.update(split_module_names(expr.node.module_name))
|
|
@@ -468,9 +431,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
468
431
|
if self.is_literal_context() and var_type.last_known_value is not None:
|
|
469
432
|
return var_type.last_known_value
|
|
470
433
|
if var.name in {"True", "False"}:
|
|
471
|
-
return self.infer_literal_expr_type(
|
|
472
|
-
var.name == "True", "builtins.bool"
|
|
473
|
-
)
|
|
434
|
+
return self.infer_literal_expr_type(var.name == "True", "builtins.bool")
|
|
474
435
|
return var.type
|
|
475
436
|
else:
|
|
476
437
|
if not var.is_ready and self.chk.in_checked_function():
|
|
@@ -524,9 +485,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
524
485
|
get_proper_type(base.node.target), TypedDictType
|
|
525
486
|
)
|
|
526
487
|
|
|
527
|
-
def visit_call_expr_inner(
|
|
528
|
-
self, e: CallExpr, allow_none_return: bool = False
|
|
529
|
-
) -> Type:
|
|
488
|
+
def visit_call_expr_inner(self, e: CallExpr, allow_none_return: bool = False) -> Type:
|
|
530
489
|
if (
|
|
531
490
|
self.refers_to_typeddict(e.callee)
|
|
532
491
|
or isinstance(e.callee, IndexExpr)
|
|
@@ -537,12 +496,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
537
496
|
typeddict_type = get_proper_type(typeddict_callable.ret_type)
|
|
538
497
|
assert isinstance(typeddict_type, TypedDictType)
|
|
539
498
|
return self.check_typeddict_call(
|
|
540
|
-
typeddict_type,
|
|
541
|
-
e.arg_kinds,
|
|
542
|
-
e.arg_names,
|
|
543
|
-
e.args,
|
|
544
|
-
e,
|
|
545
|
-
typeddict_callable,
|
|
499
|
+
typeddict_type, e.arg_kinds, e.arg_names, e.args, e, typeddict_callable
|
|
546
500
|
)
|
|
547
501
|
if (
|
|
548
502
|
isinstance(e.callee, NameExpr)
|
|
@@ -579,13 +533,9 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
579
533
|
self.msg.type_arguments_not_allowed(e)
|
|
580
534
|
if isinstance(typ, RefExpr) and isinstance(typ.node, TypeInfo):
|
|
581
535
|
if typ.node.typeddict_type:
|
|
582
|
-
self.msg.cannot_use_function_with_type(
|
|
583
|
-
e.callee.name, "TypedDict", e
|
|
584
|
-
)
|
|
536
|
+
self.msg.cannot_use_function_with_type(e.callee.name, "TypedDict", e)
|
|
585
537
|
elif typ.node.is_newtype:
|
|
586
|
-
self.msg.cannot_use_function_with_type(
|
|
587
|
-
e.callee.name, "NewType", e
|
|
588
|
-
)
|
|
538
|
+
self.msg.cannot_use_function_with_type(e.callee.name, "NewType", e)
|
|
589
539
|
self.try_infer_partial_type(e)
|
|
590
540
|
type_context = None
|
|
591
541
|
if isinstance(e.callee, LambdaExpr):
|
|
@@ -598,9 +548,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
598
548
|
)
|
|
599
549
|
|
|
600
550
|
arg_types = [
|
|
601
|
-
join.join_type_list(
|
|
602
|
-
[self.accept(e.args[j]) for j in formal_to_actual[i]]
|
|
603
|
-
)
|
|
551
|
+
join.join_type_list([self.accept(e.args[j]) for j in formal_to_actual[i]])
|
|
604
552
|
for i in range(len(e.callee.arg_kinds))
|
|
605
553
|
]
|
|
606
554
|
type_context = CallableType(
|
|
@@ -688,7 +636,17 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
688
636
|
if isinstance(e.callee.expr, StrExpr):
|
|
689
637
|
format_value = e.callee.expr.value
|
|
690
638
|
elif self.chk.has_type(e.callee.expr):
|
|
691
|
-
|
|
639
|
+
typ = get_proper_type(self.chk.lookup_type(e.callee.expr))
|
|
640
|
+
if (
|
|
641
|
+
isinstance(typ, Instance)
|
|
642
|
+
and typ.type.is_enum
|
|
643
|
+
and isinstance(typ.last_known_value, LiteralType)
|
|
644
|
+
and isinstance(typ.last_known_value.value, str)
|
|
645
|
+
):
|
|
646
|
+
value_type = typ.type.names[typ.last_known_value.value].type
|
|
647
|
+
if isinstance(value_type, Type):
|
|
648
|
+
typ = get_proper_type(value_type)
|
|
649
|
+
base_typ = try_getting_literal(typ)
|
|
692
650
|
if isinstance(base_typ, LiteralType) and isinstance(base_typ.value, str):
|
|
693
651
|
format_value = base_typ.value
|
|
694
652
|
if format_value is not None:
|
|
@@ -727,9 +685,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
727
685
|
if isinstance(node, RefExpr):
|
|
728
686
|
if self.defn_returns_none(node.node):
|
|
729
687
|
return True
|
|
730
|
-
if (
|
|
731
|
-
isinstance(node, MemberExpr) and node.node is None
|
|
732
|
-
): # instance or class attribute
|
|
688
|
+
if isinstance(node, MemberExpr) and node.node is None: # instance or class attribute
|
|
733
689
|
typ = get_proper_type(self.chk.lookup_type(node.expr))
|
|
734
690
|
if isinstance(typ, Instance):
|
|
735
691
|
info = typ.type
|
|
@@ -782,16 +738,10 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
782
738
|
def check_protocol_issubclass(self, e: CallExpr) -> None:
|
|
783
739
|
for expr in mypy.checker.flatten(e.args[1]):
|
|
784
740
|
tp = get_proper_type(self.chk.lookup_type(expr))
|
|
785
|
-
if (
|
|
786
|
-
isinstance(tp, FunctionLike)
|
|
787
|
-
and tp.is_type_obj()
|
|
788
|
-
and tp.type_object().is_protocol
|
|
789
|
-
):
|
|
741
|
+
if isinstance(tp, FunctionLike) and tp.is_type_obj() and tp.type_object().is_protocol:
|
|
790
742
|
attr_members = non_method_protocol_members(tp.type_object())
|
|
791
743
|
if attr_members:
|
|
792
|
-
self.chk.msg.report_non_method_protocol(
|
|
793
|
-
tp.type_object(), attr_members, e
|
|
794
|
-
)
|
|
744
|
+
self.chk.msg.report_non_method_protocol(tp.type_object(), attr_members, e)
|
|
795
745
|
|
|
796
746
|
def check_typeddict_call(
|
|
797
747
|
self,
|
|
@@ -806,9 +756,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
806
756
|
# ex: Point(x=42, y=1337, **extras)
|
|
807
757
|
# This is a bit ugly, but this is a price for supporting all possible syntax
|
|
808
758
|
# variants for TypedDict constructors.
|
|
809
|
-
kwargs = zip(
|
|
810
|
-
[StrExpr(n) if n is not None else None for n in arg_names], args
|
|
811
|
-
)
|
|
759
|
+
kwargs = zip([StrExpr(n) if n is not None else None for n in arg_names], args)
|
|
812
760
|
result = self.validate_typeddict_kwargs(kwargs=kwargs, callee=callee)
|
|
813
761
|
if result is not None:
|
|
814
762
|
validated_kwargs, always_present_keys = result
|
|
@@ -824,9 +772,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
824
772
|
return self.check_typeddict_call_with_dict(
|
|
825
773
|
callee, unique_arg.items, context, orig_callee
|
|
826
774
|
)
|
|
827
|
-
if isinstance(unique_arg, CallExpr) and isinstance(
|
|
828
|
-
unique_arg.analyzed, DictExpr
|
|
829
|
-
):
|
|
775
|
+
if isinstance(unique_arg, CallExpr) and isinstance(unique_arg.analyzed, DictExpr):
|
|
830
776
|
# ex: Point(dict(x=42, y=1337, **extras))
|
|
831
777
|
return self.check_typeddict_call_with_dict(
|
|
832
778
|
callee, unique_arg.analyzed.items, context, orig_callee
|
|
@@ -834,17 +780,13 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
834
780
|
|
|
835
781
|
if not args:
|
|
836
782
|
# ex: EmptyDict()
|
|
837
|
-
return self.check_typeddict_call_with_kwargs(
|
|
838
|
-
callee, {}, context, orig_callee, set()
|
|
839
|
-
)
|
|
783
|
+
return self.check_typeddict_call_with_kwargs(callee, {}, context, orig_callee, set())
|
|
840
784
|
|
|
841
785
|
self.chk.fail(message_registry.INVALID_TYPEDDICT_ARGS, context)
|
|
842
786
|
return AnyType(TypeOfAny.from_error)
|
|
843
787
|
|
|
844
788
|
def validate_typeddict_kwargs(
|
|
845
|
-
self,
|
|
846
|
-
kwargs: Iterable[tuple[Expression | None, Expression]],
|
|
847
|
-
callee: TypedDictType,
|
|
789
|
+
self, kwargs: Iterable[tuple[Expression | None, Expression]], callee: TypedDictType
|
|
848
790
|
) -> tuple[dict[str, list[Expression]], set[str]] | None:
|
|
849
791
|
# All (actual or mapped from ** unpacks) expressions that can match given key.
|
|
850
792
|
result = defaultdict(list)
|
|
@@ -890,9 +832,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
890
832
|
# TypedDict is unsafe, it may be an (incompatible) subtype at runtime.
|
|
891
833
|
# TODO: catch the cases where a declared key is overridden by a subsequent
|
|
892
834
|
# ** item without it (and not again overriden with complete ** item).
|
|
893
|
-
self.msg.non_required_keys_absent_with_star(
|
|
894
|
-
absent_keys, last_star_found
|
|
895
|
-
)
|
|
835
|
+
self.msg.non_required_keys_absent_with_star(absent_keys, last_star_found)
|
|
896
836
|
return result, always_present_keys
|
|
897
837
|
|
|
898
838
|
def validate_star_typeddict_item(
|
|
@@ -926,9 +866,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
926
866
|
all_keys |= td.items.keys()
|
|
927
867
|
for key in all_keys:
|
|
928
868
|
arg = TempNode(
|
|
929
|
-
UnionType.make_union(
|
|
930
|
-
[td.items[key] for td in possible_tds if key in td.items]
|
|
931
|
-
)
|
|
869
|
+
UnionType.make_union([td.items[key] for td in possible_tds if key in td.items])
|
|
932
870
|
)
|
|
933
871
|
arg.set_line(item_arg)
|
|
934
872
|
if all(key in td.required_keys for td in possible_tds):
|
|
@@ -958,9 +896,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
958
896
|
return True
|
|
959
897
|
if not isinstance(typ, Instance) or not typ.type.has_base("typing.Mapping"):
|
|
960
898
|
return False
|
|
961
|
-
mapped = map_instance_to_supertype(
|
|
962
|
-
typ, self.chk.lookup_typeinfo("typing.Mapping")
|
|
963
|
-
)
|
|
899
|
+
mapped = map_instance_to_supertype(typ, self.chk.lookup_typeinfo("typing.Mapping"))
|
|
964
900
|
return all(isinstance(a, AnyType) for a in get_proper_types(mapped.args))
|
|
965
901
|
|
|
966
902
|
def match_typeddict_call_with_dict(
|
|
@@ -972,11 +908,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
972
908
|
result = self.validate_typeddict_kwargs(kwargs=kwargs, callee=callee)
|
|
973
909
|
if result is not None:
|
|
974
910
|
validated_kwargs, _ = result
|
|
975
|
-
return (
|
|
976
|
-
callee.required_keys
|
|
977
|
-
<= set(validated_kwargs.keys())
|
|
978
|
-
<= set(callee.items.keys())
|
|
979
|
-
)
|
|
911
|
+
return callee.required_keys <= set(validated_kwargs.keys()) <= set(callee.items.keys())
|
|
980
912
|
else:
|
|
981
913
|
return False
|
|
982
914
|
|
|
@@ -1027,7 +959,10 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1027
959
|
def typeddict_callable_from_context(self, callee: TypedDictType) -> CallableType:
|
|
1028
960
|
return CallableType(
|
|
1029
961
|
list(callee.items.values()),
|
|
1030
|
-
[
|
|
962
|
+
[
|
|
963
|
+
ArgKind.ARG_NAMED if name in callee.required_keys else ArgKind.ARG_NAMED_OPT
|
|
964
|
+
for name in callee.items
|
|
965
|
+
],
|
|
1031
966
|
list(callee.items.keys()),
|
|
1032
967
|
callee,
|
|
1033
968
|
self.named_type("builtins.type"),
|
|
@@ -1043,8 +978,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1043
978
|
) -> Type:
|
|
1044
979
|
actual_keys = kwargs.keys()
|
|
1045
980
|
if not (
|
|
1046
|
-
callee.required_keys <= always_present_keys
|
|
1047
|
-
and actual_keys <= callee.items.keys()
|
|
981
|
+
callee.required_keys <= always_present_keys and actual_keys <= callee.items.keys()
|
|
1048
982
|
):
|
|
1049
983
|
if not (actual_keys <= callee.items.keys()):
|
|
1050
984
|
self.msg.unexpected_typeddict_keys(
|
|
@@ -1061,14 +995,10 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1061
995
|
self.msg.unexpected_typeddict_keys(
|
|
1062
996
|
callee,
|
|
1063
997
|
expected_keys=[
|
|
1064
|
-
key
|
|
1065
|
-
for key in callee.items.keys()
|
|
1066
|
-
if key in callee.required_keys
|
|
998
|
+
key for key in callee.items.keys() if key in callee.required_keys
|
|
1067
999
|
],
|
|
1068
1000
|
actual_keys=[
|
|
1069
|
-
key
|
|
1070
|
-
for key in always_present_keys
|
|
1071
|
-
if key in callee.required_keys
|
|
1001
|
+
key for key in always_present_keys if key in callee.required_keys
|
|
1072
1002
|
],
|
|
1073
1003
|
context=context,
|
|
1074
1004
|
)
|
|
@@ -1121,8 +1051,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1121
1051
|
rvalue=item_value,
|
|
1122
1052
|
context=item_value,
|
|
1123
1053
|
msg=ErrorMessage(
|
|
1124
|
-
message_registry.INCOMPATIBLE_TYPES.value,
|
|
1125
|
-
code=codes.TYPEDDICT_ITEM,
|
|
1054
|
+
message_registry.INCOMPATIBLE_TYPES.value, code=codes.TYPEDDICT_ITEM
|
|
1126
1055
|
),
|
|
1127
1056
|
lvalue_name=f'TypedDict item "{item_name}"',
|
|
1128
1057
|
rvalue_name="expression",
|
|
@@ -1180,9 +1109,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1180
1109
|
if typ is not None and var in partial_types:
|
|
1181
1110
|
var.type = typ
|
|
1182
1111
|
del partial_types[var]
|
|
1183
|
-
elif isinstance(callee.expr, IndexExpr) and isinstance(
|
|
1184
|
-
callee.expr.base, RefExpr
|
|
1185
|
-
):
|
|
1112
|
+
elif isinstance(callee.expr, IndexExpr) and isinstance(callee.expr.base, RefExpr):
|
|
1186
1113
|
# Call 'x[y].method(...)'; may infer type of 'x' if it's a partial defaultdict.
|
|
1187
1114
|
if callee.expr.analyzed is not None:
|
|
1188
1115
|
return # A special form
|
|
@@ -1195,9 +1122,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1195
1122
|
partial_type = get_partial_instance_type(var.type)
|
|
1196
1123
|
if partial_type is None or partial_type.value_type is None:
|
|
1197
1124
|
return
|
|
1198
|
-
value_type = self.try_infer_partial_value_type_from_call(
|
|
1199
|
-
e, callee.name, var
|
|
1200
|
-
)
|
|
1125
|
+
value_type = self.try_infer_partial_value_type_from_call(e, callee.name, var)
|
|
1201
1126
|
if value_type is not None:
|
|
1202
1127
|
# Infer key type.
|
|
1203
1128
|
key_type = self.accept(index)
|
|
@@ -1205,9 +1130,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1205
1130
|
# Store inferred partial type.
|
|
1206
1131
|
assert partial_type.type is not None
|
|
1207
1132
|
typename = partial_type.type.fullname
|
|
1208
|
-
var.type = self.chk.named_generic_type(
|
|
1209
|
-
typename, [key_type, value_type]
|
|
1210
|
-
)
|
|
1133
|
+
var.type = self.chk.named_generic_type(typename, [key_type, value_type])
|
|
1211
1134
|
del partial_types[var]
|
|
1212
1135
|
|
|
1213
1136
|
def get_partial_var(self, ref: RefExpr) -> tuple[Var, dict[Var, Context]] | None:
|
|
@@ -1258,9 +1181,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1258
1181
|
mypy.checker.is_valid_inferred_type(item_type)
|
|
1259
1182
|
for item_type in arg_type.args
|
|
1260
1183
|
):
|
|
1261
|
-
return self.chk.named_generic_type(
|
|
1262
|
-
typename, list(arg_type.args)
|
|
1263
|
-
)
|
|
1184
|
+
return self.chk.named_generic_type(typename, list(arg_type.args))
|
|
1264
1185
|
elif isinstance(arg_type, AnyType):
|
|
1265
1186
|
return self.chk.named_type(typename)
|
|
1266
1187
|
|
|
@@ -1364,9 +1285,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1364
1285
|
assert isinstance(callee, Overloaded)
|
|
1365
1286
|
items = []
|
|
1366
1287
|
for item in callee.items:
|
|
1367
|
-
adjusted = self.apply_signature_hook(
|
|
1368
|
-
item, args, arg_kinds, arg_names, hook
|
|
1369
|
-
)
|
|
1288
|
+
adjusted = self.apply_signature_hook(item, args, arg_kinds, arg_names, hook)
|
|
1370
1289
|
assert isinstance(adjusted, CallableType)
|
|
1371
1290
|
items.append(adjusted)
|
|
1372
1291
|
return Overloaded(items)
|
|
@@ -1386,11 +1305,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1386
1305
|
args,
|
|
1387
1306
|
arg_kinds,
|
|
1388
1307
|
arg_names,
|
|
1389
|
-
(
|
|
1390
|
-
lambda args, sig: signature_hook(
|
|
1391
|
-
FunctionSigContext(args, sig, context, self.chk)
|
|
1392
|
-
)
|
|
1393
|
-
),
|
|
1308
|
+
(lambda args, sig: signature_hook(FunctionSigContext(args, sig, context, self.chk))),
|
|
1394
1309
|
)
|
|
1395
1310
|
|
|
1396
1311
|
def apply_method_signature_hook(
|
|
@@ -1447,18 +1362,10 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1447
1362
|
method_sig_hook = self.plugin.get_method_signature_hook(callable_name)
|
|
1448
1363
|
if method_sig_hook:
|
|
1449
1364
|
return self.apply_method_signature_hook(
|
|
1450
|
-
callee,
|
|
1451
|
-
args,
|
|
1452
|
-
arg_kinds,
|
|
1453
|
-
context,
|
|
1454
|
-
arg_names,
|
|
1455
|
-
object_type,
|
|
1456
|
-
method_sig_hook,
|
|
1365
|
+
callee, args, arg_kinds, context, arg_names, object_type, method_sig_hook
|
|
1457
1366
|
)
|
|
1458
1367
|
else:
|
|
1459
|
-
function_sig_hook = self.plugin.get_function_signature_hook(
|
|
1460
|
-
callable_name
|
|
1461
|
-
)
|
|
1368
|
+
function_sig_hook = self.plugin.get_function_signature_hook(callable_name)
|
|
1462
1369
|
if function_sig_hook:
|
|
1463
1370
|
return self.apply_function_signature_hook(
|
|
1464
1371
|
callee, args, arg_kinds, context, arg_names, function_sig_hook
|
|
@@ -1498,9 +1405,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1498
1405
|
for item in overloaded.items:
|
|
1499
1406
|
arg = TempNode(typ=item)
|
|
1500
1407
|
with self.msg.filter_errors() as err:
|
|
1501
|
-
item_result, inferred_arg = self.check_call(
|
|
1502
|
-
callee_type, [arg], [ARG_POS], ctx
|
|
1503
|
-
)
|
|
1408
|
+
item_result, inferred_arg = self.check_call(callee_type, [arg], [ARG_POS], ctx)
|
|
1504
1409
|
if err.has_new_errors():
|
|
1505
1410
|
# This overload doesn't match.
|
|
1506
1411
|
continue
|
|
@@ -1543,13 +1448,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1543
1448
|
if callable_name:
|
|
1544
1449
|
# Try to refine the call signature using plugin hooks before checking the call.
|
|
1545
1450
|
callee_type = self.transform_callee_type(
|
|
1546
|
-
callable_name,
|
|
1547
|
-
callee_type,
|
|
1548
|
-
e.args,
|
|
1549
|
-
e.arg_kinds,
|
|
1550
|
-
e,
|
|
1551
|
-
e.arg_names,
|
|
1552
|
-
object_type,
|
|
1451
|
+
callable_name, callee_type, e.args, e.arg_kinds, e, e.arg_names, object_type
|
|
1553
1452
|
)
|
|
1554
1453
|
# Unions are special-cased to allow plugins to act on each item in the union.
|
|
1555
1454
|
elif member is not None and isinstance(object_type, UnionType):
|
|
@@ -1565,18 +1464,15 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1565
1464
|
object_type=object_type,
|
|
1566
1465
|
)
|
|
1567
1466
|
proper_callee = get_proper_type(callee_type)
|
|
1568
|
-
if (
|
|
1569
|
-
isinstance(e.callee, RefExpr)
|
|
1570
|
-
and isinstance(proper_callee, CallableType)
|
|
1571
|
-
and proper_callee.type_guard is not None
|
|
1572
|
-
):
|
|
1467
|
+
if isinstance(e.callee, RefExpr) and isinstance(proper_callee, CallableType):
|
|
1573
1468
|
# Cache it for find_isinstance_check()
|
|
1574
|
-
|
|
1469
|
+
if proper_callee.type_guard is not None:
|
|
1470
|
+
e.callee.type_guard = proper_callee.type_guard
|
|
1471
|
+
if proper_callee.type_is is not None:
|
|
1472
|
+
e.callee.type_is = proper_callee.type_is
|
|
1575
1473
|
return ret_type
|
|
1576
1474
|
|
|
1577
|
-
def check_union_call_expr(
|
|
1578
|
-
self, e: CallExpr, object_type: UnionType, member: str
|
|
1579
|
-
) -> Type:
|
|
1475
|
+
def check_union_call_expr(self, e: CallExpr, object_type: UnionType, member: str) -> Type:
|
|
1580
1476
|
"""Type check calling a member expression where the base type is a union."""
|
|
1581
1477
|
res: list[Type] = []
|
|
1582
1478
|
for typ in object_type.relevant_items():
|
|
@@ -1595,17 +1491,13 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1595
1491
|
in_literal_context=self.is_literal_context(),
|
|
1596
1492
|
self_type=typ,
|
|
1597
1493
|
)
|
|
1598
|
-
narrowed = self.narrow_type_from_binder(
|
|
1599
|
-
e.callee, item, skip_non_overlapping=True
|
|
1600
|
-
)
|
|
1494
|
+
narrowed = self.narrow_type_from_binder(e.callee, item, skip_non_overlapping=True)
|
|
1601
1495
|
if narrowed is None:
|
|
1602
1496
|
continue
|
|
1603
1497
|
callable_name = self.method_fullname(typ, member)
|
|
1604
1498
|
item_object_type = typ if callable_name else None
|
|
1605
1499
|
res.append(
|
|
1606
|
-
self.check_call_expr_with_callee_type(
|
|
1607
|
-
narrowed, e, callable_name, item_object_type
|
|
1608
|
-
)
|
|
1500
|
+
self.check_call_expr_with_callee_type(narrowed, e, callable_name, item_object_type)
|
|
1609
1501
|
)
|
|
1610
1502
|
return make_simplified_union(res)
|
|
1611
1503
|
|
|
@@ -1689,13 +1581,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1689
1581
|
callable_name = callee.type.fullname + ".__call__"
|
|
1690
1582
|
# Apply method signature hook, if one exists
|
|
1691
1583
|
call_function = self.transform_callee_type(
|
|
1692
|
-
callable_name,
|
|
1693
|
-
call_function,
|
|
1694
|
-
args,
|
|
1695
|
-
arg_kinds,
|
|
1696
|
-
context,
|
|
1697
|
-
arg_names,
|
|
1698
|
-
callee,
|
|
1584
|
+
callable_name, call_function, args, arg_kinds, context, arg_names, callee
|
|
1699
1585
|
)
|
|
1700
1586
|
result = self.check_call(
|
|
1701
1587
|
call_function,
|
|
@@ -1718,9 +1604,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1718
1604
|
)
|
|
1719
1605
|
elif isinstance(callee, TypeType):
|
|
1720
1606
|
item = self.analyze_type_type_callee(callee.item, context)
|
|
1721
|
-
return self.check_call(
|
|
1722
|
-
item, args, arg_kinds, context, arg_names, callable_node
|
|
1723
|
-
)
|
|
1607
|
+
return self.check_call(item, args, arg_kinds, context, arg_names, callable_node)
|
|
1724
1608
|
elif isinstance(callee, TupleType):
|
|
1725
1609
|
return self.check_call(
|
|
1726
1610
|
tuple_fallback(callee),
|
|
@@ -1769,9 +1653,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1769
1653
|
and not callee.from_type_type
|
|
1770
1654
|
):
|
|
1771
1655
|
self.chk.fail(
|
|
1772
|
-
message_registry.CANNOT_INSTANTIATE_PROTOCOL.format(
|
|
1773
|
-
callee.type_object().name
|
|
1774
|
-
),
|
|
1656
|
+
message_registry.CANNOT_INSTANTIATE_PROTOCOL.format(callee.type_object().name),
|
|
1775
1657
|
context,
|
|
1776
1658
|
)
|
|
1777
1659
|
elif (
|
|
@@ -1787,9 +1669,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1787
1669
|
abstract_attributes: dict[str, bool] = {}
|
|
1788
1670
|
for attr_name, abstract_status in type.abstract_attributes:
|
|
1789
1671
|
if abstract_status == IMPLICITLY_ABSTRACT:
|
|
1790
|
-
abstract_attributes[attr_name] = self.can_return_none(
|
|
1791
|
-
type, attr_name
|
|
1792
|
-
)
|
|
1672
|
+
abstract_attributes[attr_name] = self.can_return_none(type, attr_name)
|
|
1793
1673
|
else:
|
|
1794
1674
|
abstract_attributes[attr_name] = False
|
|
1795
1675
|
self.msg.cannot_instantiate_abstract_class(
|
|
@@ -1837,8 +1717,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1837
1717
|
|
|
1838
1718
|
if callee.is_generic():
|
|
1839
1719
|
need_refresh = any(
|
|
1840
|
-
isinstance(v, (ParamSpecType, TypeVarTupleType))
|
|
1841
|
-
for v in callee.variables
|
|
1720
|
+
isinstance(v, (ParamSpecType, TypeVarTupleType)) for v in callee.variables
|
|
1842
1721
|
)
|
|
1843
1722
|
callee = freshen_function_type_vars(callee)
|
|
1844
1723
|
callee = self.infer_function_type_arguments_using_context(callee, context)
|
|
@@ -1854,13 +1733,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1854
1733
|
lambda i: self.accept(args[i]),
|
|
1855
1734
|
)
|
|
1856
1735
|
callee = self.infer_function_type_arguments(
|
|
1857
|
-
callee,
|
|
1858
|
-
args,
|
|
1859
|
-
arg_kinds,
|
|
1860
|
-
arg_names,
|
|
1861
|
-
formal_to_actual,
|
|
1862
|
-
need_refresh,
|
|
1863
|
-
context,
|
|
1736
|
+
callee, args, arg_kinds, arg_names, formal_to_actual, need_refresh, context
|
|
1864
1737
|
)
|
|
1865
1738
|
if need_refresh:
|
|
1866
1739
|
formal_to_actual = map_actuals_to_formals(
|
|
@@ -1884,9 +1757,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1884
1757
|
):
|
|
1885
1758
|
return callee.ret_type, callee
|
|
1886
1759
|
|
|
1887
|
-
arg_types = self.infer_arg_types_in_context(
|
|
1888
|
-
callee, args, arg_kinds, formal_to_actual
|
|
1889
|
-
)
|
|
1760
|
+
arg_types = self.infer_arg_types_in_context(callee, args, arg_kinds, formal_to_actual)
|
|
1890
1761
|
|
|
1891
1762
|
self.check_argument_count(
|
|
1892
1763
|
callee,
|
|
@@ -1900,13 +1771,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1900
1771
|
)
|
|
1901
1772
|
|
|
1902
1773
|
self.check_argument_types(
|
|
1903
|
-
arg_types,
|
|
1904
|
-
arg_kinds,
|
|
1905
|
-
args,
|
|
1906
|
-
callee,
|
|
1907
|
-
formal_to_actual,
|
|
1908
|
-
context,
|
|
1909
|
-
object_type=object_type,
|
|
1774
|
+
arg_types, arg_kinds, args, callee, formal_to_actual, context, object_type=object_type
|
|
1910
1775
|
)
|
|
1911
1776
|
|
|
1912
1777
|
if (
|
|
@@ -1914,9 +1779,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1914
1779
|
and (len(arg_types) == 1)
|
|
1915
1780
|
and is_equivalent(callee.ret_type, self.named_type("builtins.type"))
|
|
1916
1781
|
):
|
|
1917
|
-
callee = callee.copy_modified(
|
|
1918
|
-
ret_type=TypeType.make_normalized(arg_types[0])
|
|
1919
|
-
)
|
|
1782
|
+
callee = callee.copy_modified(ret_type=TypeType.make_normalized(arg_types[0]))
|
|
1920
1783
|
|
|
1921
1784
|
if callable_node:
|
|
1922
1785
|
# Store the inferred callable type.
|
|
@@ -1994,23 +1857,18 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
1994
1857
|
# i.e. its constructor (a poor approximation for reality,
|
|
1995
1858
|
# but better than AnyType...), but replace the return type
|
|
1996
1859
|
# with typevar.
|
|
1997
|
-
callee = self.analyze_type_type_callee(
|
|
1998
|
-
get_proper_type(item.upper_bound), context
|
|
1999
|
-
)
|
|
1860
|
+
callee = self.analyze_type_type_callee(get_proper_type(item.upper_bound), context)
|
|
2000
1861
|
callee = get_proper_type(callee)
|
|
2001
1862
|
if isinstance(callee, CallableType):
|
|
2002
1863
|
callee = callee.copy_modified(ret_type=item)
|
|
2003
1864
|
elif isinstance(callee, Overloaded):
|
|
2004
|
-
callee = Overloaded(
|
|
2005
|
-
[c.copy_modified(ret_type=item) for c in callee.items]
|
|
2006
|
-
)
|
|
1865
|
+
callee = Overloaded([c.copy_modified(ret_type=item) for c in callee.items])
|
|
2007
1866
|
return callee
|
|
2008
1867
|
# We support Type of namedtuples but not of tuples in general
|
|
2009
|
-
if (
|
|
2010
|
-
isinstance(item, TupleType)
|
|
2011
|
-
and tuple_fallback(item).type.fullname != "builtins.tuple"
|
|
2012
|
-
):
|
|
1868
|
+
if isinstance(item, TupleType) and tuple_fallback(item).type.fullname != "builtins.tuple":
|
|
2013
1869
|
return self.analyze_type_type_callee(tuple_fallback(item), context)
|
|
1870
|
+
if isinstance(item, TypedDictType):
|
|
1871
|
+
return self.typeddict_callable_from_context(item)
|
|
2014
1872
|
|
|
2015
1873
|
self.msg.unsupported_type_type(item, context)
|
|
2016
1874
|
return AnyType(TypeOfAny.from_error)
|
|
@@ -2238,12 +2096,8 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2238
2096
|
first_arg = get_proper_type(inferred_args[0])
|
|
2239
2097
|
if isinstance(first_arg, (NoneType, UninhabitedType)):
|
|
2240
2098
|
inferred_args[0] = self.named_type("builtins.str")
|
|
2241
|
-
elif not first_arg or not is_subtype(
|
|
2242
|
-
self.
|
|
2243
|
-
):
|
|
2244
|
-
self.chk.fail(
|
|
2245
|
-
message_registry.KEYWORD_ARGUMENT_REQUIRES_STR_KEY_TYPE, context
|
|
2246
|
-
)
|
|
2099
|
+
elif not first_arg or not is_subtype(self.named_type("builtins.str"), first_arg):
|
|
2100
|
+
self.chk.fail(message_registry.KEYWORD_ARGUMENT_REQUIRES_STR_KEY_TYPE, context)
|
|
2247
2101
|
|
|
2248
2102
|
if not self.chk.options.old_type_inference and any(
|
|
2249
2103
|
a is None
|
|
@@ -2283,8 +2137,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2283
2137
|
# be interpreted as def [T] (T) -> T, but dict[T, T] cannot be expressed.
|
|
2284
2138
|
applied = apply_poly(poly_callee_type, free_vars)
|
|
2285
2139
|
if applied is not None and all(
|
|
2286
|
-
a is not None
|
|
2287
|
-
and not isinstance(get_proper_type(a), UninhabitedType)
|
|
2140
|
+
a is not None and not isinstance(get_proper_type(a), UninhabitedType)
|
|
2288
2141
|
for a in poly_inferred_args
|
|
2289
2142
|
):
|
|
2290
2143
|
freeze_all_type_vars(applied)
|
|
@@ -2295,11 +2148,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2295
2148
|
inferred_args = [
|
|
2296
2149
|
(
|
|
2297
2150
|
expand_type(
|
|
2298
|
-
a,
|
|
2299
|
-
{
|
|
2300
|
-
v.id: unknown
|
|
2301
|
-
for v in list(callee_type.variables) + free_vars
|
|
2302
|
-
},
|
|
2151
|
+
a, {v.id: unknown for v in list(callee_type.variables) + free_vars}
|
|
2303
2152
|
)
|
|
2304
2153
|
if a is not None
|
|
2305
2154
|
else None
|
|
@@ -2309,9 +2158,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2309
2158
|
else:
|
|
2310
2159
|
# In dynamically typed functions use implicit 'Any' types for
|
|
2311
2160
|
# type variables.
|
|
2312
|
-
inferred_args = [AnyType(TypeOfAny.unannotated)] * len(
|
|
2313
|
-
callee_type.variables
|
|
2314
|
-
)
|
|
2161
|
+
inferred_args = [AnyType(TypeOfAny.unannotated)] * len(callee_type.variables)
|
|
2315
2162
|
return self.apply_inferred_arguments(callee_type, inferred_args, context)
|
|
2316
2163
|
|
|
2317
2164
|
def infer_function_type_arguments_pass2(
|
|
@@ -2341,9 +2188,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2341
2188
|
# that they are not applied yet below.
|
|
2342
2189
|
inferred_args = list(old_inferred_args)
|
|
2343
2190
|
for i, arg in enumerate(get_proper_types(inferred_args)):
|
|
2344
|
-
if isinstance(arg, (NoneType, UninhabitedType)) or has_erased_component(
|
|
2345
|
-
arg
|
|
2346
|
-
):
|
|
2191
|
+
if isinstance(arg, (NoneType, UninhabitedType)) or has_erased_component(arg):
|
|
2347
2192
|
inferred_args[i] = None
|
|
2348
2193
|
callee_type = self.apply_generic_arguments(callee_type, inferred_args, context)
|
|
2349
2194
|
if need_refresh:
|
|
@@ -2374,8 +2219,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2374
2219
|
|
|
2375
2220
|
def argument_infer_context(self) -> ArgumentInferContext:
|
|
2376
2221
|
return ArgumentInferContext(
|
|
2377
|
-
self.chk.named_type("typing.Mapping"),
|
|
2378
|
-
self.chk.named_type("typing.Iterable"),
|
|
2222
|
+
self.chk.named_type("typing.Mapping"), self.chk.named_type("typing.Iterable")
|
|
2379
2223
|
)
|
|
2380
2224
|
|
|
2381
2225
|
def get_arg_infer_passes(
|
|
@@ -2410,9 +2254,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2410
2254
|
# we will use `test` for inference, since it will allow to infer also
|
|
2411
2255
|
# argument *names* for P <: [x: int, y: int].
|
|
2412
2256
|
if isinstance(p_actual, Instance):
|
|
2413
|
-
call_method = find_member(
|
|
2414
|
-
"__call__", p_actual, p_actual, is_operator=True
|
|
2415
|
-
)
|
|
2257
|
+
call_method = find_member("__call__", p_actual, p_actual, is_operator=True)
|
|
2416
2258
|
if call_method is not None:
|
|
2417
2259
|
p_actual = get_proper_type(call_method)
|
|
2418
2260
|
if (
|
|
@@ -2428,10 +2270,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2428
2270
|
return res
|
|
2429
2271
|
|
|
2430
2272
|
def apply_inferred_arguments(
|
|
2431
|
-
self,
|
|
2432
|
-
callee_type: CallableType,
|
|
2433
|
-
inferred_args: Sequence[Type | None],
|
|
2434
|
-
context: Context,
|
|
2273
|
+
self, callee_type: CallableType, inferred_args: Sequence[Type | None], context: Context
|
|
2435
2274
|
) -> CallableType:
|
|
2436
2275
|
"""Apply inferred values of type arguments to a generic function.
|
|
2437
2276
|
|
|
@@ -2486,18 +2325,12 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2486
2325
|
|
|
2487
2326
|
# Check for too many or few values for formals.
|
|
2488
2327
|
for i, kind in enumerate(callee.arg_kinds):
|
|
2489
|
-
if (
|
|
2490
|
-
kind.is_required()
|
|
2491
|
-
and not formal_to_actual[i]
|
|
2492
|
-
and not is_unexpected_arg_error
|
|
2493
|
-
):
|
|
2328
|
+
if kind.is_required() and not formal_to_actual[i] and not is_unexpected_arg_error:
|
|
2494
2329
|
# No actual for a mandatory formal
|
|
2495
2330
|
if kind.is_positional():
|
|
2496
2331
|
self.msg.too_few_arguments(callee, context, actual_names)
|
|
2497
2332
|
if object_type and callable_name and "." in callable_name:
|
|
2498
|
-
self.missing_classvar_callable_note(
|
|
2499
|
-
object_type, callable_name, context
|
|
2500
|
-
)
|
|
2333
|
+
self.missing_classvar_callable_note(object_type, callable_name, context)
|
|
2501
2334
|
else:
|
|
2502
2335
|
argname = callee.arg_names[i] or "?"
|
|
2503
2336
|
self.msg.missing_named_argument(callee, context, argname)
|
|
@@ -2513,8 +2346,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2513
2346
|
elif (
|
|
2514
2347
|
kind.is_named()
|
|
2515
2348
|
and formal_to_actual[i]
|
|
2516
|
-
and actual_kinds[formal_to_actual[i][0]]
|
|
2517
|
-
not in [nodes.ARG_NAMED, nodes.ARG_STAR2]
|
|
2349
|
+
and actual_kinds[formal_to_actual[i][0]] not in [nodes.ARG_NAMED, nodes.ARG_STAR2]
|
|
2518
2350
|
):
|
|
2519
2351
|
# Positional argument when expecting a keyword argument.
|
|
2520
2352
|
self.msg.too_many_positional_arguments(callee, context)
|
|
@@ -2536,9 +2368,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2536
2368
|
was there an extra keyword argument error [used to avoid duplicate errors]).
|
|
2537
2369
|
"""
|
|
2538
2370
|
|
|
2539
|
-
is_unexpected_arg_error =
|
|
2540
|
-
False # Keep track of errors to avoid duplicate errors
|
|
2541
|
-
)
|
|
2371
|
+
is_unexpected_arg_error = False # Keep track of errors to avoid duplicate errors
|
|
2542
2372
|
ok = True # False if we've found any error
|
|
2543
2373
|
|
|
2544
2374
|
for i, kind in enumerate(actual_kinds):
|
|
@@ -2558,15 +2388,11 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2558
2388
|
if kind != nodes.ARG_NAMED:
|
|
2559
2389
|
self.msg.too_many_arguments(callee, context)
|
|
2560
2390
|
else:
|
|
2561
|
-
assert
|
|
2562
|
-
actual_names
|
|
2563
|
-
), "Internal error: named kinds without names given"
|
|
2391
|
+
assert actual_names, "Internal error: named kinds without names given"
|
|
2564
2392
|
act_name = actual_names[i]
|
|
2565
2393
|
assert act_name is not None
|
|
2566
2394
|
act_type = actual_types[i]
|
|
2567
|
-
self.msg.unexpected_keyword_argument(
|
|
2568
|
-
callee, act_name, act_type, context
|
|
2569
|
-
)
|
|
2395
|
+
self.msg.unexpected_keyword_argument(callee, act_name, act_type, context)
|
|
2570
2396
|
is_unexpected_arg_error = True
|
|
2571
2397
|
elif (
|
|
2572
2398
|
kind == nodes.ARG_STAR and nodes.ARG_STAR not in callee.arg_kinds
|
|
@@ -2575,9 +2401,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2575
2401
|
if isinstance(actual_type, (TupleType, TypedDictType)):
|
|
2576
2402
|
if all_actuals.get(i, 0) < len(actual_type.items):
|
|
2577
2403
|
# Too many tuple/dict items as some did not match.
|
|
2578
|
-
if kind != nodes.ARG_STAR2 or not isinstance(
|
|
2579
|
-
actual_type, TypedDictType
|
|
2580
|
-
):
|
|
2404
|
+
if kind != nodes.ARG_STAR2 or not isinstance(actual_type, TypedDictType):
|
|
2581
2405
|
self.msg.too_many_arguments(callee, context)
|
|
2582
2406
|
else:
|
|
2583
2407
|
self.msg.too_many_arguments_from_typed_dict(
|
|
@@ -2642,12 +2466,9 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2642
2466
|
isinstance(p_actual_type, TupleType)
|
|
2643
2467
|
and len(p_actual_type.items) == 1
|
|
2644
2468
|
and isinstance(p_actual_type.items[0], UnpackType)
|
|
2645
|
-
and actual_kinds
|
|
2646
|
-
== [nodes.ARG_STAR] + [nodes.ARG_POS] * (len(actuals) - 1)
|
|
2469
|
+
and actual_kinds == [nodes.ARG_STAR] + [nodes.ARG_POS] * (len(actuals) - 1)
|
|
2647
2470
|
):
|
|
2648
|
-
actual_types = [p_actual_type.items[0]] + [
|
|
2649
|
-
arg_types[a] for a in actuals[1:]
|
|
2650
|
-
]
|
|
2471
|
+
actual_types = [p_actual_type.items[0]] + [arg_types[a] for a in actuals[1:]]
|
|
2651
2472
|
if isinstance(orig_callee_arg_type, UnpackType):
|
|
2652
2473
|
p_callee_type = get_proper_type(orig_callee_arg_type.type)
|
|
2653
2474
|
if isinstance(p_callee_type, TupleType):
|
|
@@ -2682,10 +2503,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2682
2503
|
else:
|
|
2683
2504
|
# We assume heterogeneous tuples are desugared earlier.
|
|
2684
2505
|
assert isinstance(inner_unpacked_type, Instance)
|
|
2685
|
-
assert
|
|
2686
|
-
inner_unpacked_type.type.fullname
|
|
2687
|
-
== "builtins.tuple"
|
|
2688
|
-
)
|
|
2506
|
+
assert inner_unpacked_type.type.fullname == "builtins.tuple"
|
|
2689
2507
|
callee_arg_types = (
|
|
2690
2508
|
unpacked_type.items[:inner_unpack_index]
|
|
2691
2509
|
+ [inner_unpacked_type.args[0]]
|
|
@@ -2716,29 +2534,19 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2716
2534
|
|
|
2717
2535
|
assert len(callee_arg_types) == len(actual_types)
|
|
2718
2536
|
assert len(callee_arg_types) == len(callee_arg_kinds)
|
|
2719
|
-
for (
|
|
2720
|
-
actual,
|
|
2721
|
-
actual_type,
|
|
2722
|
-
actual_kind,
|
|
2723
|
-
callee_arg_type,
|
|
2724
|
-
callee_arg_kind,
|
|
2725
|
-
) in zip(
|
|
2537
|
+
for actual, actual_type, actual_kind, callee_arg_type, callee_arg_kind in zip(
|
|
2726
2538
|
actuals, actual_types, actual_kinds, callee_arg_types, callee_arg_kinds
|
|
2727
2539
|
):
|
|
2728
2540
|
if actual_type is None:
|
|
2729
2541
|
continue # Some kind of error was already reported.
|
|
2730
2542
|
# Check that a *arg is valid as varargs.
|
|
2731
|
-
if actual_kind == nodes.ARG_STAR and not self.is_valid_var_arg(
|
|
2732
|
-
actual_type
|
|
2733
|
-
):
|
|
2543
|
+
if actual_kind == nodes.ARG_STAR and not self.is_valid_var_arg(actual_type):
|
|
2734
2544
|
self.msg.invalid_var_arg(actual_type, context)
|
|
2735
|
-
if (
|
|
2736
|
-
|
|
2737
|
-
and not self.is_valid_keyword_var_arg(actual_type)
|
|
2545
|
+
if actual_kind == nodes.ARG_STAR2 and not self.is_valid_keyword_var_arg(
|
|
2546
|
+
actual_type
|
|
2738
2547
|
):
|
|
2739
2548
|
is_mapping = is_subtype(
|
|
2740
|
-
actual_type,
|
|
2741
|
-
self.chk.named_type("_typeshed.SupportsKeysAndGetItem"),
|
|
2549
|
+
actual_type, self.chk.named_type("_typeshed.SupportsKeysAndGetItem")
|
|
2742
2550
|
)
|
|
2743
2551
|
self.msg.invalid_keyword_var_arg(actual_type, is_mapping, context)
|
|
2744
2552
|
expanded_actual = mapper.expand_actual_type(
|
|
@@ -2799,9 +2607,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2799
2607
|
original_caller_type, callee_type, context, code=code
|
|
2800
2608
|
)
|
|
2801
2609
|
if not self.msg.prefer_simple_messages():
|
|
2802
|
-
self.chk.check_possible_missing_await(
|
|
2803
|
-
caller_type, callee_type, context, code
|
|
2804
|
-
)
|
|
2610
|
+
self.chk.check_possible_missing_await(caller_type, callee_type, context, code)
|
|
2805
2611
|
|
|
2806
2612
|
def check_overload_call(
|
|
2807
2613
|
self,
|
|
@@ -2833,9 +2639,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2833
2639
|
# Determine whether we need to encourage union math. This should be generally safe,
|
|
2834
2640
|
# as union math infers better results in the vast majority of cases, but it is very
|
|
2835
2641
|
# computationally intensive.
|
|
2836
|
-
none_type_var_overlap = self.possible_none_type_var_overlap(
|
|
2837
|
-
arg_types, plausible_targets
|
|
2838
|
-
)
|
|
2642
|
+
none_type_var_overlap = self.possible_none_type_var_overlap(arg_types, plausible_targets)
|
|
2839
2643
|
union_interrupted = False # did we try all union combinations?
|
|
2840
2644
|
if any(self.real_union(arg) for arg in arg_types):
|
|
2841
2645
|
try:
|
|
@@ -2863,12 +2667,8 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2863
2667
|
# Union[int -> int, str -> str](Union[int, str]) is invalid and
|
|
2864
2668
|
# we don't want to introduce internal inconsistencies.
|
|
2865
2669
|
unioned_result = (
|
|
2866
|
-
make_simplified_union(
|
|
2867
|
-
|
|
2868
|
-
),
|
|
2869
|
-
self.combine_function_signatures(
|
|
2870
|
-
get_proper_types(inferred_types)
|
|
2871
|
-
),
|
|
2670
|
+
make_simplified_union(list(returns), context.line, context.column),
|
|
2671
|
+
self.combine_function_signatures(get_proper_types(inferred_types)),
|
|
2872
2672
|
)
|
|
2873
2673
|
|
|
2874
2674
|
# Step 3: We try checking each branch one-by-one.
|
|
@@ -2980,11 +2780,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
2980
2780
|
|
|
2981
2781
|
for typ in overload.items:
|
|
2982
2782
|
formal_to_actual = map_actuals_to_formals(
|
|
2983
|
-
arg_kinds,
|
|
2984
|
-
arg_names,
|
|
2985
|
-
typ.arg_kinds,
|
|
2986
|
-
typ.arg_names,
|
|
2987
|
-
lambda i: arg_types[i],
|
|
2783
|
+
arg_kinds, arg_names, typ.arg_kinds, typ.arg_names, lambda i: arg_types[i]
|
|
2988
2784
|
)
|
|
2989
2785
|
|
|
2990
2786
|
with self.msg.filter_errors():
|
|
@@ -3060,9 +2856,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
3060
2856
|
|
|
3061
2857
|
if not matches:
|
|
3062
2858
|
return None
|
|
3063
|
-
elif any_causes_overload_ambiguity(
|
|
3064
|
-
matches, return_types, arg_types, arg_kinds, arg_names
|
|
3065
|
-
):
|
|
2859
|
+
elif any_causes_overload_ambiguity(matches, return_types, arg_types, arg_kinds, arg_names):
|
|
3066
2860
|
# An argument of type or containing the type 'Any' caused ambiguity.
|
|
3067
2861
|
# We try returning a precise type if we can. If not, we give up and just return 'Any'.
|
|
3068
2862
|
if all_same_types(return_types):
|
|
@@ -3138,11 +2932,9 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
3138
2932
|
min_prefix = min(len(c.arg_types) for c in plausible_targets)
|
|
3139
2933
|
for i in range(min_prefix):
|
|
3140
2934
|
if any(
|
|
3141
|
-
isinstance(get_proper_type(c.arg_types[i]), NoneType)
|
|
3142
|
-
for c in plausible_targets
|
|
2935
|
+
isinstance(get_proper_type(c.arg_types[i]), NoneType) for c in plausible_targets
|
|
3143
2936
|
) and any(
|
|
3144
|
-
isinstance(get_proper_type(c.arg_types[i]), TypeVarType)
|
|
3145
|
-
for c in plausible_targets
|
|
2937
|
+
isinstance(get_proper_type(c.arg_types[i]), TypeVarType) for c in plausible_targets
|
|
3146
2938
|
):
|
|
3147
2939
|
return True
|
|
3148
2940
|
return False
|
|
@@ -3267,9 +3059,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
3267
3059
|
for expr in exprs:
|
|
3268
3060
|
del self.type_overrides[expr]
|
|
3269
3061
|
|
|
3270
|
-
def combine_function_signatures(
|
|
3271
|
-
self, types: list[ProperType]
|
|
3272
|
-
) -> AnyType | CallableType:
|
|
3062
|
+
def combine_function_signatures(self, types: list[ProperType]) -> AnyType | CallableType:
|
|
3273
3063
|
"""Accepts a list of function signatures and attempts to combine them together into a
|
|
3274
3064
|
new CallableType consisting of the union of all of the given arguments and return types.
|
|
3275
3065
|
|
|
@@ -3310,9 +3100,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
3310
3100
|
if len(new_kinds) != len(target.arg_kinds):
|
|
3311
3101
|
too_complex = True
|
|
3312
3102
|
break
|
|
3313
|
-
for i, (new_kind, target_kind) in enumerate(
|
|
3314
|
-
zip(new_kinds, target.arg_kinds)
|
|
3315
|
-
):
|
|
3103
|
+
for i, (new_kind, target_kind) in enumerate(zip(new_kinds, target.arg_kinds)):
|
|
3316
3104
|
if new_kind == target_kind:
|
|
3317
3105
|
continue
|
|
3318
3106
|
elif new_kind.is_positional() and target_kind.is_positional():
|
|
@@ -3365,11 +3153,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
3365
3153
|
"""Determine whether arguments could match the signature at runtime, after
|
|
3366
3154
|
erasing types."""
|
|
3367
3155
|
formal_to_actual = map_actuals_to_formals(
|
|
3368
|
-
arg_kinds,
|
|
3369
|
-
arg_names,
|
|
3370
|
-
callee.arg_kinds,
|
|
3371
|
-
callee.arg_names,
|
|
3372
|
-
lambda i: arg_types[i],
|
|
3156
|
+
arg_kinds, arg_names, callee.arg_kinds, callee.arg_names, lambda i: arg_types[i]
|
|
3373
3157
|
)
|
|
3374
3158
|
|
|
3375
3159
|
with self.msg.filter_errors():
|
|
@@ -3426,9 +3210,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
3426
3210
|
skip_unsatisfied=skip_unsatisfied,
|
|
3427
3211
|
)
|
|
3428
3212
|
|
|
3429
|
-
def check_any_type_call(
|
|
3430
|
-
self, args: list[Expression], callee: Type
|
|
3431
|
-
) -> tuple[Type, Type]:
|
|
3213
|
+
def check_any_type_call(self, args: list[Expression], callee: Type) -> tuple[Type, Type]:
|
|
3432
3214
|
self.infer_arg_types_in_empty_context(args)
|
|
3433
3215
|
callee = get_proper_type(callee)
|
|
3434
3216
|
if isinstance(callee, AnyType):
|
|
@@ -3548,9 +3330,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
3548
3330
|
|
|
3549
3331
|
def concat_tuples(self, left: TupleType, right: TupleType) -> TupleType:
|
|
3550
3332
|
"""Concatenate two fixed length tuples."""
|
|
3551
|
-
assert not (
|
|
3552
|
-
find_unpack_in_list(left.items) and find_unpack_in_list(right.items)
|
|
3553
|
-
)
|
|
3333
|
+
assert not (find_unpack_in_list(left.items) and find_unpack_in_list(right.items))
|
|
3554
3334
|
return TupleType(
|
|
3555
3335
|
items=left.items + right.items, fallback=self.named_type("builtins.tuple")
|
|
3556
3336
|
)
|
|
@@ -3602,18 +3382,14 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
3602
3382
|
if left_add_method and left_add_method.fullname == "builtins.tuple.__add__":
|
|
3603
3383
|
proper_right_type = get_proper_type(self.accept(e.right))
|
|
3604
3384
|
if isinstance(proper_right_type, TupleType):
|
|
3605
|
-
right_radd_method = proper_right_type.partial_fallback.type.get(
|
|
3606
|
-
"__radd__"
|
|
3607
|
-
)
|
|
3385
|
+
right_radd_method = proper_right_type.partial_fallback.type.get("__radd__")
|
|
3608
3386
|
if right_radd_method is None:
|
|
3609
3387
|
# One cannot have two variadic items in the same tuple.
|
|
3610
3388
|
if (
|
|
3611
3389
|
find_unpack_in_list(proper_left_type.items) is None
|
|
3612
3390
|
or find_unpack_in_list(proper_right_type.items) is None
|
|
3613
3391
|
):
|
|
3614
|
-
return self.concat_tuples(
|
|
3615
|
-
proper_left_type, proper_right_type
|
|
3616
|
-
)
|
|
3392
|
+
return self.concat_tuples(proper_left_type, proper_right_type)
|
|
3617
3393
|
elif (
|
|
3618
3394
|
PRECISE_TUPLE_TYPES in self.chk.options.enable_incomplete_feature
|
|
3619
3395
|
and isinstance(proper_right_type, Instance)
|
|
@@ -3623,14 +3399,11 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
3623
3399
|
right_radd_method = proper_right_type.type.get("__radd__")
|
|
3624
3400
|
if (
|
|
3625
3401
|
right_radd_method is None
|
|
3626
|
-
and proper_left_type.partial_fallback.type.fullname
|
|
3627
|
-
== "builtins.tuple"
|
|
3402
|
+
and proper_left_type.partial_fallback.type.fullname == "builtins.tuple"
|
|
3628
3403
|
and find_unpack_in_list(proper_left_type.items) is None
|
|
3629
3404
|
):
|
|
3630
3405
|
item_type = self.chk.iterable_item_type(proper_right_type, e)
|
|
3631
|
-
mapped = self.chk.named_generic_type(
|
|
3632
|
-
"builtins.tuple", [item_type]
|
|
3633
|
-
)
|
|
3406
|
+
mapped = self.chk.named_generic_type("builtins.tuple", [item_type])
|
|
3634
3407
|
return proper_left_type.copy_modified(
|
|
3635
3408
|
items=proper_left_type.items + [UnpackType(mapped)]
|
|
3636
3409
|
)
|
|
@@ -3662,8 +3435,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
3662
3435
|
proper_right_type = get_proper_type(self.accept(e.right))
|
|
3663
3436
|
if (
|
|
3664
3437
|
isinstance(proper_right_type, TupleType)
|
|
3665
|
-
and proper_right_type.partial_fallback.type.fullname
|
|
3666
|
-
== "builtins.tuple"
|
|
3438
|
+
and proper_right_type.partial_fallback.type.fullname == "builtins.tuple"
|
|
3667
3439
|
and find_unpack_in_list(proper_right_type.items) is None
|
|
3668
3440
|
):
|
|
3669
3441
|
return proper_right_type.copy_modified(
|
|
@@ -3738,9 +3510,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
3738
3510
|
for item_type in item_types:
|
|
3739
3511
|
# Keep track of whether we get type check errors (these won't be reported, they
|
|
3740
3512
|
# are just to verify whether something is valid typing wise).
|
|
3741
|
-
with self.msg.filter_errors(
|
|
3742
|
-
save_filtered_errors=True
|
|
3743
|
-
) as container_errors:
|
|
3513
|
+
with self.msg.filter_errors(save_filtered_errors=True) as container_errors:
|
|
3744
3514
|
_, method_type = self.check_method_call_by_name(
|
|
3745
3515
|
method="__contains__",
|
|
3746
3516
|
base_type=item_type,
|
|
@@ -3766,13 +3536,8 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
3766
3536
|
self.is_valid_var_arg(item_type)
|
|
3767
3537
|
):
|
|
3768
3538
|
# it's not a container, but it is an iterable
|
|
3769
|
-
with self.msg.filter_errors(
|
|
3770
|
-
|
|
3771
|
-
) as iterable_errors:
|
|
3772
|
-
(
|
|
3773
|
-
_,
|
|
3774
|
-
itertype,
|
|
3775
|
-
) = self.chk.analyze_iterable_item_type_without_expression(
|
|
3539
|
+
with self.msg.filter_errors(save_filtered_errors=True) as iterable_errors:
|
|
3540
|
+
_, itertype = self.chk.analyze_iterable_item_type_without_expression(
|
|
3776
3541
|
item_type, e
|
|
3777
3542
|
)
|
|
3778
3543
|
if iterable_errors.has_new_errors():
|
|
@@ -3799,9 +3564,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
3799
3564
|
iterable_type = UnionType.make_union(iterable_types)
|
|
3800
3565
|
if not is_subtype(left_type, iterable_type):
|
|
3801
3566
|
if not container_types:
|
|
3802
|
-
self.msg.unsupported_operand_types(
|
|
3803
|
-
"in", left_type, right_type, e
|
|
3804
|
-
)
|
|
3567
|
+
self.msg.unsupported_operand_types("in", left_type, right_type, e)
|
|
3805
3568
|
else:
|
|
3806
3569
|
container_type = UnionType.make_union(container_types)
|
|
3807
3570
|
if self.dangerous_comparison(
|
|
@@ -3831,9 +3594,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
3831
3594
|
# Show the most specific literal types possible
|
|
3832
3595
|
left_type = try_getting_literal(left_type)
|
|
3833
3596
|
right_type = try_getting_literal(right_type)
|
|
3834
|
-
self.msg.dangerous_comparison(
|
|
3835
|
-
left_type, right_type, "equality", e
|
|
3836
|
-
)
|
|
3597
|
+
self.msg.dangerous_comparison(left_type, right_type, "equality", e)
|
|
3837
3598
|
|
|
3838
3599
|
elif operator == "is" or operator == "is not":
|
|
3839
3600
|
right_type = self.accept(right) # validate the right operand
|
|
@@ -3910,9 +3671,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
3910
3671
|
# We suppress the error if there is a custom __eq__() method on either
|
|
3911
3672
|
# side. User defined (or even standard library) classes can define this
|
|
3912
3673
|
# to return True for comparisons between non-overlapping types.
|
|
3913
|
-
if custom_special_method(left, "__eq__") or custom_special_method(
|
|
3914
|
-
right, "__eq__"
|
|
3915
|
-
):
|
|
3674
|
+
if custom_special_method(left, "__eq__") or custom_special_method(right, "__eq__"):
|
|
3916
3675
|
return False
|
|
3917
3676
|
|
|
3918
3677
|
if prefer_literal:
|
|
@@ -3965,22 +3724,15 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
3965
3724
|
return self.dangerous_comparison(
|
|
3966
3725
|
left.args[0], right.args[0], seen_types=seen_types
|
|
3967
3726
|
)
|
|
3968
|
-
elif left.type.has_base("typing.Mapping") and right.type.has_base(
|
|
3969
|
-
"typing.Mapping"
|
|
3970
|
-
):
|
|
3727
|
+
elif left.type.has_base("typing.Mapping") and right.type.has_base("typing.Mapping"):
|
|
3971
3728
|
# Similar to above: Mapping ignores the classes, it just compares items.
|
|
3972
3729
|
abstract_map = self.chk.lookup_typeinfo("typing.Mapping")
|
|
3973
3730
|
left = map_instance_to_supertype(left, abstract_map)
|
|
3974
3731
|
right = map_instance_to_supertype(right, abstract_map)
|
|
3975
3732
|
return self.dangerous_comparison(
|
|
3976
3733
|
left.args[0], right.args[0], seen_types=seen_types
|
|
3977
|
-
) or self.dangerous_comparison(
|
|
3978
|
-
|
|
3979
|
-
)
|
|
3980
|
-
elif (
|
|
3981
|
-
left_name in ("builtins.list", "builtins.tuple")
|
|
3982
|
-
and right_name == left_name
|
|
3983
|
-
):
|
|
3734
|
+
) or self.dangerous_comparison(left.args[1], right.args[1], seen_types=seen_types)
|
|
3735
|
+
elif left_name in ("builtins.list", "builtins.tuple") and right_name == left_name:
|
|
3984
3736
|
return self.dangerous_comparison(
|
|
3985
3737
|
left.args[0], right.args[0], seen_types=seen_types
|
|
3986
3738
|
)
|
|
@@ -4028,9 +3780,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4028
3780
|
chk=self.chk,
|
|
4029
3781
|
in_literal_context=self.is_literal_context(),
|
|
4030
3782
|
)
|
|
4031
|
-
return self.check_method_call(
|
|
4032
|
-
method, base_type, method_type, args, arg_kinds, context
|
|
4033
|
-
)
|
|
3783
|
+
return self.check_method_call(method, base_type, method_type, args, arg_kinds, context)
|
|
4034
3784
|
|
|
4035
3785
|
def check_union_method_call_by_name(
|
|
4036
3786
|
self,
|
|
@@ -4078,12 +3828,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4078
3828
|
|
|
4079
3829
|
# Try to refine the method signature using plugin hooks before checking the call.
|
|
4080
3830
|
method_type = self.transform_callee_type(
|
|
4081
|
-
callable_name,
|
|
4082
|
-
method_type,
|
|
4083
|
-
args,
|
|
4084
|
-
arg_kinds,
|
|
4085
|
-
context,
|
|
4086
|
-
object_type=object_type,
|
|
3831
|
+
callable_name, method_type, args, arg_kinds, context, object_type=object_type
|
|
4087
3832
|
)
|
|
4088
3833
|
|
|
4089
3834
|
return self.check_call(
|
|
@@ -4176,9 +3921,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4176
3921
|
# We store the determined order inside the 'variants_raw' variable,
|
|
4177
3922
|
# which records tuples containing the method, base type, and the argument.
|
|
4178
3923
|
|
|
4179
|
-
if op_name in operators.op_methods_that_shortcut and is_same_type(
|
|
4180
|
-
left_type, right_type
|
|
4181
|
-
):
|
|
3924
|
+
if op_name in operators.op_methods_that_shortcut and is_same_type(left_type, right_type):
|
|
4182
3925
|
# When we do "A() + A()", for example, Python will only call the __add__ method,
|
|
4183
3926
|
# never the __radd__ method.
|
|
4184
3927
|
#
|
|
@@ -4194,8 +3937,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4194
3937
|
left_type.type.alt_promote is not None
|
|
4195
3938
|
and left_type.type.alt_promote.type is right_type.type
|
|
4196
3939
|
)
|
|
4197
|
-
and lookup_definer(left_type, op_name)
|
|
4198
|
-
!= lookup_definer(right_type, rev_op_name)
|
|
3940
|
+
and lookup_definer(left_type, op_name) != lookup_definer(right_type, rev_op_name)
|
|
4199
3941
|
):
|
|
4200
3942
|
# When we do "A() + B()" where B is a subclass of A, we'll actually try calling
|
|
4201
3943
|
# B's __radd__ method first, but ONLY if B explicitly defines or overrides the
|
|
@@ -4207,18 +3949,12 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4207
3949
|
# As a special case, the alt_promote check makes sure that we don't use the
|
|
4208
3950
|
# __radd__ method of int if the LHS is a native int type.
|
|
4209
3951
|
|
|
4210
|
-
variants_raw = [
|
|
4211
|
-
(right_op, right_type, left_expr),
|
|
4212
|
-
(left_op, left_type, right_expr),
|
|
4213
|
-
]
|
|
3952
|
+
variants_raw = [(right_op, right_type, left_expr), (left_op, left_type, right_expr)]
|
|
4214
3953
|
else:
|
|
4215
3954
|
# In all other cases, we do the usual thing and call __add__ first and
|
|
4216
3955
|
# __radd__ second when doing "A() + B()".
|
|
4217
3956
|
|
|
4218
|
-
variants_raw = [
|
|
4219
|
-
(left_op, left_type, right_expr),
|
|
4220
|
-
(right_op, right_type, left_expr),
|
|
4221
|
-
]
|
|
3957
|
+
variants_raw = [(left_op, left_type, right_expr), (right_op, right_type, left_expr)]
|
|
4222
3958
|
|
|
4223
3959
|
# STEP 3:
|
|
4224
3960
|
# We now filter out all non-existent operators. The 'variants' list contains
|
|
@@ -4236,9 +3972,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4236
3972
|
results = []
|
|
4237
3973
|
for method, obj, arg in variants:
|
|
4238
3974
|
with self.msg.filter_errors(save_filtered_errors=True) as local_errors:
|
|
4239
|
-
result = self.check_method_call(
|
|
4240
|
-
op_name, obj, method, [arg], [ARG_POS], context
|
|
4241
|
-
)
|
|
3975
|
+
result = self.check_method_call(op_name, obj, method, [arg], [ARG_POS], context)
|
|
4242
3976
|
if local_errors.has_new_errors():
|
|
4243
3977
|
errors.append(local_errors.filtered_errors())
|
|
4244
3978
|
results.append(result)
|
|
@@ -4376,9 +4110,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4376
4110
|
if len(left_variants) >= 2 and len(right_variants) >= 2:
|
|
4377
4111
|
self.msg.warn_both_operands_are_from_unions(recent_context)
|
|
4378
4112
|
elif len(left_variants) >= 2:
|
|
4379
|
-
self.msg.warn_operand_was_from_union(
|
|
4380
|
-
"Left", base_type, context=recent_context
|
|
4381
|
-
)
|
|
4113
|
+
self.msg.warn_operand_was_from_union("Left", base_type, context=recent_context)
|
|
4382
4114
|
elif len(right_variants) >= 2:
|
|
4383
4115
|
self.msg.warn_operand_was_from_union(
|
|
4384
4116
|
"Right", right_type, context=recent_context
|
|
@@ -4388,9 +4120,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4388
4120
|
# we call 'combine_function_signature' instead of just unioning the inferred
|
|
4389
4121
|
# callable types.
|
|
4390
4122
|
results_final = make_simplified_union(all_results)
|
|
4391
|
-
inferred_final = self.combine_function_signatures(
|
|
4392
|
-
get_proper_types(all_inferred)
|
|
4393
|
-
)
|
|
4123
|
+
inferred_final = self.combine_function_signatures(get_proper_types(all_inferred))
|
|
4394
4124
|
return results_final, inferred_final
|
|
4395
4125
|
else:
|
|
4396
4126
|
return self.check_method_call_by_name(
|
|
@@ -4450,9 +4180,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4450
4180
|
# to be unreachable and therefore any errors found in the right branch
|
|
4451
4181
|
# should be suppressed.
|
|
4452
4182
|
with self.msg.filter_errors(filter_errors=right_map is None):
|
|
4453
|
-
right_type = self.analyze_cond_branch(
|
|
4454
|
-
right_map, e.right, expanded_left_type
|
|
4455
|
-
)
|
|
4183
|
+
right_type = self.analyze_cond_branch(right_map, e.right, expanded_left_type)
|
|
4456
4184
|
|
|
4457
4185
|
if left_map is None and right_map is None:
|
|
4458
4186
|
return UninhabitedType()
|
|
@@ -4517,9 +4245,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4517
4245
|
result: Type = self.bool_type()
|
|
4518
4246
|
else:
|
|
4519
4247
|
method = operators.unary_op_methods[op]
|
|
4520
|
-
result, method_type = self.check_method_call_by_name(
|
|
4521
|
-
method, operand_type, [], [], e
|
|
4522
|
-
)
|
|
4248
|
+
result, method_type = self.check_method_call_by_name(method, operand_type, [], [], e)
|
|
4523
4249
|
e.method_type = method_type
|
|
4524
4250
|
return result
|
|
4525
4251
|
|
|
@@ -4592,9 +4318,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4592
4318
|
self.chk.fail(message_registry.TUPLE_INDEX_OUT_OF_RANGE, e)
|
|
4593
4319
|
if any(isinstance(t, UnpackType) for t in left_type.items):
|
|
4594
4320
|
min_len = self.min_tuple_length(left_type)
|
|
4595
|
-
self.chk.note(
|
|
4596
|
-
f"Variadic tuple can have length {min_len}", e
|
|
4597
|
-
)
|
|
4321
|
+
self.chk.note(f"Variadic tuple can have length {min_len}", e)
|
|
4598
4322
|
return AnyType(TypeOfAny.from_error)
|
|
4599
4323
|
return make_simplified_union(out)
|
|
4600
4324
|
else:
|
|
@@ -4613,12 +4337,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4613
4337
|
return self.visit_index_with_type(left_type.upper_bound, e, original_type)
|
|
4614
4338
|
else:
|
|
4615
4339
|
result, method_type = self.check_method_call_by_name(
|
|
4616
|
-
"__getitem__",
|
|
4617
|
-
left_type,
|
|
4618
|
-
[e.index],
|
|
4619
|
-
[ARG_POS],
|
|
4620
|
-
e,
|
|
4621
|
-
original_type=original_type,
|
|
4340
|
+
"__getitem__", left_type, [e.index], [ARG_POS], e, original_type=original_type
|
|
4622
4341
|
)
|
|
4623
4342
|
e.method_type = method_type
|
|
4624
4343
|
return result
|
|
@@ -4667,9 +4386,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4667
4386
|
return left.items[n]
|
|
4668
4387
|
return UnionType.make_union(
|
|
4669
4388
|
[middle]
|
|
4670
|
-
+ left.items[
|
|
4671
|
-
unpack_index + 1 : max(n - extra_items + 2, unpack_index + 1)
|
|
4672
|
-
],
|
|
4389
|
+
+ left.items[unpack_index + 1 : max(n - extra_items + 2, unpack_index + 1)],
|
|
4673
4390
|
left.line,
|
|
4674
4391
|
left.column,
|
|
4675
4392
|
)
|
|
@@ -4680,9 +4397,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4680
4397
|
if n >= unpack_index + extra_items:
|
|
4681
4398
|
return left.items[n - extra_items + 1]
|
|
4682
4399
|
return UnionType.make_union(
|
|
4683
|
-
left.items[min(n, unpack_index) : unpack_index] + [middle],
|
|
4684
|
-
left.line,
|
|
4685
|
-
left.column,
|
|
4400
|
+
left.items[min(n, unpack_index) : unpack_index] + [middle], left.line, left.column
|
|
4686
4401
|
)
|
|
4687
4402
|
|
|
4688
4403
|
def visit_tuple_slice_helper(self, left_type: TupleType, slic: SliceExpr) -> Type:
|
|
@@ -4736,6 +4451,10 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4736
4451
|
operand = index.expr
|
|
4737
4452
|
if isinstance(operand, IntExpr):
|
|
4738
4453
|
return [-1 * operand.value]
|
|
4454
|
+
if index.op == "+":
|
|
4455
|
+
operand = index.expr
|
|
4456
|
+
if isinstance(operand, IntExpr):
|
|
4457
|
+
return [operand.value]
|
|
4739
4458
|
typ = get_proper_type(self.accept(index))
|
|
4740
4459
|
if isinstance(typ, Instance) and typ.last_known_value is not None:
|
|
4741
4460
|
typ = typ.last_known_value
|
|
@@ -4751,12 +4470,8 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4751
4470
|
return out
|
|
4752
4471
|
return None
|
|
4753
4472
|
|
|
4754
|
-
def nonliteral_tuple_index_helper(
|
|
4755
|
-
self, left_type
|
|
4756
|
-
) -> Type:
|
|
4757
|
-
self.check_method_call_by_name(
|
|
4758
|
-
"__getitem__", left_type, [index], [ARG_POS], context=index
|
|
4759
|
-
)
|
|
4473
|
+
def nonliteral_tuple_index_helper(self, left_type: TupleType, index: Expression) -> Type:
|
|
4474
|
+
self.check_method_call_by_name("__getitem__", left_type, [index], [ARG_POS], context=index)
|
|
4760
4475
|
# We could return the return type from above, but unions are often better than the join
|
|
4761
4476
|
union = self.union_tuple_fallback_item(left_type)
|
|
4762
4477
|
if isinstance(index, SliceExpr):
|
|
@@ -4796,10 +4511,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4796
4511
|
|
|
4797
4512
|
key_names = []
|
|
4798
4513
|
for key_type in get_proper_types(key_types):
|
|
4799
|
-
if (
|
|
4800
|
-
isinstance(key_type, Instance)
|
|
4801
|
-
and key_type.last_known_value is not None
|
|
4802
|
-
):
|
|
4514
|
+
if isinstance(key_type, Instance) and key_type.last_known_value is not None:
|
|
4803
4515
|
key_type = key_type.last_known_value
|
|
4804
4516
|
|
|
4805
4517
|
if (
|
|
@@ -4851,18 +4563,10 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4851
4563
|
and source_type == target_type
|
|
4852
4564
|
):
|
|
4853
4565
|
self.msg.redundant_cast(target_type, expr)
|
|
4854
|
-
if options.disallow_any_unimported and has_any_from_unimported_type(
|
|
4855
|
-
target_type
|
|
4856
|
-
):
|
|
4857
|
-
self.msg.unimported_type_becomes_any(
|
|
4858
|
-
"Target type of cast", target_type, expr
|
|
4859
|
-
)
|
|
4566
|
+
if options.disallow_any_unimported and has_any_from_unimported_type(target_type):
|
|
4567
|
+
self.msg.unimported_type_becomes_any("Target type of cast", target_type, expr)
|
|
4860
4568
|
check_for_explicit_any(
|
|
4861
|
-
target_type,
|
|
4862
|
-
self.chk.options,
|
|
4863
|
-
self.chk.is_typeshed_stub,
|
|
4864
|
-
self.msg,
|
|
4865
|
-
context=expr,
|
|
4569
|
+
target_type, self.chk.options, self.chk.is_typeshed_stub, self.msg, context=expr
|
|
4866
4570
|
)
|
|
4867
4571
|
return target_type
|
|
4868
4572
|
|
|
@@ -4903,8 +4607,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4903
4607
|
self.msg.reveal_type(revealed_type, expr.expr)
|
|
4904
4608
|
if not self.chk.in_checked_function():
|
|
4905
4609
|
self.msg.note(
|
|
4906
|
-
"'reveal_type' always outputs 'Any' in unchecked functions",
|
|
4907
|
-
expr.expr,
|
|
4610
|
+
"'reveal_type' always outputs 'Any' in unchecked functions", expr.expr
|
|
4908
4611
|
)
|
|
4909
4612
|
self.check_reveal_imported(expr)
|
|
4910
4613
|
return revealed_type
|
|
@@ -4936,14 +4639,10 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4936
4639
|
else:
|
|
4937
4640
|
return
|
|
4938
4641
|
|
|
4939
|
-
self.chk.fail(
|
|
4940
|
-
f'Name "{name}" is not defined', expr, code=codes.UNIMPORTED_REVEAL
|
|
4941
|
-
)
|
|
4642
|
+
self.chk.fail(f'Name "{name}" is not defined', expr, code=codes.UNIMPORTED_REVEAL)
|
|
4942
4643
|
if name == "reveal_type":
|
|
4943
4644
|
module = (
|
|
4944
|
-
"typing"
|
|
4945
|
-
if self.chk.options.python_version >= (3, 11)
|
|
4946
|
-
else "typing_extensions"
|
|
4645
|
+
"typing" if self.chk.options.python_version >= (3, 11) else "typing_extensions"
|
|
4947
4646
|
)
|
|
4948
4647
|
hint = (
|
|
4949
4648
|
'Did you forget to import it from "{module}"?'
|
|
@@ -4973,14 +4672,9 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
4973
4672
|
if isinstance(item, Instance):
|
|
4974
4673
|
tp = type_object_type(item.type, self.named_type)
|
|
4975
4674
|
return self.apply_type_arguments_to_callable(tp, item.args, tapp)
|
|
4976
|
-
elif (
|
|
4977
|
-
isinstance(item, TupleType)
|
|
4978
|
-
and item.partial_fallback.type.is_named_tuple
|
|
4979
|
-
):
|
|
4675
|
+
elif isinstance(item, TupleType) and item.partial_fallback.type.is_named_tuple:
|
|
4980
4676
|
tp = type_object_type(item.partial_fallback.type, self.named_type)
|
|
4981
|
-
return self.apply_type_arguments_to_callable(
|
|
4982
|
-
tp, item.partial_fallback.args, tapp
|
|
4983
|
-
)
|
|
4677
|
+
return self.apply_type_arguments_to_callable(tp, item.partial_fallback.args, tapp)
|
|
4984
4678
|
elif isinstance(item, TypedDictType):
|
|
4985
4679
|
return self.typeddict_callable_from_context(item)
|
|
4986
4680
|
else:
|
|
@@ -5009,9 +4703,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5009
4703
|
both `reveal_type` instances will reveal the same type `def (...) -> builtins.list[Any]`.
|
|
5010
4704
|
Note that type variables are implicitly substituted with `Any`.
|
|
5011
4705
|
"""
|
|
5012
|
-
return self.alias_type_in_runtime_context(
|
|
5013
|
-
alias.node, ctx=alias, alias_definition=True
|
|
5014
|
-
)
|
|
4706
|
+
return self.alias_type_in_runtime_context(alias.node, ctx=alias, alias_definition=True)
|
|
5015
4707
|
|
|
5016
4708
|
def alias_type_in_runtime_context(
|
|
5017
4709
|
self, alias: TypeAlias, *, ctx: Context, alias_definition: bool = False
|
|
@@ -5094,8 +4786,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5094
4786
|
for tv, arg in zip(t.variables, args):
|
|
5095
4787
|
if isinstance(tv, ParamSpecType):
|
|
5096
4788
|
if not isinstance(
|
|
5097
|
-
get_proper_type(arg),
|
|
5098
|
-
(Parameters, ParamSpecType, AnyType, UnboundType),
|
|
4789
|
+
get_proper_type(arg), (Parameters, ParamSpecType, AnyType, UnboundType)
|
|
5099
4790
|
):
|
|
5100
4791
|
self.chk.fail(
|
|
5101
4792
|
"Can only replace ParamSpec with a parameter types list or"
|
|
@@ -5115,17 +4806,11 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5115
4806
|
# was initially an IndexExpr, and we allow empty tuple type arguments.
|
|
5116
4807
|
if not validate_instance(fake, self.chk.fail, empty_tuple_index=True):
|
|
5117
4808
|
fix_instance(
|
|
5118
|
-
fake,
|
|
5119
|
-
self.chk.fail,
|
|
5120
|
-
self.chk.note,
|
|
5121
|
-
disallow_any=False,
|
|
5122
|
-
options=self.chk.options,
|
|
4809
|
+
fake, self.chk.fail, self.chk.note, disallow_any=False, options=self.chk.options
|
|
5123
4810
|
)
|
|
5124
4811
|
args = list(fake.args)
|
|
5125
4812
|
|
|
5126
|
-
prefix = next(
|
|
5127
|
-
i for (i, v) in enumerate(vars) if isinstance(v, TypeVarTupleType)
|
|
5128
|
-
)
|
|
4813
|
+
prefix = next(i for (i, v) in enumerate(vars) if isinstance(v, TypeVarTupleType))
|
|
5129
4814
|
suffix = len(vars) - prefix - 1
|
|
5130
4815
|
tvt = vars[prefix]
|
|
5131
4816
|
assert isinstance(tvt, TypeVarTupleType)
|
|
@@ -5146,9 +4831,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5146
4831
|
|
|
5147
4832
|
if isinstance(tp, CallableType):
|
|
5148
4833
|
min_arg_count = sum(not v.has_default() for v in tp.variables)
|
|
5149
|
-
has_type_var_tuple = any(
|
|
5150
|
-
isinstance(v, TypeVarTupleType) for v in tp.variables
|
|
5151
|
-
)
|
|
4834
|
+
has_type_var_tuple = any(isinstance(v, TypeVarTupleType) for v in tp.variables)
|
|
5152
4835
|
if (
|
|
5153
4836
|
len(args) < min_arg_count or len(args) > len(tp.variables)
|
|
5154
4837
|
) and not has_type_var_tuple:
|
|
@@ -5159,15 +4842,11 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5159
4842
|
min_arg_count, len(tp.variables), len(args), ctx
|
|
5160
4843
|
)
|
|
5161
4844
|
return AnyType(TypeOfAny.from_error)
|
|
5162
|
-
return self.apply_generic_arguments(
|
|
5163
|
-
tp, self.split_for_callable(tp, args, ctx), ctx
|
|
5164
|
-
)
|
|
4845
|
+
return self.apply_generic_arguments(tp, self.split_for_callable(tp, args, ctx), ctx)
|
|
5165
4846
|
if isinstance(tp, Overloaded):
|
|
5166
4847
|
for it in tp.items:
|
|
5167
4848
|
min_arg_count = sum(not v.has_default() for v in it.variables)
|
|
5168
|
-
has_type_var_tuple = any(
|
|
5169
|
-
isinstance(v, TypeVarTupleType) for v in it.variables
|
|
5170
|
-
)
|
|
4849
|
+
has_type_var_tuple = any(isinstance(v, TypeVarTupleType) for v in it.variables)
|
|
5171
4850
|
if (
|
|
5172
4851
|
len(args) < min_arg_count or len(args) > len(it.variables)
|
|
5173
4852
|
) and not has_type_var_tuple:
|
|
@@ -5177,9 +4856,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5177
4856
|
return AnyType(TypeOfAny.from_error)
|
|
5178
4857
|
return Overloaded(
|
|
5179
4858
|
[
|
|
5180
|
-
self.apply_generic_arguments(
|
|
5181
|
-
it, self.split_for_callable(it, args, ctx), ctx
|
|
5182
|
-
)
|
|
4859
|
+
self.apply_generic_arguments(it, self.split_for_callable(it, args, ctx), ctx)
|
|
5183
4860
|
for it in tp.items
|
|
5184
4861
|
]
|
|
5185
4862
|
)
|
|
@@ -5226,9 +4903,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5226
4903
|
self.resolved_type[e] = ct
|
|
5227
4904
|
return ct
|
|
5228
4905
|
|
|
5229
|
-
def check_lst_expr(
|
|
5230
|
-
self, e: ListExpr | SetExpr | TupleExpr, fullname: str, tag: str
|
|
5231
|
-
) -> Type:
|
|
4906
|
+
def check_lst_expr(self, e: ListExpr | SetExpr | TupleExpr, fullname: str, tag: str) -> Type:
|
|
5232
4907
|
# fast path
|
|
5233
4908
|
t = self.fast_container_type(e, fullname)
|
|
5234
4909
|
if t:
|
|
@@ -5258,10 +4933,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5258
4933
|
out = self.check_call(
|
|
5259
4934
|
constructor,
|
|
5260
4935
|
[(i.expr if isinstance(i, StarExpr) else i) for i in e.items],
|
|
5261
|
-
[
|
|
5262
|
-
(nodes.ARG_STAR if isinstance(i, StarExpr) else nodes.ARG_POS)
|
|
5263
|
-
for i in e.items
|
|
5264
|
-
],
|
|
4936
|
+
[(nodes.ARG_STAR if isinstance(i, StarExpr) else nodes.ARG_POS) for i in e.items],
|
|
5265
4937
|
e,
|
|
5266
4938
|
)[0]
|
|
5267
4939
|
return remove_instance_last_known_values(out)
|
|
@@ -5271,16 +4943,12 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5271
4943
|
if ctx_unpack_index is None:
|
|
5272
4944
|
# For fixed tuples accept everything that can possibly match, even if this
|
|
5273
4945
|
# requires all star items to be empty.
|
|
5274
|
-
return len([e for e in expr.items if not isinstance(e, StarExpr)]) <= len(
|
|
5275
|
-
ctx.items
|
|
5276
|
-
)
|
|
4946
|
+
return len([e for e in expr.items if not isinstance(e, StarExpr)]) <= len(ctx.items)
|
|
5277
4947
|
# For variadic context, the only easy case is when structure matches exactly.
|
|
5278
4948
|
# TODO: try using tuple type context in more cases.
|
|
5279
4949
|
if len([e for e in expr.items if isinstance(e, StarExpr)]) != 1:
|
|
5280
4950
|
return False
|
|
5281
|
-
expr_star_index = next(
|
|
5282
|
-
i for i, lv in enumerate(expr.items) if isinstance(lv, StarExpr)
|
|
5283
|
-
)
|
|
4951
|
+
expr_star_index = next(i for i, lv in enumerate(expr.items) if isinstance(lv, StarExpr))
|
|
5284
4952
|
return len(expr.items) == len(ctx.items) and ctx_unpack_index == expr_star_index
|
|
5285
4953
|
|
|
5286
4954
|
def visit_tuple_expr(self, e: TupleExpr) -> Type:
|
|
@@ -5302,13 +4970,9 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5302
4970
|
# more than one. Either way, we can't decide on a context.
|
|
5303
4971
|
pass
|
|
5304
4972
|
|
|
5305
|
-
if isinstance(type_context, TupleType) and self.tuple_context_matches(
|
|
5306
|
-
e, type_context
|
|
5307
|
-
):
|
|
4973
|
+
if isinstance(type_context, TupleType) and self.tuple_context_matches(e, type_context):
|
|
5308
4974
|
type_context_items = type_context.items
|
|
5309
|
-
elif type_context and is_named_instance(
|
|
5310
|
-
type_context, TUPLE_LIKE_INSTANCE_NAMES
|
|
5311
|
-
):
|
|
4975
|
+
elif type_context and is_named_instance(type_context, TUPLE_LIKE_INSTANCE_NAMES):
|
|
5312
4976
|
assert isinstance(type_context, Instance)
|
|
5313
4977
|
if type_context.args:
|
|
5314
4978
|
type_context_items = [type_context.args[0]] * len(e.items)
|
|
@@ -5322,8 +4986,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5322
4986
|
unpack_in_context = find_unpack_in_list(type_context_items) is not None
|
|
5323
4987
|
seen_unpack_in_items = False
|
|
5324
4988
|
allow_precise_tuples = (
|
|
5325
|
-
unpack_in_context
|
|
5326
|
-
or PRECISE_TUPLE_TYPES in self.chk.options.enable_incomplete_feature
|
|
4989
|
+
unpack_in_context or PRECISE_TUPLE_TYPES in self.chk.options.enable_incomplete_feature
|
|
5327
4990
|
)
|
|
5328
4991
|
|
|
5329
4992
|
# Infer item types. Give up if there's a star expression
|
|
@@ -5369,9 +5032,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5369
5032
|
# Handle (x, *y, z), where y is e.g. tuple[Y, ...].
|
|
5370
5033
|
if isinstance(tt, Instance) and self.chk.type_is_iterable(tt):
|
|
5371
5034
|
item_type = self.chk.iterable_item_type(tt, e)
|
|
5372
|
-
mapped = self.chk.named_generic_type(
|
|
5373
|
-
"builtins.tuple", [item_type]
|
|
5374
|
-
)
|
|
5035
|
+
mapped = self.chk.named_generic_type("builtins.tuple", [item_type])
|
|
5375
5036
|
items.append(UnpackType(mapped))
|
|
5376
5037
|
seen_unpack_in_items = True
|
|
5377
5038
|
continue
|
|
@@ -5469,9 +5130,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5469
5130
|
# Multiple items union, check if at least one of them matches cleanly.
|
|
5470
5131
|
for typeddict_context in typeddict_contexts:
|
|
5471
5132
|
with self.msg.filter_errors() as err, self.chk.local_type_map() as tmap:
|
|
5472
|
-
ret_type = self.check_typeddict_literal_in_context(
|
|
5473
|
-
e, typeddict_context
|
|
5474
|
-
)
|
|
5133
|
+
ret_type = self.check_typeddict_literal_in_context(e, typeddict_context)
|
|
5475
5134
|
if err.has_new_errors():
|
|
5476
5135
|
continue
|
|
5477
5136
|
self.chk.store_types(tmap)
|
|
@@ -5509,9 +5168,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5509
5168
|
if key is None:
|
|
5510
5169
|
args.append(value)
|
|
5511
5170
|
expected_types.append(
|
|
5512
|
-
self.chk.named_generic_type(
|
|
5513
|
-
"_typeshed.SupportsKeysAndGetItem", [kt, vt]
|
|
5514
|
-
)
|
|
5171
|
+
self.chk.named_generic_type("_typeshed.SupportsKeysAndGetItem", [kt, vt])
|
|
5515
5172
|
)
|
|
5516
5173
|
else:
|
|
5517
5174
|
tup = TupleExpr([key, value])
|
|
@@ -5524,9 +5181,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5524
5181
|
tup.end_line = value.end_line
|
|
5525
5182
|
tup.end_column = value.end_column
|
|
5526
5183
|
args.append(tup)
|
|
5527
|
-
expected_types.append(
|
|
5528
|
-
TupleType([kt, vt], self.named_type("builtins.tuple"))
|
|
5529
|
-
)
|
|
5184
|
+
expected_types.append(TupleType([kt, vt], self.named_type("builtins.tuple")))
|
|
5530
5185
|
|
|
5531
5186
|
# The callable type represents a function like this (except we adjust for **expr):
|
|
5532
5187
|
# def <dict>(*v: Tuple[kt, vt]) -> Dict[kt, vt]: ...
|
|
@@ -5606,9 +5261,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5606
5261
|
|
|
5607
5262
|
if isinstance(ctx, UnionType):
|
|
5608
5263
|
callables = [
|
|
5609
|
-
t
|
|
5610
|
-
for t in get_proper_types(ctx.relevant_items())
|
|
5611
|
-
if isinstance(t, CallableType)
|
|
5264
|
+
t for t in get_proper_types(ctx.relevant_items()) if isinstance(t, CallableType)
|
|
5612
5265
|
]
|
|
5613
5266
|
if len(callables) == 1:
|
|
5614
5267
|
ctx = callables[0]
|
|
@@ -5635,18 +5288,14 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5635
5288
|
)
|
|
5636
5289
|
else:
|
|
5637
5290
|
erased_ctx = replace_meta_vars(ctx, ErasedType())
|
|
5638
|
-
assert isinstance(erased_ctx, ProperType) and isinstance(
|
|
5639
|
-
erased_ctx, CallableType
|
|
5640
|
-
)
|
|
5291
|
+
assert isinstance(erased_ctx, ProperType) and isinstance(erased_ctx, CallableType)
|
|
5641
5292
|
callable_ctx = erased_ctx
|
|
5642
5293
|
|
|
5643
5294
|
# The callable_ctx may have a fallback of builtins.type if the context
|
|
5644
5295
|
# is a constructor -- but this fallback doesn't make sense for lambdas.
|
|
5645
|
-
callable_ctx = callable_ctx.copy_modified(
|
|
5646
|
-
fallback=self.named_type("builtins.function")
|
|
5647
|
-
)
|
|
5296
|
+
callable_ctx = callable_ctx.copy_modified(fallback=self.named_type("builtins.function"))
|
|
5648
5297
|
|
|
5649
|
-
if callable_ctx.type_guard is not None:
|
|
5298
|
+
if callable_ctx.type_guard is not None or callable_ctx.type_is is not None:
|
|
5650
5299
|
# Lambda's return type cannot be treated as a `TypeGuard`,
|
|
5651
5300
|
# because it is implicit. And `TypeGuard`s must be explicit.
|
|
5652
5301
|
# See https://github.com/python/mypy/issues/9927
|
|
@@ -5787,9 +5436,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5787
5436
|
if method.arguments:
|
|
5788
5437
|
instance_type: Type = method.arguments[0].variable.type or current_type
|
|
5789
5438
|
else:
|
|
5790
|
-
self.chk.fail(
|
|
5791
|
-
message_registry.SUPER_ENCLOSING_POSITIONAL_ARGS_REQUIRED, e
|
|
5792
|
-
)
|
|
5439
|
+
self.chk.fail(message_registry.SUPER_ENCLOSING_POSITIONAL_ARGS_REQUIRED, e)
|
|
5793
5440
|
return AnyType(TypeOfAny.from_error)
|
|
5794
5441
|
elif ARG_STAR in e.call.arg_kinds:
|
|
5795
5442
|
self.chk.fail(message_registry.SUPER_VARARGS_NOT_SUPPORTED, e)
|
|
@@ -5853,9 +5500,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5853
5500
|
for index in [e.begin_index, e.end_index, e.stride]:
|
|
5854
5501
|
if index:
|
|
5855
5502
|
t = self.accept(index)
|
|
5856
|
-
self.chk.check_subtype(
|
|
5857
|
-
t, expected, index, message_registry.INVALID_SLICE_INDEX
|
|
5858
|
-
)
|
|
5503
|
+
self.chk.check_subtype(t, expected, index, message_registry.INVALID_SLICE_INDEX)
|
|
5859
5504
|
return self.named_type("builtins.slice")
|
|
5860
5505
|
|
|
5861
5506
|
def visit_list_comprehension(self, e: ListComprehension) -> Type:
|
|
@@ -5915,9 +5560,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5915
5560
|
name=id_for_messages,
|
|
5916
5561
|
variables=[tv],
|
|
5917
5562
|
)
|
|
5918
|
-
return self.check_call(constructor, [gen.left_expr], [nodes.ARG_POS], gen)[
|
|
5919
|
-
0
|
|
5920
|
-
]
|
|
5563
|
+
return self.check_call(constructor, [gen.left_expr], [nodes.ARG_POS], gen)[0]
|
|
5921
5564
|
|
|
5922
5565
|
def visit_dictionary_comprehension(self, e: DictionaryComprehension) -> Type:
|
|
5923
5566
|
"""Type check a dictionary comprehension."""
|
|
@@ -5984,9 +5627,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
5984
5627
|
elif false_map is None:
|
|
5985
5628
|
self.msg.redundant_condition_in_comprehension(True, condition)
|
|
5986
5629
|
|
|
5987
|
-
def visit_conditional_expr(
|
|
5988
|
-
self, e: ConditionalExpr, allow_none_return: bool = False
|
|
5989
|
-
) -> Type:
|
|
5630
|
+
def visit_conditional_expr(self, e: ConditionalExpr, allow_none_return: bool = False) -> Type:
|
|
5990
5631
|
self.accept(e.cond)
|
|
5991
5632
|
ctx = self.type_context[-1]
|
|
5992
5633
|
|
|
@@ -6019,9 +5660,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
6019
5660
|
# we want to keep the narrowest value of else_type for union'ing the branches
|
|
6020
5661
|
# however, it would be silly to pass a literal as a type context. Pass the
|
|
6021
5662
|
# underlying fallback type instead.
|
|
6022
|
-
else_type_fallback = (
|
|
6023
|
-
simple_literal_type(get_proper_type(else_type)) or else_type
|
|
6024
|
-
)
|
|
5663
|
+
else_type_fallback = simple_literal_type(get_proper_type(else_type)) or else_type
|
|
6025
5664
|
|
|
6026
5665
|
# If it would make a difference, re-analyze the left
|
|
6027
5666
|
# branch using the right branch's type as context.
|
|
@@ -6075,14 +5714,10 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
6075
5714
|
if map is None:
|
|
6076
5715
|
# We still need to type check node, in case we want to
|
|
6077
5716
|
# process it for isinstance checks later
|
|
6078
|
-
self.accept(
|
|
6079
|
-
node, type_context=context, allow_none_return=allow_none_return
|
|
6080
|
-
)
|
|
5717
|
+
self.accept(node, type_context=context, allow_none_return=allow_none_return)
|
|
6081
5718
|
return UninhabitedType()
|
|
6082
5719
|
self.chk.push_type_map(map)
|
|
6083
|
-
return self.accept(
|
|
6084
|
-
node, type_context=context, allow_none_return=allow_none_return
|
|
6085
|
-
)
|
|
5720
|
+
return self.accept(node, type_context=context, allow_none_return=allow_none_return)
|
|
6086
5721
|
|
|
6087
5722
|
#
|
|
6088
5723
|
# Helpers
|
|
@@ -6160,13 +5795,8 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
6160
5795
|
def is_valid_var_arg(self, typ: Type) -> bool:
|
|
6161
5796
|
"""Is a type valid as a *args argument?"""
|
|
6162
5797
|
typ = get_proper_type(typ)
|
|
6163
|
-
return isinstance(
|
|
6164
|
-
typ, (
|
|
6165
|
-
) or is_subtype(
|
|
6166
|
-
typ,
|
|
6167
|
-
self.chk.named_generic_type(
|
|
6168
|
-
"typing.Iterable", [AnyType(TypeOfAny.special_form)]
|
|
6169
|
-
),
|
|
5798
|
+
return isinstance(typ, (TupleType, AnyType, ParamSpecType, UnpackType)) or is_subtype(
|
|
5799
|
+
typ, self.chk.named_generic_type("typing.Iterable", [AnyType(TypeOfAny.special_form)])
|
|
6170
5800
|
)
|
|
6171
5801
|
|
|
6172
5802
|
def is_valid_keyword_var_arg(self, typ: Type) -> bool:
|
|
@@ -6182,8 +5812,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
6182
5812
|
or is_subtype(
|
|
6183
5813
|
typ,
|
|
6184
5814
|
self.chk.named_generic_type(
|
|
6185
|
-
"_typeshed.SupportsKeysAndGetItem",
|
|
6186
|
-
[UninhabitedType(), UninhabitedType()],
|
|
5815
|
+
"_typeshed.SupportsKeysAndGetItem", [UninhabitedType(), UninhabitedType()]
|
|
6187
5816
|
),
|
|
6188
5817
|
)
|
|
6189
5818
|
or isinstance(typ, ParamSpecType)
|
|
@@ -6260,9 +5889,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
6260
5889
|
def visit_await_expr(self, e: AwaitExpr, allow_none_return: bool = False) -> Type:
|
|
6261
5890
|
expected_type = self.type_context[-1]
|
|
6262
5891
|
if expected_type is not None:
|
|
6263
|
-
expected_type = self.chk.named_generic_type(
|
|
6264
|
-
"typing.Awaitable", [expected_type]
|
|
6265
|
-
)
|
|
5892
|
+
expected_type = self.chk.named_generic_type("typing.Awaitable", [expected_type])
|
|
6266
5893
|
actual_type = get_proper_type(self.accept(e.expr, expected_type))
|
|
6267
5894
|
if isinstance(actual_type, AnyType):
|
|
6268
5895
|
return AnyType(TypeOfAny.from_another_any, source_any=actual_type)
|
|
@@ -6274,23 +5901,14 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
6274
5901
|
return ret
|
|
6275
5902
|
|
|
6276
5903
|
def check_awaitable_expr(
|
|
6277
|
-
self,
|
|
6278
|
-
t: Type,
|
|
6279
|
-
ctx: Context,
|
|
6280
|
-
msg: str | ErrorMessage,
|
|
6281
|
-
ignore_binder: bool = False,
|
|
5904
|
+
self, t: Type, ctx: Context, msg: str | ErrorMessage, ignore_binder: bool = False
|
|
6282
5905
|
) -> Type:
|
|
6283
5906
|
"""Check the argument to `await` and extract the type of value.
|
|
6284
5907
|
|
|
6285
5908
|
Also used by `async for` and `async with`.
|
|
6286
5909
|
"""
|
|
6287
5910
|
if not self.chk.check_subtype(
|
|
6288
|
-
t,
|
|
6289
|
-
self.named_type("typing.Awaitable"),
|
|
6290
|
-
ctx,
|
|
6291
|
-
msg,
|
|
6292
|
-
"actual type",
|
|
6293
|
-
"expected type",
|
|
5911
|
+
t, self.named_type("typing.Awaitable"), ctx, msg, "actual type", "expected type"
|
|
6294
5912
|
):
|
|
6295
5913
|
return AnyType(TypeOfAny.special_form)
|
|
6296
5914
|
else:
|
|
@@ -6305,9 +5923,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
6305
5923
|
self.chk.binder.unreachable()
|
|
6306
5924
|
return ret_type
|
|
6307
5925
|
|
|
6308
|
-
def visit_yield_from_expr(
|
|
6309
|
-
self, e: YieldFromExpr, allow_none_return: bool = False
|
|
6310
|
-
) -> Type:
|
|
5926
|
+
def visit_yield_from_expr(self, e: YieldFromExpr, allow_none_return: bool = False) -> Type:
|
|
6311
5927
|
# NOTE: Whether `yield from` accepts an `async def` decorated
|
|
6312
5928
|
# with `@types.coroutine` (or `@asyncio.coroutine`) depends on
|
|
6313
5929
|
# whether the generator containing the `yield from` is itself
|
|
@@ -6323,9 +5939,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
6323
5939
|
# Check that the expr is an instance of Iterable and get the type of the iterator produced
|
|
6324
5940
|
# by __iter__.
|
|
6325
5941
|
if isinstance(subexpr_type, AnyType):
|
|
6326
|
-
iter_type: Type = AnyType(
|
|
6327
|
-
TypeOfAny.from_another_any, source_any=subexpr_type
|
|
6328
|
-
)
|
|
5942
|
+
iter_type: Type = AnyType(TypeOfAny.from_another_any, source_any=subexpr_type)
|
|
6329
5943
|
elif self.chk.type_is_iterable(subexpr_type):
|
|
6330
5944
|
if is_async_def(subexpr_type) and not has_coroutine_decorator(return_type):
|
|
6331
5945
|
self.chk.msg.yield_from_invalid_operand_type(subexpr_type, e)
|
|
@@ -6338,9 +5952,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
6338
5952
|
"__iter__", subexpr_type, [], [], context=generic_generator_type
|
|
6339
5953
|
)
|
|
6340
5954
|
else:
|
|
6341
|
-
if not (
|
|
6342
|
-
is_async_def(subexpr_type) and has_coroutine_decorator(return_type)
|
|
6343
|
-
):
|
|
5955
|
+
if not (is_async_def(subexpr_type) and has_coroutine_decorator(return_type)):
|
|
6344
5956
|
self.chk.msg.yield_from_invalid_operand_type(subexpr_type, e)
|
|
6345
5957
|
iter_type = AnyType(TypeOfAny.from_error)
|
|
6346
5958
|
else:
|
|
@@ -6364,22 +5976,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
6364
5976
|
|
|
6365
5977
|
# Determine the type of the entire yield from expression.
|
|
6366
5978
|
iter_type = get_proper_type(iter_type)
|
|
6367
|
-
|
|
6368
|
-
isinstance(iter_type, Instance)
|
|
6369
|
-
and iter_type.type.fullname == "typing.Generator"
|
|
6370
|
-
):
|
|
6371
|
-
expr_type = self.chk.get_generator_return_type(iter_type, False)
|
|
6372
|
-
else:
|
|
6373
|
-
# Non-Generators don't return anything from `yield from` expressions.
|
|
6374
|
-
# However special-case Any (which might be produced by an error).
|
|
6375
|
-
actual_item_type = get_proper_type(actual_item_type)
|
|
6376
|
-
if isinstance(actual_item_type, AnyType):
|
|
6377
|
-
expr_type = AnyType(
|
|
6378
|
-
TypeOfAny.from_another_any, source_any=actual_item_type
|
|
6379
|
-
)
|
|
6380
|
-
else:
|
|
6381
|
-
# Treat `Iterator[X]` as a shorthand for `Generator[X, None, Any]`.
|
|
6382
|
-
expr_type = NoneType()
|
|
5979
|
+
expr_type = self.chk.get_generator_return_type(iter_type, is_coroutine=False)
|
|
6383
5980
|
|
|
6384
5981
|
if not allow_none_return and isinstance(get_proper_type(expr_type), NoneType):
|
|
6385
5982
|
self.chk.msg.does_not_return_value(None, e)
|
|
@@ -6412,17 +6009,12 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
6412
6009
|
def visit_namedtuple_expr(self, e: NamedTupleExpr) -> Type:
|
|
6413
6010
|
tuple_type = e.info.tuple_type
|
|
6414
6011
|
if tuple_type:
|
|
6415
|
-
if (
|
|
6416
|
-
|
|
6417
|
-
and has_any_from_unimported_type(tuple_type)
|
|
6012
|
+
if self.chk.options.disallow_any_unimported and has_any_from_unimported_type(
|
|
6013
|
+
tuple_type
|
|
6418
6014
|
):
|
|
6419
6015
|
self.msg.unimported_type_becomes_any("NamedTuple type", tuple_type, e)
|
|
6420
6016
|
check_for_explicit_any(
|
|
6421
|
-
tuple_type,
|
|
6422
|
-
self.chk.options,
|
|
6423
|
-
self.chk.is_typeshed_stub,
|
|
6424
|
-
self.msg,
|
|
6425
|
-
context=e,
|
|
6017
|
+
tuple_type, self.chk.options, self.chk.is_typeshed_stub, self.msg, context=e
|
|
6426
6018
|
)
|
|
6427
6019
|
return AnyType(TypeOfAny.special_form)
|
|
6428
6020
|
|
|
@@ -6481,8 +6073,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
6481
6073
|
# otherwise wouldn't have. We don't want to narrow down these since it may
|
|
6482
6074
|
# produce invalid inferred Optional[Any] types, at least.
|
|
6483
6075
|
if restriction and not (
|
|
6484
|
-
isinstance(get_proper_type(known_type), AnyType)
|
|
6485
|
-
and self.chk.current_node_deferred
|
|
6076
|
+
isinstance(get_proper_type(known_type), AnyType) and self.chk.current_node_deferred
|
|
6486
6077
|
):
|
|
6487
6078
|
# Note: this call should match the one in narrow_declared_type().
|
|
6488
6079
|
if skip_non_overlapping and not is_overlapping_types(
|
|
@@ -6492,9 +6083,7 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
6492
6083
|
return narrow_declared_type(known_type, restriction)
|
|
6493
6084
|
return known_type
|
|
6494
6085
|
|
|
6495
|
-
def has_abstract_type_part(
|
|
6496
|
-
self, caller_type: ProperType, callee_type: ProperType
|
|
6497
|
-
) -> bool:
|
|
6086
|
+
def has_abstract_type_part(self, caller_type: ProperType, callee_type: ProperType) -> bool:
|
|
6498
6087
|
# TODO: support other possible types here
|
|
6499
6088
|
if isinstance(caller_type, TupleType) and isinstance(callee_type, TupleType):
|
|
6500
6089
|
return any(
|
|
@@ -6503,17 +6092,12 @@ class ExpressionChecker(ExpressionVisitor[Type]):
|
|
|
6503
6092
|
)
|
|
6504
6093
|
return self.has_abstract_type(caller_type, callee_type)
|
|
6505
6094
|
|
|
6506
|
-
def has_abstract_type(
|
|
6507
|
-
self, caller_type: ProperType, callee_type: ProperType
|
|
6508
|
-
) -> bool:
|
|
6095
|
+
def has_abstract_type(self, caller_type: ProperType, callee_type: ProperType) -> bool:
|
|
6509
6096
|
return (
|
|
6510
6097
|
isinstance(caller_type, FunctionLike)
|
|
6511
6098
|
and isinstance(callee_type, TypeType)
|
|
6512
6099
|
and caller_type.is_type_obj()
|
|
6513
|
-
and (
|
|
6514
|
-
caller_type.type_object().is_abstract
|
|
6515
|
-
or caller_type.type_object().is_protocol
|
|
6516
|
-
)
|
|
6100
|
+
and (caller_type.type_object().is_abstract or caller_type.type_object().is_protocol)
|
|
6517
6101
|
and isinstance(callee_type.item, Instance)
|
|
6518
6102
|
and (callee_type.item.type.is_abstract or callee_type.item.type.is_protocol)
|
|
6519
6103
|
and not self.chk.allow_abstract_call
|
|
@@ -6531,9 +6115,7 @@ class HasAnyType(types.BoolTypeQuery):
|
|
|
6531
6115
|
self.ignore_in_type_obj = ignore_in_type_obj
|
|
6532
6116
|
|
|
6533
6117
|
def visit_any(self, t: AnyType) -> bool:
|
|
6534
|
-
return
|
|
6535
|
-
t.type_of_any != TypeOfAny.special_form
|
|
6536
|
-
) # special forms are not real Any types
|
|
6118
|
+
return t.type_of_any != TypeOfAny.special_form # special forms are not real Any types
|
|
6537
6119
|
|
|
6538
6120
|
def visit_callable_type(self, t: CallableType) -> bool:
|
|
6539
6121
|
if self.ignore_in_type_obj and t.is_type_obj():
|
|
@@ -6618,9 +6200,7 @@ def replace_callable_return_type(c: CallableType, new_ret_type: Type) -> Callabl
|
|
|
6618
6200
|
return c.copy_modified(ret_type=new_ret_type)
|
|
6619
6201
|
|
|
6620
6202
|
|
|
6621
|
-
def apply_poly(
|
|
6622
|
-
tp: CallableType, poly_tvars: Sequence[TypeVarLikeType]
|
|
6623
|
-
) -> CallableType | None:
|
|
6203
|
+
def apply_poly(tp: CallableType, poly_tvars: Sequence[TypeVarLikeType]) -> CallableType | None:
|
|
6624
6204
|
"""Make free type variables generic in the type if possible.
|
|
6625
6205
|
|
|
6626
6206
|
This will translate the type `tp` while trying to create valid bindings for
|
|
@@ -6717,9 +6297,7 @@ class PolyTranslator(TypeTranslator):
|
|
|
6717
6297
|
# are not really expressible in current type system, but this looks like
|
|
6718
6298
|
# a useful feature, so let's keep it.
|
|
6719
6299
|
param_spec_index = next(
|
|
6720
|
-
i
|
|
6721
|
-
for (i, tv) in enumerate(t.type.defn.type_vars)
|
|
6722
|
-
if isinstance(tv, ParamSpecType)
|
|
6300
|
+
i for (i, tv) in enumerate(t.type.defn.type_vars) if isinstance(tv, ParamSpecType)
|
|
6723
6301
|
)
|
|
6724
6302
|
p = get_proper_type(t.args[param_spec_index])
|
|
6725
6303
|
if isinstance(p, Parameters):
|
|
@@ -6740,9 +6318,7 @@ class PolyTranslator(TypeTranslator):
|
|
|
6740
6318
|
call = find_member("__call__", t, t, is_operator=True)
|
|
6741
6319
|
assert call is not None
|
|
6742
6320
|
return call.accept(
|
|
6743
|
-
PolyTranslator(
|
|
6744
|
-
self.poly_tvars, self.bound_tvars, self.seen_aliases | {t.type}
|
|
6745
|
-
)
|
|
6321
|
+
PolyTranslator(self.poly_tvars, self.bound_tvars, self.seen_aliases | {t.type})
|
|
6746
6322
|
)
|
|
6747
6323
|
return super().visit_instance(t)
|
|
6748
6324
|
|
|
@@ -6843,13 +6419,9 @@ def arg_approximate_similarity(actual: Type, formal: Type) -> bool:
|
|
|
6843
6419
|
|
|
6844
6420
|
# Unions
|
|
6845
6421
|
if isinstance(actual, UnionType):
|
|
6846
|
-
return any(
|
|
6847
|
-
arg_approximate_similarity(item, formal) for item in actual.relevant_items()
|
|
6848
|
-
)
|
|
6422
|
+
return any(arg_approximate_similarity(item, formal) for item in actual.relevant_items())
|
|
6849
6423
|
if isinstance(formal, UnionType):
|
|
6850
|
-
return any(
|
|
6851
|
-
arg_approximate_similarity(actual, item) for item in formal.relevant_items()
|
|
6852
|
-
)
|
|
6424
|
+
return any(arg_approximate_similarity(actual, item) for item in formal.relevant_items())
|
|
6853
6425
|
|
|
6854
6426
|
# TypedDicts
|
|
6855
6427
|
if isinstance(actual, TypedDictType):
|
|
@@ -6926,9 +6498,7 @@ def any_causes_overload_ambiguity(
|
|
|
6926
6498
|
# So it's safe to just append everything to the same list.
|
|
6927
6499
|
for formal in formals:
|
|
6928
6500
|
matching_formals.append(matched_callable.arg_types[formal])
|
|
6929
|
-
if not all_same_types(matching_formals) and not all_same_types(
|
|
6930
|
-
matching_returns
|
|
6931
|
-
):
|
|
6501
|
+
if not all_same_types(matching_formals) and not all_same_types(matching_returns):
|
|
6932
6502
|
# Any maps to multiple different types, and the return types of these items differ.
|
|
6933
6503
|
return True
|
|
6934
6504
|
return False
|