@gnost-cli/darwin-arm64 0.0.0-stage → 0.5.1-rc.1
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.
- package/README.md +2 -2
- package/bundle/_internal/6ec57f84c680d3a3778b__mypyc.cpython-312-darwin.so +4 -0
- package/bundle/_internal/Python +0 -0
- package/bundle/_internal/Python.framework/Python +0 -0
- package/bundle/_internal/Python.framework/Resources/Info.plist +30 -0
- package/bundle/_internal/Python.framework/Versions/3.12/Python +0 -0
- package/bundle/_internal/Python.framework/Versions/3.12/Resources/Info.plist +30 -0
- package/bundle/_internal/Python.framework/Versions/Current/Python +0 -0
- package/bundle/_internal/Python.framework/Versions/Current/Resources/Info.plist +30 -0
- package/bundle/_internal/ast_serialize/ast_serialize.abi3.so +0 -0
- package/bundle/_internal/bandit/__init__.py +20 -0
- package/bundle/_internal/bandit/__main__.py +17 -0
- package/bundle/_internal/bandit/blacklists/__init__.py +0 -0
- package/bundle/_internal/bandit/blacklists/calls.py +670 -0
- package/bundle/_internal/bandit/blacklists/imports.py +425 -0
- package/bundle/_internal/bandit/blacklists/utils.py +17 -0
- package/bundle/_internal/bandit/cli/__init__.py +0 -0
- package/bundle/_internal/bandit/cli/baseline.py +252 -0
- package/bundle/_internal/bandit/cli/config_generator.py +207 -0
- package/bundle/_internal/bandit/cli/main.py +701 -0
- package/bundle/_internal/bandit/core/__init__.py +15 -0
- package/bundle/_internal/bandit/core/blacklisting.py +72 -0
- package/bundle/_internal/bandit/core/config.py +271 -0
- package/bundle/_internal/bandit/core/constants.py +40 -0
- package/bundle/_internal/bandit/core/context.py +316 -0
- package/bundle/_internal/bandit/core/docs_utils.py +54 -0
- package/bundle/_internal/bandit/core/extension_loader.py +114 -0
- package/bundle/_internal/bandit/core/issue.py +245 -0
- package/bundle/_internal/bandit/core/manager.py +499 -0
- package/bundle/_internal/bandit/core/meta_ast.py +44 -0
- package/bundle/_internal/bandit/core/metrics.py +106 -0
- package/bundle/_internal/bandit/core/node_visitor.py +297 -0
- package/bundle/_internal/bandit/core/test_properties.py +83 -0
- package/bundle/_internal/bandit/core/test_set.py +114 -0
- package/bundle/_internal/bandit/core/tester.py +168 -0
- package/bundle/_internal/bandit/core/utils.py +398 -0
- package/bundle/_internal/bandit/formatters/__init__.py +0 -0
- package/bundle/_internal/bandit/formatters/csv.py +82 -0
- package/bundle/_internal/bandit/formatters/custom.py +161 -0
- package/bundle/_internal/bandit/formatters/html.py +394 -0
- package/bundle/_internal/bandit/formatters/json.py +155 -0
- package/bundle/_internal/bandit/formatters/sarif.py +374 -0
- package/bundle/_internal/bandit/formatters/screen.py +244 -0
- package/bundle/_internal/bandit/formatters/text.py +200 -0
- package/bundle/_internal/bandit/formatters/utils.py +14 -0
- package/bundle/_internal/bandit/formatters/xml.py +97 -0
- package/bundle/_internal/bandit/formatters/yaml.py +126 -0
- package/bundle/_internal/bandit/plugins/__init__.py +0 -0
- package/bundle/_internal/bandit/plugins/app_debug.py +63 -0
- package/bundle/_internal/bandit/plugins/asserts.py +83 -0
- package/bundle/_internal/bandit/plugins/crypto_request_no_cert_validation.py +75 -0
- package/bundle/_internal/bandit/plugins/django_sql_injection.py +155 -0
- package/bundle/_internal/bandit/plugins/django_xss.py +287 -0
- package/bundle/_internal/bandit/plugins/exec.py +55 -0
- package/bundle/_internal/bandit/plugins/general_bad_file_permissions.py +99 -0
- package/bundle/_internal/bandit/plugins/general_bind_all_interfaces.py +52 -0
- package/bundle/_internal/bandit/plugins/general_hardcoded_password.py +282 -0
- package/bundle/_internal/bandit/plugins/general_hardcoded_tmp.py +79 -0
- package/bundle/_internal/bandit/plugins/hashlib_insecure_functions.py +121 -0
- package/bundle/_internal/bandit/plugins/huggingface_unsafe_download.py +166 -0
- package/bundle/_internal/bandit/plugins/injection_paramiko.py +63 -0
- package/bundle/_internal/bandit/plugins/injection_shell.py +706 -0
- package/bundle/_internal/bandit/plugins/injection_sql.py +143 -0
- package/bundle/_internal/bandit/plugins/injection_wildcard.py +144 -0
- package/bundle/_internal/bandit/plugins/insecure_ssl_tls.py +285 -0
- package/bundle/_internal/bandit/plugins/jinja2_templates.py +134 -0
- package/bundle/_internal/bandit/plugins/logging_config_insecure_listen.py +58 -0
- package/bundle/_internal/bandit/plugins/mako_templates.py +69 -0
- package/bundle/_internal/bandit/plugins/markupsafe_markup_xss.py +118 -0
- package/bundle/_internal/bandit/plugins/pytorch_load.py +77 -0
- package/bundle/_internal/bandit/plugins/request_without_timeout.py +84 -0
- package/bundle/_internal/bandit/plugins/snmp_security_check.py +110 -0
- package/bundle/_internal/bandit/plugins/ssh_no_host_key_verification.py +76 -0
- package/bundle/_internal/bandit/plugins/tarfile_unsafe_members.py +121 -0
- package/bundle/_internal/bandit/plugins/trojansource.py +82 -0
- package/bundle/_internal/bandit/plugins/try_except_continue.py +108 -0
- package/bundle/_internal/bandit/plugins/try_except_pass.py +106 -0
- package/bundle/_internal/bandit/plugins/weak_cryptographic_key.py +165 -0
- package/bundle/_internal/bandit/plugins/yaml_load.py +76 -0
- package/bundle/_internal/bandit-1.9.4.dist-info/INSTALLER +1 -0
- package/bundle/_internal/bandit-1.9.4.dist-info/METADATA +212 -0
- package/bundle/_internal/bandit-1.9.4.dist-info/RECORD +150 -0
- package/bundle/_internal/bandit-1.9.4.dist-info/WHEEL +5 -0
- package/bundle/_internal/bandit-1.9.4.dist-info/entry_points.txt +63 -0
- package/bundle/_internal/bandit-1.9.4.dist-info/licenses/LICENSE +175 -0
- package/bundle/_internal/bandit-1.9.4.dist-info/pbr.json +1 -0
- package/bundle/_internal/bandit-1.9.4.dist-info/top_level.txt +1 -0
- package/bundle/_internal/base_library.zip +0 -0
- package/bundle/_internal/bin/ruff +0 -0
- package/bundle/_internal/gnost/__init__.py +1 -0
- package/bundle/_internal/gnost/analysis/__init__.py +0 -0
- package/bundle/_internal/gnost/analysis/analyzers/__init__.py +11 -0
- package/bundle/_internal/gnost/analysis/analyzers/maintainability_analyzer.py +901 -0
- package/bundle/_internal/gnost/analysis/analyzers/observability_analyzer.py +592 -0
- package/bundle/_internal/gnost/analysis/analyzers/readability_analyzer.py +968 -0
- package/bundle/_internal/gnost/analysis/analyzers/robustness_analyzer.py +944 -0
- package/bundle/_internal/gnost/analysis/config/mypy.ini +4 -0
- package/bundle/_internal/gnost/analysis/core/__init__.py +0 -0
- package/bundle/_internal/gnost/analysis/core/aggregator.py +584 -0
- package/bundle/_internal/gnost/analysis/core/engine.py +430 -0
- package/bundle/_internal/gnost/analysis/core/file_utils.py +209 -0
- package/bundle/_internal/gnost/analysis/core/interfaces.py +304 -0
- package/bundle/_internal/gnost/analysis/core/models.py +479 -0
- package/bundle/_internal/gnost/analysis/core/tool_runner.py +153 -0
- package/bundle/_internal/gnost/analysis/core/transformers.py +779 -0
- package/bundle/_internal/gnost/analysis/utils/__init__.py +0 -0
- package/bundle/_internal/gnost/analysis/utils/analyze.py +132 -0
- package/bundle/_internal/gnost/analysis/utils/df_handling.py +215 -0
- package/bundle/_internal/gnost/analysis/utils/duplicate_code.py +42 -0
- package/bundle/_internal/gnost/analysis/utils/extract.py +172 -0
- package/bundle/_internal/gnost/analysis/utils/mi.py +130 -0
- package/bundle/_internal/gnost/analysis/utils/tool_command.py +63 -0
- package/bundle/_internal/gnost/cli/__init__.py +3 -0
- package/bundle/_internal/gnost/cli/app.py +696 -0
- package/bundle/_internal/gnost/cli/commands/__init__.py +3 -0
- package/bundle/_internal/gnost/cli/commands/analysis.py +190 -0
- package/bundle/_internal/gnost/cli/commands/onboard.py +507 -0
- package/bundle/_internal/gnost/cli/commands/show.py +70 -0
- package/bundle/_internal/gnost/config/__init__.py +0 -0
- package/bundle/_internal/gnost/config/languages.py +10 -0
- package/bundle/_internal/gnost/config/settings.py +240 -0
- package/bundle/_internal/gnost/core/__init__.py +0 -0
- package/bundle/_internal/gnost/core/callgraph.py +399 -0
- package/bundle/_internal/gnost/core/caution.py +315 -0
- package/bundle/_internal/gnost/core/cycles.py +148 -0
- package/bundle/_internal/gnost/core/flow.py +204 -0
- package/bundle/_internal/gnost/core/graph.py +108 -0
- package/bundle/_internal/gnost/core/insight_builder.py +164 -0
- package/bundle/_internal/gnost/core/ranker.py +119 -0
- package/bundle/_internal/gnost/core/resolver.py +304 -0
- package/bundle/_internal/gnost/languages/base.py +108 -0
- package/bundle/_internal/gnost/languages/java.py +104 -0
- package/bundle/_internal/gnost/languages/javascript.py +153 -0
- package/bundle/_internal/gnost/languages/manifests.py +45 -0
- package/bundle/_internal/gnost/languages/python.py +318 -0
- package/bundle/_internal/gnost/languages/typescript.py +6 -0
- package/bundle/_internal/gnost/models/__init__.py +0 -0
- package/bundle/_internal/gnost/models/insights.py +68 -0
- package/bundle/_internal/gnost/reporters/__init__.py +3 -0
- package/bundle/_internal/gnost/reporters/analysis_html.py +1292 -0
- package/bundle/_internal/gnost/reporters/diagram_viewer.py +153 -0
- package/bundle/_internal/gnost/reporters/files.py +18 -0
- package/bundle/_internal/gnost/reporters/folders.py +18 -0
- package/bundle/_internal/gnost/reporters/insights_json.py +189 -0
- package/bundle/_internal/gnost/reporters/loc_summary.py +19 -0
- package/bundle/_internal/gnost/reporters/markdown.py +372 -0
- package/bundle/_internal/gnost/reporters/mermaid.py +543 -0
- package/bundle/_internal/gnost/reporters/mermaid_graph.py +309 -0
- package/bundle/_internal/gnost/reporters/readme.py +81 -0
- package/bundle/_internal/gnost/reporters/stats.py +13 -0
- package/bundle/_internal/gnost/reporters/summary.py +223 -0
- package/bundle/_internal/gnost/reporters/templates/analyzer_guides.json +247 -0
- package/bundle/_internal/gnost/reporters/templates/analyzer_guides_layout.html +9 -0
- package/bundle/_internal/gnost/reporters/templates/graph_viewer.html +427 -0
- package/bundle/_internal/gnost/reporters/vendor/THIRD_PARTY_NOTICES.md +205 -0
- package/bundle/_internal/gnost/reporters/vendor/cose-base.js +3214 -0
- package/bundle/_internal/gnost/reporters/vendor/cytoscape-fcose.js +1549 -0
- package/bundle/_internal/gnost/reporters/vendor/cytoscape.min.js +32 -0
- package/bundle/_internal/gnost/reporters/vendor/layout-base.js +5230 -0
- package/bundle/_internal/gnost/reporters/vendor/marked.min.js +6 -0
- package/bundle/_internal/gnost/reporters/vendor/mermaid.min.js +2314 -0
- package/bundle/_internal/gnost/reporters/vendor/svg-pan-zoom.min.js +3 -0
- package/bundle/_internal/gnost/reporters/vendor/vendor.json +44 -0
- package/bundle/_internal/gnost/routes/__init__.py +45 -0
- package/bundle/_internal/gnost/routes/java.py +72 -0
- package/bundle/_internal/gnost/routes/javascript.py +275 -0
- package/bundle/_internal/gnost/routes/models.py +58 -0
- package/bundle/_internal/gnost/routes/python.py +429 -0
- package/bundle/_internal/gnost/scanner/__init__.py +4 -0
- package/bundle/_internal/gnost/scanner/classify.py +13 -0
- package/bundle/_internal/gnost/scanner/engine.py +169 -0
- package/bundle/_internal/gnost/scanner/filters.py +196 -0
- package/bundle/_internal/gnost/scanner/loc.py +93 -0
- package/bundle/_internal/gnost/scanner/models.py +27 -0
- package/bundle/_internal/gnost/schemas/insights.schema.json +517 -0
- package/bundle/_internal/gnost/utils/__init__.py +0 -0
- package/bundle/_internal/gnost/utils/logger.py +85 -0
- package/bundle/_internal/gnost/utils/paths.py +29 -0
- package/bundle/_internal/gnost/utils/printer.py +46 -0
- package/bundle/_internal/gnost/utils/progress.py +20 -0
- package/bundle/_internal/gnost-0.5.1rc1.dist-info/INSTALLER +1 -0
- package/bundle/_internal/gnost-0.5.1rc1.dist-info/METADATA +130 -0
- package/bundle/_internal/gnost-0.5.1rc1.dist-info/RECORD +178 -0
- package/bundle/_internal/gnost-0.5.1rc1.dist-info/REQUESTED +0 -0
- package/bundle/_internal/gnost-0.5.1rc1.dist-info/WHEEL +5 -0
- package/bundle/_internal/gnost-0.5.1rc1.dist-info/direct_url.json +1 -0
- package/bundle/_internal/gnost-0.5.1rc1.dist-info/entry_points.txt +2 -0
- package/bundle/_internal/gnost-0.5.1rc1.dist-info/licenses/LICENSE +21 -0
- package/bundle/_internal/gnost-0.5.1rc1.dist-info/top_level.txt +1 -0
- package/bundle/_internal/libcrypto.3.dylib +0 -0
- package/bundle/_internal/libncurses.6.dylib +0 -0
- package/bundle/_internal/librt/base64.cpython-312-darwin.so +0 -0
- package/bundle/_internal/librt/internal.cpython-312-darwin.so +0 -0
- package/bundle/_internal/libssl.3.dylib +0 -0
- package/bundle/_internal/mypy/__init__.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/__init__.py +1 -0
- package/bundle/_internal/mypy/__main__.py +52 -0
- package/bundle/_internal/mypy/api.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/api.py +95 -0
- package/bundle/_internal/mypy/applytype.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/applytype.py +317 -0
- package/bundle/_internal/mypy/argmap.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/argmap.py +269 -0
- package/bundle/_internal/mypy/binder.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/binder.py +710 -0
- package/bundle/_internal/mypy/bogus_type.py +27 -0
- package/bundle/_internal/mypy/build.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/build.py +5533 -0
- package/bundle/_internal/mypy/build_worker/__init__.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/build_worker/__init__.py +0 -0
- package/bundle/_internal/mypy/build_worker/__main__.py +6 -0
- package/bundle/_internal/mypy/build_worker/worker.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/build_worker/worker.py +379 -0
- package/bundle/_internal/mypy/cache.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/cache.py +626 -0
- package/bundle/_internal/mypy/checker.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/checker.py +10110 -0
- package/bundle/_internal/mypy/checker_shared.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/checker_shared.py +377 -0
- package/bundle/_internal/mypy/checker_state.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/checker_state.py +30 -0
- package/bundle/_internal/mypy/checkexpr.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/checkexpr.py +7018 -0
- package/bundle/_internal/mypy/checkmember.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/checkmember.py +1593 -0
- package/bundle/_internal/mypy/checkpattern.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/checkpattern.py +883 -0
- package/bundle/_internal/mypy/checkstrformat.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/checkstrformat.py +1103 -0
- package/bundle/_internal/mypy/config_parser.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/config_parser.py +749 -0
- package/bundle/_internal/mypy/constant_fold.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/constant_fold.py +187 -0
- package/bundle/_internal/mypy/constraints.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/constraints.py +1748 -0
- package/bundle/_internal/mypy/copytype.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/copytype.py +137 -0
- package/bundle/_internal/mypy/defaults.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/defaults.py +67 -0
- package/bundle/_internal/mypy/dmypy/__init__.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/dmypy/__init__.py +0 -0
- package/bundle/_internal/mypy/dmypy/__main__.py +6 -0
- package/bundle/_internal/mypy/dmypy/client.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/dmypy/client.py +732 -0
- package/bundle/_internal/mypy/dmypy_os.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/dmypy_os.py +43 -0
- package/bundle/_internal/mypy/dmypy_server.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/dmypy_server.py +1132 -0
- package/bundle/_internal/mypy/dmypy_util.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/dmypy_util.py +117 -0
- package/bundle/_internal/mypy/erasetype.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/erasetype.py +301 -0
- package/bundle/_internal/mypy/error_formatter.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/error_formatter.py +39 -0
- package/bundle/_internal/mypy/errorcodes.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/errorcodes.py +340 -0
- package/bundle/_internal/mypy/errors.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/errors.py +1468 -0
- package/bundle/_internal/mypy/evalexpr.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/evalexpr.py +211 -0
- package/bundle/_internal/mypy/expandtype.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/expandtype.py +662 -0
- package/bundle/_internal/mypy/exportjson.py +616 -0
- package/bundle/_internal/mypy/exprtotype.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/exprtotype.py +285 -0
- package/bundle/_internal/mypy/fastparse.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/fastparse.py +2267 -0
- package/bundle/_internal/mypy/find_sources.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/find_sources.py +257 -0
- package/bundle/_internal/mypy/fixup.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/fixup.py +438 -0
- package/bundle/_internal/mypy/freetree.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/freetree.py +23 -0
- package/bundle/_internal/mypy/fscache.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/fscache.py +312 -0
- package/bundle/_internal/mypy/fswatcher.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/fswatcher.py +106 -0
- package/bundle/_internal/mypy/gclogger.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/gclogger.py +48 -0
- package/bundle/_internal/mypy/git.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/git.py +69 -0
- package/bundle/_internal/mypy/graph_utils.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/graph_utils.py +161 -0
- package/bundle/_internal/mypy/indirection.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/indirection.py +176 -0
- package/bundle/_internal/mypy/infer.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/infer.py +80 -0
- package/bundle/_internal/mypy/inspections.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/inspections.py +626 -0
- package/bundle/_internal/mypy/ipc.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/ipc.py +508 -0
- package/bundle/_internal/mypy/join.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/join.py +962 -0
- package/bundle/_internal/mypy/known_modules.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/known_modules.py +174 -0
- package/bundle/_internal/mypy/literals.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/literals.py +327 -0
- package/bundle/_internal/mypy/lookup.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/lookup.py +80 -0
- package/bundle/_internal/mypy/main.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/main.py +1793 -0
- package/bundle/_internal/mypy/maptype.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/maptype.py +109 -0
- package/bundle/_internal/mypy/meet.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/meet.py +1371 -0
- package/bundle/_internal/mypy/memprofile.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/memprofile.py +122 -0
- package/bundle/_internal/mypy/message_registry.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/message_registry.py +378 -0
- package/bundle/_internal/mypy/messages.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/messages.py +3535 -0
- package/bundle/_internal/mypy/metastore.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/metastore.py +278 -0
- package/bundle/_internal/mypy/mixedtraverser.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/mixedtraverser.py +147 -0
- package/bundle/_internal/mypy/modulefinder.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/modulefinder.py +1008 -0
- package/bundle/_internal/mypy/moduleinspect.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/moduleinspect.py +184 -0
- package/bundle/_internal/mypy/modules_state.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/modules_state.py +20 -0
- package/bundle/_internal/mypy/mro.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/mro.py +62 -0
- package/bundle/_internal/mypy/nativeparse.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/nativeparse.py +2199 -0
- package/bundle/_internal/mypy/nodes.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/nodes.py +5608 -0
- package/bundle/_internal/mypy/operators.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/operators.py +126 -0
- package/bundle/_internal/mypy/options.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/options.py +678 -0
- package/bundle/_internal/mypy/parse.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/parse.py +135 -0
- package/bundle/_internal/mypy/partially_defined.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/partially_defined.py +703 -0
- package/bundle/_internal/mypy/patterns.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/patterns.py +162 -0
- package/bundle/_internal/mypy/plugin.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/plugin.py +945 -0
- package/bundle/_internal/mypy/plugins/__init__.py +0 -0
- package/bundle/_internal/mypy/plugins/attrs.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/plugins/attrs.py +1179 -0
- package/bundle/_internal/mypy/plugins/common.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/plugins/common.py +441 -0
- package/bundle/_internal/mypy/plugins/constants.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/plugins/constants.py +20 -0
- package/bundle/_internal/mypy/plugins/ctypes.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/plugins/ctypes.py +245 -0
- package/bundle/_internal/mypy/plugins/dataclasses.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/plugins/dataclasses.py +1135 -0
- package/bundle/_internal/mypy/plugins/default.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/plugins/default.py +612 -0
- package/bundle/_internal/mypy/plugins/enums.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/plugins/enums.py +299 -0
- package/bundle/_internal/mypy/plugins/functools.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/plugins/functools.py +399 -0
- package/bundle/_internal/mypy/plugins/proper_plugin.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/plugins/proper_plugin.py +178 -0
- package/bundle/_internal/mypy/plugins/singledispatch.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/plugins/singledispatch.py +212 -0
- package/bundle/_internal/mypy/py.typed +1 -0
- package/bundle/_internal/mypy/pyinfo.py +79 -0
- package/bundle/_internal/mypy/reachability.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/reachability.py +388 -0
- package/bundle/_internal/mypy/refinfo.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/refinfo.py +92 -0
- package/bundle/_internal/mypy/renaming.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/renaming.py +583 -0
- package/bundle/_internal/mypy/report.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/report.py +930 -0
- package/bundle/_internal/mypy/scope.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/scope.py +125 -0
- package/bundle/_internal/mypy/semanal.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/semanal.py +8674 -0
- package/bundle/_internal/mypy/semanal_classprop.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/semanal_classprop.py +188 -0
- package/bundle/_internal/mypy/semanal_enum.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/semanal_enum.py +259 -0
- package/bundle/_internal/mypy/semanal_infer.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/semanal_infer.py +135 -0
- package/bundle/_internal/mypy/semanal_main.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/semanal_main.py +542 -0
- package/bundle/_internal/mypy/semanal_namedtuple.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/semanal_namedtuple.py +679 -0
- package/bundle/_internal/mypy/semanal_newtype.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/semanal_newtype.py +272 -0
- package/bundle/_internal/mypy/semanal_pass1.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/semanal_pass1.py +159 -0
- package/bundle/_internal/mypy/semanal_shared.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/semanal_shared.py +499 -0
- package/bundle/_internal/mypy/semanal_typeargs.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/semanal_typeargs.py +309 -0
- package/bundle/_internal/mypy/semanal_typeddict.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/semanal_typeddict.py +826 -0
- package/bundle/_internal/mypy/server/__init__.py +0 -0
- package/bundle/_internal/mypy/server/astdiff.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/server/astdiff.py +552 -0
- package/bundle/_internal/mypy/server/astmerge.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/server/astmerge.py +583 -0
- package/bundle/_internal/mypy/server/aststrip.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/server/aststrip.py +255 -0
- package/bundle/_internal/mypy/server/deps.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/server/deps.py +1153 -0
- package/bundle/_internal/mypy/server/mergecheck.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/server/mergecheck.py +84 -0
- package/bundle/_internal/mypy/server/objgraph.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/server/objgraph.py +101 -0
- package/bundle/_internal/mypy/server/subexpr.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/server/subexpr.py +208 -0
- package/bundle/_internal/mypy/server/target.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/server/target.py +11 -0
- package/bundle/_internal/mypy/server/trigger.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/server/trigger.py +26 -0
- package/bundle/_internal/mypy/server/update.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/server/update.py +1372 -0
- package/bundle/_internal/mypy/sharedparse.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/sharedparse.py +114 -0
- package/bundle/_internal/mypy/solve.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/solve.py +602 -0
- package/bundle/_internal/mypy/split_namespace.py +35 -0
- package/bundle/_internal/mypy/state.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/state.py +29 -0
- package/bundle/_internal/mypy/stats.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/stats.py +494 -0
- package/bundle/_internal/mypy/strconv.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/strconv.py +707 -0
- package/bundle/_internal/mypy/stubdoc.py +545 -0
- package/bundle/_internal/mypy/stubgen.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/stubgen.py +2064 -0
- package/bundle/_internal/mypy/stubgenc.py +1046 -0
- package/bundle/_internal/mypy/stubinfo.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/stubinfo.py +321 -0
- package/bundle/_internal/mypy/stubtest.py +2676 -0
- package/bundle/_internal/mypy/stubutil.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/stubutil.py +895 -0
- package/bundle/_internal/mypy/subtypes.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/subtypes.py +2572 -0
- package/bundle/_internal/mypy/suggestions.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/suggestions.py +1068 -0
- package/bundle/_internal/mypy/test/__init__.py +0 -0
- package/bundle/_internal/mypy/test/config.py +31 -0
- package/bundle/_internal/mypy/test/data.py +864 -0
- package/bundle/_internal/mypy/test/helpers.py +546 -0
- package/bundle/_internal/mypy/test/meta/__init__.py +0 -0
- package/bundle/_internal/mypy/test/meta/_pytest.py +72 -0
- package/bundle/_internal/mypy/test/meta/test_diff_helper.py +47 -0
- package/bundle/_internal/mypy/test/meta/test_parse_data.py +69 -0
- package/bundle/_internal/mypy/test/meta/test_update_data.py +131 -0
- package/bundle/_internal/mypy/test/test_config_parser.py +130 -0
- package/bundle/_internal/mypy/test/test_diff_cache.py +209 -0
- package/bundle/_internal/mypy/test/test_find_sources.py +376 -0
- package/bundle/_internal/mypy/test/test_nativeparse.py +306 -0
- package/bundle/_internal/mypy/test/test_ref_info.py +46 -0
- package/bundle/_internal/mypy/test/testapi.py +45 -0
- package/bundle/_internal/mypy/test/testargs.py +202 -0
- package/bundle/_internal/mypy/test/testcheck.py +360 -0
- package/bundle/_internal/mypy/test/testcmdline.py +162 -0
- package/bundle/_internal/mypy/test/testconstraints.py +134 -0
- package/bundle/_internal/mypy/test/testdaemon.py +132 -0
- package/bundle/_internal/mypy/test/testdeps.py +85 -0
- package/bundle/_internal/mypy/test/testdiff.py +70 -0
- package/bundle/_internal/mypy/test/testerrorstream.py +46 -0
- package/bundle/_internal/mypy/test/testexportjson.py +104 -0
- package/bundle/_internal/mypy/test/testfinegrained.py +453 -0
- package/bundle/_internal/mypy/test/testfinegrainedcache.py +18 -0
- package/bundle/_internal/mypy/test/testformatter.py +85 -0
- package/bundle/_internal/mypy/test/testfscache.py +100 -0
- package/bundle/_internal/mypy/test/testgraph.py +138 -0
- package/bundle/_internal/mypy/test/testinfer.py +373 -0
- package/bundle/_internal/mypy/test/testipc.py +154 -0
- package/bundle/_internal/mypy/test/testmerge.py +235 -0
- package/bundle/_internal/mypy/test/testmodulefinder.py +284 -0
- package/bundle/_internal/mypy/test/testmypyc.py +26 -0
- package/bundle/_internal/mypy/test/testoutput.py +64 -0
- package/bundle/_internal/mypy/test/testparse.py +131 -0
- package/bundle/_internal/mypy/test/testpep561.py +174 -0
- package/bundle/_internal/mypy/test/testpythoneval.py +116 -0
- package/bundle/_internal/mypy/test/testreports.py +59 -0
- package/bundle/_internal/mypy/test/testsemanal.py +219 -0
- package/bundle/_internal/mypy/test/testsolve.py +287 -0
- package/bundle/_internal/mypy/test/teststubgen.py +1650 -0
- package/bundle/_internal/mypy/test/teststubinfo.py +24 -0
- package/bundle/_internal/mypy/test/teststubtest.py +3417 -0
- package/bundle/_internal/mypy/test/testsubtypes.py +306 -0
- package/bundle/_internal/mypy/test/testtransform.py +64 -0
- package/bundle/_internal/mypy/test/testtypegen.py +83 -0
- package/bundle/_internal/mypy/test/testtypes.py +1666 -0
- package/bundle/_internal/mypy/test/testutil.py +111 -0
- package/bundle/_internal/mypy/test/typefixture.py +419 -0
- package/bundle/_internal/mypy/test/update_data.py +87 -0
- package/bundle/_internal/mypy/test/visitors.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/test/visitors.py +77 -0
- package/bundle/_internal/mypy/traverser.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/traverser.py +1106 -0
- package/bundle/_internal/mypy/treetransform.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/treetransform.py +820 -0
- package/bundle/_internal/mypy/tvar_scope.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/tvar_scope.py +154 -0
- package/bundle/_internal/mypy/type_visitor.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/type_visitor.py +630 -0
- package/bundle/_internal/mypy/typeanal.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/typeanal.py +2961 -0
- package/bundle/_internal/mypy/typeops.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/typeops.py +1355 -0
- package/bundle/_internal/mypy/types.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/types.py +4639 -0
- package/bundle/_internal/mypy/types_utils.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/types_utils.py +183 -0
- package/bundle/_internal/mypy/typeshed/LICENSE +237 -0
- package/bundle/_internal/mypy/typeshed/stdlib/VERSIONS +349 -0
- package/bundle/_internal/mypy/typeshed/stdlib/__future__.pyi +36 -0
- package/bundle/_internal/mypy/typeshed/stdlib/__main__.pyi +1 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_ast.pyi +141 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_asyncio.pyi +114 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_bisect.pyi +103 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_blake2.pyi +119 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_bz2.pyi +24 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_codecs.pyi +125 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_collections_abc.pyi +105 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_compat_pickle.pyi +10 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_compression.pyi +39 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_contextvars.pyi +69 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_csv.pyi +116 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_ctypes.pyi +375 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_curses.pyi +583 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_curses_panel.pyi +27 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_dbm.pyi +46 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_decimal.pyi +73 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_frozen_importlib.pyi +121 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_frozen_importlib_external.pyi +218 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_gdbm.pyi +50 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_hashlib.pyi +127 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_heapq.pyi +18 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_imp.pyi +30 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_interpchannels.pyi +86 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_interpqueues.pyi +31 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_interpreters.pyi +68 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_io.pyi +330 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_json.pyi +59 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_locale.pyi +121 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_lsprof.pyi +34 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_lzma.pyi +71 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_markupbase.pyi +10 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_msi.pyi +97 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_multibytecodec.pyi +49 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_operator.pyi +130 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_osx_support.pyi +34 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_pickle.pyi +114 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_posixsubprocess.pyi +59 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_py_abc.pyi +14 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_pydecimal.pyi +50 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_queue.pyi +18 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_random.pyi +14 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_remote_debugging.pyi +186 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_sitebuiltins.pyi +18 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_socket.pyi +966 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_sqlite3.pyi +311 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_ssl.pyi +303 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_stat.pyi +119 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_struct.pyi +24 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_thread.pyi +125 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_threading_local.pyi +24 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_tkinter.pyi +156 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_tracemalloc.pyi +13 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_typeshed/README.md +34 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_typeshed/__init__.pyi +415 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_typeshed/_type_checker_internals.pyi +102 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_typeshed/dbapi.pyi +36 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_typeshed/importlib.pyi +18 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_typeshed/wsgi.pyi +43 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_typeshed/xml.pyi +9 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_warnings.pyi +54 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_weakref.pyi +15 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_weakrefset.pyi +49 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_winapi.pyi +319 -0
- package/bundle/_internal/mypy/typeshed/stdlib/_zstd.pyi +102 -0
- package/bundle/_internal/mypy/typeshed/stdlib/abc.pyi +50 -0
- package/bundle/_internal/mypy/typeshed/stdlib/aifc.pyi +79 -0
- package/bundle/_internal/mypy/typeshed/stdlib/annotationlib.pyi +156 -0
- package/bundle/_internal/mypy/typeshed/stdlib/antigravity.pyi +3 -0
- package/bundle/_internal/mypy/typeshed/stdlib/argparse.pyi +866 -0
- package/bundle/_internal/mypy/typeshed/stdlib/array.pyi +113 -0
- package/bundle/_internal/mypy/typeshed/stdlib/ast.pyi +2199 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asynchat.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/__init__.pyi +1022 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/base_events.pyi +607 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/base_futures.pyi +17 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/base_subprocess.pyi +62 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/base_tasks.pyi +17 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/constants.pyi +20 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/coroutines.pyi +45 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/events.pyi +803 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/exceptions.pyi +44 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/format_helpers.pyi +31 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/futures.pyi +19 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/graph.pyi +29 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/locks.pyi +83 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/log.pyi +3 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/mixins.pyi +9 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/proactor_events.pyi +53 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/protocols.pyi +39 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/queues.pyi +45 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/runners.pyi +41 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/selector_events.pyi +10 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/sslproto.pyi +164 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/staggered.pyi +10 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/streams.pyi +124 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/subprocess.pyi +166 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/taskgroups.pyi +41 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/tasks.pyi +315 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/threads.pyi +9 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/timeouts.pyi +20 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/tools.pyi +51 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/transports.pyi +57 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/trsock.pyi +137 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/unix_events.pyi +277 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/windows_events.pyi +122 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncio/windows_utils.pyi +49 -0
- package/bundle/_internal/mypy/typeshed/stdlib/asyncore.pyi +91 -0
- package/bundle/_internal/mypy/typeshed/stdlib/atexit.pyi +11 -0
- package/bundle/_internal/mypy/typeshed/stdlib/audioop.pyi +44 -0
- package/bundle/_internal/mypy/typeshed/stdlib/base64.pyi +124 -0
- package/bundle/_internal/mypy/typeshed/stdlib/bdb.pyi +139 -0
- package/bundle/_internal/mypy/typeshed/stdlib/binascii.pyi +102 -0
- package/bundle/_internal/mypy/typeshed/stdlib/binhex.pyi +44 -0
- package/bundle/_internal/mypy/typeshed/stdlib/bisect.pyi +4 -0
- package/bundle/_internal/mypy/typeshed/stdlib/builtins.pyi +2470 -0
- package/bundle/_internal/mypy/typeshed/stdlib/bz2.pyi +121 -0
- package/bundle/_internal/mypy/typeshed/stdlib/cProfile.pyi +33 -0
- package/bundle/_internal/mypy/typeshed/stdlib/calendar.pyi +249 -0
- package/bundle/_internal/mypy/typeshed/stdlib/cgi.pyi +120 -0
- package/bundle/_internal/mypy/typeshed/stdlib/cgitb.pyi +32 -0
- package/bundle/_internal/mypy/typeshed/stdlib/chunk.pyi +20 -0
- package/bundle/_internal/mypy/typeshed/stdlib/cmath.pyi +36 -0
- package/bundle/_internal/mypy/typeshed/stdlib/cmd.pyi +46 -0
- package/bundle/_internal/mypy/typeshed/stdlib/code.pyi +55 -0
- package/bundle/_internal/mypy/typeshed/stdlib/codecs.pyi +357 -0
- package/bundle/_internal/mypy/typeshed/stdlib/codeop.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/collections/__init__.pyi +565 -0
- package/bundle/_internal/mypy/typeshed/stdlib/collections/abc.pyi +2 -0
- package/bundle/_internal/mypy/typeshed/stdlib/colorsys.pyi +15 -0
- package/bundle/_internal/mypy/typeshed/stdlib/compileall.pyi +51 -0
- package/bundle/_internal/mypy/typeshed/stdlib/compression/__init__.pyi +0 -0
- package/bundle/_internal/mypy/typeshed/stdlib/compression/_common/__init__.pyi +0 -0
- package/bundle/_internal/mypy/typeshed/stdlib/compression/_common/_streams.pyi +37 -0
- package/bundle/_internal/mypy/typeshed/stdlib/compression/bz2.pyi +1 -0
- package/bundle/_internal/mypy/typeshed/stdlib/compression/gzip.pyi +1 -0
- package/bundle/_internal/mypy/typeshed/stdlib/compression/lzma.pyi +1 -0
- package/bundle/_internal/mypy/typeshed/stdlib/compression/zlib.pyi +1 -0
- package/bundle/_internal/mypy/typeshed/stdlib/compression/zstd/__init__.pyi +94 -0
- package/bundle/_internal/mypy/typeshed/stdlib/compression/zstd/_zstdfile.pyi +117 -0
- package/bundle/_internal/mypy/typeshed/stdlib/concurrent/__init__.pyi +0 -0
- package/bundle/_internal/mypy/typeshed/stdlib/concurrent/futures/__init__.pyi +71 -0
- package/bundle/_internal/mypy/typeshed/stdlib/concurrent/futures/_base.pyi +119 -0
- package/bundle/_internal/mypy/typeshed/stdlib/concurrent/futures/interpreter.pyi +82 -0
- package/bundle/_internal/mypy/typeshed/stdlib/concurrent/futures/process.pyi +248 -0
- package/bundle/_internal/mypy/typeshed/stdlib/concurrent/futures/thread.pyi +143 -0
- package/bundle/_internal/mypy/typeshed/stdlib/concurrent/interpreters/__init__.pyi +68 -0
- package/bundle/_internal/mypy/typeshed/stdlib/concurrent/interpreters/_crossinterp.pyi +30 -0
- package/bundle/_internal/mypy/typeshed/stdlib/concurrent/interpreters/_queues.pyi +74 -0
- package/bundle/_internal/mypy/typeshed/stdlib/configparser.pyi +509 -0
- package/bundle/_internal/mypy/typeshed/stdlib/contextlib.pyi +211 -0
- package/bundle/_internal/mypy/typeshed/stdlib/contextvars.pyi +3 -0
- package/bundle/_internal/mypy/typeshed/stdlib/copy.pyi +37 -0
- package/bundle/_internal/mypy/typeshed/stdlib/copyreg.pyi +20 -0
- package/bundle/_internal/mypy/typeshed/stdlib/crypt.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/csv.pyi +153 -0
- package/bundle/_internal/mypy/typeshed/stdlib/ctypes/__init__.pyi +394 -0
- package/bundle/_internal/mypy/typeshed/stdlib/ctypes/_endian.pyi +16 -0
- package/bundle/_internal/mypy/typeshed/stdlib/ctypes/macholib/__init__.pyi +3 -0
- package/bundle/_internal/mypy/typeshed/stdlib/ctypes/macholib/dyld.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/ctypes/macholib/dylib.pyi +14 -0
- package/bundle/_internal/mypy/typeshed/stdlib/ctypes/macholib/framework.pyi +14 -0
- package/bundle/_internal/mypy/typeshed/stdlib/ctypes/util.pyi +11 -0
- package/bundle/_internal/mypy/typeshed/stdlib/ctypes/wintypes.pyi +321 -0
- package/bundle/_internal/mypy/typeshed/stdlib/curses/__init__.pyi +38 -0
- package/bundle/_internal/mypy/typeshed/stdlib/curses/ascii.pyi +62 -0
- package/bundle/_internal/mypy/typeshed/stdlib/curses/has_key.pyi +1 -0
- package/bundle/_internal/mypy/typeshed/stdlib/curses/panel.pyi +1 -0
- package/bundle/_internal/mypy/typeshed/stdlib/curses/textpad.pyi +11 -0
- package/bundle/_internal/mypy/typeshed/stdlib/dataclasses.pyi +401 -0
- package/bundle/_internal/mypy/typeshed/stdlib/datetime.pyi +381 -0
- package/bundle/_internal/mypy/typeshed/stdlib/dbm/__init__.pyi +105 -0
- package/bundle/_internal/mypy/typeshed/stdlib/dbm/dumb.pyi +41 -0
- package/bundle/_internal/mypy/typeshed/stdlib/dbm/gnu.pyi +1 -0
- package/bundle/_internal/mypy/typeshed/stdlib/dbm/ndbm.pyi +1 -0
- package/bundle/_internal/mypy/typeshed/stdlib/dbm/sqlite3.pyi +34 -0
- package/bundle/_internal/mypy/typeshed/stdlib/decimal.pyi +278 -0
- package/bundle/_internal/mypy/typeshed/stdlib/difflib.pyi +157 -0
- package/bundle/_internal/mypy/typeshed/stdlib/dis.pyi +302 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/__init__.pyi +5 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/_msvccompiler.pyi +13 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/archive_util.pyi +36 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/bcppcompiler.pyi +3 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/ccompiler.pyi +182 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/cmd.pyi +238 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/__init__.pyi +41 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/bdist.pyi +27 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/bdist_dumb.pyi +22 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/bdist_msi.pyi +45 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/bdist_packager.pyi +0 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/bdist_rpm.pyi +53 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/build.pyi +34 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/build_clib.pyi +29 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/build_ext.pyi +52 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/build_py.pyi +45 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/build_scripts.pyi +25 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/check.pyi +39 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/clean.pyi +18 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/config.pyi +84 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/install.pyi +67 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/install_data.pyi +20 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/install_egg_info.pyi +19 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/install_headers.pyi +17 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/install_lib.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/install_scripts.pyi +19 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/register.pyi +20 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/sdist.pyi +45 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/command/upload.pyi +18 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/config.pyi +17 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/core.pyi +58 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/cygwinccompiler.pyi +20 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/debug.pyi +3 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/dep_util.pyi +14 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/dir_util.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/dist.pyi +318 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/errors.pyi +19 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/extension.pyi +36 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/fancy_getopt.pyi +45 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/file_util.pyi +40 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/filelist.pyi +61 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/log.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/msvccompiler.pyi +3 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/spawn.pyi +10 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/sysconfig.pyi +32 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/text_file.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/unixccompiler.pyi +3 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/util.pyi +53 -0
- package/bundle/_internal/mypy/typeshed/stdlib/distutils/version.pyi +36 -0
- package/bundle/_internal/mypy/typeshed/stdlib/doctest.pyi +265 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/__init__.pyi +68 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/_header_value_parser.pyi +415 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/_policybase.pyi +80 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/base64mime.pyi +13 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/charset.pyi +44 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/contentmanager.pyi +11 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/encoders.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/errors.pyi +38 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/feedparser.pyi +24 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/generator.pyi +79 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/header.pyi +32 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/headerregistry.pyi +196 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/iterators.pyi +15 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/message.pyi +191 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/mime/__init__.pyi +0 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/mime/application.pyi +17 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/mime/audio.pyi +17 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/mime/base.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/mime/image.pyi +17 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/mime/message.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/mime/multipart.pyi +18 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/mime/nonmultipart.pyi +5 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/mime/text.pyi +9 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/parser.pyi +42 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/policy.pyi +78 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/quoprimime.pyi +28 -0
- package/bundle/_internal/mypy/typeshed/stdlib/email/utils.pyi +72 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/__init__.pyi +15 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/aliases.pyi +1 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/ascii.pyi +30 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/base64_codec.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/big5.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/big5hkscs.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/bz2_codec.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/charmap.pyi +33 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp037.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1006.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1026.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1125.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1140.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1250.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1251.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1252.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1253.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1254.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1255.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1256.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1257.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp1258.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp273.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp424.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp437.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp500.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp720.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp737.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp775.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp850.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp852.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp855.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp856.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp857.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp858.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp860.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp861.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp862.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp863.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp864.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp865.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp866.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp869.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp874.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp875.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp932.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp949.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/cp950.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/euc_jis_2004.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/euc_jisx0213.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/euc_jp.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/euc_kr.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/gb18030.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/gb2312.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/gbk.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/hex_codec.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/hp_roman8.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/hz.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/idna.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso2022_jp.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso2022_jp_1.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso2022_jp_2.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso2022_jp_2004.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso2022_jp_3.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso2022_jp_ext.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso2022_kr.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_1.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_10.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_11.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_13.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_14.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_15.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_16.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_2.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_3.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_4.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_5.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_6.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_7.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_8.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/iso8859_9.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/johab.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/koi8_r.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/koi8_t.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/koi8_u.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/kz1048.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/latin_1.pyi +30 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_arabic.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_croatian.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_cyrillic.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_farsi.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_greek.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_iceland.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_latin2.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_roman.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_romanian.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/mac_turkish.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/mbcs.pyi +28 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/oem.pyi +28 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/palmos.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/ptcp154.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/punycode.pyi +33 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/quopri_codec.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/raw_unicode_escape.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/rot_13.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/shift_jis.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/shift_jis_2004.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/shift_jisx0213.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/tis_620.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/undefined.pyi +20 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/unicode_escape.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_16.pyi +20 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_16_be.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_16_le.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_32.pyi +20 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_32_be.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_32_le.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_7.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_8.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/utf_8_sig.pyi +22 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/uu_codec.pyi +28 -0
- package/bundle/_internal/mypy/typeshed/stdlib/encodings/zlib_codec.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/ensurepip/__init__.pyi +12 -0
- package/bundle/_internal/mypy/typeshed/stdlib/enum.pyi +374 -0
- package/bundle/_internal/mypy/typeshed/stdlib/errno.pyi +227 -0
- package/bundle/_internal/mypy/typeshed/stdlib/faulthandler.pyi +61 -0
- package/bundle/_internal/mypy/typeshed/stdlib/fcntl.pyi +157 -0
- package/bundle/_internal/mypy/typeshed/stdlib/filecmp.pyi +65 -0
- package/bundle/_internal/mypy/typeshed/stdlib/fileinput.pyi +141 -0
- package/bundle/_internal/mypy/typeshed/stdlib/fnmatch.pyi +16 -0
- package/bundle/_internal/mypy/typeshed/stdlib/fractions.pyi +185 -0
- package/bundle/_internal/mypy/typeshed/stdlib/ftplib.pyi +174 -0
- package/bundle/_internal/mypy/typeshed/stdlib/functools.pyi +287 -0
- package/bundle/_internal/mypy/typeshed/stdlib/gc.pyi +32 -0
- package/bundle/_internal/mypy/typeshed/stdlib/genericpath.pyi +98 -0
- package/bundle/_internal/mypy/typeshed/stdlib/getopt.pyi +27 -0
- package/bundle/_internal/mypy/typeshed/stdlib/getpass.pyi +14 -0
- package/bundle/_internal/mypy/typeshed/stdlib/gettext.pyi +190 -0
- package/bundle/_internal/mypy/typeshed/stdlib/glob.pyi +50 -0
- package/bundle/_internal/mypy/typeshed/stdlib/graphlib.pyi +29 -0
- package/bundle/_internal/mypy/typeshed/stdlib/grp.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/gzip.pyi +181 -0
- package/bundle/_internal/mypy/typeshed/stdlib/hashlib.pyi +112 -0
- package/bundle/_internal/mypy/typeshed/stdlib/heapq.pyi +32 -0
- package/bundle/_internal/mypy/typeshed/stdlib/hmac.pyi +33 -0
- package/bundle/_internal/mypy/typeshed/stdlib/html/__init__.pyi +7 -0
- package/bundle/_internal/mypy/typeshed/stdlib/html/entities.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/html/parser.pyi +40 -0
- package/bundle/_internal/mypy/typeshed/stdlib/http/__init__.pyi +118 -0
- package/bundle/_internal/mypy/typeshed/stdlib/http/client.pyi +318 -0
- package/bundle/_internal/mypy/typeshed/stdlib/http/cookiejar.pyi +158 -0
- package/bundle/_internal/mypy/typeshed/stdlib/http/cookies.pyi +57 -0
- package/bundle/_internal/mypy/typeshed/stdlib/http/server.pyi +139 -0
- package/bundle/_internal/mypy/typeshed/stdlib/imaplib.pyi +212 -0
- package/bundle/_internal/mypy/typeshed/stdlib/imghdr.pyi +18 -0
- package/bundle/_internal/mypy/typeshed/stdlib/imp.pyi +63 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/__init__.pyi +17 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/_abc.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/_bootstrap.pyi +2 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/_bootstrap_external.pyi +2 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/abc.pyi +165 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/machinery.pyi +43 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/metadata/__init__.pyi +310 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/metadata/_meta.pyi +65 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/metadata/diagnose.pyi +2 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/readers.pyi +69 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/resources/__init__.pyi +81 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/resources/_common.pyi +48 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/resources/_functional.pyi +35 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/resources/abc.pyi +64 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/resources/readers.pyi +14 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/resources/simple.pyi +59 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/simple.pyi +11 -0
- package/bundle/_internal/mypy/typeshed/stdlib/importlib/util.pyi +75 -0
- package/bundle/_internal/mypy/typeshed/stdlib/inspect.pyi +749 -0
- package/bundle/_internal/mypy/typeshed/stdlib/io.pyi +75 -0
- package/bundle/_internal/mypy/typeshed/stdlib/ipaddress.pyi +249 -0
- package/bundle/_internal/mypy/typeshed/stdlib/itertools.pyi +376 -0
- package/bundle/_internal/mypy/typeshed/stdlib/json/__init__.pyi +93 -0
- package/bundle/_internal/mypy/typeshed/stdlib/json/decoder.pyi +50 -0
- package/bundle/_internal/mypy/typeshed/stdlib/json/encoder.pyi +40 -0
- package/bundle/_internal/mypy/typeshed/stdlib/json/scanner.pyi +7 -0
- package/bundle/_internal/mypy/typeshed/stdlib/json/tool.pyi +1 -0
- package/bundle/_internal/mypy/typeshed/stdlib/keyword.pyi +16 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/__init__.pyi +0 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/btm_matcher.pyi +28 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixer_base.pyi +42 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/__init__.pyi +0 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_apply.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_asserts.pyi +10 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_basestring.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_buffer.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_dict.pyi +16 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_except.pyi +14 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_exec.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_execfile.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_exitfunc.pyi +13 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_filter.pyi +9 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_funcattrs.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_future.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_getcwdu.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_has_key.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_idioms.pyi +15 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_import.pyi +16 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_imports.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_imports2.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_input.pyi +11 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_intern.pyi +9 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_isinstance.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_itertools.pyi +9 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_itertools_imports.pyi +7 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_long.pyi +7 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_map.pyi +9 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_metaclass.pyi +17 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_methodattrs.pyi +10 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_ne.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_next.pyi +19 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_nonzero.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_numliterals.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_operator.pyi +12 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_paren.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_print.pyi +12 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_raise.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_raw_input.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_reduce.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_reload.pyi +9 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_renames.pyi +17 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_repr.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_set_literal.pyi +7 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_standarderror.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_sys_exc.pyi +9 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_throw.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_tuple_params.pyi +16 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_types.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_unicode.pyi +12 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_urllib.pyi +15 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_ws_comma.pyi +12 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_xrange.pyi +20 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_xreadlines.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/fixes/fix_zip.pyi +9 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/main.pyi +42 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pgen2/__init__.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pgen2/driver.pyi +27 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pgen2/grammar.pyi +25 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pgen2/literals.pyi +7 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pgen2/parse.pyi +30 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pgen2/pgen.pyi +53 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pgen2/token.pyi +69 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pgen2/tokenize.pyi +96 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pygram.pyi +114 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/pytree.pyi +118 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lib2to3/refactor.pyi +86 -0
- package/bundle/_internal/mypy/typeshed/stdlib/linecache.pyi +18 -0
- package/bundle/_internal/mypy/typeshed/stdlib/locale.pyi +160 -0
- package/bundle/_internal/mypy/typeshed/stdlib/logging/__init__.pyi +674 -0
- package/bundle/_internal/mypy/typeshed/stdlib/logging/config.pyi +141 -0
- package/bundle/_internal/mypy/typeshed/stdlib/logging/handlers.pyi +258 -0
- package/bundle/_internal/mypy/typeshed/stdlib/lzma.pyi +181 -0
- package/bundle/_internal/mypy/typeshed/stdlib/mailbox.pyi +307 -0
- package/bundle/_internal/mypy/typeshed/stdlib/mailcap.pyi +11 -0
- package/bundle/_internal/mypy/typeshed/stdlib/marshal.pyi +51 -0
- package/bundle/_internal/mypy/typeshed/stdlib/math/__init__.pyi +157 -0
- package/bundle/_internal/mypy/typeshed/stdlib/math/integer.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/mimetypes.pyi +56 -0
- package/bundle/_internal/mypy/typeshed/stdlib/mmap.pyi +191 -0
- package/bundle/_internal/mypy/typeshed/stdlib/modulefinder.pyi +68 -0
- package/bundle/_internal/mypy/typeshed/stdlib/msilib/__init__.pyi +177 -0
- package/bundle/_internal/mypy/typeshed/stdlib/msilib/schema.pyi +95 -0
- package/bundle/_internal/mypy/typeshed/stdlib/msilib/sequence.pyi +13 -0
- package/bundle/_internal/mypy/typeshed/stdlib/msilib/text.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/msvcrt.pyi +31 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/__init__.pyi +90 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/connection.pyi +97 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/context.pyi +220 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/dummy/__init__.pyi +89 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/dummy/connection.pyi +39 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/forkserver.pyi +78 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/heap.pyi +41 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/managers.pyi +390 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/pool.pyi +101 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/popen_fork.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/popen_forkserver.pyi +16 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/popen_spawn_posix.pyi +20 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/popen_spawn_win32.pyi +30 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/process.pyi +57 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/queues.pyi +46 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/reduction.pyi +95 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/resource_sharer.pyi +20 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/resource_tracker.pyi +21 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/shared_memory.pyi +43 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/sharedctypes.pyi +140 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/spawn.pyi +32 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/synchronize.pyi +63 -0
- package/bundle/_internal/mypy/typeshed/stdlib/multiprocessing/util.pyi +109 -0
- package/bundle/_internal/mypy/typeshed/stdlib/netrc.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/nis.pyi +9 -0
- package/bundle/_internal/mypy/typeshed/stdlib/nntplib.pyi +120 -0
- package/bundle/_internal/mypy/typeshed/stdlib/nt.pyi +116 -0
- package/bundle/_internal/mypy/typeshed/stdlib/ntpath.pyi +134 -0
- package/bundle/_internal/mypy/typeshed/stdlib/nturl2path.pyi +6 -0
- package/bundle/_internal/mypy/typeshed/stdlib/numbers.pyi +220 -0
- package/bundle/_internal/mypy/typeshed/stdlib/opcode.pyi +53 -0
- package/bundle/_internal/mypy/typeshed/stdlib/operator.pyi +219 -0
- package/bundle/_internal/mypy/typeshed/stdlib/optparse.pyi +312 -0
- package/bundle/_internal/mypy/typeshed/stdlib/os/__init__.pyi +1878 -0
- package/bundle/_internal/mypy/typeshed/stdlib/os/path.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/ossaudiodev.pyi +132 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pathlib/__init__.pyi +358 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pathlib/types.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pdb.pyi +275 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pickle.pyi +240 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pickletools.pyi +176 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pipes.pyi +16 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pkgutil.pyi +60 -0
- package/bundle/_internal/mypy/typeshed/stdlib/platform.pyi +100 -0
- package/bundle/_internal/mypy/typeshed/stdlib/plistlib.pyi +84 -0
- package/bundle/_internal/mypy/typeshed/stdlib/poplib.pyi +93 -0
- package/bundle/_internal/mypy/typeshed/stdlib/posix.pyi +427 -0
- package/bundle/_internal/mypy/typeshed/stdlib/posixpath.pyi +230 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pprint.pyi +170 -0
- package/bundle/_internal/mypy/typeshed/stdlib/profile.pyi +31 -0
- package/bundle/_internal/mypy/typeshed/stdlib/profiling/__init__.pyi +3 -0
- package/bundle/_internal/mypy/typeshed/stdlib/profiling/sampling/__init__.pyi +17 -0
- package/bundle/_internal/mypy/typeshed/stdlib/profiling/sampling/collector.pyi +25 -0
- package/bundle/_internal/mypy/typeshed/stdlib/profiling/sampling/gecko_collector.pyi +111 -0
- package/bundle/_internal/mypy/typeshed/stdlib/profiling/sampling/heatmap_collector.pyi +24 -0
- package/bundle/_internal/mypy/typeshed/stdlib/profiling/sampling/jsonl_collector.pyi +15 -0
- package/bundle/_internal/mypy/typeshed/stdlib/profiling/sampling/pstats_collector.pyi +17 -0
- package/bundle/_internal/mypy/typeshed/stdlib/profiling/sampling/stack_collector.pyi +40 -0
- package/bundle/_internal/mypy/typeshed/stdlib/profiling/sampling/string_table.pyi +5 -0
- package/bundle/_internal/mypy/typeshed/stdlib/profiling/tracing.pyi +9 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pstats.pyi +96 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pty.pyi +24 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pwd.pyi +27 -0
- package/bundle/_internal/mypy/typeshed/stdlib/py_compile.pyi +28 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pyclbr.pyi +57 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pydoc.pyi +348 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pydoc_data/__init__.pyi +0 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pydoc_data/module_docs.pyi +3 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pydoc_data/topics.pyi +3 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pyexpat/__init__.pyi +88 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pyexpat/errors.pyi +53 -0
- package/bundle/_internal/mypy/typeshed/stdlib/pyexpat/model.pyi +13 -0
- package/bundle/_internal/mypy/typeshed/stdlib/queue.pyi +55 -0
- package/bundle/_internal/mypy/typeshed/stdlib/quopri.pyi +12 -0
- package/bundle/_internal/mypy/typeshed/stdlib/random.pyi +135 -0
- package/bundle/_internal/mypy/typeshed/stdlib/re.pyi +347 -0
- package/bundle/_internal/mypy/typeshed/stdlib/readline.pyi +39 -0
- package/bundle/_internal/mypy/typeshed/stdlib/reprlib.pyi +64 -0
- package/bundle/_internal/mypy/typeshed/stdlib/resource.pyi +102 -0
- package/bundle/_internal/mypy/typeshed/stdlib/rlcompleter.pyi +9 -0
- package/bundle/_internal/mypy/typeshed/stdlib/runpy.pyi +24 -0
- package/bundle/_internal/mypy/typeshed/stdlib/sched.pyi +34 -0
- package/bundle/_internal/mypy/typeshed/stdlib/secrets.pyi +17 -0
- package/bundle/_internal/mypy/typeshed/stdlib/select.pyi +171 -0
- package/bundle/_internal/mypy/typeshed/stdlib/selectors.pyi +67 -0
- package/bundle/_internal/mypy/typeshed/stdlib/shelve.pyi +110 -0
- package/bundle/_internal/mypy/typeshed/stdlib/shlex.pyi +63 -0
- package/bundle/_internal/mypy/typeshed/stdlib/shutil.pyi +243 -0
- package/bundle/_internal/mypy/typeshed/stdlib/signal.pyi +174 -0
- package/bundle/_internal/mypy/typeshed/stdlib/site.pyi +46 -0
- package/bundle/_internal/mypy/typeshed/stdlib/smtpd.pyi +92 -0
- package/bundle/_internal/mypy/typeshed/stdlib/smtplib.pyi +223 -0
- package/bundle/_internal/mypy/typeshed/stdlib/sndhdr.pyi +14 -0
- package/bundle/_internal/mypy/typeshed/stdlib/socket.pyi +1587 -0
- package/bundle/_internal/mypy/typeshed/stdlib/socketserver.pyi +170 -0
- package/bundle/_internal/mypy/typeshed/stdlib/spwd.pyi +45 -0
- package/bundle/_internal/mypy/typeshed/stdlib/sqlite3/__init__.pyi +510 -0
- package/bundle/_internal/mypy/typeshed/stdlib/sqlite3/dbapi2.pyi +244 -0
- package/bundle/_internal/mypy/typeshed/stdlib/sqlite3/dump.pyi +2 -0
- package/bundle/_internal/mypy/typeshed/stdlib/sre_compile.pyi +12 -0
- package/bundle/_internal/mypy/typeshed/stdlib/sre_constants.pyi +135 -0
- package/bundle/_internal/mypy/typeshed/stdlib/sre_parse.pyi +102 -0
- package/bundle/_internal/mypy/typeshed/stdlib/ssl.pyi +540 -0
- package/bundle/_internal/mypy/typeshed/stdlib/stat.pyi +126 -0
- package/bundle/_internal/mypy/typeshed/stdlib/statistics.pyi +161 -0
- package/bundle/_internal/mypy/typeshed/stdlib/string/__init__.pyi +81 -0
- package/bundle/_internal/mypy/typeshed/stdlib/string/templatelib.pyi +36 -0
- package/bundle/_internal/mypy/typeshed/stdlib/stringprep.pyi +29 -0
- package/bundle/_internal/mypy/typeshed/stdlib/struct.pyi +5 -0
- package/bundle/_internal/mypy/typeshed/stdlib/subprocess.pyi +1484 -0
- package/bundle/_internal/mypy/typeshed/stdlib/sunau.pyi +82 -0
- package/bundle/_internal/mypy/typeshed/stdlib/symtable.pyi +95 -0
- package/bundle/_internal/mypy/typeshed/stdlib/sys/__init__.pyi +538 -0
- package/bundle/_internal/mypy/typeshed/stdlib/sys/__jit.pyi +11 -0
- package/bundle/_internal/mypy/typeshed/stdlib/sys/_monitoring.pyi +69 -0
- package/bundle/_internal/mypy/typeshed/stdlib/sysconfig.pyi +59 -0
- package/bundle/_internal/mypy/typeshed/stdlib/syslog.pyi +58 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tabnanny.pyi +16 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tarfile.pyi +868 -0
- package/bundle/_internal/mypy/typeshed/stdlib/telnetlib.pyi +123 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tempfile.pyi +474 -0
- package/bundle/_internal/mypy/typeshed/stdlib/termios.pyi +303 -0
- package/bundle/_internal/mypy/typeshed/stdlib/textwrap.pyi +103 -0
- package/bundle/_internal/mypy/typeshed/stdlib/this.pyi +2 -0
- package/bundle/_internal/mypy/typeshed/stdlib/threading.pyi +221 -0
- package/bundle/_internal/mypy/typeshed/stdlib/time.pyi +117 -0
- package/bundle/_internal/mypy/typeshed/stdlib/timeit.pyi +46 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tkinter/__init__.pyi +4376 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tkinter/colorchooser.pyi +12 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tkinter/commondialog.pyi +14 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tkinter/constants.pyi +80 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tkinter/dialog.pyi +13 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tkinter/dnd.pyi +19 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tkinter/filedialog.pyi +149 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tkinter/font.pyi +123 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tkinter/messagebox.pyi +98 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tkinter/scrolledtext.pyi +9 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tkinter/simpledialog.pyi +58 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tkinter/tix.pyi +299 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tkinter/ttk.pyi +1434 -0
- package/bundle/_internal/mypy/typeshed/stdlib/token.pyi +166 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tokenize.pyi +201 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tomllib.pyi +27 -0
- package/bundle/_internal/mypy/typeshed/stdlib/trace.pyi +85 -0
- package/bundle/_internal/mypy/typeshed/stdlib/traceback.pyi +293 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tracemalloc.pyi +123 -0
- package/bundle/_internal/mypy/typeshed/stdlib/tty.pyi +29 -0
- package/bundle/_internal/mypy/typeshed/stdlib/turtle.pyi +856 -0
- package/bundle/_internal/mypy/typeshed/stdlib/types.pyi +744 -0
- package/bundle/_internal/mypy/typeshed/stdlib/typing.pyi +1250 -0
- package/bundle/_internal/mypy/typeshed/stdlib/typing_extensions.pyi +749 -0
- package/bundle/_internal/mypy/typeshed/stdlib/unicodedata.pyi +94 -0
- package/bundle/_internal/mypy/typeshed/stdlib/unittest/__init__.pyi +63 -0
- package/bundle/_internal/mypy/typeshed/stdlib/unittest/_log.pyi +29 -0
- package/bundle/_internal/mypy/typeshed/stdlib/unittest/async_case.pyi +24 -0
- package/bundle/_internal/mypy/typeshed/stdlib/unittest/case.pyi +352 -0
- package/bundle/_internal/mypy/typeshed/stdlib/unittest/loader.pyi +55 -0
- package/bundle/_internal/mypy/typeshed/stdlib/unittest/main.pyi +74 -0
- package/bundle/_internal/mypy/typeshed/stdlib/unittest/mock.pyi +555 -0
- package/bundle/_internal/mypy/typeshed/stdlib/unittest/result.pyi +46 -0
- package/bundle/_internal/mypy/typeshed/stdlib/unittest/runner.pyi +93 -0
- package/bundle/_internal/mypy/typeshed/stdlib/unittest/signals.pyi +15 -0
- package/bundle/_internal/mypy/typeshed/stdlib/unittest/suite.pyi +23 -0
- package/bundle/_internal/mypy/typeshed/stdlib/unittest/util.pyi +39 -0
- package/bundle/_internal/mypy/typeshed/stdlib/urllib/__init__.pyi +0 -0
- package/bundle/_internal/mypy/typeshed/stdlib/urllib/error.pyi +29 -0
- package/bundle/_internal/mypy/typeshed/stdlib/urllib/parse.pyi +354 -0
- package/bundle/_internal/mypy/typeshed/stdlib/urllib/request.pyi +447 -0
- package/bundle/_internal/mypy/typeshed/stdlib/urllib/response.pyi +45 -0
- package/bundle/_internal/mypy/typeshed/stdlib/urllib/robotparser.pyi +20 -0
- package/bundle/_internal/mypy/typeshed/stdlib/uu.pyi +12 -0
- package/bundle/_internal/mypy/typeshed/stdlib/uuid.pyi +106 -0
- package/bundle/_internal/mypy/typeshed/stdlib/venv/__init__.pyi +86 -0
- package/bundle/_internal/mypy/typeshed/stdlib/warnings.pyi +146 -0
- package/bundle/_internal/mypy/typeshed/stdlib/wave.pyi +105 -0
- package/bundle/_internal/mypy/typeshed/stdlib/weakref.pyi +217 -0
- package/bundle/_internal/mypy/typeshed/stdlib/webbrowser.pyi +93 -0
- package/bundle/_internal/mypy/typeshed/stdlib/winreg.pyi +137 -0
- package/bundle/_internal/mypy/typeshed/stdlib/winsound.pyi +40 -0
- package/bundle/_internal/mypy/typeshed/stdlib/wsgiref/__init__.pyi +0 -0
- package/bundle/_internal/mypy/typeshed/stdlib/wsgiref/handlers.pyi +91 -0
- package/bundle/_internal/mypy/typeshed/stdlib/wsgiref/headers.pyi +27 -0
- package/bundle/_internal/mypy/typeshed/stdlib/wsgiref/simple_server.pyi +37 -0
- package/bundle/_internal/mypy/typeshed/stdlib/wsgiref/types.pyi +31 -0
- package/bundle/_internal/mypy/typeshed/stdlib/wsgiref/util.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/wsgiref/validate.pyi +50 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xdrlib.pyi +57 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/__init__.pyi +9 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/dom/NodeFilter.pyi +22 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/dom/__init__.pyi +101 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/dom/domreg.pyi +8 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/dom/expatbuilder.pyi +126 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/dom/minicompat.pyi +24 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/dom/minidom.pyi +693 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/dom/pulldom.pyi +109 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/dom/xmlbuilder.pyi +82 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/etree/ElementInclude.pyi +28 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/etree/ElementPath.pyi +42 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/etree/ElementTree.pyi +402 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/etree/__init__.pyi +0 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/etree/cElementTree.pyi +1 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/parsers/__init__.pyi +1 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/parsers/expat/__init__.pyi +7 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/parsers/expat/errors.pyi +1 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/parsers/expat/model.pyi +1 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/sax/__init__.pyi +42 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/sax/_exceptions.pyi +19 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/sax/expatreader.pyi +72 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/sax/handler.pyi +85 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/sax/saxutils.pyi +69 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/sax/xmlreader.pyi +94 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xml/utils.pyi +2 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xmlrpc/__init__.pyi +0 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xmlrpc/client.pyi +300 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xmlrpc/server.pyi +149 -0
- package/bundle/_internal/mypy/typeshed/stdlib/xxlimited.pyi +15 -0
- package/bundle/_internal/mypy/typeshed/stdlib/zipapp.pyi +19 -0
- package/bundle/_internal/mypy/typeshed/stdlib/zipfile/__init__.pyi +411 -0
- package/bundle/_internal/mypy/typeshed/stdlib/zipfile/_path/__init__.pyi +87 -0
- package/bundle/_internal/mypy/typeshed/stdlib/zipfile/_path/glob.pyi +26 -0
- package/bundle/_internal/mypy/typeshed/stdlib/zipimport.pyi +44 -0
- package/bundle/_internal/mypy/typeshed/stdlib/zlib.pyi +81 -0
- package/bundle/_internal/mypy/typeshed/stdlib/zoneinfo/__init__.pyi +36 -0
- package/bundle/_internal/mypy/typeshed/stdlib/zoneinfo/_common.pyi +14 -0
- package/bundle/_internal/mypy/typeshed/stdlib/zoneinfo/_tzpath.pyi +13 -0
- package/bundle/_internal/mypy/typeshed/stubs/librt/librt/__init__.pyi +0 -0
- package/bundle/_internal/mypy/typeshed/stubs/librt/librt/base64.pyi +4 -0
- package/bundle/_internal/mypy/typeshed/stubs/librt/librt/internal.pyi +22 -0
- package/bundle/_internal/mypy/typeshed/stubs/librt/librt/random.pyi +22 -0
- package/bundle/_internal/mypy/typeshed/stubs/librt/librt/strings.pyi +61 -0
- package/bundle/_internal/mypy/typeshed/stubs/librt/librt/threading.pyi +16 -0
- package/bundle/_internal/mypy/typeshed/stubs/librt/librt/time.pyi +1 -0
- package/bundle/_internal/mypy/typeshed/stubs/librt/librt/vecs.pyi +24 -0
- package/bundle/_internal/mypy/typeshed/stubs/mypy-extensions/mypy_extensions.pyi +226 -0
- package/bundle/_internal/mypy/typestate.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/typestate.py +334 -0
- package/bundle/_internal/mypy/typetraverser.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/typetraverser.py +166 -0
- package/bundle/_internal/mypy/typevars.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/typevars.py +84 -0
- package/bundle/_internal/mypy/typevartuples.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/typevartuples.py +36 -0
- package/bundle/_internal/mypy/util.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/util.py +1055 -0
- package/bundle/_internal/mypy/version.py +1 -0
- package/bundle/_internal/mypy/visitor.cpython-312-darwin.so +0 -0
- package/bundle/_internal/mypy/visitor.py +639 -0
- package/bundle/_internal/mypy/xml/mypy-html.css +104 -0
- package/bundle/_internal/mypy/xml/mypy-html.xslt +81 -0
- package/bundle/_internal/mypy/xml/mypy-txt.xslt +100 -0
- package/bundle/_internal/mypy/xml/mypy.xsd +50 -0
- package/bundle/_internal/mypy-2.4.1.dist-info/INSTALLER +1 -0
- package/bundle/_internal/mypy-2.4.1.dist-info/METADATA +56 -0
- package/bundle/_internal/mypy-2.4.1.dist-info/RECORD +1814 -0
- package/bundle/_internal/mypy-2.4.1.dist-info/WHEEL +6 -0
- package/bundle/_internal/mypy-2.4.1.dist-info/entry_points.txt +6 -0
- package/bundle/_internal/mypy-2.4.1.dist-info/licenses/LICENSE +264 -0
- package/bundle/_internal/mypy-2.4.1.dist-info/licenses/mypy/typeshed/LICENSE +237 -0
- package/bundle/_internal/mypy-2.4.1.dist-info/top_level.txt +3 -0
- package/bundle/_internal/mypyc/__init__.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_asyncio.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_bisect.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_blake2.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_bz2.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_codecs_cn.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_codecs_hk.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_codecs_iso2022.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_codecs_jp.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_codecs_kr.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_codecs_tw.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_contextvars.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_csv.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_ctypes.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_curses.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_datetime.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_decimal.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_elementtree.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_hashlib.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_heapq.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_json.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_lzma.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_md5.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_multibytecodec.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_multiprocessing.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_opcode.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_pickle.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_posixshmem.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_posixsubprocess.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_queue.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_random.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_scproxy.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_sha1.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_sha2.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_sha3.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_socket.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_sqlite3.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_ssl.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_statistics.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_struct.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/_uuid.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/array.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/binascii.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/fcntl.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/grp.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/math.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/mmap.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/pyexpat.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/readline.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/resource.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/select.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/syslog.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/termios.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/unicodedata.cpython-312-darwin.so +0 -0
- package/bundle/_internal/python3.12/lib-dynload/zlib.cpython-312-darwin.so +0 -0
- package/bundle/_internal/radon/__init__.py +21 -0
- package/bundle/_internal/radon/__main__.py +4 -0
- package/bundle/_internal/radon/cli/__init__.py +433 -0
- package/bundle/_internal/radon/cli/colors.py +49 -0
- package/bundle/_internal/radon/cli/harvest.py +449 -0
- package/bundle/_internal/radon/cli/tools.py +597 -0
- package/bundle/_internal/radon/complexity.py +108 -0
- package/bundle/_internal/radon/contrib/__init__.py +0 -0
- package/bundle/_internal/radon/contrib/flake8.py +72 -0
- package/bundle/_internal/radon/metrics.py +157 -0
- package/bundle/_internal/radon/raw.py +245 -0
- package/bundle/_internal/radon/tests/__init__.py +0 -0
- package/bundle/_internal/radon/tests/conftest.py +31 -0
- package/bundle/_internal/radon/tests/data/__init__.py +5 -0
- package/bundle/_internal/radon/tests/data/no_encoding.py +2 -0
- package/bundle/_internal/radon/tests/data/py3unicode.py +5 -0
- package/bundle/_internal/radon/tests/run.py +14 -0
- package/bundle/_internal/radon/tests/test_cli.py +282 -0
- package/bundle/_internal/radon/tests/test_cli_colors.py +22 -0
- package/bundle/_internal/radon/tests/test_cli_harvest.py +392 -0
- package/bundle/_internal/radon/tests/test_cli_tools.py +616 -0
- package/bundle/_internal/radon/tests/test_complexity_utils.py +118 -0
- package/bundle/_internal/radon/tests/test_complexity_visitor.py +754 -0
- package/bundle/_internal/radon/tests/test_halstead.py +113 -0
- package/bundle/_internal/radon/tests/test_ipynb.py +141 -0
- package/bundle/_internal/radon/tests/test_other_metrics.py +169 -0
- package/bundle/_internal/radon/tests/test_raw.py +467 -0
- package/bundle/_internal/radon/visitors.py +460 -0
- package/bundle/_internal/radon-6.0.1.dist-info/INSTALLER +1 -0
- package/bundle/_internal/radon-6.0.1.dist-info/LICENSE +22 -0
- package/bundle/_internal/radon-6.0.1.dist-info/METADATA +263 -0
- package/bundle/_internal/radon-6.0.1.dist-info/RECORD +64 -0
- package/bundle/_internal/radon-6.0.1.dist-info/WHEEL +6 -0
- package/bundle/_internal/radon-6.0.1.dist-info/entry_points.txt +8 -0
- package/bundle/_internal/radon-6.0.1.dist-info/top_level.txt +1 -0
- package/bundle/_internal/setuptools/_vendor/jaraco/text/Lorem ipsum.txt +2 -0
- package/bundle/_internal/stevedore-5.10.0.dist-info/INSTALLER +1 -0
- package/bundle/_internal/stevedore-5.10.0.dist-info/METADATA +56 -0
- package/bundle/_internal/stevedore-5.10.0.dist-info/RECORD +84 -0
- package/bundle/_internal/stevedore-5.10.0.dist-info/WHEEL +5 -0
- package/bundle/_internal/stevedore-5.10.0.dist-info/entry_points.txt +10 -0
- package/bundle/_internal/stevedore-5.10.0.dist-info/licenses/AUTHORS +76 -0
- package/bundle/_internal/stevedore-5.10.0.dist-info/licenses/LICENSE +202 -0
- package/bundle/_internal/stevedore-5.10.0.dist-info/pbr.json +1 -0
- package/bundle/_internal/stevedore-5.10.0.dist-info/top_level.txt +1 -0
- package/bundle/_internal/tqdm-4.70.1.dist-info/INSTALLER +1 -0
- package/bundle/_internal/tqdm-4.70.1.dist-info/METADATA +1600 -0
- package/bundle/_internal/tqdm-4.70.1.dist-info/RECORD +72 -0
- package/bundle/_internal/tqdm-4.70.1.dist-info/WHEEL +5 -0
- package/bundle/_internal/tqdm-4.70.1.dist-info/entry_points.txt +2 -0
- package/bundle/_internal/tqdm-4.70.1.dist-info/licenses/LICENCE +49 -0
- package/bundle/_internal/tqdm-4.70.1.dist-info/top_level.txt +1 -0
- package/bundle/_internal/yaml/_yaml.cpython-312-darwin.so +0 -0
- package/bundle/gnost +0 -0
- package/package.json +21 -4
|
@@ -0,0 +1,2267 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
import sys
|
|
5
|
+
import warnings
|
|
6
|
+
from collections.abc import Callable, Sequence
|
|
7
|
+
from typing import Any, Final, Literal, TypeVar, cast, overload
|
|
8
|
+
|
|
9
|
+
from mypy import defaults, errorcodes as codes, message_registry
|
|
10
|
+
from mypy.errors import Errors
|
|
11
|
+
from mypy.message_registry import ErrorMessage
|
|
12
|
+
from mypy.nodes import (
|
|
13
|
+
ARG_NAMED,
|
|
14
|
+
ARG_NAMED_OPT,
|
|
15
|
+
ARG_OPT,
|
|
16
|
+
ARG_POS,
|
|
17
|
+
ARG_STAR,
|
|
18
|
+
ARG_STAR2,
|
|
19
|
+
MISSING_FALLBACK,
|
|
20
|
+
PARAM_SPEC_KIND,
|
|
21
|
+
TYPE_VAR_KIND,
|
|
22
|
+
TYPE_VAR_TUPLE_KIND,
|
|
23
|
+
ArgKind,
|
|
24
|
+
Argument,
|
|
25
|
+
AssertStmt,
|
|
26
|
+
AssignmentExpr,
|
|
27
|
+
AssignmentStmt,
|
|
28
|
+
AwaitExpr,
|
|
29
|
+
Block,
|
|
30
|
+
BreakStmt,
|
|
31
|
+
BytesExpr,
|
|
32
|
+
CallExpr,
|
|
33
|
+
ClassDef,
|
|
34
|
+
ComparisonExpr,
|
|
35
|
+
ComplexExpr,
|
|
36
|
+
ConditionalExpr,
|
|
37
|
+
ContinueStmt,
|
|
38
|
+
Decorator,
|
|
39
|
+
DelStmt,
|
|
40
|
+
DictExpr,
|
|
41
|
+
DictionaryComprehension,
|
|
42
|
+
EllipsisExpr,
|
|
43
|
+
Expression,
|
|
44
|
+
ExpressionStmt,
|
|
45
|
+
FloatExpr,
|
|
46
|
+
ForStmt,
|
|
47
|
+
FuncDef,
|
|
48
|
+
GeneratorExpr,
|
|
49
|
+
GlobalDecl,
|
|
50
|
+
IfStmt,
|
|
51
|
+
Import,
|
|
52
|
+
ImportAll,
|
|
53
|
+
ImportBase,
|
|
54
|
+
ImportFrom,
|
|
55
|
+
IndexExpr,
|
|
56
|
+
IntExpr,
|
|
57
|
+
LambdaExpr,
|
|
58
|
+
ListComprehension,
|
|
59
|
+
ListExpr,
|
|
60
|
+
MatchStmt,
|
|
61
|
+
MemberExpr,
|
|
62
|
+
MypyFile,
|
|
63
|
+
NameExpr,
|
|
64
|
+
Node,
|
|
65
|
+
NonlocalDecl,
|
|
66
|
+
OperatorAssignmentStmt,
|
|
67
|
+
OpExpr,
|
|
68
|
+
OverloadedFuncDef,
|
|
69
|
+
OverloadPart,
|
|
70
|
+
PassStmt,
|
|
71
|
+
RaiseStmt,
|
|
72
|
+
RefExpr,
|
|
73
|
+
ReturnStmt,
|
|
74
|
+
SetComprehension,
|
|
75
|
+
SetExpr,
|
|
76
|
+
SliceExpr,
|
|
77
|
+
StarExpr,
|
|
78
|
+
Statement,
|
|
79
|
+
StrExpr,
|
|
80
|
+
SuperExpr,
|
|
81
|
+
TemplateStrExpr,
|
|
82
|
+
TempNode,
|
|
83
|
+
TryStmt,
|
|
84
|
+
TupleExpr,
|
|
85
|
+
TypeAliasStmt,
|
|
86
|
+
TypeParam,
|
|
87
|
+
UnaryExpr,
|
|
88
|
+
Var,
|
|
89
|
+
WhileStmt,
|
|
90
|
+
WithStmt,
|
|
91
|
+
YieldExpr,
|
|
92
|
+
YieldFromExpr,
|
|
93
|
+
check_param_names,
|
|
94
|
+
)
|
|
95
|
+
from mypy.options import Options
|
|
96
|
+
from mypy.patterns import (
|
|
97
|
+
AsPattern,
|
|
98
|
+
ClassPattern,
|
|
99
|
+
MappingPattern,
|
|
100
|
+
OrPattern,
|
|
101
|
+
SequencePattern,
|
|
102
|
+
SingletonPattern,
|
|
103
|
+
StarredPattern,
|
|
104
|
+
ValuePattern,
|
|
105
|
+
)
|
|
106
|
+
from mypy.reachability import infer_reachability_of_if_statement, mark_block_unreachable
|
|
107
|
+
from mypy.sharedparse import argument_elide_name, special_function_elide_names
|
|
108
|
+
from mypy.traverser import TraverserVisitor
|
|
109
|
+
from mypy.types import (
|
|
110
|
+
AnyType,
|
|
111
|
+
CallableArgument,
|
|
112
|
+
CallableType,
|
|
113
|
+
EllipsisType,
|
|
114
|
+
Instance,
|
|
115
|
+
ProperType,
|
|
116
|
+
RawExpressionType,
|
|
117
|
+
TupleType,
|
|
118
|
+
Type,
|
|
119
|
+
TypedDictType,
|
|
120
|
+
TypeList,
|
|
121
|
+
TypeOfAny,
|
|
122
|
+
UnboundType,
|
|
123
|
+
UnionType,
|
|
124
|
+
UnpackType,
|
|
125
|
+
)
|
|
126
|
+
from mypy.util import bytes_to_human_readable_repr, unnamed_function
|
|
127
|
+
|
|
128
|
+
# pull this into a final variable to make mypyc be quiet about the
|
|
129
|
+
# the default argument warning
|
|
130
|
+
PY_MINOR_VERSION: Final = sys.version_info[1]
|
|
131
|
+
|
|
132
|
+
import ast as ast3
|
|
133
|
+
from ast import AST, Attribute, Call, FunctionType, Name, Starred, UAdd, UnaryOp, USub
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def ast3_parse(
|
|
137
|
+
source: str | bytes, filename: str, mode: str, feature_version: int = PY_MINOR_VERSION
|
|
138
|
+
) -> AST:
|
|
139
|
+
# Ignore warnings that look like:
|
|
140
|
+
# <type_comment>:1: SyntaxWarning: invalid escape sequence '\.'
|
|
141
|
+
# because `source` could be anything, including literals like r'(re\.match)'
|
|
142
|
+
with warnings.catch_warnings():
|
|
143
|
+
warnings.simplefilter("ignore", SyntaxWarning)
|
|
144
|
+
return ast3.parse(
|
|
145
|
+
source,
|
|
146
|
+
filename,
|
|
147
|
+
mode,
|
|
148
|
+
type_comments=True, # This works the magic
|
|
149
|
+
feature_version=feature_version,
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
AstNode = ast3.expr | ast3.stmt | ast3.pattern | ast3.ExceptHandler
|
|
154
|
+
|
|
155
|
+
if sys.version_info >= (3, 11):
|
|
156
|
+
TryStar = ast3.TryStar
|
|
157
|
+
else:
|
|
158
|
+
TryStar = Any
|
|
159
|
+
|
|
160
|
+
if sys.version_info >= (3, 12):
|
|
161
|
+
ast_TypeAlias = ast3.TypeAlias
|
|
162
|
+
ast_ParamSpec = ast3.ParamSpec
|
|
163
|
+
ast_TypeVar = ast3.TypeVar
|
|
164
|
+
ast_TypeVarTuple = ast3.TypeVarTuple
|
|
165
|
+
else:
|
|
166
|
+
ast_TypeAlias = Any
|
|
167
|
+
ast_ParamSpec = Any
|
|
168
|
+
ast_TypeVar = Any
|
|
169
|
+
ast_TypeVarTuple = Any
|
|
170
|
+
|
|
171
|
+
if sys.version_info >= (3, 14):
|
|
172
|
+
ast_TemplateStr = ast3.TemplateStr
|
|
173
|
+
ast_Interpolation = ast3.Interpolation
|
|
174
|
+
else:
|
|
175
|
+
ast_TemplateStr = Any
|
|
176
|
+
ast_Interpolation = Any
|
|
177
|
+
|
|
178
|
+
N = TypeVar("N", bound=Node)
|
|
179
|
+
|
|
180
|
+
# There is no way to create reasonable fallbacks at this stage,
|
|
181
|
+
# they must be patched later.
|
|
182
|
+
_dummy_fallback: Final = Instance(MISSING_FALLBACK, [], -1)
|
|
183
|
+
|
|
184
|
+
TYPE_IGNORE_PATTERN: Final = re.compile(r"[^#]*#\s*type:\s*ignore\s*(.*)")
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def parse(
|
|
188
|
+
source: str | bytes,
|
|
189
|
+
fnam: str,
|
|
190
|
+
module: str | None,
|
|
191
|
+
errors: Errors,
|
|
192
|
+
options: Options | None = None,
|
|
193
|
+
) -> MypyFile:
|
|
194
|
+
"""Parse a source file, without doing any semantic analysis.
|
|
195
|
+
|
|
196
|
+
Return the parse tree. If errors is not provided, raise ParseError
|
|
197
|
+
on failure. Otherwise, use the errors object to report parse errors.
|
|
198
|
+
"""
|
|
199
|
+
ignore_errors = (options is not None and options.ignore_errors) or (
|
|
200
|
+
fnam in errors.ignored_files
|
|
201
|
+
)
|
|
202
|
+
# If errors are ignored, we can drop many function bodies to speed up type checking.
|
|
203
|
+
strip_function_bodies = ignore_errors and (options is None or not options.preserve_asts)
|
|
204
|
+
|
|
205
|
+
if options is None:
|
|
206
|
+
options = Options()
|
|
207
|
+
errors.set_file(fnam, module, options=options)
|
|
208
|
+
is_stub_file = fnam.endswith(".pyi")
|
|
209
|
+
if ignore_errors:
|
|
210
|
+
feature_version = sys.version_info[1]
|
|
211
|
+
elif is_stub_file:
|
|
212
|
+
feature_version = defaults.PYTHON3_VERSION[1]
|
|
213
|
+
else:
|
|
214
|
+
assert options.python_version[0] >= 3
|
|
215
|
+
feature_version = options.python_version[1]
|
|
216
|
+
if options.python_version[0] == 3 and options.python_version[1] > feature_version:
|
|
217
|
+
feature_version = options.python_version[1]
|
|
218
|
+
try:
|
|
219
|
+
# Disable
|
|
220
|
+
# - deprecation warnings for 'invalid escape sequence' (Python 3.11 and below)
|
|
221
|
+
# - syntax warnings for 'invalid escape sequence' (3.12+) and 'return in finally' (3.14+)
|
|
222
|
+
with warnings.catch_warnings():
|
|
223
|
+
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
|
224
|
+
warnings.filterwarnings("ignore", category=SyntaxWarning)
|
|
225
|
+
ast = ast3_parse(source, fnam, "exec", feature_version=feature_version)
|
|
226
|
+
|
|
227
|
+
tree = ASTConverter(
|
|
228
|
+
options=options,
|
|
229
|
+
is_stub=is_stub_file,
|
|
230
|
+
errors=errors,
|
|
231
|
+
strip_function_bodies=strip_function_bodies,
|
|
232
|
+
path=fnam,
|
|
233
|
+
).visit(ast)
|
|
234
|
+
|
|
235
|
+
except RecursionError as e:
|
|
236
|
+
# For very complex expressions it is possible to hit recursion limit
|
|
237
|
+
# before reaching a leaf node.
|
|
238
|
+
# Should reject at top level instead at bottom, since bottom would already
|
|
239
|
+
# be at the threshold of the recursion limit, and may fail again later.
|
|
240
|
+
# E.G. x1+x2+x3+...+xn -> BinOp(left=BinOp(left=BinOp(left=...
|
|
241
|
+
try:
|
|
242
|
+
# But to prove that is the cause of this particular recursion error,
|
|
243
|
+
# try to walk the tree using builtin visitor
|
|
244
|
+
ast3.NodeVisitor().visit(ast)
|
|
245
|
+
except RecursionError:
|
|
246
|
+
errors.report(
|
|
247
|
+
-1, -1, "Source expression too complex to parse", blocker=False, code=codes.MISC
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
tree = MypyFile([], [], False, {})
|
|
251
|
+
|
|
252
|
+
else:
|
|
253
|
+
# re-raise original recursion error if it *can* be unparsed,
|
|
254
|
+
# maybe this is some other issue that shouldn't be silenced/misdirected
|
|
255
|
+
raise e
|
|
256
|
+
|
|
257
|
+
except SyntaxError as e:
|
|
258
|
+
message = e.msg
|
|
259
|
+
if feature_version > sys.version_info.minor and message.startswith("invalid syntax"):
|
|
260
|
+
python_version_str = f"{options.python_version[0]}.{options.python_version[1]}"
|
|
261
|
+
message += f"; you likely need to run mypy using Python {python_version_str} or newer"
|
|
262
|
+
errors.report(
|
|
263
|
+
e.lineno if e.lineno is not None else -1,
|
|
264
|
+
e.offset,
|
|
265
|
+
re.sub(
|
|
266
|
+
r"^(\s*\w)", lambda m: m.group(1).upper(), message
|
|
267
|
+
), # Standardizing error message
|
|
268
|
+
blocker=True,
|
|
269
|
+
code=codes.SYNTAX,
|
|
270
|
+
)
|
|
271
|
+
tree = MypyFile([], [], False, {})
|
|
272
|
+
|
|
273
|
+
assert isinstance(tree, MypyFile)
|
|
274
|
+
return tree
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def parse_type_ignore_tag(tag: str | None) -> list[str] | None:
|
|
278
|
+
"""Parse optional "[code, ...]" tag after "# type: ignore".
|
|
279
|
+
|
|
280
|
+
Return:
|
|
281
|
+
* [] if no tag was found (ignore all errors)
|
|
282
|
+
* list of ignored error codes if a tag was found
|
|
283
|
+
* None if the tag was invalid.
|
|
284
|
+
"""
|
|
285
|
+
if not tag or tag.strip() == "" or tag.strip().startswith("#"):
|
|
286
|
+
# No tag -- ignore all errors.
|
|
287
|
+
return []
|
|
288
|
+
m = re.match(r"\s*\[([^]#]*)\]\s*(#.*)?$", tag)
|
|
289
|
+
if m is None:
|
|
290
|
+
# Invalid "# type: ignore" comment.
|
|
291
|
+
return None
|
|
292
|
+
return [stripped_code for code in m.group(1).split(",") if (stripped_code := code.strip())]
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def parse_type_comment(
|
|
296
|
+
type_comment: str, line: int, column: int, errors: Errors | None
|
|
297
|
+
) -> tuple[list[str] | None, ProperType | None]:
|
|
298
|
+
"""Parse type portion of a type comment (+ optional type ignore).
|
|
299
|
+
|
|
300
|
+
Return (ignore info, parsed type).
|
|
301
|
+
"""
|
|
302
|
+
try:
|
|
303
|
+
typ = ast3_parse(type_comment, "<type_comment>", "eval")
|
|
304
|
+
except SyntaxError:
|
|
305
|
+
if errors is not None:
|
|
306
|
+
stripped_type = type_comment.split("#", 2)[0].strip()
|
|
307
|
+
err_msg = message_registry.TYPE_COMMENT_SYNTAX_ERROR_VALUE.format(stripped_type)
|
|
308
|
+
errors.report(line, column, err_msg.value, blocker=True, code=err_msg.code)
|
|
309
|
+
return None, None
|
|
310
|
+
else:
|
|
311
|
+
raise
|
|
312
|
+
else:
|
|
313
|
+
extra_ignore = TYPE_IGNORE_PATTERN.match(type_comment)
|
|
314
|
+
if extra_ignore:
|
|
315
|
+
tag: str | None = extra_ignore.group(1)
|
|
316
|
+
ignored: list[str] | None = parse_type_ignore_tag(tag)
|
|
317
|
+
if ignored is None:
|
|
318
|
+
if errors is not None:
|
|
319
|
+
errors.report(
|
|
320
|
+
line, column, message_registry.INVALID_TYPE_IGNORE.value, code=codes.SYNTAX
|
|
321
|
+
)
|
|
322
|
+
else:
|
|
323
|
+
raise SyntaxError
|
|
324
|
+
else:
|
|
325
|
+
ignored = None
|
|
326
|
+
assert isinstance(typ, ast3.Expression)
|
|
327
|
+
converted = TypeConverter(
|
|
328
|
+
errors, line=line, override_column=column, is_evaluated=False
|
|
329
|
+
).visit(typ.body)
|
|
330
|
+
return ignored, converted
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def parse_type_string(
|
|
334
|
+
expr_string: str, expr_fallback_name: str, line: int, column: int
|
|
335
|
+
) -> ProperType:
|
|
336
|
+
"""Parses a type that was originally present inside of an explicit string.
|
|
337
|
+
|
|
338
|
+
For example, suppose we have the type `Foo["blah"]`. We should parse the
|
|
339
|
+
string expression "blah" using this function.
|
|
340
|
+
"""
|
|
341
|
+
try:
|
|
342
|
+
_, node = parse_type_comment(f"({expr_string})", line=line, column=column, errors=None)
|
|
343
|
+
if isinstance(node, (UnboundType, UnionType)) and node.original_str_expr is None:
|
|
344
|
+
node.original_str_expr = expr_string
|
|
345
|
+
node.original_str_fallback = expr_fallback_name
|
|
346
|
+
return node
|
|
347
|
+
else:
|
|
348
|
+
return RawExpressionType(expr_string, expr_fallback_name, line, column)
|
|
349
|
+
except (SyntaxError, ValueError):
|
|
350
|
+
# Note: the parser will raise a `ValueError` instead of a SyntaxError if
|
|
351
|
+
# the string happens to contain things like \x00.
|
|
352
|
+
return RawExpressionType(expr_string, expr_fallback_name, line, column)
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
def is_no_type_check_decorator(expr: ast3.expr) -> bool:
|
|
356
|
+
if isinstance(expr, Name):
|
|
357
|
+
return expr.id == "no_type_check"
|
|
358
|
+
elif isinstance(expr, Attribute):
|
|
359
|
+
if isinstance(expr.value, Name):
|
|
360
|
+
return expr.value.id == "typing" and expr.attr == "no_type_check"
|
|
361
|
+
return False
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
def find_disallowed_expression_in_annotation_scope(expr: ast3.expr | None) -> ast3.expr | None:
|
|
365
|
+
if expr is None:
|
|
366
|
+
return None
|
|
367
|
+
for node in ast3.walk(expr):
|
|
368
|
+
if isinstance(node, (ast3.Yield, ast3.YieldFrom, ast3.NamedExpr, ast3.Await)):
|
|
369
|
+
return node
|
|
370
|
+
return None
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
class ASTConverter:
|
|
374
|
+
def __init__(
|
|
375
|
+
self,
|
|
376
|
+
options: Options,
|
|
377
|
+
is_stub: bool,
|
|
378
|
+
errors: Errors,
|
|
379
|
+
*,
|
|
380
|
+
strip_function_bodies: bool,
|
|
381
|
+
path: str,
|
|
382
|
+
) -> None:
|
|
383
|
+
# 'C' for class, 'D' for function signature, 'F' for function, 'L' for lambda
|
|
384
|
+
self.class_and_function_stack: list[Literal["C", "D", "F", "L"]] = []
|
|
385
|
+
self.imports: list[ImportBase] = []
|
|
386
|
+
|
|
387
|
+
self.options = options
|
|
388
|
+
self.is_stub = is_stub
|
|
389
|
+
self.errors = errors
|
|
390
|
+
self.strip_function_bodies = strip_function_bodies
|
|
391
|
+
self.path = path
|
|
392
|
+
|
|
393
|
+
self.type_ignores: dict[int, list[str]] = {}
|
|
394
|
+
self.uses_template_strings = False
|
|
395
|
+
|
|
396
|
+
# Cache of visit_X methods keyed by type of visited object
|
|
397
|
+
self.visitor_cache: dict[type, Callable[[AST | None], Any]] = {}
|
|
398
|
+
|
|
399
|
+
def note(self, msg: str, line: int, column: int) -> None:
|
|
400
|
+
self.errors.report(line, column, msg, severity="note", code=codes.SYNTAX)
|
|
401
|
+
|
|
402
|
+
def fail(self, msg: ErrorMessage, line: int, column: int, blocker: bool) -> None:
|
|
403
|
+
if blocker or not self.options.ignore_errors:
|
|
404
|
+
# Make sure self.errors reflects any type ignores that we have parsed
|
|
405
|
+
self.errors.set_file_ignored_lines(
|
|
406
|
+
self.path, self.type_ignores, self.options.ignore_errors
|
|
407
|
+
)
|
|
408
|
+
self.errors.report(line, column, msg.value, blocker=blocker, code=msg.code)
|
|
409
|
+
|
|
410
|
+
def fail_merge_overload(self, node: IfStmt) -> None:
|
|
411
|
+
self.fail(
|
|
412
|
+
message_registry.FAILED_TO_MERGE_OVERLOADS,
|
|
413
|
+
line=node.line,
|
|
414
|
+
column=node.column,
|
|
415
|
+
blocker=False,
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
def visit(self, node: AST | None) -> Any:
|
|
419
|
+
if node is None:
|
|
420
|
+
return None
|
|
421
|
+
typeobj = type(node)
|
|
422
|
+
visitor = self.visitor_cache.get(typeobj)
|
|
423
|
+
if visitor is None:
|
|
424
|
+
method = "visit_" + node.__class__.__name__
|
|
425
|
+
visitor = getattr(self, method)
|
|
426
|
+
self.visitor_cache[typeobj] = visitor
|
|
427
|
+
|
|
428
|
+
return visitor(node)
|
|
429
|
+
|
|
430
|
+
def set_line(self, node: N, n: AstNode) -> N:
|
|
431
|
+
node.line = n.lineno
|
|
432
|
+
node.column = n.col_offset
|
|
433
|
+
node.end_line = n.end_lineno
|
|
434
|
+
node.end_column = n.end_col_offset
|
|
435
|
+
|
|
436
|
+
return node
|
|
437
|
+
|
|
438
|
+
def translate_opt_expr_list(self, l: Sequence[AST | None]) -> list[Expression | None]:
|
|
439
|
+
res: list[Expression | None] = []
|
|
440
|
+
for e in l:
|
|
441
|
+
exp = self.visit(e)
|
|
442
|
+
res.append(exp)
|
|
443
|
+
return res
|
|
444
|
+
|
|
445
|
+
def translate_expr_list(self, l: Sequence[AST]) -> list[Expression]:
|
|
446
|
+
return cast(list[Expression], self.translate_opt_expr_list(l))
|
|
447
|
+
|
|
448
|
+
def get_lineno(self, node: ast3.expr | ast3.stmt) -> int:
|
|
449
|
+
if (
|
|
450
|
+
isinstance(node, (ast3.AsyncFunctionDef, ast3.ClassDef, ast3.FunctionDef))
|
|
451
|
+
and node.decorator_list
|
|
452
|
+
):
|
|
453
|
+
return node.decorator_list[0].lineno
|
|
454
|
+
return node.lineno
|
|
455
|
+
|
|
456
|
+
def translate_stmt_list(
|
|
457
|
+
self,
|
|
458
|
+
stmts: Sequence[ast3.stmt],
|
|
459
|
+
*,
|
|
460
|
+
ismodule: bool = False,
|
|
461
|
+
can_strip: bool = False,
|
|
462
|
+
is_coroutine: bool = False,
|
|
463
|
+
) -> list[Statement]:
|
|
464
|
+
# A "# type: ignore" comment before the first statement of a module
|
|
465
|
+
# ignores the whole module:
|
|
466
|
+
if (
|
|
467
|
+
ismodule
|
|
468
|
+
and stmts
|
|
469
|
+
and self.type_ignores
|
|
470
|
+
and (first := min(self.type_ignores)) < self.get_lineno(stmts[0])
|
|
471
|
+
):
|
|
472
|
+
ignores = self.type_ignores.pop(first)
|
|
473
|
+
if ignores:
|
|
474
|
+
joined_ignores = ", ".join(ignores)
|
|
475
|
+
self.fail(
|
|
476
|
+
message_registry.TYPE_IGNORE_WITH_ERRCODE_ON_MODULE.format(joined_ignores),
|
|
477
|
+
line=first,
|
|
478
|
+
column=0,
|
|
479
|
+
blocker=False,
|
|
480
|
+
)
|
|
481
|
+
block = Block(self.fix_function_overloads(self.translate_stmt_list(stmts)))
|
|
482
|
+
self.set_block_lines(block, stmts)
|
|
483
|
+
mark_block_unreachable(block)
|
|
484
|
+
return [block]
|
|
485
|
+
|
|
486
|
+
stack = self.class_and_function_stack
|
|
487
|
+
# Fast case for stripping function bodies
|
|
488
|
+
if (
|
|
489
|
+
can_strip
|
|
490
|
+
and self.strip_function_bodies
|
|
491
|
+
and len(stack) == 1
|
|
492
|
+
and stack[0] == "F"
|
|
493
|
+
and not is_coroutine
|
|
494
|
+
):
|
|
495
|
+
return []
|
|
496
|
+
|
|
497
|
+
res: list[Statement] = []
|
|
498
|
+
for stmt in stmts:
|
|
499
|
+
node = self.visit(stmt)
|
|
500
|
+
res.append(node)
|
|
501
|
+
|
|
502
|
+
# Slow case for stripping function bodies
|
|
503
|
+
if can_strip and self.strip_function_bodies:
|
|
504
|
+
if stack[-2:] == ["C", "F"]:
|
|
505
|
+
if is_possible_trivial_body(res):
|
|
506
|
+
can_strip = False
|
|
507
|
+
else:
|
|
508
|
+
# We only strip method bodies if they don't assign to an attribute, as
|
|
509
|
+
# this may define an attribute which has an externally visible effect.
|
|
510
|
+
visitor = FindAttributeAssign()
|
|
511
|
+
for s in res:
|
|
512
|
+
s.accept(visitor)
|
|
513
|
+
if visitor.found:
|
|
514
|
+
can_strip = False
|
|
515
|
+
break
|
|
516
|
+
|
|
517
|
+
if can_strip and stack[-1] == "F" and is_coroutine:
|
|
518
|
+
# Yields inside an async function affect the return type and should not
|
|
519
|
+
# be stripped.
|
|
520
|
+
yield_visitor = FindYield()
|
|
521
|
+
for s in res:
|
|
522
|
+
s.accept(yield_visitor)
|
|
523
|
+
if yield_visitor.found:
|
|
524
|
+
can_strip = False
|
|
525
|
+
break
|
|
526
|
+
|
|
527
|
+
if can_strip:
|
|
528
|
+
return []
|
|
529
|
+
return res
|
|
530
|
+
|
|
531
|
+
def translate_type_comment(
|
|
532
|
+
self, n: ast3.stmt | ast3.arg, type_comment: str | None
|
|
533
|
+
) -> ProperType | None:
|
|
534
|
+
if type_comment is None:
|
|
535
|
+
return None
|
|
536
|
+
else:
|
|
537
|
+
lineno = n.lineno
|
|
538
|
+
extra_ignore, typ = parse_type_comment(type_comment, lineno, n.col_offset, self.errors)
|
|
539
|
+
if extra_ignore is not None:
|
|
540
|
+
self.type_ignores[lineno] = extra_ignore
|
|
541
|
+
return typ
|
|
542
|
+
|
|
543
|
+
op_map: Final[dict[type[AST], str]] = {
|
|
544
|
+
ast3.Add: "+",
|
|
545
|
+
ast3.Sub: "-",
|
|
546
|
+
ast3.Mult: "*",
|
|
547
|
+
ast3.MatMult: "@",
|
|
548
|
+
ast3.Div: "/",
|
|
549
|
+
ast3.Mod: "%",
|
|
550
|
+
ast3.Pow: "**",
|
|
551
|
+
ast3.LShift: "<<",
|
|
552
|
+
ast3.RShift: ">>",
|
|
553
|
+
ast3.BitOr: "|",
|
|
554
|
+
ast3.BitXor: "^",
|
|
555
|
+
ast3.BitAnd: "&",
|
|
556
|
+
ast3.FloorDiv: "//",
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
def from_operator(self, op: ast3.operator) -> str:
|
|
560
|
+
op_name = ASTConverter.op_map.get(type(op))
|
|
561
|
+
if op_name is None:
|
|
562
|
+
raise RuntimeError("Unknown operator " + str(type(op)))
|
|
563
|
+
else:
|
|
564
|
+
return op_name
|
|
565
|
+
|
|
566
|
+
comp_op_map: Final[dict[type[AST], str]] = {
|
|
567
|
+
ast3.Gt: ">",
|
|
568
|
+
ast3.Lt: "<",
|
|
569
|
+
ast3.Eq: "==",
|
|
570
|
+
ast3.GtE: ">=",
|
|
571
|
+
ast3.LtE: "<=",
|
|
572
|
+
ast3.NotEq: "!=",
|
|
573
|
+
ast3.Is: "is",
|
|
574
|
+
ast3.IsNot: "is not",
|
|
575
|
+
ast3.In: "in",
|
|
576
|
+
ast3.NotIn: "not in", # codespell:ignore notin
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
def from_comp_operator(self, op: ast3.cmpop) -> str:
|
|
580
|
+
op_name = ASTConverter.comp_op_map.get(type(op))
|
|
581
|
+
if op_name is None:
|
|
582
|
+
raise RuntimeError("Unknown comparison operator " + str(type(op)))
|
|
583
|
+
else:
|
|
584
|
+
return op_name
|
|
585
|
+
|
|
586
|
+
def set_block_lines(self, b: Block, stmts: Sequence[ast3.stmt]) -> None:
|
|
587
|
+
first, last = stmts[0], stmts[-1]
|
|
588
|
+
b.line = first.lineno
|
|
589
|
+
b.column = first.col_offset
|
|
590
|
+
b.end_line = last.end_lineno
|
|
591
|
+
b.end_column = last.end_col_offset
|
|
592
|
+
if not b.body:
|
|
593
|
+
return
|
|
594
|
+
new_first = b.body[0]
|
|
595
|
+
if isinstance(new_first, (Decorator, OverloadedFuncDef)):
|
|
596
|
+
# Decorated function lines are different between Python versions.
|
|
597
|
+
# copy the normalization we do for them to block first lines.
|
|
598
|
+
b.line = new_first.line
|
|
599
|
+
b.column = new_first.column
|
|
600
|
+
|
|
601
|
+
def as_block(self, stmts: list[ast3.stmt]) -> Block | None:
|
|
602
|
+
b = None
|
|
603
|
+
if stmts:
|
|
604
|
+
b = Block(self.fix_function_overloads(self.translate_stmt_list(stmts)))
|
|
605
|
+
self.set_block_lines(b, stmts)
|
|
606
|
+
return b
|
|
607
|
+
|
|
608
|
+
def as_required_block(
|
|
609
|
+
self, stmts: list[ast3.stmt], *, can_strip: bool = False, is_coroutine: bool = False
|
|
610
|
+
) -> Block:
|
|
611
|
+
assert stmts # must be non-empty
|
|
612
|
+
b = Block(
|
|
613
|
+
self.fix_function_overloads(
|
|
614
|
+
self.translate_stmt_list(stmts, can_strip=can_strip, is_coroutine=is_coroutine)
|
|
615
|
+
)
|
|
616
|
+
)
|
|
617
|
+
self.set_block_lines(b, stmts)
|
|
618
|
+
return b
|
|
619
|
+
|
|
620
|
+
def fix_function_overloads(self, stmts: list[Statement]) -> list[Statement]:
|
|
621
|
+
ret: list[Statement] = []
|
|
622
|
+
current_overload: list[OverloadPart] = []
|
|
623
|
+
current_overload_name: str | None = None
|
|
624
|
+
last_unconditional_func_def: str | None = None
|
|
625
|
+
last_if_stmt: IfStmt | None = None
|
|
626
|
+
last_if_overload: Decorator | FuncDef | OverloadedFuncDef | None = None
|
|
627
|
+
last_if_stmt_overload_name: str | None = None
|
|
628
|
+
last_if_unknown_truth_value: IfStmt | None = None
|
|
629
|
+
skipped_if_stmts: list[IfStmt] = []
|
|
630
|
+
for stmt in stmts:
|
|
631
|
+
if_overload_name: str | None = None
|
|
632
|
+
if_block_with_overload: Block | None = None
|
|
633
|
+
if_unknown_truth_value: IfStmt | None = None
|
|
634
|
+
if isinstance(stmt, IfStmt):
|
|
635
|
+
# Check IfStmt block to determine if function overloads can be merged
|
|
636
|
+
if_overload_name = self._check_ifstmt_for_overloads(stmt, current_overload_name)
|
|
637
|
+
if if_overload_name is not None:
|
|
638
|
+
if_block_with_overload, if_unknown_truth_value = (
|
|
639
|
+
self._get_executable_if_block_with_overloads(stmt)
|
|
640
|
+
)
|
|
641
|
+
|
|
642
|
+
if (
|
|
643
|
+
current_overload_name is not None
|
|
644
|
+
and isinstance(stmt, (Decorator, FuncDef))
|
|
645
|
+
and stmt.name == current_overload_name
|
|
646
|
+
):
|
|
647
|
+
if last_if_stmt is not None:
|
|
648
|
+
skipped_if_stmts.append(last_if_stmt)
|
|
649
|
+
if last_if_overload is not None:
|
|
650
|
+
# Last stmt was an IfStmt with same overload name
|
|
651
|
+
# Add overloads to current_overload
|
|
652
|
+
if isinstance(last_if_overload, OverloadedFuncDef):
|
|
653
|
+
current_overload.extend(last_if_overload.items)
|
|
654
|
+
else:
|
|
655
|
+
current_overload.append(last_if_overload)
|
|
656
|
+
last_if_stmt, last_if_overload = None, None
|
|
657
|
+
if last_if_unknown_truth_value:
|
|
658
|
+
self.fail_merge_overload(last_if_unknown_truth_value)
|
|
659
|
+
last_if_unknown_truth_value = None
|
|
660
|
+
current_overload.append(stmt)
|
|
661
|
+
if isinstance(stmt, FuncDef):
|
|
662
|
+
# This is, strictly speaking, wrong: there might be a decorated
|
|
663
|
+
# implementation. However, it only affects the error message we show:
|
|
664
|
+
# ideally it's "already defined", but "implementation must come last"
|
|
665
|
+
# is also reasonable.
|
|
666
|
+
# TODO: can we get rid of this completely and just always emit
|
|
667
|
+
# "implementation must come last" instead?
|
|
668
|
+
last_unconditional_func_def = stmt.name
|
|
669
|
+
elif (
|
|
670
|
+
current_overload_name is not None
|
|
671
|
+
and isinstance(stmt, IfStmt)
|
|
672
|
+
and if_overload_name == current_overload_name
|
|
673
|
+
and last_unconditional_func_def != current_overload_name
|
|
674
|
+
):
|
|
675
|
+
# IfStmt only contains stmts relevant to current_overload.
|
|
676
|
+
# Check if stmts are reachable and add them to current_overload,
|
|
677
|
+
# otherwise skip IfStmt to allow subsequent overload
|
|
678
|
+
# or function definitions.
|
|
679
|
+
skipped_if_stmts.append(stmt)
|
|
680
|
+
if if_block_with_overload is None:
|
|
681
|
+
if if_unknown_truth_value is not None:
|
|
682
|
+
self.fail_merge_overload(if_unknown_truth_value)
|
|
683
|
+
continue
|
|
684
|
+
if last_if_overload is not None:
|
|
685
|
+
# Last stmt was an IfStmt with same overload name
|
|
686
|
+
# Add overloads to current_overload
|
|
687
|
+
if isinstance(last_if_overload, OverloadedFuncDef):
|
|
688
|
+
current_overload.extend(last_if_overload.items)
|
|
689
|
+
else:
|
|
690
|
+
current_overload.append(last_if_overload)
|
|
691
|
+
last_if_stmt, last_if_overload = None, None
|
|
692
|
+
if isinstance(if_block_with_overload.body[-1], OverloadedFuncDef):
|
|
693
|
+
skipped_if_stmts.extend(cast(list[IfStmt], if_block_with_overload.body[:-1]))
|
|
694
|
+
current_overload.extend(if_block_with_overload.body[-1].items)
|
|
695
|
+
else:
|
|
696
|
+
current_overload.append(
|
|
697
|
+
cast(Decorator | FuncDef, if_block_with_overload.body[0])
|
|
698
|
+
)
|
|
699
|
+
else:
|
|
700
|
+
if last_if_stmt is not None:
|
|
701
|
+
ret.append(last_if_stmt)
|
|
702
|
+
last_if_stmt_overload_name = current_overload_name
|
|
703
|
+
last_if_stmt, last_if_overload = None, None
|
|
704
|
+
last_if_unknown_truth_value = None
|
|
705
|
+
|
|
706
|
+
if current_overload and current_overload_name == last_if_stmt_overload_name:
|
|
707
|
+
# Remove last stmt (IfStmt) from ret if the overload names matched
|
|
708
|
+
# Only happens if no executable block had been found in IfStmt
|
|
709
|
+
popped = ret.pop()
|
|
710
|
+
assert isinstance(popped, IfStmt)
|
|
711
|
+
skipped_if_stmts.append(popped)
|
|
712
|
+
if current_overload and skipped_if_stmts:
|
|
713
|
+
# Add bare IfStmt (without overloads) to ret
|
|
714
|
+
# Required for mypy to be able to still check conditions
|
|
715
|
+
for if_stmt in skipped_if_stmts:
|
|
716
|
+
self._strip_contents_from_if_stmt(if_stmt)
|
|
717
|
+
ret.append(if_stmt)
|
|
718
|
+
skipped_if_stmts = []
|
|
719
|
+
if len(current_overload) == 1:
|
|
720
|
+
ret.append(current_overload[0])
|
|
721
|
+
elif len(current_overload) > 1:
|
|
722
|
+
ret.append(OverloadedFuncDef(current_overload))
|
|
723
|
+
|
|
724
|
+
# If we have multiple decorated functions named "_" next to each, we want to treat
|
|
725
|
+
# them as a series of regular FuncDefs instead of one OverloadedFuncDef because
|
|
726
|
+
# most of mypy/mypyc assumes that all the functions in an OverloadedFuncDef are
|
|
727
|
+
# related, but multiple underscore functions next to each other aren't necessarily
|
|
728
|
+
# related
|
|
729
|
+
last_unconditional_func_def = None
|
|
730
|
+
if isinstance(stmt, Decorator) and not unnamed_function(stmt.name):
|
|
731
|
+
current_overload = [stmt]
|
|
732
|
+
current_overload_name = stmt.name
|
|
733
|
+
elif isinstance(stmt, IfStmt) and if_overload_name is not None:
|
|
734
|
+
current_overload = []
|
|
735
|
+
current_overload_name = if_overload_name
|
|
736
|
+
last_if_stmt = stmt
|
|
737
|
+
last_if_stmt_overload_name = None
|
|
738
|
+
if if_block_with_overload is not None:
|
|
739
|
+
skipped_if_stmts.extend(
|
|
740
|
+
cast(list[IfStmt], if_block_with_overload.body[:-1])
|
|
741
|
+
)
|
|
742
|
+
last_if_overload = cast(
|
|
743
|
+
Decorator | FuncDef | OverloadedFuncDef,
|
|
744
|
+
if_block_with_overload.body[-1],
|
|
745
|
+
)
|
|
746
|
+
last_if_unknown_truth_value = if_unknown_truth_value
|
|
747
|
+
else:
|
|
748
|
+
current_overload = []
|
|
749
|
+
current_overload_name = None
|
|
750
|
+
ret.append(stmt)
|
|
751
|
+
|
|
752
|
+
if current_overload and skipped_if_stmts:
|
|
753
|
+
# Add bare IfStmt (without overloads) to ret
|
|
754
|
+
# Required for mypy to be able to still check conditions
|
|
755
|
+
for if_stmt in skipped_if_stmts:
|
|
756
|
+
self._strip_contents_from_if_stmt(if_stmt)
|
|
757
|
+
ret.append(if_stmt)
|
|
758
|
+
if len(current_overload) == 1:
|
|
759
|
+
ret.append(current_overload[0])
|
|
760
|
+
elif len(current_overload) > 1:
|
|
761
|
+
ret.append(OverloadedFuncDef(current_overload))
|
|
762
|
+
elif last_if_overload is not None:
|
|
763
|
+
ret.append(last_if_overload)
|
|
764
|
+
elif last_if_stmt is not None:
|
|
765
|
+
ret.append(last_if_stmt)
|
|
766
|
+
return ret
|
|
767
|
+
|
|
768
|
+
def _check_ifstmt_for_overloads(
|
|
769
|
+
self, stmt: IfStmt, current_overload_name: str | None = None
|
|
770
|
+
) -> str | None:
|
|
771
|
+
"""Check if IfStmt contains only overloads with the same name.
|
|
772
|
+
Return overload_name if found, None otherwise.
|
|
773
|
+
"""
|
|
774
|
+
# Check that block only contains a single Decorator, FuncDef, or OverloadedFuncDef.
|
|
775
|
+
# Multiple overloads have already been merged as OverloadedFuncDef.
|
|
776
|
+
if not (
|
|
777
|
+
len(stmt.body[0].body) == 1
|
|
778
|
+
and (
|
|
779
|
+
isinstance(stmt.body[0].body[0], (Decorator, OverloadedFuncDef))
|
|
780
|
+
or current_overload_name is not None
|
|
781
|
+
and isinstance(stmt.body[0].body[0], FuncDef)
|
|
782
|
+
)
|
|
783
|
+
or len(stmt.body[0].body) > 1
|
|
784
|
+
and isinstance(stmt.body[0].body[-1], OverloadedFuncDef)
|
|
785
|
+
and all(self._is_stripped_if_stmt(if_stmt) for if_stmt in stmt.body[0].body[:-1])
|
|
786
|
+
):
|
|
787
|
+
return None
|
|
788
|
+
|
|
789
|
+
overload_name = cast(Decorator | FuncDef | OverloadedFuncDef, stmt.body[0].body[-1]).name
|
|
790
|
+
if stmt.else_body is None:
|
|
791
|
+
return overload_name
|
|
792
|
+
|
|
793
|
+
if len(stmt.else_body.body) == 1:
|
|
794
|
+
# For elif: else_body contains an IfStmt itself -> do a recursive check.
|
|
795
|
+
if (
|
|
796
|
+
isinstance(stmt.else_body.body[0], (Decorator, FuncDef, OverloadedFuncDef))
|
|
797
|
+
and stmt.else_body.body[0].name == overload_name
|
|
798
|
+
):
|
|
799
|
+
return overload_name
|
|
800
|
+
if (
|
|
801
|
+
isinstance(stmt.else_body.body[0], IfStmt)
|
|
802
|
+
and self._check_ifstmt_for_overloads(stmt.else_body.body[0], current_overload_name)
|
|
803
|
+
== overload_name
|
|
804
|
+
):
|
|
805
|
+
return overload_name
|
|
806
|
+
|
|
807
|
+
return None
|
|
808
|
+
|
|
809
|
+
def _get_executable_if_block_with_overloads(
|
|
810
|
+
self, stmt: IfStmt
|
|
811
|
+
) -> tuple[Block | None, IfStmt | None]:
|
|
812
|
+
"""Return block from IfStmt that will get executed.
|
|
813
|
+
|
|
814
|
+
Return
|
|
815
|
+
0 -> A block if sure that alternative blocks are unreachable.
|
|
816
|
+
1 -> An IfStmt if the reachability of it can't be inferred,
|
|
817
|
+
i.e. the truth value is unknown.
|
|
818
|
+
"""
|
|
819
|
+
infer_reachability_of_if_statement(stmt, self.options)
|
|
820
|
+
if stmt.else_body is None and stmt.body[0].is_unreachable is True:
|
|
821
|
+
# always False condition with no else
|
|
822
|
+
return None, None
|
|
823
|
+
if (
|
|
824
|
+
stmt.else_body is None
|
|
825
|
+
or stmt.body[0].is_unreachable is False
|
|
826
|
+
and stmt.else_body.is_unreachable is False
|
|
827
|
+
):
|
|
828
|
+
# The truth value is unknown, thus not conclusive
|
|
829
|
+
return None, stmt
|
|
830
|
+
if stmt.else_body.is_unreachable is True:
|
|
831
|
+
# else_body will be set unreachable if condition is always True
|
|
832
|
+
return stmt.body[0], None
|
|
833
|
+
if stmt.body[0].is_unreachable is True:
|
|
834
|
+
# body will be set unreachable if condition is always False
|
|
835
|
+
# else_body can contain an IfStmt itself (for elif) -> do a recursive check
|
|
836
|
+
if isinstance(stmt.else_body.body[0], IfStmt):
|
|
837
|
+
return self._get_executable_if_block_with_overloads(stmt.else_body.body[0])
|
|
838
|
+
return stmt.else_body, None
|
|
839
|
+
return None, stmt
|
|
840
|
+
|
|
841
|
+
def _strip_contents_from_if_stmt(self, stmt: IfStmt) -> None:
|
|
842
|
+
"""Remove contents from IfStmt.
|
|
843
|
+
|
|
844
|
+
Needed to still be able to check the conditions after the contents
|
|
845
|
+
have been merged with the surrounding function overloads.
|
|
846
|
+
"""
|
|
847
|
+
if len(stmt.body) == 1:
|
|
848
|
+
stmt.body[0].body = []
|
|
849
|
+
if stmt.else_body and len(stmt.else_body.body) == 1:
|
|
850
|
+
if isinstance(stmt.else_body.body[0], IfStmt):
|
|
851
|
+
self._strip_contents_from_if_stmt(stmt.else_body.body[0])
|
|
852
|
+
else:
|
|
853
|
+
stmt.else_body.body = []
|
|
854
|
+
|
|
855
|
+
def _is_stripped_if_stmt(self, stmt: Statement) -> bool:
|
|
856
|
+
"""Check stmt to make sure it is a stripped IfStmt.
|
|
857
|
+
|
|
858
|
+
See also: _strip_contents_from_if_stmt
|
|
859
|
+
"""
|
|
860
|
+
if not isinstance(stmt, IfStmt):
|
|
861
|
+
return False
|
|
862
|
+
|
|
863
|
+
if not (len(stmt.body) == 1 and len(stmt.body[0].body) == 0):
|
|
864
|
+
# Body not empty
|
|
865
|
+
return False
|
|
866
|
+
|
|
867
|
+
if not stmt.else_body or len(stmt.else_body.body) == 0:
|
|
868
|
+
# No or empty else_body
|
|
869
|
+
return True
|
|
870
|
+
|
|
871
|
+
# For elif, IfStmt are stored recursively in else_body
|
|
872
|
+
return self._is_stripped_if_stmt(stmt.else_body.body[0])
|
|
873
|
+
|
|
874
|
+
def translate_module_id(self, id: str) -> str:
|
|
875
|
+
"""Return the actual, internal module id for a source text id."""
|
|
876
|
+
if id == self.options.custom_typing_module:
|
|
877
|
+
return "typing"
|
|
878
|
+
return id
|
|
879
|
+
|
|
880
|
+
def visit_Module(self, mod: ast3.Module) -> MypyFile:
|
|
881
|
+
self.type_ignores = {}
|
|
882
|
+
self.uses_template_strings = False
|
|
883
|
+
for ti in mod.type_ignores:
|
|
884
|
+
parsed = parse_type_ignore_tag(ti.tag)
|
|
885
|
+
if parsed is not None:
|
|
886
|
+
self.type_ignores[ti.lineno] = parsed
|
|
887
|
+
else:
|
|
888
|
+
self.fail(message_registry.INVALID_TYPE_IGNORE, ti.lineno, -1, blocker=False)
|
|
889
|
+
|
|
890
|
+
body = self.fix_function_overloads(self.translate_stmt_list(mod.body, ismodule=True))
|
|
891
|
+
|
|
892
|
+
ret = MypyFile(body, self.imports, False, ignored_lines=self.type_ignores)
|
|
893
|
+
ret.is_stub = self.is_stub
|
|
894
|
+
ret.path = self.path
|
|
895
|
+
ret.uses_template_strings = self.uses_template_strings
|
|
896
|
+
return ret
|
|
897
|
+
|
|
898
|
+
# --- stmt ---
|
|
899
|
+
# FunctionDef(identifier name, arguments args,
|
|
900
|
+
# stmt* body, expr* decorator_list, expr? returns, string? type_comment)
|
|
901
|
+
# arguments = (arg* args, arg? vararg, arg* kwonlyargs, expr* kw_defaults,
|
|
902
|
+
# arg? kwarg, expr* defaults)
|
|
903
|
+
def visit_FunctionDef(self, n: ast3.FunctionDef) -> FuncDef | Decorator:
|
|
904
|
+
return self.do_func_def(n)
|
|
905
|
+
|
|
906
|
+
# AsyncFunctionDef(identifier name, arguments args,
|
|
907
|
+
# stmt* body, expr* decorator_list, expr? returns, string? type_comment)
|
|
908
|
+
def visit_AsyncFunctionDef(self, n: ast3.AsyncFunctionDef) -> FuncDef | Decorator:
|
|
909
|
+
return self.do_func_def(n, is_coroutine=True)
|
|
910
|
+
|
|
911
|
+
def do_func_def(
|
|
912
|
+
self, n: ast3.FunctionDef | ast3.AsyncFunctionDef, is_coroutine: bool = False
|
|
913
|
+
) -> FuncDef | Decorator:
|
|
914
|
+
"""Helper shared between visit_FunctionDef and visit_AsyncFunctionDef."""
|
|
915
|
+
self.class_and_function_stack.append("D")
|
|
916
|
+
no_type_check = bool(
|
|
917
|
+
n.decorator_list and any(is_no_type_check_decorator(d) for d in n.decorator_list)
|
|
918
|
+
)
|
|
919
|
+
|
|
920
|
+
lineno = n.lineno
|
|
921
|
+
args = self.transform_args(n.args, lineno, no_type_check=no_type_check)
|
|
922
|
+
if self.options.pos_only_special_methods and special_function_elide_names(n.name):
|
|
923
|
+
for arg in args:
|
|
924
|
+
arg.pos_only = True
|
|
925
|
+
|
|
926
|
+
arg_kinds = [arg.kind for arg in args]
|
|
927
|
+
arg_names = [None if arg.pos_only else arg.variable.name for arg in args]
|
|
928
|
+
# Type parameters, if using new syntax for generics (PEP 695)
|
|
929
|
+
explicit_type_params: list[TypeParam] | None = None
|
|
930
|
+
|
|
931
|
+
arg_types: list[Type | None] = []
|
|
932
|
+
if no_type_check:
|
|
933
|
+
arg_types = [None] * len(args)
|
|
934
|
+
return_type = None
|
|
935
|
+
elif n.type_comment is not None:
|
|
936
|
+
try:
|
|
937
|
+
func_type_ast = ast3_parse(n.type_comment, "<func_type>", "func_type")
|
|
938
|
+
assert isinstance(func_type_ast, FunctionType)
|
|
939
|
+
# for ellipsis arg
|
|
940
|
+
if (
|
|
941
|
+
len(func_type_ast.argtypes) == 1
|
|
942
|
+
and isinstance(func_type_ast.argtypes[0], ast3.Constant)
|
|
943
|
+
and func_type_ast.argtypes[0].value is Ellipsis
|
|
944
|
+
):
|
|
945
|
+
if n.returns:
|
|
946
|
+
# PEP 484 disallows both type annotations and type comments
|
|
947
|
+
self.fail(
|
|
948
|
+
message_registry.DUPLICATE_TYPE_SIGNATURES,
|
|
949
|
+
lineno,
|
|
950
|
+
n.col_offset,
|
|
951
|
+
blocker=False,
|
|
952
|
+
)
|
|
953
|
+
arg_types = [
|
|
954
|
+
(
|
|
955
|
+
a.type_annotation
|
|
956
|
+
if a.type_annotation is not None
|
|
957
|
+
else AnyType(TypeOfAny.unannotated)
|
|
958
|
+
)
|
|
959
|
+
for a in args
|
|
960
|
+
]
|
|
961
|
+
else:
|
|
962
|
+
# PEP 484 disallows both type annotations and type comments
|
|
963
|
+
if n.returns or any(a.type_annotation is not None for a in args):
|
|
964
|
+
self.fail(
|
|
965
|
+
message_registry.DUPLICATE_TYPE_SIGNATURES,
|
|
966
|
+
lineno,
|
|
967
|
+
n.col_offset,
|
|
968
|
+
blocker=False,
|
|
969
|
+
)
|
|
970
|
+
translated_args: list[Type] = TypeConverter(
|
|
971
|
+
self.errors, line=lineno, override_column=n.col_offset
|
|
972
|
+
).translate_expr_list(func_type_ast.argtypes)
|
|
973
|
+
# Use a cast to work around `list` invariance
|
|
974
|
+
arg_types = cast(list[Type | None], translated_args)
|
|
975
|
+
return_type = TypeConverter(self.errors, line=lineno).visit(func_type_ast.returns)
|
|
976
|
+
|
|
977
|
+
# add implicit self type
|
|
978
|
+
in_method_scope = self.class_and_function_stack[-2:] == ["C", "D"]
|
|
979
|
+
if in_method_scope and len(arg_types) < len(args):
|
|
980
|
+
arg_types.insert(0, AnyType(TypeOfAny.special_form))
|
|
981
|
+
except SyntaxError:
|
|
982
|
+
stripped_type = n.type_comment.split("#", 2)[0].strip()
|
|
983
|
+
err_msg = message_registry.TYPE_COMMENT_SYNTAX_ERROR_VALUE.format(stripped_type)
|
|
984
|
+
self.fail(err_msg, lineno, n.col_offset, blocker=False)
|
|
985
|
+
if n.type_comment and n.type_comment[0] not in ["(", "#"]:
|
|
986
|
+
self.note(
|
|
987
|
+
"Suggestion: wrap argument types in parentheses", lineno, n.col_offset
|
|
988
|
+
)
|
|
989
|
+
arg_types = [AnyType(TypeOfAny.from_error)] * len(args)
|
|
990
|
+
return_type = AnyType(TypeOfAny.from_error)
|
|
991
|
+
else:
|
|
992
|
+
if sys.version_info >= (3, 12) and n.type_params:
|
|
993
|
+
explicit_type_params = self.translate_type_params(n.type_params)
|
|
994
|
+
|
|
995
|
+
arg_types = [a.type_annotation for a in args]
|
|
996
|
+
return_type = TypeConverter(
|
|
997
|
+
self.errors, line=n.returns.lineno if n.returns else lineno
|
|
998
|
+
).visit(n.returns)
|
|
999
|
+
|
|
1000
|
+
for arg, arg_type in zip(args, arg_types):
|
|
1001
|
+
self.set_type_optional(arg_type, arg.initializer)
|
|
1002
|
+
|
|
1003
|
+
func_type = None
|
|
1004
|
+
if any(arg_types) or return_type:
|
|
1005
|
+
if len(arg_types) != 1 and any(isinstance(t, EllipsisType) for t in arg_types):
|
|
1006
|
+
self.fail(
|
|
1007
|
+
message_registry.ELLIPSIS_WITH_OTHER_TYPEPARAMS,
|
|
1008
|
+
lineno,
|
|
1009
|
+
n.col_offset,
|
|
1010
|
+
blocker=False,
|
|
1011
|
+
)
|
|
1012
|
+
elif len(arg_types) > len(arg_kinds):
|
|
1013
|
+
self.fail(
|
|
1014
|
+
message_registry.TYPE_SIGNATURE_TOO_MANY_PARAMS,
|
|
1015
|
+
lineno,
|
|
1016
|
+
n.col_offset,
|
|
1017
|
+
blocker=False,
|
|
1018
|
+
)
|
|
1019
|
+
elif len(arg_types) < len(arg_kinds):
|
|
1020
|
+
self.fail(
|
|
1021
|
+
message_registry.TYPE_SIGNATURE_TOO_FEW_PARAMS,
|
|
1022
|
+
lineno,
|
|
1023
|
+
n.col_offset,
|
|
1024
|
+
blocker=False,
|
|
1025
|
+
)
|
|
1026
|
+
else:
|
|
1027
|
+
func_type = CallableType(
|
|
1028
|
+
[a if a is not None else AnyType(TypeOfAny.unannotated) for a in arg_types],
|
|
1029
|
+
arg_kinds,
|
|
1030
|
+
arg_names,
|
|
1031
|
+
return_type if return_type is not None else AnyType(TypeOfAny.unannotated),
|
|
1032
|
+
_dummy_fallback,
|
|
1033
|
+
)
|
|
1034
|
+
|
|
1035
|
+
# End position is always the same.
|
|
1036
|
+
end_line = n.end_lineno
|
|
1037
|
+
end_column = n.end_col_offset
|
|
1038
|
+
|
|
1039
|
+
self.class_and_function_stack.pop()
|
|
1040
|
+
self.class_and_function_stack.append("F")
|
|
1041
|
+
body = self.as_required_block(n.body, can_strip=True, is_coroutine=is_coroutine)
|
|
1042
|
+
func_def = FuncDef(n.name, args, body, func_type, explicit_type_params)
|
|
1043
|
+
if isinstance(func_def.type, CallableType):
|
|
1044
|
+
# semanal.py does some in-place modifications we want to avoid
|
|
1045
|
+
func_def.unanalyzed_type = func_def.type.copy_modified()
|
|
1046
|
+
if is_coroutine:
|
|
1047
|
+
func_def.is_coroutine = True
|
|
1048
|
+
if func_type is not None:
|
|
1049
|
+
func_type.definition = func_def
|
|
1050
|
+
func_type.set_line(lineno)
|
|
1051
|
+
|
|
1052
|
+
if n.decorator_list:
|
|
1053
|
+
var = Var(func_def.name)
|
|
1054
|
+
var.is_ready = False
|
|
1055
|
+
var.set_line(lineno)
|
|
1056
|
+
|
|
1057
|
+
func_def.is_decorated = True
|
|
1058
|
+
self.set_line(func_def, n)
|
|
1059
|
+
|
|
1060
|
+
deco = Decorator(func_def, self.translate_expr_list(n.decorator_list), var)
|
|
1061
|
+
first = n.decorator_list[0]
|
|
1062
|
+
deco.set_line(first.lineno, first.col_offset, end_line, end_column)
|
|
1063
|
+
retval: FuncDef | Decorator = deco
|
|
1064
|
+
else:
|
|
1065
|
+
self.set_line(func_def, n)
|
|
1066
|
+
retval = func_def
|
|
1067
|
+
if self.options.include_docstrings:
|
|
1068
|
+
func_def.docstring = ast3.get_docstring(n, clean=False)
|
|
1069
|
+
self.class_and_function_stack.pop()
|
|
1070
|
+
return retval
|
|
1071
|
+
|
|
1072
|
+
def set_type_optional(self, type: Type | None, initializer: Expression | None) -> None:
|
|
1073
|
+
if not self.options.implicit_optional:
|
|
1074
|
+
return
|
|
1075
|
+
# Indicate that type should be wrapped in an Optional if arg is initialized to None.
|
|
1076
|
+
optional = isinstance(initializer, NameExpr) and initializer.name == "None"
|
|
1077
|
+
if isinstance(type, UnboundType):
|
|
1078
|
+
type.optional = optional
|
|
1079
|
+
|
|
1080
|
+
def transform_args(
|
|
1081
|
+
self, args: ast3.arguments, line: int, no_type_check: bool = False
|
|
1082
|
+
) -> list[Argument]:
|
|
1083
|
+
new_args = []
|
|
1084
|
+
names: list[ast3.arg] = []
|
|
1085
|
+
posonlyargs = args.posonlyargs
|
|
1086
|
+
args_args = posonlyargs + args.args
|
|
1087
|
+
args_defaults = args.defaults
|
|
1088
|
+
num_no_defaults = len(args_args) - len(args_defaults)
|
|
1089
|
+
# positional arguments without defaults
|
|
1090
|
+
for i, a in enumerate(args_args[:num_no_defaults]):
|
|
1091
|
+
pos_only = i < len(posonlyargs)
|
|
1092
|
+
new_args.append(self.make_argument(a, None, ARG_POS, no_type_check, pos_only))
|
|
1093
|
+
names.append(a)
|
|
1094
|
+
|
|
1095
|
+
# positional arguments with defaults
|
|
1096
|
+
for i, (a, d) in enumerate(zip(args_args[num_no_defaults:], args_defaults)):
|
|
1097
|
+
pos_only = num_no_defaults + i < len(posonlyargs)
|
|
1098
|
+
new_args.append(self.make_argument(a, d, ARG_OPT, no_type_check, pos_only))
|
|
1099
|
+
names.append(a)
|
|
1100
|
+
|
|
1101
|
+
# *arg
|
|
1102
|
+
if args.vararg is not None:
|
|
1103
|
+
new_args.append(self.make_argument(args.vararg, None, ARG_STAR, no_type_check))
|
|
1104
|
+
names.append(args.vararg)
|
|
1105
|
+
|
|
1106
|
+
# keyword-only arguments with defaults
|
|
1107
|
+
for a, kd in zip(args.kwonlyargs, args.kw_defaults):
|
|
1108
|
+
new_args.append(
|
|
1109
|
+
self.make_argument(
|
|
1110
|
+
a, kd, ARG_NAMED if kd is None else ARG_NAMED_OPT, no_type_check
|
|
1111
|
+
)
|
|
1112
|
+
)
|
|
1113
|
+
names.append(a)
|
|
1114
|
+
|
|
1115
|
+
# **kwarg
|
|
1116
|
+
if args.kwarg is not None:
|
|
1117
|
+
new_args.append(self.make_argument(args.kwarg, None, ARG_STAR2, no_type_check))
|
|
1118
|
+
names.append(args.kwarg)
|
|
1119
|
+
|
|
1120
|
+
check_param_names([arg.variable.name for arg in new_args], names, self.fail_arg)
|
|
1121
|
+
|
|
1122
|
+
return new_args
|
|
1123
|
+
|
|
1124
|
+
def make_argument(
|
|
1125
|
+
self,
|
|
1126
|
+
arg: ast3.arg,
|
|
1127
|
+
default: ast3.expr | None,
|
|
1128
|
+
kind: ArgKind,
|
|
1129
|
+
no_type_check: bool,
|
|
1130
|
+
pos_only: bool = False,
|
|
1131
|
+
) -> Argument:
|
|
1132
|
+
if no_type_check:
|
|
1133
|
+
arg_type = None
|
|
1134
|
+
else:
|
|
1135
|
+
annotation = arg.annotation
|
|
1136
|
+
type_comment = arg.type_comment
|
|
1137
|
+
if annotation is not None and type_comment is not None:
|
|
1138
|
+
self.fail(
|
|
1139
|
+
message_registry.DUPLICATE_TYPE_SIGNATURES,
|
|
1140
|
+
arg.lineno,
|
|
1141
|
+
arg.col_offset,
|
|
1142
|
+
blocker=False,
|
|
1143
|
+
)
|
|
1144
|
+
arg_type = None
|
|
1145
|
+
if annotation is not None:
|
|
1146
|
+
arg_type = TypeConverter(self.errors, line=arg.lineno).visit(annotation)
|
|
1147
|
+
else:
|
|
1148
|
+
arg_type = self.translate_type_comment(arg, type_comment)
|
|
1149
|
+
if argument_elide_name(arg.arg):
|
|
1150
|
+
pos_only = True
|
|
1151
|
+
|
|
1152
|
+
var = Var(arg.arg, arg_type)
|
|
1153
|
+
var.is_inferred = False
|
|
1154
|
+
var.is_argument = True
|
|
1155
|
+
argument = Argument(var, arg_type, self.visit(default), kind, pos_only)
|
|
1156
|
+
argument.set_line(arg.lineno, arg.col_offset, arg.end_lineno, arg.end_col_offset)
|
|
1157
|
+
return argument
|
|
1158
|
+
|
|
1159
|
+
def fail_arg(self, msg: str, arg: ast3.arg) -> None:
|
|
1160
|
+
self.fail(ErrorMessage(msg), arg.lineno, arg.col_offset, blocker=True)
|
|
1161
|
+
|
|
1162
|
+
# ClassDef(identifier name,
|
|
1163
|
+
# expr* bases,
|
|
1164
|
+
# keyword* keywords,
|
|
1165
|
+
# stmt* body,
|
|
1166
|
+
# expr* decorator_list)
|
|
1167
|
+
def visit_ClassDef(self, n: ast3.ClassDef) -> ClassDef:
|
|
1168
|
+
self.class_and_function_stack.append("C")
|
|
1169
|
+
keywords = [(kw.arg, self.visit(kw.value)) for kw in n.keywords if kw.arg]
|
|
1170
|
+
|
|
1171
|
+
# Type parameters, if using new syntax for generics (PEP 695)
|
|
1172
|
+
explicit_type_params: list[TypeParam] | None = None
|
|
1173
|
+
|
|
1174
|
+
if sys.version_info >= (3, 12) and n.type_params:
|
|
1175
|
+
explicit_type_params = self.translate_type_params(n.type_params)
|
|
1176
|
+
|
|
1177
|
+
cdef = ClassDef(
|
|
1178
|
+
n.name,
|
|
1179
|
+
self.as_required_block(n.body),
|
|
1180
|
+
None,
|
|
1181
|
+
self.translate_expr_list(n.bases),
|
|
1182
|
+
metaclass=dict(keywords).get("metaclass"),
|
|
1183
|
+
keywords=keywords,
|
|
1184
|
+
type_args=explicit_type_params,
|
|
1185
|
+
)
|
|
1186
|
+
cdef.decorators = self.translate_expr_list(n.decorator_list)
|
|
1187
|
+
self.set_line(cdef, n)
|
|
1188
|
+
|
|
1189
|
+
if self.options.include_docstrings:
|
|
1190
|
+
cdef.docstring = ast3.get_docstring(n, clean=False)
|
|
1191
|
+
cdef.column = n.col_offset
|
|
1192
|
+
cdef.end_line = n.end_lineno
|
|
1193
|
+
cdef.end_column = n.end_col_offset
|
|
1194
|
+
self.class_and_function_stack.pop()
|
|
1195
|
+
return cdef
|
|
1196
|
+
|
|
1197
|
+
def validate_type_param(self, type_param: ast_TypeVar) -> None:
|
|
1198
|
+
incorrect_expr = find_disallowed_expression_in_annotation_scope(type_param.bound)
|
|
1199
|
+
if incorrect_expr is None:
|
|
1200
|
+
return
|
|
1201
|
+
if isinstance(incorrect_expr, (ast3.Yield, ast3.YieldFrom)):
|
|
1202
|
+
self.fail(
|
|
1203
|
+
message_registry.TYPE_VAR_YIELD_EXPRESSION_IN_BOUND,
|
|
1204
|
+
type_param.lineno,
|
|
1205
|
+
type_param.col_offset,
|
|
1206
|
+
blocker=True,
|
|
1207
|
+
)
|
|
1208
|
+
if isinstance(incorrect_expr, ast3.NamedExpr):
|
|
1209
|
+
self.fail(
|
|
1210
|
+
message_registry.TYPE_VAR_NAMED_EXPRESSION_IN_BOUND,
|
|
1211
|
+
type_param.lineno,
|
|
1212
|
+
type_param.col_offset,
|
|
1213
|
+
blocker=True,
|
|
1214
|
+
)
|
|
1215
|
+
if isinstance(incorrect_expr, ast3.Await):
|
|
1216
|
+
self.fail(
|
|
1217
|
+
message_registry.TYPE_VAR_AWAIT_EXPRESSION_IN_BOUND,
|
|
1218
|
+
type_param.lineno,
|
|
1219
|
+
type_param.col_offset,
|
|
1220
|
+
blocker=True,
|
|
1221
|
+
)
|
|
1222
|
+
|
|
1223
|
+
def translate_type_params(self, type_params: list[Any]) -> list[TypeParam]:
|
|
1224
|
+
explicit_type_params = []
|
|
1225
|
+
for p in type_params:
|
|
1226
|
+
bound: Type | None = None
|
|
1227
|
+
values: list[Type] = []
|
|
1228
|
+
default: Type | None = None
|
|
1229
|
+
if sys.version_info >= (3, 13):
|
|
1230
|
+
default = TypeConverter(self.errors, line=p.lineno).visit(p.default_value)
|
|
1231
|
+
if isinstance(p, ast_ParamSpec): # type: ignore[misc]
|
|
1232
|
+
explicit_type_params.append(TypeParam(p.name, PARAM_SPEC_KIND, None, [], default))
|
|
1233
|
+
elif isinstance(p, ast_TypeVarTuple): # type: ignore[misc]
|
|
1234
|
+
explicit_type_params.append(
|
|
1235
|
+
TypeParam(p.name, TYPE_VAR_TUPLE_KIND, None, [], default)
|
|
1236
|
+
)
|
|
1237
|
+
else:
|
|
1238
|
+
if isinstance(p.bound, ast3.Tuple):
|
|
1239
|
+
if len(p.bound.elts) < 2:
|
|
1240
|
+
self.fail(
|
|
1241
|
+
message_registry.TYPE_VAR_TOO_FEW_CONSTRAINED_TYPES,
|
|
1242
|
+
p.lineno,
|
|
1243
|
+
p.col_offset,
|
|
1244
|
+
blocker=False,
|
|
1245
|
+
)
|
|
1246
|
+
else:
|
|
1247
|
+
conv = TypeConverter(self.errors, line=p.lineno)
|
|
1248
|
+
values = [conv.visit(t) for t in p.bound.elts]
|
|
1249
|
+
elif p.bound is not None:
|
|
1250
|
+
self.validate_type_param(p)
|
|
1251
|
+
bound = TypeConverter(self.errors, line=p.lineno).visit(p.bound)
|
|
1252
|
+
explicit_type_params.append(
|
|
1253
|
+
TypeParam(p.name, TYPE_VAR_KIND, bound, values, default)
|
|
1254
|
+
)
|
|
1255
|
+
return explicit_type_params
|
|
1256
|
+
|
|
1257
|
+
# Return(expr? value)
|
|
1258
|
+
def visit_Return(self, n: ast3.Return) -> ReturnStmt:
|
|
1259
|
+
node = ReturnStmt(self.visit(n.value))
|
|
1260
|
+
return self.set_line(node, n)
|
|
1261
|
+
|
|
1262
|
+
# Delete(expr* targets)
|
|
1263
|
+
def visit_Delete(self, n: ast3.Delete) -> DelStmt:
|
|
1264
|
+
if len(n.targets) > 1:
|
|
1265
|
+
tup = TupleExpr(self.translate_expr_list(n.targets))
|
|
1266
|
+
tup.set_line(n.lineno)
|
|
1267
|
+
node = DelStmt(tup)
|
|
1268
|
+
else:
|
|
1269
|
+
node = DelStmt(self.visit(n.targets[0]))
|
|
1270
|
+
return self.set_line(node, n)
|
|
1271
|
+
|
|
1272
|
+
# Assign(expr* targets, expr? value, string? type_comment, expr? annotation)
|
|
1273
|
+
def visit_Assign(self, n: ast3.Assign) -> AssignmentStmt:
|
|
1274
|
+
lvalues = self.translate_expr_list(n.targets)
|
|
1275
|
+
rvalue = self.visit(n.value)
|
|
1276
|
+
typ = self.translate_type_comment(n, n.type_comment)
|
|
1277
|
+
s = AssignmentStmt(lvalues, rvalue, type=typ, new_syntax=False)
|
|
1278
|
+
return self.set_line(s, n)
|
|
1279
|
+
|
|
1280
|
+
# AnnAssign(expr target, expr annotation, expr? value, int simple)
|
|
1281
|
+
def visit_AnnAssign(self, n: ast3.AnnAssign) -> AssignmentStmt:
|
|
1282
|
+
line = n.lineno
|
|
1283
|
+
if n.value is None: # always allow 'x: int'
|
|
1284
|
+
rvalue: Expression = TempNode(AnyType(TypeOfAny.special_form), no_rhs=True)
|
|
1285
|
+
self.set_line(rvalue, n)
|
|
1286
|
+
else:
|
|
1287
|
+
rvalue = self.visit(n.value)
|
|
1288
|
+
typ = TypeConverter(self.errors, line=line).visit(n.annotation)
|
|
1289
|
+
assert typ is not None
|
|
1290
|
+
typ.column = n.annotation.col_offset
|
|
1291
|
+
s = AssignmentStmt([self.visit(n.target)], rvalue, type=typ, new_syntax=True)
|
|
1292
|
+
return self.set_line(s, n)
|
|
1293
|
+
|
|
1294
|
+
# AugAssign(expr target, operator op, expr value)
|
|
1295
|
+
def visit_AugAssign(self, n: ast3.AugAssign) -> OperatorAssignmentStmt:
|
|
1296
|
+
s = OperatorAssignmentStmt(
|
|
1297
|
+
self.from_operator(n.op), self.visit(n.target), self.visit(n.value)
|
|
1298
|
+
)
|
|
1299
|
+
return self.set_line(s, n)
|
|
1300
|
+
|
|
1301
|
+
# For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)
|
|
1302
|
+
def visit_For(self, n: ast3.For) -> ForStmt:
|
|
1303
|
+
target_type = self.translate_type_comment(n, n.type_comment)
|
|
1304
|
+
node = ForStmt(
|
|
1305
|
+
self.visit(n.target),
|
|
1306
|
+
self.visit(n.iter),
|
|
1307
|
+
self.as_required_block(n.body),
|
|
1308
|
+
self.as_block(n.orelse),
|
|
1309
|
+
target_type,
|
|
1310
|
+
)
|
|
1311
|
+
return self.set_line(node, n)
|
|
1312
|
+
|
|
1313
|
+
# AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)
|
|
1314
|
+
def visit_AsyncFor(self, n: ast3.AsyncFor) -> ForStmt:
|
|
1315
|
+
target_type = self.translate_type_comment(n, n.type_comment)
|
|
1316
|
+
node = ForStmt(
|
|
1317
|
+
self.visit(n.target),
|
|
1318
|
+
self.visit(n.iter),
|
|
1319
|
+
self.as_required_block(n.body),
|
|
1320
|
+
self.as_block(n.orelse),
|
|
1321
|
+
target_type,
|
|
1322
|
+
)
|
|
1323
|
+
node.is_async = True
|
|
1324
|
+
return self.set_line(node, n)
|
|
1325
|
+
|
|
1326
|
+
# While(expr test, stmt* body, stmt* orelse)
|
|
1327
|
+
def visit_While(self, n: ast3.While) -> WhileStmt:
|
|
1328
|
+
node = WhileStmt(
|
|
1329
|
+
self.visit(n.test), self.as_required_block(n.body), self.as_block(n.orelse)
|
|
1330
|
+
)
|
|
1331
|
+
return self.set_line(node, n)
|
|
1332
|
+
|
|
1333
|
+
# If(expr test, stmt* body, stmt* orelse)
|
|
1334
|
+
def visit_If(self, n: ast3.If) -> IfStmt:
|
|
1335
|
+
node = IfStmt(
|
|
1336
|
+
[self.visit(n.test)], [self.as_required_block(n.body)], self.as_block(n.orelse)
|
|
1337
|
+
)
|
|
1338
|
+
return self.set_line(node, n)
|
|
1339
|
+
|
|
1340
|
+
# With(withitem* items, stmt* body, string? type_comment)
|
|
1341
|
+
def visit_With(self, n: ast3.With) -> WithStmt:
|
|
1342
|
+
target_type = self.translate_type_comment(n, n.type_comment)
|
|
1343
|
+
node = WithStmt(
|
|
1344
|
+
[self.visit(i.context_expr) for i in n.items],
|
|
1345
|
+
[self.visit(i.optional_vars) for i in n.items],
|
|
1346
|
+
self.as_required_block(n.body),
|
|
1347
|
+
target_type,
|
|
1348
|
+
)
|
|
1349
|
+
return self.set_line(node, n)
|
|
1350
|
+
|
|
1351
|
+
# AsyncWith(withitem* items, stmt* body, string? type_comment)
|
|
1352
|
+
def visit_AsyncWith(self, n: ast3.AsyncWith) -> WithStmt:
|
|
1353
|
+
target_type = self.translate_type_comment(n, n.type_comment)
|
|
1354
|
+
s = WithStmt(
|
|
1355
|
+
[self.visit(i.context_expr) for i in n.items],
|
|
1356
|
+
[self.visit(i.optional_vars) for i in n.items],
|
|
1357
|
+
self.as_required_block(n.body),
|
|
1358
|
+
target_type,
|
|
1359
|
+
)
|
|
1360
|
+
s.is_async = True
|
|
1361
|
+
return self.set_line(s, n)
|
|
1362
|
+
|
|
1363
|
+
# Raise(expr? exc, expr? cause)
|
|
1364
|
+
def visit_Raise(self, n: ast3.Raise) -> RaiseStmt:
|
|
1365
|
+
node = RaiseStmt(self.visit(n.exc), self.visit(n.cause))
|
|
1366
|
+
return self.set_line(node, n)
|
|
1367
|
+
|
|
1368
|
+
# Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)
|
|
1369
|
+
def visit_Try(self, n: ast3.Try) -> TryStmt:
|
|
1370
|
+
vs = [
|
|
1371
|
+
self.set_line(NameExpr(h.name), h) if h.name is not None else None for h in n.handlers
|
|
1372
|
+
]
|
|
1373
|
+
types = [self.visit(h.type) for h in n.handlers]
|
|
1374
|
+
handlers = [self.as_required_block(h.body) for h in n.handlers]
|
|
1375
|
+
|
|
1376
|
+
node = TryStmt(
|
|
1377
|
+
self.as_required_block(n.body),
|
|
1378
|
+
vs,
|
|
1379
|
+
types,
|
|
1380
|
+
handlers,
|
|
1381
|
+
self.as_block(n.orelse),
|
|
1382
|
+
self.as_block(n.finalbody),
|
|
1383
|
+
)
|
|
1384
|
+
return self.set_line(node, n)
|
|
1385
|
+
|
|
1386
|
+
def visit_TryStar(self, n: TryStar) -> TryStmt:
|
|
1387
|
+
vs = [
|
|
1388
|
+
self.set_line(NameExpr(h.name), h) if h.name is not None else None for h in n.handlers
|
|
1389
|
+
]
|
|
1390
|
+
types = [self.visit(h.type) for h in n.handlers]
|
|
1391
|
+
handlers = [self.as_required_block(h.body) for h in n.handlers]
|
|
1392
|
+
|
|
1393
|
+
node = TryStmt(
|
|
1394
|
+
self.as_required_block(n.body),
|
|
1395
|
+
vs,
|
|
1396
|
+
types,
|
|
1397
|
+
handlers,
|
|
1398
|
+
self.as_block(n.orelse),
|
|
1399
|
+
self.as_block(n.finalbody),
|
|
1400
|
+
)
|
|
1401
|
+
node.is_star = True
|
|
1402
|
+
return self.set_line(node, n)
|
|
1403
|
+
|
|
1404
|
+
# Assert(expr test, expr? msg)
|
|
1405
|
+
def visit_Assert(self, n: ast3.Assert) -> AssertStmt:
|
|
1406
|
+
node = AssertStmt(self.visit(n.test), self.visit(n.msg))
|
|
1407
|
+
return self.set_line(node, n)
|
|
1408
|
+
|
|
1409
|
+
# Import(alias* names)
|
|
1410
|
+
def visit_Import(self, n: ast3.Import) -> Import:
|
|
1411
|
+
names: list[tuple[str, str | None]] = []
|
|
1412
|
+
for alias in n.names:
|
|
1413
|
+
name = self.translate_module_id(alias.name)
|
|
1414
|
+
asname = alias.asname
|
|
1415
|
+
if asname is None and name != alias.name:
|
|
1416
|
+
# if the module name has been translated (and it's not already
|
|
1417
|
+
# an explicit import-as), make it an implicit import-as the
|
|
1418
|
+
# original name
|
|
1419
|
+
asname = alias.name
|
|
1420
|
+
names.append((name, asname))
|
|
1421
|
+
i = Import(names)
|
|
1422
|
+
self.imports.append(i)
|
|
1423
|
+
return self.set_line(i, n)
|
|
1424
|
+
|
|
1425
|
+
# ImportFrom(identifier? module, alias* names, int? level)
|
|
1426
|
+
def visit_ImportFrom(self, n: ast3.ImportFrom) -> ImportBase:
|
|
1427
|
+
assert n.level is not None
|
|
1428
|
+
if len(n.names) == 1 and n.names[0].name == "*":
|
|
1429
|
+
mod = n.module if n.module is not None else ""
|
|
1430
|
+
i: ImportBase = ImportAll(mod, n.level)
|
|
1431
|
+
else:
|
|
1432
|
+
i = ImportFrom(
|
|
1433
|
+
self.translate_module_id(n.module) if n.module is not None else "",
|
|
1434
|
+
n.level,
|
|
1435
|
+
[(a.name, a.asname) for a in n.names],
|
|
1436
|
+
)
|
|
1437
|
+
self.imports.append(i)
|
|
1438
|
+
return self.set_line(i, n)
|
|
1439
|
+
|
|
1440
|
+
# Global(identifier* names)
|
|
1441
|
+
def visit_Global(self, n: ast3.Global) -> GlobalDecl:
|
|
1442
|
+
g = GlobalDecl(n.names)
|
|
1443
|
+
return self.set_line(g, n)
|
|
1444
|
+
|
|
1445
|
+
# Nonlocal(identifier* names)
|
|
1446
|
+
def visit_Nonlocal(self, n: ast3.Nonlocal) -> NonlocalDecl:
|
|
1447
|
+
d = NonlocalDecl(n.names)
|
|
1448
|
+
return self.set_line(d, n)
|
|
1449
|
+
|
|
1450
|
+
# Expr(expr value)
|
|
1451
|
+
def visit_Expr(self, n: ast3.Expr) -> ExpressionStmt:
|
|
1452
|
+
value = self.visit(n.value)
|
|
1453
|
+
node = ExpressionStmt(value)
|
|
1454
|
+
return self.set_line(node, n)
|
|
1455
|
+
|
|
1456
|
+
# Pass
|
|
1457
|
+
def visit_Pass(self, n: ast3.Pass) -> PassStmt:
|
|
1458
|
+
s = PassStmt()
|
|
1459
|
+
return self.set_line(s, n)
|
|
1460
|
+
|
|
1461
|
+
# Break
|
|
1462
|
+
def visit_Break(self, n: ast3.Break) -> BreakStmt:
|
|
1463
|
+
s = BreakStmt()
|
|
1464
|
+
return self.set_line(s, n)
|
|
1465
|
+
|
|
1466
|
+
# Continue
|
|
1467
|
+
def visit_Continue(self, n: ast3.Continue) -> ContinueStmt:
|
|
1468
|
+
s = ContinueStmt()
|
|
1469
|
+
return self.set_line(s, n)
|
|
1470
|
+
|
|
1471
|
+
# --- expr ---
|
|
1472
|
+
|
|
1473
|
+
def visit_NamedExpr(self, n: ast3.NamedExpr) -> AssignmentExpr:
|
|
1474
|
+
s = AssignmentExpr(self.visit(n.target), self.visit(n.value))
|
|
1475
|
+
return self.set_line(s, n)
|
|
1476
|
+
|
|
1477
|
+
# BoolOp(boolop op, expr* values)
|
|
1478
|
+
def visit_BoolOp(self, n: ast3.BoolOp) -> OpExpr:
|
|
1479
|
+
# mypy translates (1 and 2 and 3) as (1 and (2 and 3))
|
|
1480
|
+
assert len(n.values) >= 2
|
|
1481
|
+
op_node = n.op
|
|
1482
|
+
if isinstance(op_node, ast3.And):
|
|
1483
|
+
op = "and"
|
|
1484
|
+
elif isinstance(op_node, ast3.Or):
|
|
1485
|
+
op = "or"
|
|
1486
|
+
else:
|
|
1487
|
+
raise RuntimeError("unknown BoolOp " + str(type(n)))
|
|
1488
|
+
|
|
1489
|
+
# potentially inefficient!
|
|
1490
|
+
return self.group(op, self.translate_expr_list(n.values), n)
|
|
1491
|
+
|
|
1492
|
+
def group(self, op: str, vals: list[Expression], n: ast3.expr) -> OpExpr:
|
|
1493
|
+
if len(vals) == 2:
|
|
1494
|
+
e = OpExpr(op, vals[0], vals[1])
|
|
1495
|
+
else:
|
|
1496
|
+
e = OpExpr(op, vals[0], self.group(op, vals[1:], n))
|
|
1497
|
+
return self.set_line(e, n)
|
|
1498
|
+
|
|
1499
|
+
# BinOp(expr left, operator op, expr right)
|
|
1500
|
+
def visit_BinOp(self, n: ast3.BinOp) -> OpExpr:
|
|
1501
|
+
op = self.from_operator(n.op)
|
|
1502
|
+
|
|
1503
|
+
if op is None:
|
|
1504
|
+
raise RuntimeError("cannot translate BinOp " + str(type(n.op)))
|
|
1505
|
+
|
|
1506
|
+
e = OpExpr(op, self.visit(n.left), self.visit(n.right))
|
|
1507
|
+
return self.set_line(e, n)
|
|
1508
|
+
|
|
1509
|
+
# UnaryOp(unaryop op, expr operand)
|
|
1510
|
+
def visit_UnaryOp(self, n: ast3.UnaryOp) -> UnaryExpr:
|
|
1511
|
+
op = None
|
|
1512
|
+
if isinstance(n.op, ast3.Invert):
|
|
1513
|
+
op = "~"
|
|
1514
|
+
elif isinstance(n.op, ast3.Not):
|
|
1515
|
+
op = "not"
|
|
1516
|
+
elif isinstance(n.op, ast3.UAdd):
|
|
1517
|
+
op = "+"
|
|
1518
|
+
elif isinstance(n.op, ast3.USub):
|
|
1519
|
+
op = "-"
|
|
1520
|
+
|
|
1521
|
+
if op is None:
|
|
1522
|
+
raise RuntimeError("cannot translate UnaryOp " + str(type(n.op)))
|
|
1523
|
+
|
|
1524
|
+
e = UnaryExpr(op, self.visit(n.operand))
|
|
1525
|
+
return self.set_line(e, n)
|
|
1526
|
+
|
|
1527
|
+
# Lambda(arguments args, expr body)
|
|
1528
|
+
def visit_Lambda(self, n: ast3.Lambda) -> LambdaExpr:
|
|
1529
|
+
body = ast3.Return(n.body)
|
|
1530
|
+
body.lineno = n.body.lineno
|
|
1531
|
+
body.col_offset = n.body.col_offset
|
|
1532
|
+
|
|
1533
|
+
self.class_and_function_stack.append("L")
|
|
1534
|
+
e = LambdaExpr(self.transform_args(n.args, n.lineno), self.as_required_block([body]))
|
|
1535
|
+
self.class_and_function_stack.pop()
|
|
1536
|
+
e.set_line(n.lineno, n.col_offset) # Overrides set_line -- can't use self.set_line
|
|
1537
|
+
return e
|
|
1538
|
+
|
|
1539
|
+
# IfExp(expr test, expr body, expr orelse)
|
|
1540
|
+
def visit_IfExp(self, n: ast3.IfExp) -> ConditionalExpr:
|
|
1541
|
+
e = ConditionalExpr(self.visit(n.test), self.visit(n.body), self.visit(n.orelse))
|
|
1542
|
+
return self.set_line(e, n)
|
|
1543
|
+
|
|
1544
|
+
# Dict(expr* keys, expr* values)
|
|
1545
|
+
def visit_Dict(self, n: ast3.Dict) -> DictExpr:
|
|
1546
|
+
e = DictExpr(
|
|
1547
|
+
list(zip(self.translate_opt_expr_list(n.keys), self.translate_expr_list(n.values)))
|
|
1548
|
+
)
|
|
1549
|
+
return self.set_line(e, n)
|
|
1550
|
+
|
|
1551
|
+
# Set(expr* elts)
|
|
1552
|
+
def visit_Set(self, n: ast3.Set) -> SetExpr:
|
|
1553
|
+
e = SetExpr(self.translate_expr_list(n.elts))
|
|
1554
|
+
return self.set_line(e, n)
|
|
1555
|
+
|
|
1556
|
+
# ListComp(expr elt, comprehension* generators)
|
|
1557
|
+
def visit_ListComp(self, n: ast3.ListComp) -> ListComprehension:
|
|
1558
|
+
e = ListComprehension(self.visit_GeneratorExp(cast(ast3.GeneratorExp, n)))
|
|
1559
|
+
return self.set_line(e, n)
|
|
1560
|
+
|
|
1561
|
+
# SetComp(expr elt, comprehension* generators)
|
|
1562
|
+
def visit_SetComp(self, n: ast3.SetComp) -> SetComprehension:
|
|
1563
|
+
e = SetComprehension(self.visit_GeneratorExp(cast(ast3.GeneratorExp, n)))
|
|
1564
|
+
return self.set_line(e, n)
|
|
1565
|
+
|
|
1566
|
+
# DictComp(expr key, expr value, comprehension* generators)
|
|
1567
|
+
def visit_DictComp(self, n: ast3.DictComp) -> DictionaryComprehension:
|
|
1568
|
+
targets = [self.visit(c.target) for c in n.generators]
|
|
1569
|
+
iters = [self.visit(c.iter) for c in n.generators]
|
|
1570
|
+
ifs_list = [self.translate_expr_list(c.ifs) for c in n.generators]
|
|
1571
|
+
is_async = [bool(c.is_async) for c in n.generators]
|
|
1572
|
+
key = self.visit(n.key)
|
|
1573
|
+
if n.value is not None:
|
|
1574
|
+
value = self.visit(n.value)
|
|
1575
|
+
else:
|
|
1576
|
+
# Our convention for ** unpack in dictionary comprehension matches Ruff
|
|
1577
|
+
# parser, while Python parser has an opposite one.
|
|
1578
|
+
value = key # type: ignore[unreachable]
|
|
1579
|
+
key = None
|
|
1580
|
+
e = DictionaryComprehension(key, value, targets, iters, ifs_list, is_async)
|
|
1581
|
+
return self.set_line(e, n)
|
|
1582
|
+
|
|
1583
|
+
# GeneratorExp(expr elt, comprehension* generators)
|
|
1584
|
+
def visit_GeneratorExp(self, n: ast3.GeneratorExp) -> GeneratorExpr:
|
|
1585
|
+
targets = [self.visit(c.target) for c in n.generators]
|
|
1586
|
+
iters = [self.visit(c.iter) for c in n.generators]
|
|
1587
|
+
ifs_list = [self.translate_expr_list(c.ifs) for c in n.generators]
|
|
1588
|
+
is_async = [bool(c.is_async) for c in n.generators]
|
|
1589
|
+
e = GeneratorExpr(self.visit(n.elt), targets, iters, ifs_list, is_async)
|
|
1590
|
+
return self.set_line(e, n)
|
|
1591
|
+
|
|
1592
|
+
# Await(expr value)
|
|
1593
|
+
def visit_Await(self, n: ast3.Await) -> AwaitExpr:
|
|
1594
|
+
v = self.visit(n.value)
|
|
1595
|
+
e = AwaitExpr(v)
|
|
1596
|
+
return self.set_line(e, n)
|
|
1597
|
+
|
|
1598
|
+
# Yield(expr? value)
|
|
1599
|
+
def visit_Yield(self, n: ast3.Yield) -> YieldExpr:
|
|
1600
|
+
e = YieldExpr(self.visit(n.value))
|
|
1601
|
+
return self.set_line(e, n)
|
|
1602
|
+
|
|
1603
|
+
# YieldFrom(expr value)
|
|
1604
|
+
def visit_YieldFrom(self, n: ast3.YieldFrom) -> YieldFromExpr:
|
|
1605
|
+
e = YieldFromExpr(self.visit(n.value))
|
|
1606
|
+
return self.set_line(e, n)
|
|
1607
|
+
|
|
1608
|
+
# Compare(expr left, cmpop* ops, expr* comparators)
|
|
1609
|
+
def visit_Compare(self, n: ast3.Compare) -> ComparisonExpr:
|
|
1610
|
+
operators = [self.from_comp_operator(o) for o in n.ops]
|
|
1611
|
+
operands = self.translate_expr_list([n.left] + n.comparators)
|
|
1612
|
+
e = ComparisonExpr(operators, operands)
|
|
1613
|
+
return self.set_line(e, n)
|
|
1614
|
+
|
|
1615
|
+
# Call(expr func, expr* args, keyword* keywords)
|
|
1616
|
+
# keyword = (identifier? arg, expr value)
|
|
1617
|
+
def visit_Call(self, n: Call) -> CallExpr:
|
|
1618
|
+
args = n.args
|
|
1619
|
+
keywords = n.keywords
|
|
1620
|
+
keyword_names = [k.arg for k in keywords]
|
|
1621
|
+
arg_types = self.translate_expr_list(
|
|
1622
|
+
[a.value if isinstance(a, Starred) else a for a in args] + [k.value for k in keywords]
|
|
1623
|
+
)
|
|
1624
|
+
arg_kinds = [ARG_STAR if type(a) is Starred else ARG_POS for a in args] + [
|
|
1625
|
+
ARG_STAR2 if arg is None else ARG_NAMED for arg in keyword_names
|
|
1626
|
+
]
|
|
1627
|
+
e = CallExpr(
|
|
1628
|
+
self.visit(n.func),
|
|
1629
|
+
arg_types,
|
|
1630
|
+
arg_kinds,
|
|
1631
|
+
cast("list[str | None]", [None] * len(args)) + keyword_names,
|
|
1632
|
+
)
|
|
1633
|
+
return self.set_line(e, n)
|
|
1634
|
+
|
|
1635
|
+
# Constant(object value)
|
|
1636
|
+
def visit_Constant(self, n: ast3.Constant) -> Any:
|
|
1637
|
+
val = n.value
|
|
1638
|
+
e: Any = None
|
|
1639
|
+
if val is None:
|
|
1640
|
+
e = NameExpr("None")
|
|
1641
|
+
elif isinstance(val, str):
|
|
1642
|
+
e = StrExpr(val)
|
|
1643
|
+
elif isinstance(val, bytes):
|
|
1644
|
+
e = BytesExpr(bytes_to_human_readable_repr(val))
|
|
1645
|
+
elif isinstance(val, bool): # Must check before int!
|
|
1646
|
+
e = NameExpr(str(val))
|
|
1647
|
+
elif isinstance(val, int):
|
|
1648
|
+
e = IntExpr(val)
|
|
1649
|
+
elif isinstance(val, float):
|
|
1650
|
+
e = FloatExpr(val)
|
|
1651
|
+
elif isinstance(val, complex):
|
|
1652
|
+
e = ComplexExpr(val)
|
|
1653
|
+
elif val is Ellipsis:
|
|
1654
|
+
e = EllipsisExpr()
|
|
1655
|
+
else:
|
|
1656
|
+
raise RuntimeError("Constant not implemented for " + str(type(val)))
|
|
1657
|
+
return self.set_line(e, n)
|
|
1658
|
+
|
|
1659
|
+
# JoinedStr(expr* values)
|
|
1660
|
+
def visit_JoinedStr(self, n: ast3.JoinedStr) -> Expression:
|
|
1661
|
+
# Each of n.values is a str or FormattedValue; we just concatenate
|
|
1662
|
+
# them all using ''.join.
|
|
1663
|
+
empty_string = StrExpr("")
|
|
1664
|
+
empty_string.set_line(n.lineno, n.col_offset)
|
|
1665
|
+
strs_to_join = ListExpr(self.translate_expr_list(n.values))
|
|
1666
|
+
strs_to_join.set_line(empty_string)
|
|
1667
|
+
# Don't make unnecessary join call if there is only one str to join
|
|
1668
|
+
if len(strs_to_join.items) == 1:
|
|
1669
|
+
return self.set_line(strs_to_join.items[0], n)
|
|
1670
|
+
elif len(strs_to_join.items) > 1:
|
|
1671
|
+
last = strs_to_join.items[-1]
|
|
1672
|
+
if isinstance(last, StrExpr) and last.value == "":
|
|
1673
|
+
# 3.12 can add an empty literal at the end. Delete it for consistency
|
|
1674
|
+
# between Python versions.
|
|
1675
|
+
del strs_to_join.items[-1:]
|
|
1676
|
+
join_method = MemberExpr(empty_string, "join")
|
|
1677
|
+
join_method.set_line(empty_string)
|
|
1678
|
+
result_expression = CallExpr(join_method, [strs_to_join], [ARG_POS], [None])
|
|
1679
|
+
return self.set_line(result_expression, n)
|
|
1680
|
+
|
|
1681
|
+
# FormattedValue(expr value)
|
|
1682
|
+
def visit_FormattedValue(self, n: ast3.FormattedValue) -> Expression:
|
|
1683
|
+
# A FormattedValue is a component of a JoinedStr, or it can exist
|
|
1684
|
+
# on its own. We translate them to individual '{}'.format(value)
|
|
1685
|
+
# calls. Format specifier and conversion information is passed along
|
|
1686
|
+
# to allow mypyc to support f-strings with format specifiers and conversions.
|
|
1687
|
+
val_exp = self.visit(n.value)
|
|
1688
|
+
val_exp.set_line(n.lineno, n.col_offset)
|
|
1689
|
+
conv_str = "" if n.conversion < 0 else "!" + chr(n.conversion)
|
|
1690
|
+
format_string = StrExpr("{" + conv_str + ":{}}")
|
|
1691
|
+
format_spec_exp = self.visit(n.format_spec) if n.format_spec is not None else StrExpr("")
|
|
1692
|
+
format_string.set_line(n.lineno, n.col_offset)
|
|
1693
|
+
format_method = MemberExpr(format_string, "format")
|
|
1694
|
+
format_method.set_line(format_string)
|
|
1695
|
+
result_expression = CallExpr(
|
|
1696
|
+
format_method, [val_exp, format_spec_exp], [ARG_POS, ARG_POS], [None, None]
|
|
1697
|
+
)
|
|
1698
|
+
return self.set_line(result_expression, n)
|
|
1699
|
+
|
|
1700
|
+
# TemplateStr(expr* values)
|
|
1701
|
+
def visit_TemplateStr(self, n: ast_TemplateStr) -> TemplateStrExpr:
|
|
1702
|
+
self.uses_template_strings = True
|
|
1703
|
+
items: list[Expression | tuple[Expression, str, str | None, Expression | None]] = []
|
|
1704
|
+
for value in n.values:
|
|
1705
|
+
if isinstance(value, ast_Interpolation): # type: ignore[misc]
|
|
1706
|
+
val_expr = self.visit(value.value)
|
|
1707
|
+
val_expr.set_line(value.lineno, value.col_offset)
|
|
1708
|
+
conversion = None if value.conversion < 0 else chr(value.conversion)
|
|
1709
|
+
format_spec = (
|
|
1710
|
+
self.visit(value.format_spec) if value.format_spec is not None else None
|
|
1711
|
+
)
|
|
1712
|
+
items.append((val_expr, value.str, conversion, format_spec))
|
|
1713
|
+
else:
|
|
1714
|
+
items.append(self.visit(value))
|
|
1715
|
+
e = TemplateStrExpr(items)
|
|
1716
|
+
return self.set_line(e, n)
|
|
1717
|
+
|
|
1718
|
+
# Attribute(expr value, identifier attr, expr_context ctx)
|
|
1719
|
+
def visit_Attribute(self, n: Attribute) -> MemberExpr | SuperExpr:
|
|
1720
|
+
value = n.value
|
|
1721
|
+
member_expr = MemberExpr(self.visit(value), n.attr)
|
|
1722
|
+
obj = member_expr.expr
|
|
1723
|
+
if (
|
|
1724
|
+
isinstance(obj, CallExpr)
|
|
1725
|
+
and isinstance(obj.callee, NameExpr)
|
|
1726
|
+
and obj.callee.name == "super"
|
|
1727
|
+
):
|
|
1728
|
+
e: MemberExpr | SuperExpr = SuperExpr(member_expr.name, obj)
|
|
1729
|
+
else:
|
|
1730
|
+
e = member_expr
|
|
1731
|
+
return self.set_line(e, n)
|
|
1732
|
+
|
|
1733
|
+
# Subscript(expr value, slice slice, expr_context ctx)
|
|
1734
|
+
def visit_Subscript(self, n: ast3.Subscript) -> IndexExpr:
|
|
1735
|
+
e = IndexExpr(self.visit(n.value), self.visit(n.slice))
|
|
1736
|
+
return self.set_line(e, n)
|
|
1737
|
+
|
|
1738
|
+
# Starred(expr value, expr_context ctx)
|
|
1739
|
+
def visit_Starred(self, n: Starred) -> StarExpr:
|
|
1740
|
+
e = StarExpr(self.visit(n.value))
|
|
1741
|
+
return self.set_line(e, n)
|
|
1742
|
+
|
|
1743
|
+
# Name(identifier id, expr_context ctx)
|
|
1744
|
+
def visit_Name(self, n: Name) -> NameExpr:
|
|
1745
|
+
e = NameExpr(n.id)
|
|
1746
|
+
return self.set_line(e, n)
|
|
1747
|
+
|
|
1748
|
+
# List(expr* elts, expr_context ctx)
|
|
1749
|
+
def visit_List(self, n: ast3.List) -> ListExpr | TupleExpr:
|
|
1750
|
+
expr_list: list[Expression] = [self.visit(e) for e in n.elts]
|
|
1751
|
+
if isinstance(n.ctx, ast3.Store):
|
|
1752
|
+
# [x, y] = z and (x, y) = z means exactly the same thing
|
|
1753
|
+
e: ListExpr | TupleExpr = TupleExpr(expr_list)
|
|
1754
|
+
else:
|
|
1755
|
+
e = ListExpr(expr_list)
|
|
1756
|
+
return self.set_line(e, n)
|
|
1757
|
+
|
|
1758
|
+
# Tuple(expr* elts, expr_context ctx)
|
|
1759
|
+
def visit_Tuple(self, n: ast3.Tuple) -> TupleExpr:
|
|
1760
|
+
e = TupleExpr(self.translate_expr_list(n.elts))
|
|
1761
|
+
return self.set_line(e, n)
|
|
1762
|
+
|
|
1763
|
+
# Slice(expr? lower, expr? upper, expr? step)
|
|
1764
|
+
def visit_Slice(self, n: ast3.Slice) -> SliceExpr:
|
|
1765
|
+
e = SliceExpr(self.visit(n.lower), self.visit(n.upper), self.visit(n.step))
|
|
1766
|
+
return self.set_line(e, n)
|
|
1767
|
+
|
|
1768
|
+
# Match(expr subject, match_case* cases) # python 3.10 and later
|
|
1769
|
+
def visit_Match(self, n: ast3.Match) -> MatchStmt:
|
|
1770
|
+
node = MatchStmt(
|
|
1771
|
+
self.visit(n.subject),
|
|
1772
|
+
[self.visit(c.pattern) for c in n.cases],
|
|
1773
|
+
[self.visit(c.guard) for c in n.cases],
|
|
1774
|
+
[self.as_required_block(c.body) for c in n.cases],
|
|
1775
|
+
)
|
|
1776
|
+
return self.set_line(node, n)
|
|
1777
|
+
|
|
1778
|
+
def visit_MatchValue(self, n: ast3.MatchValue) -> ValuePattern:
|
|
1779
|
+
node = ValuePattern(self.visit(n.value))
|
|
1780
|
+
return self.set_line(node, n)
|
|
1781
|
+
|
|
1782
|
+
def visit_MatchSingleton(self, n: ast3.MatchSingleton) -> SingletonPattern:
|
|
1783
|
+
node = SingletonPattern(n.value)
|
|
1784
|
+
return self.set_line(node, n)
|
|
1785
|
+
|
|
1786
|
+
def visit_MatchSequence(self, n: ast3.MatchSequence) -> SequencePattern:
|
|
1787
|
+
patterns = [self.visit(p) for p in n.patterns]
|
|
1788
|
+
stars = [p for p in patterns if isinstance(p, StarredPattern)]
|
|
1789
|
+
assert len(stars) < 2
|
|
1790
|
+
|
|
1791
|
+
node = SequencePattern(patterns)
|
|
1792
|
+
return self.set_line(node, n)
|
|
1793
|
+
|
|
1794
|
+
def visit_MatchStar(self, n: ast3.MatchStar) -> StarredPattern:
|
|
1795
|
+
if n.name is None:
|
|
1796
|
+
node = StarredPattern(None)
|
|
1797
|
+
else:
|
|
1798
|
+
name = self.set_line(NameExpr(n.name), n)
|
|
1799
|
+
node = StarredPattern(name)
|
|
1800
|
+
|
|
1801
|
+
return self.set_line(node, n)
|
|
1802
|
+
|
|
1803
|
+
def visit_MatchMapping(self, n: ast3.MatchMapping) -> MappingPattern:
|
|
1804
|
+
keys = [self.visit(k) for k in n.keys]
|
|
1805
|
+
values = [self.visit(v) for v in n.patterns]
|
|
1806
|
+
|
|
1807
|
+
if n.rest is None:
|
|
1808
|
+
rest = None
|
|
1809
|
+
else:
|
|
1810
|
+
rest = self.set_line(NameExpr(n.rest), n)
|
|
1811
|
+
|
|
1812
|
+
node = MappingPattern(keys, values, rest)
|
|
1813
|
+
return self.set_line(node, n)
|
|
1814
|
+
|
|
1815
|
+
def visit_MatchClass(self, n: ast3.MatchClass) -> ClassPattern:
|
|
1816
|
+
class_ref = self.visit(n.cls)
|
|
1817
|
+
assert isinstance(class_ref, RefExpr)
|
|
1818
|
+
positionals = [self.visit(p) for p in n.patterns]
|
|
1819
|
+
keyword_keys = n.kwd_attrs
|
|
1820
|
+
keyword_values = [self.visit(p) for p in n.kwd_patterns]
|
|
1821
|
+
|
|
1822
|
+
node = ClassPattern(class_ref, positionals, keyword_keys, keyword_values)
|
|
1823
|
+
return self.set_line(node, n)
|
|
1824
|
+
|
|
1825
|
+
# MatchAs(expr pattern, identifier name)
|
|
1826
|
+
def visit_MatchAs(self, n: ast3.MatchAs) -> AsPattern:
|
|
1827
|
+
if n.name is None:
|
|
1828
|
+
name = None
|
|
1829
|
+
else:
|
|
1830
|
+
name = NameExpr(n.name)
|
|
1831
|
+
name = self.set_line(name, n)
|
|
1832
|
+
node = AsPattern(self.visit(n.pattern), name)
|
|
1833
|
+
return self.set_line(node, n)
|
|
1834
|
+
|
|
1835
|
+
# MatchOr(expr* pattern)
|
|
1836
|
+
def visit_MatchOr(self, n: ast3.MatchOr) -> OrPattern:
|
|
1837
|
+
node = OrPattern([self.visit(pattern) for pattern in n.patterns])
|
|
1838
|
+
return self.set_line(node, n)
|
|
1839
|
+
|
|
1840
|
+
def validate_type_alias(self, n: ast_TypeAlias) -> None:
|
|
1841
|
+
incorrect_expr = find_disallowed_expression_in_annotation_scope(n.value)
|
|
1842
|
+
if incorrect_expr is None:
|
|
1843
|
+
return
|
|
1844
|
+
if isinstance(incorrect_expr, (ast3.Yield, ast3.YieldFrom)):
|
|
1845
|
+
self.fail(
|
|
1846
|
+
message_registry.TYPE_ALIAS_WITH_YIELD_EXPRESSION,
|
|
1847
|
+
n.lineno,
|
|
1848
|
+
n.col_offset,
|
|
1849
|
+
blocker=True,
|
|
1850
|
+
)
|
|
1851
|
+
if isinstance(incorrect_expr, ast3.NamedExpr):
|
|
1852
|
+
self.fail(
|
|
1853
|
+
message_registry.TYPE_ALIAS_WITH_NAMED_EXPRESSION,
|
|
1854
|
+
n.lineno,
|
|
1855
|
+
n.col_offset,
|
|
1856
|
+
blocker=True,
|
|
1857
|
+
)
|
|
1858
|
+
if isinstance(incorrect_expr, ast3.Await):
|
|
1859
|
+
self.fail(
|
|
1860
|
+
message_registry.TYPE_ALIAS_WITH_AWAIT_EXPRESSION,
|
|
1861
|
+
n.lineno,
|
|
1862
|
+
n.col_offset,
|
|
1863
|
+
blocker=True,
|
|
1864
|
+
)
|
|
1865
|
+
|
|
1866
|
+
# TypeAlias(identifier name, type_param* type_params, expr value)
|
|
1867
|
+
def visit_TypeAlias(self, n: ast_TypeAlias) -> TypeAliasStmt | AssignmentStmt:
|
|
1868
|
+
node: TypeAliasStmt | AssignmentStmt
|
|
1869
|
+
type_params = self.translate_type_params(n.type_params)
|
|
1870
|
+
self.validate_type_alias(n)
|
|
1871
|
+
value = self.visit(n.value)
|
|
1872
|
+
# Since the value is evaluated lazily, wrap the value inside a lambda.
|
|
1873
|
+
# This helps mypyc.
|
|
1874
|
+
ret = ReturnStmt(value)
|
|
1875
|
+
self.set_line(ret, n.value)
|
|
1876
|
+
value_func = LambdaExpr(body=Block([ret]))
|
|
1877
|
+
self.set_line(value_func, n.value)
|
|
1878
|
+
node = TypeAliasStmt(self.visit_Name(n.name), type_params, value_func)
|
|
1879
|
+
return self.set_line(node, n)
|
|
1880
|
+
|
|
1881
|
+
|
|
1882
|
+
class TypeConverter:
|
|
1883
|
+
def __init__(
|
|
1884
|
+
self,
|
|
1885
|
+
errors: Errors | None,
|
|
1886
|
+
line: int = -1,
|
|
1887
|
+
override_column: int = -1,
|
|
1888
|
+
is_evaluated: bool = True,
|
|
1889
|
+
) -> None:
|
|
1890
|
+
self.errors = errors
|
|
1891
|
+
self.line = line
|
|
1892
|
+
self.override_column = override_column
|
|
1893
|
+
self.node_stack: list[AST] = []
|
|
1894
|
+
self.is_evaluated = is_evaluated
|
|
1895
|
+
|
|
1896
|
+
def convert_column(self, column: int) -> int:
|
|
1897
|
+
"""Apply column override if defined; otherwise return column.
|
|
1898
|
+
|
|
1899
|
+
Column numbers are sometimes incorrect in the AST and the column
|
|
1900
|
+
override can be used to work around that.
|
|
1901
|
+
"""
|
|
1902
|
+
if self.override_column < 0:
|
|
1903
|
+
return column
|
|
1904
|
+
else:
|
|
1905
|
+
return self.override_column
|
|
1906
|
+
|
|
1907
|
+
def invalid_type(self, node: AST, note: str | None = None) -> RawExpressionType:
|
|
1908
|
+
"""Constructs a type representing some expression that normally forms an invalid type.
|
|
1909
|
+
For example, if we see a type hint that says "3 + 4", we would transform that
|
|
1910
|
+
expression into a RawExpressionType.
|
|
1911
|
+
|
|
1912
|
+
The semantic analysis layer will report an "Invalid type" error when it
|
|
1913
|
+
encounters this type, along with the given note if one is provided.
|
|
1914
|
+
|
|
1915
|
+
See RawExpressionType's docstring for more details on how it's used.
|
|
1916
|
+
"""
|
|
1917
|
+
return RawExpressionType(
|
|
1918
|
+
None, "typing.Any", line=self.line, column=getattr(node, "col_offset", -1), note=note
|
|
1919
|
+
)
|
|
1920
|
+
|
|
1921
|
+
@overload
|
|
1922
|
+
def visit(self, node: ast3.expr) -> ProperType: ...
|
|
1923
|
+
|
|
1924
|
+
@overload
|
|
1925
|
+
def visit(self, node: AST | None) -> ProperType | None: ...
|
|
1926
|
+
|
|
1927
|
+
def visit(self, node: AST | None) -> ProperType | None:
|
|
1928
|
+
"""Modified visit -- keep track of the stack of nodes"""
|
|
1929
|
+
if node is None:
|
|
1930
|
+
return None
|
|
1931
|
+
self.node_stack.append(node)
|
|
1932
|
+
try:
|
|
1933
|
+
method = "visit_" + node.__class__.__name__
|
|
1934
|
+
visitor = getattr(self, method, None)
|
|
1935
|
+
if visitor is not None:
|
|
1936
|
+
typ = visitor(node)
|
|
1937
|
+
assert isinstance(typ, ProperType)
|
|
1938
|
+
return typ
|
|
1939
|
+
else:
|
|
1940
|
+
return self.invalid_type(node)
|
|
1941
|
+
finally:
|
|
1942
|
+
self.node_stack.pop()
|
|
1943
|
+
|
|
1944
|
+
def parent(self) -> AST | None:
|
|
1945
|
+
"""Return the AST node above the one we are processing"""
|
|
1946
|
+
if len(self.node_stack) < 2:
|
|
1947
|
+
return None
|
|
1948
|
+
return self.node_stack[-2]
|
|
1949
|
+
|
|
1950
|
+
def fail(self, msg: ErrorMessage, line: int, column: int) -> None:
|
|
1951
|
+
if self.errors:
|
|
1952
|
+
self.errors.report(line, column, msg.value, blocker=True, code=msg.code)
|
|
1953
|
+
|
|
1954
|
+
def note(self, msg: str, line: int, column: int) -> None:
|
|
1955
|
+
if self.errors:
|
|
1956
|
+
self.errors.report(line, column, msg, severity="note", code=codes.SYNTAX)
|
|
1957
|
+
|
|
1958
|
+
def translate_expr_list(self, l: Sequence[ast3.expr]) -> list[Type]:
|
|
1959
|
+
return [self.visit(e) for e in l]
|
|
1960
|
+
|
|
1961
|
+
def visit_Call(self, e: Call) -> Type:
|
|
1962
|
+
# Parse the arg constructor
|
|
1963
|
+
f = e.func
|
|
1964
|
+
constructor = stringify_name(f)
|
|
1965
|
+
|
|
1966
|
+
if not isinstance(self.parent(), ast3.List):
|
|
1967
|
+
note = None
|
|
1968
|
+
if constructor:
|
|
1969
|
+
if e.keywords:
|
|
1970
|
+
note = "Cannot use a function call in a type annotation"
|
|
1971
|
+
else:
|
|
1972
|
+
note = "Suggestion: use {0}[...] instead of {0}(...)".format(constructor)
|
|
1973
|
+
return self.invalid_type(e, note=note)
|
|
1974
|
+
if not constructor:
|
|
1975
|
+
self.fail(message_registry.ARG_CONSTRUCTOR_NAME_EXPECTED, e.lineno, e.col_offset)
|
|
1976
|
+
|
|
1977
|
+
name: str | None = None
|
|
1978
|
+
default_type = AnyType(TypeOfAny.special_form)
|
|
1979
|
+
typ: Type = default_type
|
|
1980
|
+
for i, arg in enumerate(e.args):
|
|
1981
|
+
if i == 0:
|
|
1982
|
+
converted = self.visit(arg)
|
|
1983
|
+
assert converted is not None
|
|
1984
|
+
typ = converted
|
|
1985
|
+
elif i == 1:
|
|
1986
|
+
name = self._extract_argument_name(arg)
|
|
1987
|
+
else:
|
|
1988
|
+
self.fail(message_registry.ARG_CONSTRUCTOR_TOO_MANY_ARGS, f.lineno, f.col_offset)
|
|
1989
|
+
for k in e.keywords:
|
|
1990
|
+
value = k.value
|
|
1991
|
+
if k.arg == "name":
|
|
1992
|
+
if name is not None:
|
|
1993
|
+
self.fail(
|
|
1994
|
+
message_registry.MULTIPLE_VALUES_FOR_NAME_KWARG.format(constructor),
|
|
1995
|
+
f.lineno,
|
|
1996
|
+
f.col_offset,
|
|
1997
|
+
)
|
|
1998
|
+
name = self._extract_argument_name(value)
|
|
1999
|
+
elif k.arg == "type":
|
|
2000
|
+
if typ is not default_type:
|
|
2001
|
+
self.fail(
|
|
2002
|
+
message_registry.MULTIPLE_VALUES_FOR_TYPE_KWARG.format(constructor),
|
|
2003
|
+
f.lineno,
|
|
2004
|
+
f.col_offset,
|
|
2005
|
+
)
|
|
2006
|
+
converted = self.visit(value)
|
|
2007
|
+
assert converted is not None
|
|
2008
|
+
typ = converted
|
|
2009
|
+
else:
|
|
2010
|
+
self.fail(
|
|
2011
|
+
message_registry.ARG_CONSTRUCTOR_UNEXPECTED_ARG.format(k.arg),
|
|
2012
|
+
value.lineno,
|
|
2013
|
+
value.col_offset,
|
|
2014
|
+
)
|
|
2015
|
+
return CallableArgument(typ, name, constructor, e.lineno, e.col_offset)
|
|
2016
|
+
|
|
2017
|
+
def translate_argument_list(self, l: Sequence[ast3.expr]) -> TypeList:
|
|
2018
|
+
return TypeList([self.visit(e) for e in l], line=self.line)
|
|
2019
|
+
|
|
2020
|
+
def _extract_argument_name(self, n: ast3.expr) -> str | None:
|
|
2021
|
+
if isinstance(n, ast3.Constant) and isinstance(n.value, str):
|
|
2022
|
+
return n.value.strip()
|
|
2023
|
+
elif isinstance(n, ast3.Constant) and n.value is None:
|
|
2024
|
+
return None
|
|
2025
|
+
self.fail(
|
|
2026
|
+
message_registry.ARG_NAME_EXPECTED_STRING_LITERAL.format(type(n).__name__),
|
|
2027
|
+
self.line,
|
|
2028
|
+
0,
|
|
2029
|
+
)
|
|
2030
|
+
return None
|
|
2031
|
+
|
|
2032
|
+
def visit_Name(self, n: Name) -> Type:
|
|
2033
|
+
return UnboundType(n.id, line=self.line, column=self.convert_column(n.col_offset))
|
|
2034
|
+
|
|
2035
|
+
def visit_BinOp(self, n: ast3.BinOp) -> Type:
|
|
2036
|
+
if not isinstance(n.op, ast3.BitOr):
|
|
2037
|
+
return self.invalid_type(n)
|
|
2038
|
+
|
|
2039
|
+
left = self.visit(n.left)
|
|
2040
|
+
right = self.visit(n.right)
|
|
2041
|
+
return UnionType(
|
|
2042
|
+
[left, right],
|
|
2043
|
+
line=self.line,
|
|
2044
|
+
column=self.convert_column(n.col_offset),
|
|
2045
|
+
is_evaluated=self.is_evaluated,
|
|
2046
|
+
uses_pep604_syntax=True,
|
|
2047
|
+
)
|
|
2048
|
+
|
|
2049
|
+
def visit_Constant(self, n: ast3.Constant) -> Type:
|
|
2050
|
+
val = n.value
|
|
2051
|
+
if val is None:
|
|
2052
|
+
# None is a type.
|
|
2053
|
+
return UnboundType("None", line=self.line)
|
|
2054
|
+
if isinstance(val, str):
|
|
2055
|
+
# Parse forward reference.
|
|
2056
|
+
return parse_type_string(val, "builtins.str", self.line, n.col_offset)
|
|
2057
|
+
if val is Ellipsis:
|
|
2058
|
+
# '...' is valid in some types.
|
|
2059
|
+
return EllipsisType(line=self.line)
|
|
2060
|
+
if isinstance(val, bool):
|
|
2061
|
+
# Special case for True/False.
|
|
2062
|
+
return RawExpressionType(val, "builtins.bool", line=self.line)
|
|
2063
|
+
if isinstance(val, (int, float, complex)):
|
|
2064
|
+
return self.numeric_type(val, n)
|
|
2065
|
+
if isinstance(val, bytes):
|
|
2066
|
+
contents = bytes_to_human_readable_repr(val)
|
|
2067
|
+
return RawExpressionType(contents, "builtins.bytes", self.line, column=n.col_offset)
|
|
2068
|
+
# Everything else is invalid.
|
|
2069
|
+
|
|
2070
|
+
# UnaryOp(op, operand)
|
|
2071
|
+
def visit_UnaryOp(self, n: UnaryOp) -> Type:
|
|
2072
|
+
# We support specifically Literal[-4], Literal[+4], and nothing else.
|
|
2073
|
+
# For example, Literal[~6] or Literal[not False] is not supported.
|
|
2074
|
+
typ = self.visit(n.operand)
|
|
2075
|
+
if (
|
|
2076
|
+
isinstance(typ, RawExpressionType)
|
|
2077
|
+
# Use type() because we do not want to allow bools.
|
|
2078
|
+
and type(typ.literal_value) is int
|
|
2079
|
+
):
|
|
2080
|
+
if isinstance(n.op, USub):
|
|
2081
|
+
typ.literal_value *= -1
|
|
2082
|
+
return typ
|
|
2083
|
+
if isinstance(n.op, UAdd):
|
|
2084
|
+
return typ
|
|
2085
|
+
return self.invalid_type(n)
|
|
2086
|
+
|
|
2087
|
+
def numeric_type(self, value: object, n: AST) -> Type:
|
|
2088
|
+
# The node's field has the type complex, but complex isn't *really*
|
|
2089
|
+
# a parent of int and float, and this causes isinstance below
|
|
2090
|
+
# to think that the complex branch is always picked. Avoid
|
|
2091
|
+
# this by throwing away the type.
|
|
2092
|
+
if isinstance(value, int):
|
|
2093
|
+
numeric_value: int | None = value
|
|
2094
|
+
type_name = "builtins.int"
|
|
2095
|
+
else:
|
|
2096
|
+
# Other kinds of numbers (floats, complex) are not valid parameters for
|
|
2097
|
+
# RawExpressionType so we just pass in 'None' for now. We'll report the
|
|
2098
|
+
# appropriate error at a later stage.
|
|
2099
|
+
numeric_value = None
|
|
2100
|
+
type_name = f"builtins.{type(value).__name__}"
|
|
2101
|
+
return RawExpressionType(
|
|
2102
|
+
numeric_value, type_name, line=self.line, column=getattr(n, "col_offset", -1)
|
|
2103
|
+
)
|
|
2104
|
+
|
|
2105
|
+
def visit_Slice(self, n: ast3.Slice) -> Type:
|
|
2106
|
+
return self.invalid_type(n, note="did you mean to use ',' instead of ':' ?")
|
|
2107
|
+
|
|
2108
|
+
# Subscript(expr value, expr slice, expr_context ctx)
|
|
2109
|
+
def visit_Subscript(self, n: ast3.Subscript) -> Type:
|
|
2110
|
+
empty_tuple_index = False
|
|
2111
|
+
if isinstance(n.slice, ast3.Tuple):
|
|
2112
|
+
params = self.translate_expr_list(n.slice.elts)
|
|
2113
|
+
if len(n.slice.elts) == 0:
|
|
2114
|
+
empty_tuple_index = True
|
|
2115
|
+
else:
|
|
2116
|
+
params = [self.visit(n.slice)]
|
|
2117
|
+
|
|
2118
|
+
value = self.visit(n.value)
|
|
2119
|
+
if isinstance(value, UnboundType) and not value.args:
|
|
2120
|
+
result = UnboundType(
|
|
2121
|
+
value.name,
|
|
2122
|
+
params,
|
|
2123
|
+
line=self.line,
|
|
2124
|
+
column=value.column,
|
|
2125
|
+
empty_tuple_index=empty_tuple_index,
|
|
2126
|
+
)
|
|
2127
|
+
result.end_column = n.end_col_offset
|
|
2128
|
+
result.end_line = n.end_lineno
|
|
2129
|
+
return result
|
|
2130
|
+
else:
|
|
2131
|
+
return self.invalid_type(n)
|
|
2132
|
+
|
|
2133
|
+
def visit_Tuple(self, n: ast3.Tuple) -> Type:
|
|
2134
|
+
return TupleType(
|
|
2135
|
+
self.translate_expr_list(n.elts),
|
|
2136
|
+
_dummy_fallback,
|
|
2137
|
+
implicit=True,
|
|
2138
|
+
line=self.line,
|
|
2139
|
+
column=self.convert_column(n.col_offset),
|
|
2140
|
+
)
|
|
2141
|
+
|
|
2142
|
+
def visit_Dict(self, n: ast3.Dict) -> Type:
|
|
2143
|
+
if not n.keys:
|
|
2144
|
+
return self.invalid_type(n)
|
|
2145
|
+
items: dict[str, Type] = {}
|
|
2146
|
+
extra_items_from = []
|
|
2147
|
+
for item_name, value in zip(n.keys, n.values):
|
|
2148
|
+
if not isinstance(item_name, ast3.Constant) or not isinstance(item_name.value, str):
|
|
2149
|
+
if item_name is None:
|
|
2150
|
+
extra_items_from.append(self.visit(value))
|
|
2151
|
+
continue
|
|
2152
|
+
return self.invalid_type(n)
|
|
2153
|
+
items[item_name.value] = self.visit(value)
|
|
2154
|
+
result = TypedDictType(items, set(), set(), _dummy_fallback, n.lineno, n.col_offset)
|
|
2155
|
+
result.extra_items_from = extra_items_from
|
|
2156
|
+
return result
|
|
2157
|
+
|
|
2158
|
+
# Attribute(expr value, identifier attr, expr_context ctx)
|
|
2159
|
+
def visit_Attribute(self, n: Attribute) -> Type:
|
|
2160
|
+
before_dot = self.visit(n.value)
|
|
2161
|
+
|
|
2162
|
+
if isinstance(before_dot, UnboundType) and not before_dot.args:
|
|
2163
|
+
return UnboundType(f"{before_dot.name}.{n.attr}", line=self.line, column=n.col_offset)
|
|
2164
|
+
else:
|
|
2165
|
+
return self.invalid_type(n)
|
|
2166
|
+
|
|
2167
|
+
# Used for Callable[[X *Ys, Z], R] etc.
|
|
2168
|
+
def visit_Starred(self, n: ast3.Starred) -> Type:
|
|
2169
|
+
return UnpackType(self.visit(n.value), from_star_syntax=True)
|
|
2170
|
+
|
|
2171
|
+
# List(expr* elts, expr_context ctx)
|
|
2172
|
+
def visit_List(self, n: ast3.List) -> Type:
|
|
2173
|
+
assert isinstance(n.ctx, ast3.Load)
|
|
2174
|
+
result = self.translate_argument_list(n.elts)
|
|
2175
|
+
return result
|
|
2176
|
+
|
|
2177
|
+
|
|
2178
|
+
def stringify_name(n: AST) -> str | None:
|
|
2179
|
+
if isinstance(n, Name):
|
|
2180
|
+
return n.id
|
|
2181
|
+
elif isinstance(n, Attribute):
|
|
2182
|
+
sv = stringify_name(n.value)
|
|
2183
|
+
if sv is not None:
|
|
2184
|
+
return f"{sv}.{n.attr}"
|
|
2185
|
+
return None # Can't do it.
|
|
2186
|
+
|
|
2187
|
+
|
|
2188
|
+
class FindAttributeAssign(TraverserVisitor):
|
|
2189
|
+
"""Check if an AST contains attribute assignments (e.g. self.x = 0)."""
|
|
2190
|
+
|
|
2191
|
+
def __init__(self) -> None:
|
|
2192
|
+
self.lvalue = False
|
|
2193
|
+
self.found = False
|
|
2194
|
+
|
|
2195
|
+
def visit_assignment_stmt(self, s: AssignmentStmt) -> None:
|
|
2196
|
+
self.lvalue = True
|
|
2197
|
+
for lv in s.lvalues:
|
|
2198
|
+
lv.accept(self)
|
|
2199
|
+
self.lvalue = False
|
|
2200
|
+
|
|
2201
|
+
def visit_with_stmt(self, s: WithStmt) -> None:
|
|
2202
|
+
self.lvalue = True
|
|
2203
|
+
for lv in s.target:
|
|
2204
|
+
if lv is not None:
|
|
2205
|
+
lv.accept(self)
|
|
2206
|
+
self.lvalue = False
|
|
2207
|
+
s.body.accept(self)
|
|
2208
|
+
|
|
2209
|
+
def visit_for_stmt(self, s: ForStmt) -> None:
|
|
2210
|
+
self.lvalue = True
|
|
2211
|
+
s.index.accept(self)
|
|
2212
|
+
self.lvalue = False
|
|
2213
|
+
s.body.accept(self)
|
|
2214
|
+
if s.else_body:
|
|
2215
|
+
s.else_body.accept(self)
|
|
2216
|
+
|
|
2217
|
+
def visit_expression_stmt(self, s: ExpressionStmt) -> None:
|
|
2218
|
+
# No need to look inside these
|
|
2219
|
+
pass
|
|
2220
|
+
|
|
2221
|
+
def visit_call_expr(self, e: CallExpr) -> None:
|
|
2222
|
+
# No need to look inside these
|
|
2223
|
+
pass
|
|
2224
|
+
|
|
2225
|
+
def visit_index_expr(self, e: IndexExpr) -> None:
|
|
2226
|
+
# No need to look inside these
|
|
2227
|
+
pass
|
|
2228
|
+
|
|
2229
|
+
def visit_member_expr(self, e: MemberExpr) -> None:
|
|
2230
|
+
if self.lvalue and isinstance(e.expr, NameExpr):
|
|
2231
|
+
self.found = True
|
|
2232
|
+
|
|
2233
|
+
|
|
2234
|
+
class FindYield(TraverserVisitor):
|
|
2235
|
+
"""Check if an AST contains yields or yield froms.""" # codespell:ignore froms
|
|
2236
|
+
|
|
2237
|
+
def __init__(self) -> None:
|
|
2238
|
+
self.found = False
|
|
2239
|
+
|
|
2240
|
+
def visit_yield_expr(self, e: YieldExpr) -> None:
|
|
2241
|
+
self.found = True
|
|
2242
|
+
|
|
2243
|
+
def visit_yield_from_expr(self, e: YieldFromExpr) -> None:
|
|
2244
|
+
self.found = True
|
|
2245
|
+
|
|
2246
|
+
|
|
2247
|
+
def is_possible_trivial_body(s: list[Statement]) -> bool:
|
|
2248
|
+
"""Could the statements form a "trivial" function body, such as 'pass'?
|
|
2249
|
+
|
|
2250
|
+
This mimics mypy.semanal.is_trivial_body, but this runs before
|
|
2251
|
+
semantic analysis so some checks must be conservative.
|
|
2252
|
+
"""
|
|
2253
|
+
l = len(s)
|
|
2254
|
+
if l == 0:
|
|
2255
|
+
return False
|
|
2256
|
+
i = 0
|
|
2257
|
+
if isinstance(s[0], ExpressionStmt) and isinstance(s[0].expr, StrExpr):
|
|
2258
|
+
# Skip docstring
|
|
2259
|
+
i += 1
|
|
2260
|
+
if i == l:
|
|
2261
|
+
return True
|
|
2262
|
+
if l > i + 1:
|
|
2263
|
+
return False
|
|
2264
|
+
stmt = s[i]
|
|
2265
|
+
return isinstance(stmt, (PassStmt, RaiseStmt)) or (
|
|
2266
|
+
isinstance(stmt, ExpressionStmt) and isinstance(stmt.expr, EllipsisExpr)
|
|
2267
|
+
)
|