@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,2199 @@
|
|
|
1
|
+
"""Python parser that directly constructs a native AST (when compiled).
|
|
2
|
+
|
|
3
|
+
Use a Rust extension to generate a serialized AST, and deserialize the AST directly
|
|
4
|
+
to a mypy AST.
|
|
5
|
+
|
|
6
|
+
NOTE: This is work in progress. To use this, you need to manually build the
|
|
7
|
+
ast_serialize Rust extension. See the README at https://github.com/mypyc/ast_serialize.
|
|
8
|
+
|
|
9
|
+
Expected benefits over mypy.fastparse:
|
|
10
|
+
* No intermediate non-mypyc Python-level AST created, to improve performance
|
|
11
|
+
* Parsing doesn't need GIL => use multithreading to construct serialized ASTs in parallel
|
|
12
|
+
* Produce import dependencies without having to build an AST => helps parallel type checking
|
|
13
|
+
* Support all Python syntax even if mypy is running on an older Python version
|
|
14
|
+
* Generate an AST even if there are syntax errors
|
|
15
|
+
* Potential to support incremental parsing (quickly process modified sections in a file)
|
|
16
|
+
* Stripping function bodies in third-party code can happen earlier, for extra performance
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
import os
|
|
22
|
+
from typing import Final, cast
|
|
23
|
+
|
|
24
|
+
import ast_serialize
|
|
25
|
+
from librt.internal import (
|
|
26
|
+
read_float as read_float_bare,
|
|
27
|
+
read_int as read_int_bare,
|
|
28
|
+
read_str as read_str_bare,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
from mypy import message_registry, nodes, types
|
|
32
|
+
from mypy.cache import (
|
|
33
|
+
DICT_STR_GEN,
|
|
34
|
+
END_TAG,
|
|
35
|
+
LIST_GEN,
|
|
36
|
+
LIST_INT,
|
|
37
|
+
LITERAL_FLOAT,
|
|
38
|
+
LITERAL_NONE,
|
|
39
|
+
LITERAL_STR,
|
|
40
|
+
LOCATION,
|
|
41
|
+
ReadBuffer,
|
|
42
|
+
Tag,
|
|
43
|
+
read_bool,
|
|
44
|
+
read_int,
|
|
45
|
+
read_str,
|
|
46
|
+
read_str_opt,
|
|
47
|
+
read_tag,
|
|
48
|
+
)
|
|
49
|
+
from mypy.errors import CompileError
|
|
50
|
+
from mypy.nodes import (
|
|
51
|
+
ARG_KINDS,
|
|
52
|
+
ARG_POS,
|
|
53
|
+
IMPORT_METADATA,
|
|
54
|
+
IMPORTALL_METADATA,
|
|
55
|
+
IMPORTFROM_METADATA,
|
|
56
|
+
MISSING_FALLBACK,
|
|
57
|
+
Argument,
|
|
58
|
+
AssertStmt,
|
|
59
|
+
AssignmentExpr,
|
|
60
|
+
AssignmentStmt,
|
|
61
|
+
AwaitExpr,
|
|
62
|
+
Block,
|
|
63
|
+
BreakStmt,
|
|
64
|
+
BytesExpr,
|
|
65
|
+
CallExpr,
|
|
66
|
+
ClassDef,
|
|
67
|
+
ComparisonExpr,
|
|
68
|
+
ComplexExpr,
|
|
69
|
+
ConditionalExpr,
|
|
70
|
+
Context,
|
|
71
|
+
ContinueStmt,
|
|
72
|
+
Decorator,
|
|
73
|
+
DelStmt,
|
|
74
|
+
DictExpr,
|
|
75
|
+
DictionaryComprehension,
|
|
76
|
+
EllipsisExpr,
|
|
77
|
+
Expression,
|
|
78
|
+
ExpressionStmt,
|
|
79
|
+
FileRawData,
|
|
80
|
+
FloatExpr,
|
|
81
|
+
ForStmt,
|
|
82
|
+
FuncDef,
|
|
83
|
+
GeneratorExpr,
|
|
84
|
+
GlobalDecl,
|
|
85
|
+
IfStmt,
|
|
86
|
+
Import,
|
|
87
|
+
ImportAll,
|
|
88
|
+
ImportBase,
|
|
89
|
+
ImportFrom,
|
|
90
|
+
IndexExpr,
|
|
91
|
+
IntExpr,
|
|
92
|
+
LambdaExpr,
|
|
93
|
+
ListComprehension,
|
|
94
|
+
ListExpr,
|
|
95
|
+
MatchStmt,
|
|
96
|
+
MemberExpr,
|
|
97
|
+
MypyFile,
|
|
98
|
+
NameExpr,
|
|
99
|
+
NonlocalDecl,
|
|
100
|
+
OperatorAssignmentStmt,
|
|
101
|
+
OpExpr,
|
|
102
|
+
OverloadedFuncDef,
|
|
103
|
+
OverloadPart,
|
|
104
|
+
ParseError,
|
|
105
|
+
PassStmt,
|
|
106
|
+
RaiseStmt,
|
|
107
|
+
RefExpr,
|
|
108
|
+
ReturnStmt,
|
|
109
|
+
SetComprehension,
|
|
110
|
+
SetExpr,
|
|
111
|
+
SliceExpr,
|
|
112
|
+
StarExpr,
|
|
113
|
+
Statement,
|
|
114
|
+
StrExpr,
|
|
115
|
+
SuperExpr,
|
|
116
|
+
TemplateStrExpr,
|
|
117
|
+
TempNode,
|
|
118
|
+
TryStmt,
|
|
119
|
+
TupleExpr,
|
|
120
|
+
TypeAliasStmt,
|
|
121
|
+
TypeParam,
|
|
122
|
+
UnaryExpr,
|
|
123
|
+
Var,
|
|
124
|
+
WhileStmt,
|
|
125
|
+
WithStmt,
|
|
126
|
+
YieldExpr,
|
|
127
|
+
YieldFromExpr,
|
|
128
|
+
check_param_names,
|
|
129
|
+
)
|
|
130
|
+
from mypy.options import Options
|
|
131
|
+
from mypy.patterns import (
|
|
132
|
+
AsPattern,
|
|
133
|
+
ClassPattern,
|
|
134
|
+
ConcretePattern,
|
|
135
|
+
MappingPattern,
|
|
136
|
+
OrPattern,
|
|
137
|
+
SequencePattern,
|
|
138
|
+
SingletonPattern,
|
|
139
|
+
StarredPattern,
|
|
140
|
+
ValuePattern,
|
|
141
|
+
)
|
|
142
|
+
from mypy.reachability import infer_reachability_of_if_statement
|
|
143
|
+
from mypy.sharedparse import special_function_elide_names
|
|
144
|
+
from mypy.types import (
|
|
145
|
+
AnyType,
|
|
146
|
+
CallableArgument,
|
|
147
|
+
CallableType,
|
|
148
|
+
EllipsisType,
|
|
149
|
+
Instance,
|
|
150
|
+
ProperType,
|
|
151
|
+
RawExpressionType,
|
|
152
|
+
TupleType,
|
|
153
|
+
Type,
|
|
154
|
+
TypedDictType,
|
|
155
|
+
TypeList,
|
|
156
|
+
TypeOfAny,
|
|
157
|
+
UnboundType,
|
|
158
|
+
UnionType,
|
|
159
|
+
UnpackType,
|
|
160
|
+
)
|
|
161
|
+
from mypy.util import decode_python_encoding, hash_digest, unnamed_function
|
|
162
|
+
|
|
163
|
+
TypeIgnores = list[tuple[int, list[str]]]
|
|
164
|
+
|
|
165
|
+
# There is no way to create reasonable fallbacks at this stage,
|
|
166
|
+
# they must be patched later.
|
|
167
|
+
_dummy_fallback: Final = Instance(MISSING_FALLBACK, [], -1)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
class State:
|
|
171
|
+
def __init__(self, options: Options, is_stub: bool = False) -> None:
|
|
172
|
+
self.options = options
|
|
173
|
+
self.is_stub = is_stub
|
|
174
|
+
self.errors: list[ParseError] = []
|
|
175
|
+
self.num_funcs = 0
|
|
176
|
+
|
|
177
|
+
def add_error(
|
|
178
|
+
self, message: str, line: int, column: int, *, blocker: bool = False, code: str
|
|
179
|
+
) -> None:
|
|
180
|
+
"""Report an error at a specific location."""
|
|
181
|
+
self.errors.append(
|
|
182
|
+
{"line": line, "column": column, "message": message, "blocker": blocker, "code": code}
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
def check_min_version(
|
|
186
|
+
self,
|
|
187
|
+
feature: str,
|
|
188
|
+
min_version: tuple[int, int],
|
|
189
|
+
line: int,
|
|
190
|
+
column: int,
|
|
191
|
+
*,
|
|
192
|
+
enforce_in_stubs: bool = False,
|
|
193
|
+
) -> None:
|
|
194
|
+
"""Report a non blocker syntax error if the target Python feature is older than min_version."""
|
|
195
|
+
if self.is_stub and not enforce_in_stubs:
|
|
196
|
+
return
|
|
197
|
+
if self.options.python_version < min_version:
|
|
198
|
+
curr = self.options.python_version
|
|
199
|
+
self.add_error(
|
|
200
|
+
f"{feature}: requires Python {min_version[0]}.{min_version[1]} or newer "
|
|
201
|
+
f"(current target: Python {curr[0]}.{curr[1]})",
|
|
202
|
+
line,
|
|
203
|
+
column,
|
|
204
|
+
blocker=False,
|
|
205
|
+
code="syntax",
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def native_parse(
|
|
210
|
+
filename: str,
|
|
211
|
+
options: Options,
|
|
212
|
+
source: str | bytes | None = None,
|
|
213
|
+
skip_function_bodies: bool = False,
|
|
214
|
+
) -> tuple[MypyFile, list[ParseError], TypeIgnores]:
|
|
215
|
+
"""Parse a Python file using the native Rust-based parser.
|
|
216
|
+
|
|
217
|
+
Return (MypyFile, errors, type_ignores).
|
|
218
|
+
|
|
219
|
+
The returned tree is empty with actual serialized data stored in `raw_data`
|
|
220
|
+
attribute. Use read_statements() and/or deserialize_imports() to de-serialize.
|
|
221
|
+
|
|
222
|
+
The caller should set these additional attributes on the returned MypyFile:
|
|
223
|
+
- ignored_lines: dict of type ignore comments (from the TypeIgnores return value)
|
|
224
|
+
- is_stub: whether the file is a .pyi stub
|
|
225
|
+
"""
|
|
226
|
+
# If the path is a directory, return empty AST (matching fastparse behavior)
|
|
227
|
+
# This can happen for packages that only contain .pyc files without source
|
|
228
|
+
if os.path.isdir(filename):
|
|
229
|
+
node = MypyFile([], [])
|
|
230
|
+
node.path = filename
|
|
231
|
+
return node, [], []
|
|
232
|
+
|
|
233
|
+
(
|
|
234
|
+
b,
|
|
235
|
+
errors,
|
|
236
|
+
ignores,
|
|
237
|
+
import_bytes,
|
|
238
|
+
is_partial_package,
|
|
239
|
+
uses_template_strings,
|
|
240
|
+
source_hash,
|
|
241
|
+
mypy_comments,
|
|
242
|
+
) = parse_to_binary_ast(filename, options, source, skip_function_bodies)
|
|
243
|
+
node = MypyFile([], [])
|
|
244
|
+
node.path = filename
|
|
245
|
+
node.raw_data = FileRawData(
|
|
246
|
+
b,
|
|
247
|
+
import_bytes,
|
|
248
|
+
errors,
|
|
249
|
+
dict(ignores),
|
|
250
|
+
is_partial_package,
|
|
251
|
+
uses_template_strings,
|
|
252
|
+
source_hash,
|
|
253
|
+
mypy_comments,
|
|
254
|
+
)
|
|
255
|
+
return node, errors, ignores
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def native_parse_type_string(
|
|
259
|
+
expr_string: str, line: int, column: int, end_line: int, end_column: int, options: Options
|
|
260
|
+
) -> ProperType:
|
|
261
|
+
"""Try to parse a string literal as a type expression (i.e. resolve a forward reference).
|
|
262
|
+
|
|
263
|
+
If parsing fails, a RawExpressionType will be returned.
|
|
264
|
+
"""
|
|
265
|
+
ast_bytes = ast_serialize.parse_type_string(
|
|
266
|
+
expr_string, (line, column, end_line, end_column), cache_version=5
|
|
267
|
+
)
|
|
268
|
+
state = State(options)
|
|
269
|
+
data = ReadBuffer(ast_bytes)
|
|
270
|
+
ret = read_type(state, data)
|
|
271
|
+
assert isinstance(ret, ProperType)
|
|
272
|
+
return ret
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
def expect_end_tag(data: ReadBuffer) -> None:
|
|
276
|
+
assert read_tag(data) == END_TAG
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
def expect_tag(data: ReadBuffer, tag: Tag) -> None:
|
|
280
|
+
assert (actual := read_tag(data)) == tag, actual
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def read_statements(state: State, data: ReadBuffer, n: int) -> list[Statement]:
|
|
284
|
+
defs: list[Statement] = []
|
|
285
|
+
old_num_funcs = state.num_funcs
|
|
286
|
+
for _ in range(n):
|
|
287
|
+
stmt = read_statement(state, data)
|
|
288
|
+
defs.append(stmt)
|
|
289
|
+
if state.num_funcs > old_num_funcs + 1:
|
|
290
|
+
# There were at least two functions, so we may need to merge overloads.
|
|
291
|
+
defs = fix_function_overloads(state, defs)
|
|
292
|
+
return defs
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def parse_to_binary_ast(
|
|
296
|
+
filename: str,
|
|
297
|
+
options: Options,
|
|
298
|
+
source: str | bytes | None = None,
|
|
299
|
+
skip_function_bodies: bool = False,
|
|
300
|
+
) -> tuple[bytes, list[ParseError], TypeIgnores, bytes, bool, bool, str, list[tuple[int, str]]]:
|
|
301
|
+
try:
|
|
302
|
+
ast_bytes, errors, ignores, import_bytes, ast_data = ast_serialize.parse(
|
|
303
|
+
filename,
|
|
304
|
+
source,
|
|
305
|
+
skip_function_bodies=skip_function_bodies,
|
|
306
|
+
python_version=options.python_version,
|
|
307
|
+
platform=options.platform,
|
|
308
|
+
always_true=options.always_true,
|
|
309
|
+
always_false=options.always_false,
|
|
310
|
+
cache_version=5,
|
|
311
|
+
)
|
|
312
|
+
except ValueError as exc:
|
|
313
|
+
if source is None:
|
|
314
|
+
# Try reading/encoding manually, since native parser only supports UTF-8.
|
|
315
|
+
# If we still cannot decode, decode error will bubble up to caller.
|
|
316
|
+
with open(filename, "rb") as f:
|
|
317
|
+
source_bytes = f.read()
|
|
318
|
+
source = decode_python_encoding(source_bytes)
|
|
319
|
+
ast_bytes, errors, ignores, import_bytes, ast_data = ast_serialize.parse(
|
|
320
|
+
filename,
|
|
321
|
+
source,
|
|
322
|
+
skip_function_bodies=skip_function_bodies,
|
|
323
|
+
python_version=options.python_version,
|
|
324
|
+
platform=options.platform,
|
|
325
|
+
always_true=options.always_true,
|
|
326
|
+
always_false=options.always_false,
|
|
327
|
+
cache_version=5,
|
|
328
|
+
)
|
|
329
|
+
# Compute hash using original non-UTF-8 bytes, so that
|
|
330
|
+
# incremental mode works correctly.
|
|
331
|
+
ast_data["source_hash"] = hash_digest(source_bytes)
|
|
332
|
+
else:
|
|
333
|
+
# Convert everything unexpected to a standard-looking blocker.
|
|
334
|
+
raise CompileError([f"{filename}: error: Cannot parse file: {exc}"]) from exc
|
|
335
|
+
return (
|
|
336
|
+
ast_bytes,
|
|
337
|
+
errors,
|
|
338
|
+
ignores,
|
|
339
|
+
import_bytes,
|
|
340
|
+
ast_data["is_partial_package"],
|
|
341
|
+
ast_data["uses_template_strings"],
|
|
342
|
+
ast_data["source_hash"],
|
|
343
|
+
ast_data["mypy_comments"],
|
|
344
|
+
)
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
def read_statement(state: State, data: ReadBuffer) -> Statement:
|
|
348
|
+
# Branches ordered by frequency (based on mypy self-check)
|
|
349
|
+
tag = read_tag(data)
|
|
350
|
+
stmt: Statement
|
|
351
|
+
if tag == nodes.ASSIGNMENT_STMT:
|
|
352
|
+
lvalues = read_expression_list(state, data)
|
|
353
|
+
rvalue = read_expression(state, data)
|
|
354
|
+
has_type = read_bool(data)
|
|
355
|
+
if has_type:
|
|
356
|
+
type_annotation = read_type(state, data)
|
|
357
|
+
else:
|
|
358
|
+
type_annotation = None
|
|
359
|
+
new_syntax = read_bool(data)
|
|
360
|
+
a = AssignmentStmt(lvalues, rvalue, type=type_annotation, new_syntax=new_syntax)
|
|
361
|
+
read_loc(data, a)
|
|
362
|
+
# If rvalue is TempNode, copy location from AssignmentStmt
|
|
363
|
+
if isinstance(rvalue, TempNode):
|
|
364
|
+
set_line_column_range(rvalue, a)
|
|
365
|
+
expect_end_tag(data)
|
|
366
|
+
return a
|
|
367
|
+
elif tag == nodes.EXPR_STMT:
|
|
368
|
+
es = ExpressionStmt(read_expression(state, data))
|
|
369
|
+
set_line_column_range(es, es.expr)
|
|
370
|
+
expect_end_tag(data)
|
|
371
|
+
return es
|
|
372
|
+
elif tag == nodes.IF_STMT:
|
|
373
|
+
expr = read_expression(state, data)
|
|
374
|
+
body = read_block(state, data)
|
|
375
|
+
|
|
376
|
+
num_elif = read_int(data)
|
|
377
|
+
elif_exprs = []
|
|
378
|
+
elif_bodies = []
|
|
379
|
+
for i in range(num_elif):
|
|
380
|
+
elif_exprs.append(read_expression(state, data))
|
|
381
|
+
elif_bodies.append(read_block(state, data))
|
|
382
|
+
|
|
383
|
+
has_else = read_bool(data)
|
|
384
|
+
if has_else:
|
|
385
|
+
else_body = read_block(state, data)
|
|
386
|
+
else:
|
|
387
|
+
else_body = None
|
|
388
|
+
|
|
389
|
+
# Normalize elif into nested if/else statements
|
|
390
|
+
# Build from the bottom up, starting with the final else body
|
|
391
|
+
current_else = else_body
|
|
392
|
+
|
|
393
|
+
for elif_expr, elif_body in reversed(list(zip(elif_exprs, elif_bodies))):
|
|
394
|
+
elif_stmt = IfStmt([elif_expr], [elif_body], current_else)
|
|
395
|
+
elif_stmt.line = elif_expr.line
|
|
396
|
+
elif_stmt.column = elif_expr.column
|
|
397
|
+
if current_else is not None:
|
|
398
|
+
elif_stmt.end_line = current_else.end_line
|
|
399
|
+
elif_stmt.end_column = current_else.end_column
|
|
400
|
+
else:
|
|
401
|
+
elif_stmt.end_line = elif_body.end_line
|
|
402
|
+
elif_stmt.end_column = elif_body.end_column
|
|
403
|
+
|
|
404
|
+
current_else = Block([elif_stmt])
|
|
405
|
+
set_line_column_range(current_else, elif_stmt)
|
|
406
|
+
|
|
407
|
+
if_stmt = IfStmt([expr], [body], current_else)
|
|
408
|
+
read_loc(data, if_stmt)
|
|
409
|
+
expect_end_tag(data)
|
|
410
|
+
return if_stmt
|
|
411
|
+
elif tag == nodes.RETURN_STMT:
|
|
412
|
+
has_value = read_bool(data)
|
|
413
|
+
if has_value:
|
|
414
|
+
value = read_expression(state, data)
|
|
415
|
+
else:
|
|
416
|
+
value = None
|
|
417
|
+
stmt = ReturnStmt(value)
|
|
418
|
+
read_loc(data, stmt)
|
|
419
|
+
expect_end_tag(data)
|
|
420
|
+
return stmt
|
|
421
|
+
elif tag == nodes.FUNC_DEF_STMT:
|
|
422
|
+
return read_func_def(state, data)
|
|
423
|
+
elif tag == nodes.IMPORT_FROM:
|
|
424
|
+
relative = read_int(data)
|
|
425
|
+
module_id = read_str(data) # Empty string for "from . import x"
|
|
426
|
+
n = read_int(data)
|
|
427
|
+
names = []
|
|
428
|
+
for _ in range(n):
|
|
429
|
+
name = read_str(data)
|
|
430
|
+
has_asname = read_bool(data)
|
|
431
|
+
if has_asname:
|
|
432
|
+
asname = read_str(data)
|
|
433
|
+
else:
|
|
434
|
+
asname = None
|
|
435
|
+
names.append((name, asname))
|
|
436
|
+
|
|
437
|
+
stmt = ImportFrom(module_id, relative, names)
|
|
438
|
+
_read_and_set_import_metadata(data, stmt)
|
|
439
|
+
expect_end_tag(data)
|
|
440
|
+
return stmt
|
|
441
|
+
elif tag == nodes.FOR_STMT:
|
|
442
|
+
index = read_expression(state, data)
|
|
443
|
+
expr = read_expression(state, data)
|
|
444
|
+
body = read_block(state, data)
|
|
445
|
+
else_body = read_optional_block(state, data)
|
|
446
|
+
is_async = read_bool(data)
|
|
447
|
+
stmt = ForStmt(index, expr, body, else_body)
|
|
448
|
+
stmt.is_async = is_async
|
|
449
|
+
read_loc(data, stmt)
|
|
450
|
+
expect_end_tag(data)
|
|
451
|
+
return stmt
|
|
452
|
+
elif tag == nodes.ASSERT_STMT:
|
|
453
|
+
test = read_expression(state, data)
|
|
454
|
+
has_msg = read_bool(data)
|
|
455
|
+
if has_msg:
|
|
456
|
+
msg = read_expression(state, data)
|
|
457
|
+
else:
|
|
458
|
+
msg = None
|
|
459
|
+
stmt = AssertStmt(test, msg)
|
|
460
|
+
read_loc(data, stmt)
|
|
461
|
+
expect_end_tag(data)
|
|
462
|
+
return stmt
|
|
463
|
+
elif tag == nodes.CLASS_DEF:
|
|
464
|
+
return read_class_def(state, data)
|
|
465
|
+
elif tag == nodes.DECORATOR:
|
|
466
|
+
expect_tag(data, LIST_GEN)
|
|
467
|
+
n_decorators = read_int_bare(data)
|
|
468
|
+
decorators = [read_expression(state, data) for i in range(n_decorators)]
|
|
469
|
+
line = read_int(data)
|
|
470
|
+
column = read_int(data)
|
|
471
|
+
fdef = read_statement(state, data)
|
|
472
|
+
assert isinstance(fdef, FuncDef)
|
|
473
|
+
fdef.is_decorated = True
|
|
474
|
+
var = Var(fdef.name)
|
|
475
|
+
var.line = fdef.line
|
|
476
|
+
var.is_ready = False
|
|
477
|
+
stmt = Decorator(fdef, decorators, var)
|
|
478
|
+
stmt.line = line
|
|
479
|
+
stmt.column = column
|
|
480
|
+
stmt.end_line = fdef.end_line
|
|
481
|
+
stmt.end_column = fdef.end_column
|
|
482
|
+
# TODO: Adjust funcdef location to start after decorator?
|
|
483
|
+
expect_end_tag(data)
|
|
484
|
+
return stmt
|
|
485
|
+
elif tag == nodes.IMPORT:
|
|
486
|
+
n = read_int(data)
|
|
487
|
+
ids = []
|
|
488
|
+
for _ in range(n):
|
|
489
|
+
name = read_str(data)
|
|
490
|
+
has_asname = read_bool(data)
|
|
491
|
+
if has_asname:
|
|
492
|
+
asname = read_str(data)
|
|
493
|
+
else:
|
|
494
|
+
asname = None
|
|
495
|
+
ids.append((name, asname))
|
|
496
|
+
stmt = Import(ids)
|
|
497
|
+
_read_and_set_import_metadata(data, stmt)
|
|
498
|
+
expect_end_tag(data)
|
|
499
|
+
return stmt
|
|
500
|
+
elif tag == nodes.RAISE_STMT:
|
|
501
|
+
has_exc = read_bool(data)
|
|
502
|
+
if has_exc:
|
|
503
|
+
exc = read_expression(state, data)
|
|
504
|
+
else:
|
|
505
|
+
exc = None
|
|
506
|
+
has_from = read_bool(data)
|
|
507
|
+
if has_from:
|
|
508
|
+
from_expr = read_expression(state, data)
|
|
509
|
+
else:
|
|
510
|
+
from_expr = None
|
|
511
|
+
stmt = RaiseStmt(exc, from_expr)
|
|
512
|
+
read_loc(data, stmt)
|
|
513
|
+
expect_end_tag(data)
|
|
514
|
+
return stmt
|
|
515
|
+
elif tag == nodes.OPERATOR_ASSIGNMENT_STMT:
|
|
516
|
+
op = read_str(data)
|
|
517
|
+
lvalue = read_expression(state, data)
|
|
518
|
+
rvalue = read_expression(state, data)
|
|
519
|
+
stmt = OperatorAssignmentStmt(op, lvalue, rvalue)
|
|
520
|
+
read_loc(data, stmt)
|
|
521
|
+
expect_end_tag(data)
|
|
522
|
+
return stmt
|
|
523
|
+
elif tag == nodes.PASS_STMT:
|
|
524
|
+
stmt = PassStmt()
|
|
525
|
+
read_loc(data, stmt)
|
|
526
|
+
expect_end_tag(data)
|
|
527
|
+
return stmt
|
|
528
|
+
elif tag == nodes.CONTINUE_STMT:
|
|
529
|
+
stmt = ContinueStmt()
|
|
530
|
+
read_loc(data, stmt)
|
|
531
|
+
expect_end_tag(data)
|
|
532
|
+
return stmt
|
|
533
|
+
elif tag == nodes.WITH_STMT:
|
|
534
|
+
n = read_int(data)
|
|
535
|
+
expr_list = []
|
|
536
|
+
target_list: list[Expression | None] = []
|
|
537
|
+
for _ in range(n):
|
|
538
|
+
context_expr = read_expression(state, data)
|
|
539
|
+
expr_list.append(context_expr)
|
|
540
|
+
has_target = read_bool(data)
|
|
541
|
+
if has_target:
|
|
542
|
+
target = read_expression(state, data)
|
|
543
|
+
target_list.append(target)
|
|
544
|
+
else:
|
|
545
|
+
target_list.append(None)
|
|
546
|
+
body = read_block(state, data)
|
|
547
|
+
is_async = read_bool(data)
|
|
548
|
+
stmt = WithStmt(expr_list, target_list, body)
|
|
549
|
+
stmt.is_async = is_async
|
|
550
|
+
read_loc(data, stmt)
|
|
551
|
+
expect_end_tag(data)
|
|
552
|
+
return stmt
|
|
553
|
+
elif tag == nodes.TRY_STMT:
|
|
554
|
+
return read_try_stmt(state, data)
|
|
555
|
+
elif tag == nodes.BREAK_STMT:
|
|
556
|
+
stmt = BreakStmt()
|
|
557
|
+
read_loc(data, stmt)
|
|
558
|
+
expect_end_tag(data)
|
|
559
|
+
return stmt
|
|
560
|
+
elif tag == nodes.WHILE_STMT:
|
|
561
|
+
expr = read_expression(state, data)
|
|
562
|
+
body = read_block(state, data)
|
|
563
|
+
else_body = read_optional_block(state, data)
|
|
564
|
+
stmt = WhileStmt(expr, body, else_body)
|
|
565
|
+
read_loc(data, stmt)
|
|
566
|
+
expect_end_tag(data)
|
|
567
|
+
return stmt
|
|
568
|
+
elif tag == nodes.DEL_STMT:
|
|
569
|
+
expr = read_expression(state, data)
|
|
570
|
+
stmt = DelStmt(expr)
|
|
571
|
+
read_loc(data, stmt)
|
|
572
|
+
expect_end_tag(data)
|
|
573
|
+
return stmt
|
|
574
|
+
elif tag == nodes.TYPE_ALIAS_STMT:
|
|
575
|
+
return read_type_alias_stmt(state, data)
|
|
576
|
+
elif tag == nodes.IMPORT_ALL:
|
|
577
|
+
module_id = read_str(data) # Empty string for "from . import *"
|
|
578
|
+
relative = read_int(data)
|
|
579
|
+
|
|
580
|
+
stmt = ImportAll(module_id, relative)
|
|
581
|
+
_read_and_set_import_metadata(data, stmt)
|
|
582
|
+
expect_end_tag(data)
|
|
583
|
+
return stmt
|
|
584
|
+
elif tag == nodes.NONLOCAL_DECL:
|
|
585
|
+
n = read_int(data)
|
|
586
|
+
decl_names = []
|
|
587
|
+
for _ in range(n):
|
|
588
|
+
decl_names.append(read_str(data))
|
|
589
|
+
stmt = NonlocalDecl(decl_names)
|
|
590
|
+
read_loc(data, stmt)
|
|
591
|
+
expect_end_tag(data)
|
|
592
|
+
return stmt
|
|
593
|
+
elif tag == nodes.GLOBAL_DECL:
|
|
594
|
+
n = read_int(data)
|
|
595
|
+
decl_names = []
|
|
596
|
+
for _ in range(n):
|
|
597
|
+
decl_names.append(read_str(data))
|
|
598
|
+
stmt = GlobalDecl(decl_names)
|
|
599
|
+
read_loc(data, stmt)
|
|
600
|
+
expect_end_tag(data)
|
|
601
|
+
return stmt
|
|
602
|
+
elif tag == nodes.MATCH_STMT:
|
|
603
|
+
subject = read_expression(state, data)
|
|
604
|
+
n_cases = read_int(data)
|
|
605
|
+
patterns = []
|
|
606
|
+
guards: list[Expression | None] = []
|
|
607
|
+
bodies = []
|
|
608
|
+
for _ in range(n_cases):
|
|
609
|
+
pattern = read_pattern(state, data)
|
|
610
|
+
patterns.append(pattern)
|
|
611
|
+
has_guard = read_bool(data)
|
|
612
|
+
if has_guard:
|
|
613
|
+
guard = read_expression(state, data)
|
|
614
|
+
guards.append(guard)
|
|
615
|
+
else:
|
|
616
|
+
guards.append(None)
|
|
617
|
+
body = read_block(state, data)
|
|
618
|
+
bodies.append(body)
|
|
619
|
+
stmt = MatchStmt(subject, patterns, guards, bodies)
|
|
620
|
+
read_loc(data, stmt)
|
|
621
|
+
expect_end_tag(data)
|
|
622
|
+
return stmt
|
|
623
|
+
else:
|
|
624
|
+
assert False, tag
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
def read_parameters(state: State, data: ReadBuffer) -> tuple[list[Argument], bool]:
|
|
628
|
+
"""Read function/lambda parameters.
|
|
629
|
+
|
|
630
|
+
Return (parameters, has_annotations).
|
|
631
|
+
"""
|
|
632
|
+
expect_tag(data, LIST_GEN)
|
|
633
|
+
n_args = read_int_bare(data)
|
|
634
|
+
arguments = []
|
|
635
|
+
has_ann = False
|
|
636
|
+
for _ in range(n_args):
|
|
637
|
+
arg_name = read_str(data)
|
|
638
|
+
arg_kind_int = read_int(data)
|
|
639
|
+
arg_kind = ARG_KINDS[arg_kind_int]
|
|
640
|
+
has_type = read_bool(data)
|
|
641
|
+
if has_type:
|
|
642
|
+
ann = read_type(state, data)
|
|
643
|
+
has_ann = True
|
|
644
|
+
else:
|
|
645
|
+
ann = None
|
|
646
|
+
has_default = read_bool(data)
|
|
647
|
+
if has_default:
|
|
648
|
+
default = read_expression(state, data)
|
|
649
|
+
else:
|
|
650
|
+
default = None
|
|
651
|
+
pos_only = read_bool(data)
|
|
652
|
+
|
|
653
|
+
if state.options.implicit_optional and ann is not None:
|
|
654
|
+
optional = isinstance(default, NameExpr) and default.name == "None"
|
|
655
|
+
if isinstance(ann, UnboundType):
|
|
656
|
+
ann.optional = optional
|
|
657
|
+
|
|
658
|
+
var = Var(arg_name, ann)
|
|
659
|
+
var.is_inferred = False
|
|
660
|
+
var.is_argument = True
|
|
661
|
+
arg = Argument(var, ann, default, arg_kind, pos_only)
|
|
662
|
+
read_loc(data, arg)
|
|
663
|
+
set_line_column_range(var, arg)
|
|
664
|
+
arguments.append(arg)
|
|
665
|
+
|
|
666
|
+
def fail_arg(msg: str, ctx: Argument) -> None:
|
|
667
|
+
# To match the old parser (for now).
|
|
668
|
+
state.add_error(msg, ctx.line, ctx.column, blocker=True, code="syntax")
|
|
669
|
+
|
|
670
|
+
check_param_names([arg.variable.name for arg in arguments], arguments, fail_arg)
|
|
671
|
+
return arguments, has_ann
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
def check_type_param_defaults(
|
|
675
|
+
state: State, type_params: list[TypeParam], line: int, column: int
|
|
676
|
+
) -> None:
|
|
677
|
+
if any(p.default is not None for p in type_params):
|
|
678
|
+
state.check_min_version("Type parameter defaults", (3, 13), line, column)
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
def check_type_param_values(
|
|
682
|
+
state: State, type_params: list[TypeParam], line: int, column: int
|
|
683
|
+
) -> None:
|
|
684
|
+
for type_param in type_params:
|
|
685
|
+
if len(type_param.values) == 1:
|
|
686
|
+
state.add_error(
|
|
687
|
+
message_registry.TYPE_VAR_TOO_FEW_CONSTRAINED_TYPES.value,
|
|
688
|
+
line,
|
|
689
|
+
column,
|
|
690
|
+
blocker=False,
|
|
691
|
+
code="misc",
|
|
692
|
+
)
|
|
693
|
+
# For compatibility with old parser.
|
|
694
|
+
type_param.values = []
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
def read_type_params(state: State, data: ReadBuffer) -> list[TypeParam]:
|
|
698
|
+
"""Read type parameters (PEP 695 generics)."""
|
|
699
|
+
type_params: list[TypeParam] = []
|
|
700
|
+
n = read_int_bare(data)
|
|
701
|
+
for _ in range(n):
|
|
702
|
+
kind = read_int(data)
|
|
703
|
+
name = read_str(data)
|
|
704
|
+
has_bound = read_bool(data)
|
|
705
|
+
if has_bound:
|
|
706
|
+
upper_bound = read_type(state, data)
|
|
707
|
+
else:
|
|
708
|
+
upper_bound = None
|
|
709
|
+
|
|
710
|
+
expect_tag(data, LIST_GEN)
|
|
711
|
+
n_values = read_int_bare(data)
|
|
712
|
+
values = [read_type(state, data) for _ in range(n_values)]
|
|
713
|
+
|
|
714
|
+
has_default = read_bool(data)
|
|
715
|
+
if has_default:
|
|
716
|
+
default = read_type(state, data)
|
|
717
|
+
else:
|
|
718
|
+
default = None
|
|
719
|
+
|
|
720
|
+
type_params.append(TypeParam(name, kind, upper_bound, values, default))
|
|
721
|
+
|
|
722
|
+
return type_params
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
def read_func_def(state: State, data: ReadBuffer) -> FuncDef:
|
|
726
|
+
state.num_funcs += 1
|
|
727
|
+
|
|
728
|
+
name = read_str(data)
|
|
729
|
+
arguments, has_ann = read_parameters(state, data)
|
|
730
|
+
|
|
731
|
+
if state.options.pos_only_special_methods and special_function_elide_names(name):
|
|
732
|
+
for arg in arguments:
|
|
733
|
+
arg.pos_only = True
|
|
734
|
+
|
|
735
|
+
body = read_block(state, data)
|
|
736
|
+
is_async = read_bool(data)
|
|
737
|
+
|
|
738
|
+
# Type parameters (PEP 695)
|
|
739
|
+
has_type_params = read_bool(data)
|
|
740
|
+
if has_type_params:
|
|
741
|
+
type_params = read_type_params(state, data)
|
|
742
|
+
else:
|
|
743
|
+
type_params = None
|
|
744
|
+
|
|
745
|
+
has_return_type = read_bool(data)
|
|
746
|
+
if has_return_type:
|
|
747
|
+
return_type = read_type(state, data)
|
|
748
|
+
has_ann = True
|
|
749
|
+
else:
|
|
750
|
+
return_type = None
|
|
751
|
+
|
|
752
|
+
if has_ann:
|
|
753
|
+
typ = CallableType(
|
|
754
|
+
[
|
|
755
|
+
arg.type_annotation if arg.type_annotation else AnyType(TypeOfAny.unannotated)
|
|
756
|
+
for arg in arguments
|
|
757
|
+
],
|
|
758
|
+
[arg.kind for arg in arguments],
|
|
759
|
+
[None if arg.pos_only else arg.variable.name for arg in arguments],
|
|
760
|
+
return_type if return_type else AnyType(TypeOfAny.unannotated),
|
|
761
|
+
_dummy_fallback,
|
|
762
|
+
)
|
|
763
|
+
else:
|
|
764
|
+
typ = None
|
|
765
|
+
|
|
766
|
+
func_def = FuncDef(name, arguments, body, typ=typ, type_args=type_params)
|
|
767
|
+
if is_async:
|
|
768
|
+
func_def.is_coroutine = True
|
|
769
|
+
read_loc(data, func_def)
|
|
770
|
+
if type_params:
|
|
771
|
+
state.check_min_version(
|
|
772
|
+
"Improved type parameter syntax", (3, 12), func_def.line, func_def.column
|
|
773
|
+
)
|
|
774
|
+
check_type_param_defaults(state, type_params, func_def.line, func_def.column)
|
|
775
|
+
check_type_param_values(state, type_params, func_def.line, func_def.column)
|
|
776
|
+
if typ:
|
|
777
|
+
typ.line = func_def.line
|
|
778
|
+
typ.column = func_def.column
|
|
779
|
+
typ.definition = func_def
|
|
780
|
+
# TODO: This seems wasteful, can we avoid it?
|
|
781
|
+
func_def.unanalyzed_type = typ.copy_modified()
|
|
782
|
+
expect_end_tag(data)
|
|
783
|
+
if state.options.include_docstrings:
|
|
784
|
+
func_def.docstring = get_docstring(body)
|
|
785
|
+
return func_def
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
def read_class_def(state: State, data: ReadBuffer) -> ClassDef:
|
|
789
|
+
name = read_str(data)
|
|
790
|
+
body = read_block(state, data)
|
|
791
|
+
base_type_exprs = read_expression_list(state, data)
|
|
792
|
+
|
|
793
|
+
expect_tag(data, LIST_GEN)
|
|
794
|
+
n_decorators = read_int_bare(data)
|
|
795
|
+
decorators = [read_expression(state, data) for _ in range(n_decorators)]
|
|
796
|
+
|
|
797
|
+
# Type parameters (PEP 695)
|
|
798
|
+
has_type_params = read_bool(data)
|
|
799
|
+
if has_type_params:
|
|
800
|
+
type_params = read_type_params(state, data)
|
|
801
|
+
else:
|
|
802
|
+
type_params = None
|
|
803
|
+
|
|
804
|
+
expect_tag(data, DICT_STR_GEN)
|
|
805
|
+
n_keywords = read_int_bare(data)
|
|
806
|
+
keywords = []
|
|
807
|
+
for _ in range(n_keywords):
|
|
808
|
+
key = read_str(data)
|
|
809
|
+
value = read_expression(state, data)
|
|
810
|
+
keywords.append((key, value))
|
|
811
|
+
|
|
812
|
+
metaclass = dict(keywords).get("metaclass") if keywords else None
|
|
813
|
+
|
|
814
|
+
class_def = ClassDef(
|
|
815
|
+
name,
|
|
816
|
+
body,
|
|
817
|
+
base_type_exprs=base_type_exprs if base_type_exprs else None,
|
|
818
|
+
metaclass=metaclass,
|
|
819
|
+
# Note we keep metaclass in keywords as well, to match the old parser.
|
|
820
|
+
keywords=keywords if keywords else None,
|
|
821
|
+
type_args=type_params,
|
|
822
|
+
)
|
|
823
|
+
class_def.decorators = decorators
|
|
824
|
+
read_loc(data, class_def)
|
|
825
|
+
if type_params:
|
|
826
|
+
state.check_min_version(
|
|
827
|
+
"Improved type parameter syntax", (3, 12), class_def.line, class_def.column
|
|
828
|
+
)
|
|
829
|
+
check_type_param_defaults(state, type_params, class_def.line, class_def.column)
|
|
830
|
+
check_type_param_values(state, type_params, class_def.line, class_def.column)
|
|
831
|
+
expect_end_tag(data)
|
|
832
|
+
if state.options.include_docstrings:
|
|
833
|
+
class_def.docstring = get_docstring(body)
|
|
834
|
+
return class_def
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
def get_docstring(body: Block) -> str | None:
|
|
838
|
+
if body.body and isinstance(body.body[0], ExpressionStmt):
|
|
839
|
+
expr = body.body[0].expr
|
|
840
|
+
if isinstance(expr, StrExpr):
|
|
841
|
+
return expr.value
|
|
842
|
+
return None
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
def read_type_alias_stmt(state: State, data: ReadBuffer) -> TypeAliasStmt:
|
|
846
|
+
"""Read PEP 695 type alias statement."""
|
|
847
|
+
name = read_expression(state, data)
|
|
848
|
+
assert isinstance(name, NameExpr), f"Expected NameExpr for type alias name, got {type(name)}"
|
|
849
|
+
|
|
850
|
+
n_type_params = read_int_bare(data)
|
|
851
|
+
if n_type_params > 0:
|
|
852
|
+
type_params = []
|
|
853
|
+
for _ in range(n_type_params):
|
|
854
|
+
kind = read_int(data)
|
|
855
|
+
param_name = read_str(data)
|
|
856
|
+
has_bound = read_bool(data)
|
|
857
|
+
if has_bound:
|
|
858
|
+
upper_bound = read_type(state, data)
|
|
859
|
+
else:
|
|
860
|
+
upper_bound = None
|
|
861
|
+
|
|
862
|
+
# Read values (for constrained TypeVar)
|
|
863
|
+
expect_tag(data, LIST_GEN)
|
|
864
|
+
n_values = read_int_bare(data)
|
|
865
|
+
values = [read_type(state, data) for _ in range(n_values)]
|
|
866
|
+
|
|
867
|
+
has_default = read_bool(data)
|
|
868
|
+
if has_default:
|
|
869
|
+
default = read_type(state, data)
|
|
870
|
+
else:
|
|
871
|
+
default = None
|
|
872
|
+
|
|
873
|
+
type_params.append(TypeParam(param_name, kind, upper_bound, values, default))
|
|
874
|
+
else:
|
|
875
|
+
type_params = []
|
|
876
|
+
|
|
877
|
+
value_expr = read_expression(state, data)
|
|
878
|
+
|
|
879
|
+
# Wrap the value expression in a LambdaExpr as expected by TypeAliasStmt
|
|
880
|
+
# The LambdaExpr body is a Block with a single ReturnStmt
|
|
881
|
+
return_stmt = ReturnStmt(value_expr)
|
|
882
|
+
set_line_column_range(return_stmt, value_expr)
|
|
883
|
+
|
|
884
|
+
block = Block([return_stmt])
|
|
885
|
+
block.line = -1 # Synthetic block
|
|
886
|
+
block.column = 0
|
|
887
|
+
block.end_line = -1
|
|
888
|
+
block.end_column = 0
|
|
889
|
+
|
|
890
|
+
lambda_expr = LambdaExpr([], block)
|
|
891
|
+
set_line_column_range(lambda_expr, value_expr)
|
|
892
|
+
|
|
893
|
+
stmt = TypeAliasStmt(name, type_params, lambda_expr)
|
|
894
|
+
read_loc(data, stmt)
|
|
895
|
+
state.check_min_version('"type" statements', (3, 12), stmt.line, stmt.column)
|
|
896
|
+
check_type_param_defaults(state, type_params, stmt.line, stmt.column)
|
|
897
|
+
check_type_param_values(state, type_params, stmt.line, stmt.column)
|
|
898
|
+
expect_end_tag(data)
|
|
899
|
+
return stmt
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
def read_try_stmt(state: State, data: ReadBuffer) -> TryStmt:
|
|
903
|
+
body = read_block(state, data)
|
|
904
|
+
num_handlers = read_int(data)
|
|
905
|
+
|
|
906
|
+
types_list: list[Expression | None] = []
|
|
907
|
+
for _ in range(num_handlers):
|
|
908
|
+
has_type = read_bool(data)
|
|
909
|
+
if has_type:
|
|
910
|
+
exc_type = read_expression(state, data)
|
|
911
|
+
types_list.append(exc_type)
|
|
912
|
+
else:
|
|
913
|
+
types_list.append(None)
|
|
914
|
+
|
|
915
|
+
vars_list: list[NameExpr | None] = []
|
|
916
|
+
for _ in range(num_handlers):
|
|
917
|
+
has_name = read_bool(data)
|
|
918
|
+
if has_name:
|
|
919
|
+
var_name = read_str(data)
|
|
920
|
+
var_expr = NameExpr(var_name)
|
|
921
|
+
read_loc(data, var_expr)
|
|
922
|
+
vars_list.append(var_expr)
|
|
923
|
+
else:
|
|
924
|
+
vars_list.append(None)
|
|
925
|
+
|
|
926
|
+
handlers = []
|
|
927
|
+
for _ in range(num_handlers):
|
|
928
|
+
handler_body = read_block(state, data)
|
|
929
|
+
handlers.append(handler_body)
|
|
930
|
+
|
|
931
|
+
has_else = read_bool(data)
|
|
932
|
+
if has_else:
|
|
933
|
+
else_body = read_block(state, data)
|
|
934
|
+
else:
|
|
935
|
+
else_body = None
|
|
936
|
+
|
|
937
|
+
has_finally = read_bool(data)
|
|
938
|
+
if has_finally:
|
|
939
|
+
finally_body = read_block(state, data)
|
|
940
|
+
else:
|
|
941
|
+
finally_body = None
|
|
942
|
+
|
|
943
|
+
# except* (Python 3.11+)
|
|
944
|
+
is_star = read_bool(data)
|
|
945
|
+
|
|
946
|
+
stmt = TryStmt(body, vars_list, types_list, handlers, else_body, finally_body)
|
|
947
|
+
stmt.is_star = is_star
|
|
948
|
+
read_loc(data, stmt)
|
|
949
|
+
if is_star:
|
|
950
|
+
state.check_min_version("Exception groups", (3, 11), stmt.line, stmt.column)
|
|
951
|
+
if state.options.python_version < (3, 11):
|
|
952
|
+
stmt.is_star = False
|
|
953
|
+
expect_end_tag(data)
|
|
954
|
+
return stmt
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
def read_type(state: State, data: ReadBuffer, always_allow_star: bool = False) -> Type:
|
|
958
|
+
tag = read_tag(data)
|
|
959
|
+
if tag == types.UNBOUND_TYPE:
|
|
960
|
+
name = read_str(data)
|
|
961
|
+
expect_tag(data, LIST_GEN)
|
|
962
|
+
n = read_int_bare(data)
|
|
963
|
+
args = tuple(read_type(state, data) for i in range(n))
|
|
964
|
+
empty_tuple_index = read_bool(data)
|
|
965
|
+
t = read_tag(data)
|
|
966
|
+
if t == LITERAL_NONE:
|
|
967
|
+
original_str_expr = None
|
|
968
|
+
elif t == LITERAL_STR:
|
|
969
|
+
original_str_expr = read_str_bare(data)
|
|
970
|
+
else:
|
|
971
|
+
assert False, f"Unexpected tag for original_str_expr: {t}"
|
|
972
|
+
t = read_tag(data)
|
|
973
|
+
if t == LITERAL_NONE:
|
|
974
|
+
original_str_fallback = None
|
|
975
|
+
elif t == LITERAL_STR:
|
|
976
|
+
original_str_fallback = read_str_bare(data)
|
|
977
|
+
else:
|
|
978
|
+
assert False, f"Unexpected tag for original_str_fallback: {t}"
|
|
979
|
+
unbound = UnboundType(
|
|
980
|
+
name,
|
|
981
|
+
args,
|
|
982
|
+
empty_tuple_index=empty_tuple_index,
|
|
983
|
+
original_str_expr=original_str_expr,
|
|
984
|
+
original_str_fallback=original_str_fallback,
|
|
985
|
+
)
|
|
986
|
+
read_loc(data, unbound)
|
|
987
|
+
expect_end_tag(data)
|
|
988
|
+
return unbound
|
|
989
|
+
elif tag == types.UNION_TYPE:
|
|
990
|
+
expect_tag(data, LIST_GEN)
|
|
991
|
+
n = read_int_bare(data)
|
|
992
|
+
items = [read_type(state, data) for i in range(n)]
|
|
993
|
+
uses_pep604_syntax = read_bool(data)
|
|
994
|
+
t = read_tag(data)
|
|
995
|
+
if t == LITERAL_NONE:
|
|
996
|
+
original_str_expr = None
|
|
997
|
+
elif t == LITERAL_STR:
|
|
998
|
+
original_str_expr = read_str_bare(data)
|
|
999
|
+
else:
|
|
1000
|
+
assert False, f"Unexpected tag for original_str_expr: {t}"
|
|
1001
|
+
t = read_tag(data)
|
|
1002
|
+
if t == LITERAL_NONE:
|
|
1003
|
+
original_str_fallback = None
|
|
1004
|
+
elif t == LITERAL_STR:
|
|
1005
|
+
original_str_fallback = read_str_bare(data)
|
|
1006
|
+
else:
|
|
1007
|
+
assert False, f"Unexpected tag for original_str_fallback: {t}"
|
|
1008
|
+
union = UnionType(items, uses_pep604_syntax=uses_pep604_syntax)
|
|
1009
|
+
union.original_str_expr = original_str_expr
|
|
1010
|
+
union.original_str_fallback = original_str_fallback
|
|
1011
|
+
union.is_evaluated = read_bool(data)
|
|
1012
|
+
read_loc(data, union)
|
|
1013
|
+
expect_end_tag(data)
|
|
1014
|
+
return union
|
|
1015
|
+
elif tag == types.LIST_TYPE:
|
|
1016
|
+
expect_tag(data, LIST_GEN)
|
|
1017
|
+
n = read_int_bare(data)
|
|
1018
|
+
items = [read_type(state, data, always_allow_star=True) for i in range(n)]
|
|
1019
|
+
type_list = TypeList(items)
|
|
1020
|
+
read_loc(data, type_list)
|
|
1021
|
+
expect_end_tag(data)
|
|
1022
|
+
return type_list
|
|
1023
|
+
elif tag == types.TUPLE_TYPE:
|
|
1024
|
+
expect_tag(data, LIST_GEN)
|
|
1025
|
+
n = read_int_bare(data)
|
|
1026
|
+
items = [read_type(state, data) for i in range(n)]
|
|
1027
|
+
implicit = read_bool(data)
|
|
1028
|
+
tuple_type = TupleType(items, _dummy_fallback, implicit=implicit)
|
|
1029
|
+
read_loc(data, tuple_type)
|
|
1030
|
+
expect_end_tag(data)
|
|
1031
|
+
return tuple_type
|
|
1032
|
+
elif tag == types.TYPED_DICT_TYPE:
|
|
1033
|
+
expect_tag(data, LIST_GEN)
|
|
1034
|
+
n = read_int_bare(data)
|
|
1035
|
+
keys = [read_str_opt(data) for i in range(n)]
|
|
1036
|
+
expect_tag(data, LIST_GEN)
|
|
1037
|
+
n = read_int_bare(data)
|
|
1038
|
+
values = [read_type(state, data) for i in range(n)]
|
|
1039
|
+
td_items = {}
|
|
1040
|
+
extra_items_from = []
|
|
1041
|
+
for key, val in zip(keys, values):
|
|
1042
|
+
if key is None:
|
|
1043
|
+
assert isinstance(val, ProperType)
|
|
1044
|
+
extra_items_from.append(val)
|
|
1045
|
+
else:
|
|
1046
|
+
td_items[key] = val
|
|
1047
|
+
typeddict_type = TypedDictType(td_items, set(), set(), _dummy_fallback)
|
|
1048
|
+
typeddict_type.extra_items_from = extra_items_from
|
|
1049
|
+
read_loc(data, typeddict_type)
|
|
1050
|
+
expect_end_tag(data)
|
|
1051
|
+
return typeddict_type
|
|
1052
|
+
elif tag == types.ELLIPSIS_TYPE:
|
|
1053
|
+
ellipsis_type = EllipsisType()
|
|
1054
|
+
read_loc(data, ellipsis_type)
|
|
1055
|
+
expect_end_tag(data)
|
|
1056
|
+
return ellipsis_type
|
|
1057
|
+
elif tag == types.RAW_EXPRESSION_TYPE:
|
|
1058
|
+
type_name = read_str(data)
|
|
1059
|
+
value: types.LiteralValue | str | None
|
|
1060
|
+
note: str | None = None
|
|
1061
|
+
if type_name == "builtins.bool":
|
|
1062
|
+
value = read_bool(data)
|
|
1063
|
+
elif type_name == "builtins.int":
|
|
1064
|
+
value = read_int(data)
|
|
1065
|
+
elif type_name == "builtins.str":
|
|
1066
|
+
value = read_str(data)
|
|
1067
|
+
elif type_name == "builtins.bytes":
|
|
1068
|
+
# Bytes literals are serialized as escaped strings
|
|
1069
|
+
value = read_str(data)
|
|
1070
|
+
elif type_name == "typing.Any":
|
|
1071
|
+
# Invalid type - read None value
|
|
1072
|
+
tag = read_tag(data)
|
|
1073
|
+
assert tag == LITERAL_NONE, f"Expected LITERAL_NONE for invalid type, got {tag}"
|
|
1074
|
+
value = None
|
|
1075
|
+
# Read optional note (cache_version >= 2)
|
|
1076
|
+
note = read_str_opt(data)
|
|
1077
|
+
else:
|
|
1078
|
+
assert False, f"Unsupported RawExpressionType: {type_name}"
|
|
1079
|
+
raw_type = RawExpressionType(value, type_name, note=note)
|
|
1080
|
+
read_loc(data, raw_type)
|
|
1081
|
+
expect_end_tag(data)
|
|
1082
|
+
return raw_type
|
|
1083
|
+
elif tag == types.UNPACK_TYPE:
|
|
1084
|
+
inner_type = read_type(state, data)
|
|
1085
|
+
from_star_syntax = read_bool(data)
|
|
1086
|
+
unpack = UnpackType(inner_type, from_star_syntax=from_star_syntax)
|
|
1087
|
+
read_loc(data, unpack)
|
|
1088
|
+
if from_star_syntax and not always_allow_star:
|
|
1089
|
+
state.check_min_version("Star unpack syntax", (3, 11), unpack.line, unpack.column)
|
|
1090
|
+
expect_end_tag(data)
|
|
1091
|
+
return unpack
|
|
1092
|
+
elif tag == types.CALL_TYPE:
|
|
1093
|
+
return read_call_type(state, data)
|
|
1094
|
+
else:
|
|
1095
|
+
assert False, tag
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
def stringify_type_name(typ: Type) -> str | None:
|
|
1099
|
+
if isinstance(typ, UnboundType):
|
|
1100
|
+
return typ.name
|
|
1101
|
+
return None
|
|
1102
|
+
|
|
1103
|
+
|
|
1104
|
+
def extract_arg_name(typ: Type) -> str | None:
|
|
1105
|
+
if isinstance(typ, RawExpressionType) and typ.base_type_name == "builtins.str":
|
|
1106
|
+
return typ.literal_value # type: ignore[return-value]
|
|
1107
|
+
elif isinstance(typ, UnboundType):
|
|
1108
|
+
if typ.name == "None":
|
|
1109
|
+
return None
|
|
1110
|
+
return typ.name
|
|
1111
|
+
return None # Invalid, but let validation handle it
|
|
1112
|
+
|
|
1113
|
+
|
|
1114
|
+
def read_call_type(state: State, data: ReadBuffer) -> Type:
|
|
1115
|
+
"""Read Call in type context (Arg/DefaultArg/VarArg/KwArg constructor)."""
|
|
1116
|
+
callee_type = read_type(state, data)
|
|
1117
|
+
|
|
1118
|
+
# Read positional arguments
|
|
1119
|
+
expect_tag(data, LIST_GEN)
|
|
1120
|
+
n_args = read_int_bare(data)
|
|
1121
|
+
args = [read_type(state, data) for _ in range(n_args)]
|
|
1122
|
+
|
|
1123
|
+
# Read keyword arguments
|
|
1124
|
+
expect_tag(data, LIST_GEN)
|
|
1125
|
+
n_kwargs = read_int_bare(data)
|
|
1126
|
+
kwargs = []
|
|
1127
|
+
for _ in range(n_kwargs):
|
|
1128
|
+
tag_kw = read_tag(data)
|
|
1129
|
+
if tag_kw == LITERAL_NONE:
|
|
1130
|
+
kw_name = None
|
|
1131
|
+
elif tag_kw == LITERAL_STR:
|
|
1132
|
+
kw_name = read_str_bare(data)
|
|
1133
|
+
else:
|
|
1134
|
+
assert False, f"Unexpected tag for keyword name: {tag_kw}"
|
|
1135
|
+
kw_value = read_type(state, data)
|
|
1136
|
+
kwargs.append((kw_name, kw_value))
|
|
1137
|
+
|
|
1138
|
+
constructor = stringify_type_name(callee_type)
|
|
1139
|
+
|
|
1140
|
+
invalid = AnyType(TypeOfAny.from_error)
|
|
1141
|
+
read_loc(data, invalid)
|
|
1142
|
+
expect_end_tag(data)
|
|
1143
|
+
|
|
1144
|
+
if not constructor:
|
|
1145
|
+
state.add_error(
|
|
1146
|
+
message_registry.ARG_CONSTRUCTOR_NAME_EXPECTED.value,
|
|
1147
|
+
invalid.line,
|
|
1148
|
+
invalid.column,
|
|
1149
|
+
blocker=True,
|
|
1150
|
+
code="misc",
|
|
1151
|
+
)
|
|
1152
|
+
return invalid
|
|
1153
|
+
|
|
1154
|
+
# Extract type and name from arguments
|
|
1155
|
+
name: str | None = None
|
|
1156
|
+
name_set_from_positional = False
|
|
1157
|
+
default_type = AnyType(TypeOfAny.special_form)
|
|
1158
|
+
typ: Type = default_type
|
|
1159
|
+
typ_set_from_positional = False
|
|
1160
|
+
|
|
1161
|
+
# Process positional arguments
|
|
1162
|
+
for i, arg in enumerate(args):
|
|
1163
|
+
if i == 0:
|
|
1164
|
+
typ = arg
|
|
1165
|
+
typ_set_from_positional = True
|
|
1166
|
+
elif i == 1:
|
|
1167
|
+
name = extract_arg_name(arg)
|
|
1168
|
+
name_set_from_positional = True
|
|
1169
|
+
else:
|
|
1170
|
+
state.add_error(
|
|
1171
|
+
message_registry.ARG_CONSTRUCTOR_TOO_MANY_ARGS.value,
|
|
1172
|
+
invalid.line,
|
|
1173
|
+
invalid.column,
|
|
1174
|
+
blocker=True,
|
|
1175
|
+
code="misc",
|
|
1176
|
+
)
|
|
1177
|
+
|
|
1178
|
+
# Process keyword arguments
|
|
1179
|
+
for kw_name, kw_value in kwargs:
|
|
1180
|
+
if kw_name == "name":
|
|
1181
|
+
if name is not None and name_set_from_positional:
|
|
1182
|
+
state.add_error(
|
|
1183
|
+
message_registry.MULTIPLE_VALUES_FOR_NAME_KWARG.format(constructor).value,
|
|
1184
|
+
invalid.line,
|
|
1185
|
+
invalid.column,
|
|
1186
|
+
blocker=True,
|
|
1187
|
+
code="misc",
|
|
1188
|
+
)
|
|
1189
|
+
name = extract_arg_name(kw_value)
|
|
1190
|
+
elif kw_name == "type":
|
|
1191
|
+
if typ is not default_type and typ_set_from_positional:
|
|
1192
|
+
state.add_error(
|
|
1193
|
+
message_registry.MULTIPLE_VALUES_FOR_TYPE_KWARG.format(constructor).value,
|
|
1194
|
+
invalid.line,
|
|
1195
|
+
invalid.column,
|
|
1196
|
+
blocker=True,
|
|
1197
|
+
code="misc",
|
|
1198
|
+
)
|
|
1199
|
+
typ = kw_value
|
|
1200
|
+
else:
|
|
1201
|
+
state.add_error(
|
|
1202
|
+
message_registry.ARG_CONSTRUCTOR_UNEXPECTED_ARG.format(kw_name).value,
|
|
1203
|
+
invalid.line,
|
|
1204
|
+
invalid.column,
|
|
1205
|
+
blocker=True,
|
|
1206
|
+
code="misc",
|
|
1207
|
+
)
|
|
1208
|
+
|
|
1209
|
+
call_arg = CallableArgument(typ, name, constructor)
|
|
1210
|
+
set_line_column_range(call_arg, invalid)
|
|
1211
|
+
return call_arg
|
|
1212
|
+
|
|
1213
|
+
|
|
1214
|
+
def read_pattern(state: State, data: ReadBuffer) -> ConcretePattern:
|
|
1215
|
+
tag = read_tag(data)
|
|
1216
|
+
if tag == nodes.AS_PATTERN:
|
|
1217
|
+
has_pattern = read_bool(data)
|
|
1218
|
+
if has_pattern:
|
|
1219
|
+
pattern = read_pattern(state, data)
|
|
1220
|
+
else:
|
|
1221
|
+
pattern = None
|
|
1222
|
+
has_name = read_bool(data)
|
|
1223
|
+
if has_name:
|
|
1224
|
+
name_str = read_str(data)
|
|
1225
|
+
name = NameExpr(name_str)
|
|
1226
|
+
read_loc(data, name)
|
|
1227
|
+
else:
|
|
1228
|
+
name = None
|
|
1229
|
+
as_pattern = AsPattern(pattern, name)
|
|
1230
|
+
read_loc(data, as_pattern)
|
|
1231
|
+
expect_end_tag(data)
|
|
1232
|
+
return as_pattern
|
|
1233
|
+
elif tag == nodes.OR_PATTERN:
|
|
1234
|
+
n = read_int(data)
|
|
1235
|
+
patterns = [read_pattern(state, data) for _ in range(n)]
|
|
1236
|
+
or_pattern = OrPattern(patterns)
|
|
1237
|
+
read_loc(data, or_pattern)
|
|
1238
|
+
expect_end_tag(data)
|
|
1239
|
+
return or_pattern
|
|
1240
|
+
elif tag == nodes.VALUE_PATTERN:
|
|
1241
|
+
expr = read_expression(state, data)
|
|
1242
|
+
value_pattern = ValuePattern(expr)
|
|
1243
|
+
read_loc(data, value_pattern)
|
|
1244
|
+
expect_end_tag(data)
|
|
1245
|
+
return value_pattern
|
|
1246
|
+
elif tag == nodes.SINGLETON_PATTERN:
|
|
1247
|
+
singleton_tag = read_tag(data)
|
|
1248
|
+
if singleton_tag == LITERAL_NONE:
|
|
1249
|
+
value = None
|
|
1250
|
+
else:
|
|
1251
|
+
# It's a boolean
|
|
1252
|
+
value = singleton_tag == 1 # TAG_LITERAL_TRUE
|
|
1253
|
+
singleton_pattern = SingletonPattern(value)
|
|
1254
|
+
read_loc(data, singleton_pattern)
|
|
1255
|
+
expect_end_tag(data)
|
|
1256
|
+
return singleton_pattern
|
|
1257
|
+
elif tag == nodes.SEQUENCE_PATTERN:
|
|
1258
|
+
n = read_int(data)
|
|
1259
|
+
patterns = [read_pattern(state, data) for _ in range(n)]
|
|
1260
|
+
sequence_pattern = SequencePattern(patterns)
|
|
1261
|
+
read_loc(data, sequence_pattern)
|
|
1262
|
+
expect_end_tag(data)
|
|
1263
|
+
return sequence_pattern
|
|
1264
|
+
elif tag == nodes.STARRED_PATTERN:
|
|
1265
|
+
has_name = read_bool(data)
|
|
1266
|
+
if has_name:
|
|
1267
|
+
name_str = read_str(data)
|
|
1268
|
+
name = NameExpr(name_str)
|
|
1269
|
+
read_loc(data, name)
|
|
1270
|
+
else:
|
|
1271
|
+
name = None
|
|
1272
|
+
starred_pattern = StarredPattern(name)
|
|
1273
|
+
read_loc(data, starred_pattern)
|
|
1274
|
+
expect_end_tag(data)
|
|
1275
|
+
return starred_pattern
|
|
1276
|
+
elif tag == nodes.MAPPING_PATTERN:
|
|
1277
|
+
n = read_int(data)
|
|
1278
|
+
keys = []
|
|
1279
|
+
values = []
|
|
1280
|
+
for _ in range(n):
|
|
1281
|
+
key = read_expression(state, data)
|
|
1282
|
+
value = read_pattern(state, data)
|
|
1283
|
+
keys.append(key)
|
|
1284
|
+
values.append(value)
|
|
1285
|
+
has_rest = read_bool(data)
|
|
1286
|
+
if has_rest:
|
|
1287
|
+
rest_str = read_str(data)
|
|
1288
|
+
rest = NameExpr(rest_str)
|
|
1289
|
+
read_loc(data, rest)
|
|
1290
|
+
else:
|
|
1291
|
+
rest = None
|
|
1292
|
+
mapping_pattern = MappingPattern(keys, values, rest)
|
|
1293
|
+
read_loc(data, mapping_pattern)
|
|
1294
|
+
expect_end_tag(data)
|
|
1295
|
+
return mapping_pattern
|
|
1296
|
+
elif tag == nodes.CLASS_PATTERN:
|
|
1297
|
+
class_ref = cast(RefExpr, read_expression(state, data))
|
|
1298
|
+
n_positional = read_int(data)
|
|
1299
|
+
positionals = [read_pattern(state, data) for _ in range(n_positional)]
|
|
1300
|
+
n_keywords = read_int(data)
|
|
1301
|
+
keyword_keys = []
|
|
1302
|
+
keyword_values = []
|
|
1303
|
+
for _ in range(n_keywords):
|
|
1304
|
+
key = read_str(data)
|
|
1305
|
+
value = read_pattern(state, data)
|
|
1306
|
+
keyword_keys.append(key)
|
|
1307
|
+
keyword_values.append(value)
|
|
1308
|
+
class_pattern = ClassPattern(class_ref, positionals, keyword_keys, keyword_values)
|
|
1309
|
+
read_loc(data, class_pattern)
|
|
1310
|
+
expect_end_tag(data)
|
|
1311
|
+
return class_pattern
|
|
1312
|
+
else:
|
|
1313
|
+
assert False, f"Unknown pattern tag: {tag}"
|
|
1314
|
+
|
|
1315
|
+
|
|
1316
|
+
def read_block(state: State, data: ReadBuffer) -> Block:
|
|
1317
|
+
expect_tag(data, nodes.BLOCK)
|
|
1318
|
+
expect_tag(data, LIST_GEN)
|
|
1319
|
+
n = read_int_bare(data)
|
|
1320
|
+
is_unreachable = read_bool(data)
|
|
1321
|
+
if n == 0:
|
|
1322
|
+
# Empty block - read explicit location
|
|
1323
|
+
b = Block([], is_unreachable=is_unreachable)
|
|
1324
|
+
read_loc(data, b)
|
|
1325
|
+
expect_end_tag(data)
|
|
1326
|
+
return b
|
|
1327
|
+
else:
|
|
1328
|
+
# Non-empty block - read statements and set location from them
|
|
1329
|
+
a = read_statements(state, data, n)
|
|
1330
|
+
expect_end_tag(data)
|
|
1331
|
+
b = Block(a, is_unreachable=is_unreachable)
|
|
1332
|
+
b.line = a[0].line
|
|
1333
|
+
b.column = a[0].column
|
|
1334
|
+
b.end_line = a[-1].end_line
|
|
1335
|
+
b.end_column = a[-1].end_column
|
|
1336
|
+
return b
|
|
1337
|
+
|
|
1338
|
+
|
|
1339
|
+
def read_optional_block(state: State, data: ReadBuffer) -> Block | None:
|
|
1340
|
+
expect_tag(data, nodes.BLOCK)
|
|
1341
|
+
expect_tag(data, LIST_GEN)
|
|
1342
|
+
n = read_int_bare(data)
|
|
1343
|
+
is_unreachable = read_bool(data)
|
|
1344
|
+
if n == 0:
|
|
1345
|
+
b = None
|
|
1346
|
+
else:
|
|
1347
|
+
a = [read_statement(state, data) for i in range(n)]
|
|
1348
|
+
b = Block(a, is_unreachable=is_unreachable)
|
|
1349
|
+
b.line = a[0].line
|
|
1350
|
+
b.column = a[0].column
|
|
1351
|
+
b.end_line = a[-1].end_line
|
|
1352
|
+
b.end_column = a[-1].end_column
|
|
1353
|
+
expect_end_tag(data)
|
|
1354
|
+
return b
|
|
1355
|
+
|
|
1356
|
+
|
|
1357
|
+
bin_ops: Final = ["+", "-", "*", "@", "/", "%", "**", "<<", ">>", "|", "^", "&", "//"]
|
|
1358
|
+
bool_ops: Final = ["and", "or"]
|
|
1359
|
+
cmp_ops: Final = ["==", "!=", "<", "<=", ">", ">=", "is", "is not", "in", "not in"]
|
|
1360
|
+
unary_ops: Final = ["~", "not", "+", "-"]
|
|
1361
|
+
|
|
1362
|
+
|
|
1363
|
+
def read_expression(state: State, data: ReadBuffer) -> Expression:
|
|
1364
|
+
# Branches ordered by frequency (based on mypy self-check)
|
|
1365
|
+
tag = read_tag(data)
|
|
1366
|
+
expr: Expression
|
|
1367
|
+
if tag == nodes.NAME_EXPR:
|
|
1368
|
+
s = read_str(data)
|
|
1369
|
+
ne = NameExpr(s)
|
|
1370
|
+
read_loc(data, ne)
|
|
1371
|
+
expect_end_tag(data)
|
|
1372
|
+
return ne
|
|
1373
|
+
elif tag == nodes.MEMBER_EXPR:
|
|
1374
|
+
e = read_expression(state, data)
|
|
1375
|
+
attr = read_str(data)
|
|
1376
|
+
m = MemberExpr(e, attr)
|
|
1377
|
+
# Check if this is a super() call - if so, convert to SuperExpr
|
|
1378
|
+
if isinstance(e, CallExpr) and isinstance(e.callee, NameExpr) and e.callee.name == "super":
|
|
1379
|
+
result: Expression = SuperExpr(attr, e)
|
|
1380
|
+
else:
|
|
1381
|
+
result = m
|
|
1382
|
+
read_loc(data, result)
|
|
1383
|
+
expect_end_tag(data)
|
|
1384
|
+
return result
|
|
1385
|
+
elif tag == nodes.CALL_EXPR:
|
|
1386
|
+
callee = read_expression(state, data)
|
|
1387
|
+
args = read_expression_list(state, data)
|
|
1388
|
+
# Read argument kinds
|
|
1389
|
+
expect_tag(data, LIST_INT)
|
|
1390
|
+
n_kinds = read_int_bare(data)
|
|
1391
|
+
arg_kinds = [ARG_KINDS[read_int_bare(data)] for _ in range(n_kinds)]
|
|
1392
|
+
# Read argument names
|
|
1393
|
+
expect_tag(data, LIST_GEN)
|
|
1394
|
+
n_names = read_int_bare(data)
|
|
1395
|
+
arg_names: list[str | None] = []
|
|
1396
|
+
for _ in range(n_names):
|
|
1397
|
+
tag = read_tag(data)
|
|
1398
|
+
if tag == LITERAL_NONE:
|
|
1399
|
+
arg_names.append(None)
|
|
1400
|
+
elif tag == LITERAL_STR:
|
|
1401
|
+
arg_names.append(read_str_bare(data))
|
|
1402
|
+
else:
|
|
1403
|
+
assert False, f"Unexpected tag for arg_name: {tag}"
|
|
1404
|
+
ce = CallExpr(callee, args, arg_kinds, arg_names)
|
|
1405
|
+
read_loc(data, ce)
|
|
1406
|
+
expect_end_tag(data)
|
|
1407
|
+
return ce
|
|
1408
|
+
elif tag == nodes.STR_EXPR:
|
|
1409
|
+
se = StrExpr(read_str(data))
|
|
1410
|
+
se.has_surrogates = read_bool(data)
|
|
1411
|
+
read_loc(data, se)
|
|
1412
|
+
expect_end_tag(data)
|
|
1413
|
+
return se
|
|
1414
|
+
elif tag == nodes.COMPARISON_EXPR:
|
|
1415
|
+
left = read_expression(state, data)
|
|
1416
|
+
expect_tag(data, LIST_INT)
|
|
1417
|
+
n_ops = read_int_bare(data)
|
|
1418
|
+
ops = [cmp_ops[read_int_bare(data)] for _ in range(n_ops)]
|
|
1419
|
+
comparators = read_expression_list(state, data)
|
|
1420
|
+
assert len(ops) == len(comparators)
|
|
1421
|
+
expr = ComparisonExpr(ops, [left] + comparators)
|
|
1422
|
+
read_loc(data, expr)
|
|
1423
|
+
expect_end_tag(data)
|
|
1424
|
+
return expr
|
|
1425
|
+
elif tag == nodes.INT_EXPR:
|
|
1426
|
+
ie = IntExpr(read_int(data))
|
|
1427
|
+
read_loc(data, ie)
|
|
1428
|
+
expect_end_tag(data)
|
|
1429
|
+
return ie
|
|
1430
|
+
elif tag == nodes.INDEX_EXPR:
|
|
1431
|
+
base = read_expression(state, data)
|
|
1432
|
+
index = read_expression(state, data)
|
|
1433
|
+
expr = IndexExpr(base, index)
|
|
1434
|
+
if (
|
|
1435
|
+
isinstance(index, StarExpr)
|
|
1436
|
+
or isinstance(index, TupleExpr)
|
|
1437
|
+
and any(isinstance(it, StarExpr) for it in index.items)
|
|
1438
|
+
):
|
|
1439
|
+
state.check_min_version("Star unpack syntax", (3, 11), index.line, index.column)
|
|
1440
|
+
read_loc(data, expr)
|
|
1441
|
+
expect_end_tag(data)
|
|
1442
|
+
return expr
|
|
1443
|
+
elif tag == nodes.LIST_EXPR:
|
|
1444
|
+
items = read_expression_list(state, data)
|
|
1445
|
+
expr = ListExpr(items)
|
|
1446
|
+
read_loc(data, expr)
|
|
1447
|
+
expect_end_tag(data)
|
|
1448
|
+
return expr
|
|
1449
|
+
elif tag == nodes.TUPLE_EXPR:
|
|
1450
|
+
items = read_expression_list(state, data)
|
|
1451
|
+
t = TupleExpr(items)
|
|
1452
|
+
read_loc(data, t)
|
|
1453
|
+
expect_end_tag(data)
|
|
1454
|
+
return t
|
|
1455
|
+
elif tag == nodes.BOOL_OP_EXPR:
|
|
1456
|
+
op = bool_ops[read_int(data)]
|
|
1457
|
+
values = read_expression_list(state, data)
|
|
1458
|
+
# Convert list of values to nested OpExpr nodes
|
|
1459
|
+
# E.g., [a, b, c] with "and" becomes OpExpr("and", a, OpExpr("and", b, c))
|
|
1460
|
+
# This matches the old parser behavior, on which we may implicitly rely.
|
|
1461
|
+
assert len(values) >= 2
|
|
1462
|
+
result = last = values[-1]
|
|
1463
|
+
for val in values[-2::-1]:
|
|
1464
|
+
result = OpExpr(op, val, result)
|
|
1465
|
+
result.line = val.line
|
|
1466
|
+
result.column = val.column
|
|
1467
|
+
result.end_line = last.end_line
|
|
1468
|
+
result.end_column = last.end_column
|
|
1469
|
+
read_loc(data, result)
|
|
1470
|
+
expect_end_tag(data)
|
|
1471
|
+
return result
|
|
1472
|
+
elif tag == nodes.UNARY_EXPR:
|
|
1473
|
+
op = unary_ops[read_int(data)]
|
|
1474
|
+
operand = read_expression(state, data)
|
|
1475
|
+
expr = UnaryExpr(op, operand)
|
|
1476
|
+
read_loc(data, expr)
|
|
1477
|
+
expect_end_tag(data)
|
|
1478
|
+
return expr
|
|
1479
|
+
elif tag == nodes.OP_EXPR:
|
|
1480
|
+
op = bin_ops[read_int(data)]
|
|
1481
|
+
left = read_expression(state, data)
|
|
1482
|
+
right = read_expression(state, data)
|
|
1483
|
+
o = OpExpr(op, left, right)
|
|
1484
|
+
# TODO: Store these explicitly?
|
|
1485
|
+
o.line = left.line
|
|
1486
|
+
o.column = left.column
|
|
1487
|
+
o.end_line = right.end_line
|
|
1488
|
+
o.end_column = right.end_column
|
|
1489
|
+
expect_end_tag(data)
|
|
1490
|
+
return o
|
|
1491
|
+
elif tag == nodes.FSTRING_EXPR:
|
|
1492
|
+
# F-strings are converted into nodes representing "".join([...]), to match
|
|
1493
|
+
# pre-existing behavior.
|
|
1494
|
+
nparts = read_int(data)
|
|
1495
|
+
fitems = []
|
|
1496
|
+
for _ in range(nparts):
|
|
1497
|
+
b = read_bool(data)
|
|
1498
|
+
if b:
|
|
1499
|
+
n = read_int(data)
|
|
1500
|
+
for i in range(n):
|
|
1501
|
+
fitems.append(read_fstring_item(state, data))
|
|
1502
|
+
else:
|
|
1503
|
+
s = StrExpr(read_str(data))
|
|
1504
|
+
read_loc(data, s)
|
|
1505
|
+
fitems.append(s)
|
|
1506
|
+
expr = build_fstring_join(data, fitems, set_has_surrogates=True)
|
|
1507
|
+
expect_end_tag(data)
|
|
1508
|
+
return expr
|
|
1509
|
+
elif tag == nodes.LIST_COMPREHENSION:
|
|
1510
|
+
generator = read_generator_expr(state, data)
|
|
1511
|
+
expr = ListComprehension(generator)
|
|
1512
|
+
read_loc(data, expr)
|
|
1513
|
+
set_line_column_range(generator, expr)
|
|
1514
|
+
expect_end_tag(data)
|
|
1515
|
+
return expr
|
|
1516
|
+
elif tag == nodes.DICT_EXPR:
|
|
1517
|
+
expect_tag(data, LIST_GEN)
|
|
1518
|
+
n_keys = read_int_bare(data)
|
|
1519
|
+
keys: list[Expression | None] = []
|
|
1520
|
+
for _ in range(n_keys):
|
|
1521
|
+
has_key = read_bool(data)
|
|
1522
|
+
if has_key:
|
|
1523
|
+
keys.append(read_expression(state, data))
|
|
1524
|
+
else:
|
|
1525
|
+
keys.append(None)
|
|
1526
|
+
values = read_expression_list(state, data)
|
|
1527
|
+
items = list(zip(keys, values))
|
|
1528
|
+
expr = DictExpr(items)
|
|
1529
|
+
read_loc(data, expr)
|
|
1530
|
+
expect_end_tag(data)
|
|
1531
|
+
return expr
|
|
1532
|
+
elif tag == nodes.TEMP_NODE:
|
|
1533
|
+
temp = TempNode(AnyType(TypeOfAny.special_form), no_rhs=True)
|
|
1534
|
+
expect_end_tag(data)
|
|
1535
|
+
return temp
|
|
1536
|
+
elif tag == nodes.CONDITIONAL_EXPR:
|
|
1537
|
+
if_expr = read_expression(state, data)
|
|
1538
|
+
cond = read_expression(state, data)
|
|
1539
|
+
else_expr = read_expression(state, data)
|
|
1540
|
+
expr = ConditionalExpr(cond, if_expr, else_expr)
|
|
1541
|
+
read_loc(data, expr)
|
|
1542
|
+
expect_end_tag(data)
|
|
1543
|
+
return expr
|
|
1544
|
+
elif tag == nodes.SLICE_EXPR:
|
|
1545
|
+
has_begin = read_bool(data)
|
|
1546
|
+
begin_index = read_expression(state, data) if has_begin else None
|
|
1547
|
+
has_end = read_bool(data)
|
|
1548
|
+
end_index = read_expression(state, data) if has_end else None
|
|
1549
|
+
has_stride = read_bool(data)
|
|
1550
|
+
stride = read_expression(state, data) if has_stride else None
|
|
1551
|
+
expr = SliceExpr(begin_index, end_index, stride)
|
|
1552
|
+
read_loc(data, expr)
|
|
1553
|
+
expect_end_tag(data)
|
|
1554
|
+
return expr
|
|
1555
|
+
elif tag == nodes.GENERATOR_EXPR:
|
|
1556
|
+
expr = read_generator_expr(state, data)
|
|
1557
|
+
read_loc(data, expr)
|
|
1558
|
+
expect_end_tag(data)
|
|
1559
|
+
return expr
|
|
1560
|
+
elif tag == nodes.YIELD_EXPR:
|
|
1561
|
+
has_value = read_bool(data)
|
|
1562
|
+
if has_value:
|
|
1563
|
+
value = read_expression(state, data)
|
|
1564
|
+
else:
|
|
1565
|
+
value = None
|
|
1566
|
+
expr = YieldExpr(value)
|
|
1567
|
+
read_loc(data, expr)
|
|
1568
|
+
expect_end_tag(data)
|
|
1569
|
+
return expr
|
|
1570
|
+
elif tag == nodes.SET_EXPR:
|
|
1571
|
+
items = read_expression_list(state, data)
|
|
1572
|
+
expr = SetExpr(items)
|
|
1573
|
+
read_loc(data, expr)
|
|
1574
|
+
expect_end_tag(data)
|
|
1575
|
+
return expr
|
|
1576
|
+
elif tag == nodes.ELLIPSIS_EXPR:
|
|
1577
|
+
expr = EllipsisExpr()
|
|
1578
|
+
read_loc(data, expr)
|
|
1579
|
+
expect_end_tag(data)
|
|
1580
|
+
return expr
|
|
1581
|
+
elif tag == nodes.TSTRING_EXPR:
|
|
1582
|
+
nparts = read_int(data)
|
|
1583
|
+
titems: list[Expression | tuple[Expression, str, str | None, Expression | None]] = []
|
|
1584
|
+
for _ in range(nparts):
|
|
1585
|
+
if read_bool(data):
|
|
1586
|
+
e = read_expression(state, data)
|
|
1587
|
+
s = read_str(data)
|
|
1588
|
+
if read_bool(data):
|
|
1589
|
+
conv = read_str(data)
|
|
1590
|
+
else:
|
|
1591
|
+
conv = None
|
|
1592
|
+
if read_bool(data):
|
|
1593
|
+
# Parse format spec as a JoinedStr, this matches the old parser behavior.
|
|
1594
|
+
format_spec = read_fstring_items(state, data)
|
|
1595
|
+
else:
|
|
1596
|
+
format_spec = None
|
|
1597
|
+
titems.append((e, s, conv, format_spec))
|
|
1598
|
+
else:
|
|
1599
|
+
s = StrExpr(read_str(data))
|
|
1600
|
+
read_loc(data, s)
|
|
1601
|
+
titems.append(s)
|
|
1602
|
+
expr = TemplateStrExpr(titems)
|
|
1603
|
+
expr.has_surrogates = read_bool(data)
|
|
1604
|
+
read_loc(data, expr)
|
|
1605
|
+
state.check_min_version(
|
|
1606
|
+
"t-strings", (3, 14), expr.line, expr.column, enforce_in_stubs=True
|
|
1607
|
+
)
|
|
1608
|
+
expect_end_tag(data)
|
|
1609
|
+
return expr
|
|
1610
|
+
elif tag == nodes.LAMBDA_EXPR:
|
|
1611
|
+
arguments, has_ann = read_parameters(state, data)
|
|
1612
|
+
body = read_block(state, data)
|
|
1613
|
+
|
|
1614
|
+
if has_ann:
|
|
1615
|
+
typ = CallableType(
|
|
1616
|
+
[
|
|
1617
|
+
arg.type_annotation if arg.type_annotation else AnyType(TypeOfAny.unannotated)
|
|
1618
|
+
for arg in arguments
|
|
1619
|
+
],
|
|
1620
|
+
[arg.kind for arg in arguments],
|
|
1621
|
+
[None if arg.pos_only else arg.variable.name for arg in arguments],
|
|
1622
|
+
AnyType(TypeOfAny.unannotated),
|
|
1623
|
+
_dummy_fallback,
|
|
1624
|
+
)
|
|
1625
|
+
else:
|
|
1626
|
+
typ = None
|
|
1627
|
+
|
|
1628
|
+
expr = LambdaExpr(arguments, body)
|
|
1629
|
+
expr.type = typ
|
|
1630
|
+
read_loc(data, expr)
|
|
1631
|
+
expect_end_tag(data)
|
|
1632
|
+
return expr
|
|
1633
|
+
elif tag == nodes.DICT_COMPREHENSION:
|
|
1634
|
+
has_key = read_bool(data)
|
|
1635
|
+
if has_key:
|
|
1636
|
+
key = read_expression(state, data)
|
|
1637
|
+
else:
|
|
1638
|
+
key = None
|
|
1639
|
+
value = read_expression(state, data)
|
|
1640
|
+
n_generators = read_int(data)
|
|
1641
|
+
indices = [read_expression(state, data) for _ in range(n_generators)]
|
|
1642
|
+
sequences = [read_expression(state, data) for _ in range(n_generators)]
|
|
1643
|
+
condlists = [read_expression_list(state, data) for _ in range(n_generators)]
|
|
1644
|
+
is_async = [read_bool(data) for _ in range(n_generators)]
|
|
1645
|
+
expr = DictionaryComprehension(key, value, indices, sequences, condlists, is_async)
|
|
1646
|
+
read_loc(data, expr)
|
|
1647
|
+
if key is None:
|
|
1648
|
+
state.check_min_version("Unpacking in comprehensions", (3, 15), expr.line, expr.column)
|
|
1649
|
+
expect_end_tag(data)
|
|
1650
|
+
return expr
|
|
1651
|
+
elif tag == nodes.SET_COMPREHENSION:
|
|
1652
|
+
generator = read_generator_expr(state, data)
|
|
1653
|
+
expr = SetComprehension(generator)
|
|
1654
|
+
read_loc(data, expr)
|
|
1655
|
+
set_line_column_range(generator, expr)
|
|
1656
|
+
expect_end_tag(data)
|
|
1657
|
+
return expr
|
|
1658
|
+
elif tag == nodes.BYTES_EXPR:
|
|
1659
|
+
value = read_str(data)
|
|
1660
|
+
expr = BytesExpr(value)
|
|
1661
|
+
read_loc(data, expr)
|
|
1662
|
+
expect_end_tag(data)
|
|
1663
|
+
return expr
|
|
1664
|
+
elif tag == nodes.ASSIGNMENT_EXPR:
|
|
1665
|
+
target = read_expression(state, data)
|
|
1666
|
+
value = read_expression(state, data)
|
|
1667
|
+
if not isinstance(target, NameExpr):
|
|
1668
|
+
# The only valid target of ":=" is a plain name, but ruff's error
|
|
1669
|
+
# recovery can produce other targets for invalid code such as
|
|
1670
|
+
# "(f() := 1)". Ruff already reports a syntax error in this case, so
|
|
1671
|
+
# here we just recover with a placeholder name instead of crashing.
|
|
1672
|
+
placeholder = NameExpr("")
|
|
1673
|
+
placeholder.set_line(target)
|
|
1674
|
+
target = placeholder
|
|
1675
|
+
expr = AssignmentExpr(target, value)
|
|
1676
|
+
read_loc(data, expr)
|
|
1677
|
+
expect_end_tag(data)
|
|
1678
|
+
return expr
|
|
1679
|
+
elif tag == nodes.FLOAT_EXPR:
|
|
1680
|
+
expect_tag(data, LITERAL_FLOAT)
|
|
1681
|
+
value = read_float_bare(data)
|
|
1682
|
+
fe = FloatExpr(value)
|
|
1683
|
+
read_loc(data, fe)
|
|
1684
|
+
expect_end_tag(data)
|
|
1685
|
+
return fe
|
|
1686
|
+
elif tag == nodes.STAR_EXPR:
|
|
1687
|
+
wrapped_expr = read_expression(state, data)
|
|
1688
|
+
expr = StarExpr(wrapped_expr)
|
|
1689
|
+
read_loc(data, expr)
|
|
1690
|
+
expect_end_tag(data)
|
|
1691
|
+
return expr
|
|
1692
|
+
elif tag == nodes.YIELD_FROM_EXPR:
|
|
1693
|
+
value = read_expression(state, data)
|
|
1694
|
+
expr = YieldFromExpr(value)
|
|
1695
|
+
read_loc(data, expr)
|
|
1696
|
+
expect_end_tag(data)
|
|
1697
|
+
return expr
|
|
1698
|
+
elif tag == nodes.AWAIT_EXPR:
|
|
1699
|
+
value = read_expression(state, data)
|
|
1700
|
+
expr = AwaitExpr(value)
|
|
1701
|
+
read_loc(data, expr)
|
|
1702
|
+
expect_end_tag(data)
|
|
1703
|
+
return expr
|
|
1704
|
+
elif tag == nodes.COMPLEX_EXPR:
|
|
1705
|
+
expect_tag(data, LITERAL_FLOAT)
|
|
1706
|
+
real = read_float_bare(data)
|
|
1707
|
+
expect_tag(data, LITERAL_FLOAT)
|
|
1708
|
+
imag = read_float_bare(data)
|
|
1709
|
+
expr = ComplexExpr(complex(real, imag))
|
|
1710
|
+
read_loc(data, expr)
|
|
1711
|
+
expect_end_tag(data)
|
|
1712
|
+
return expr
|
|
1713
|
+
elif tag == nodes.BIG_INT_EXPR:
|
|
1714
|
+
strval = read_str(data)
|
|
1715
|
+
ie = IntExpr(int(strval, base=0))
|
|
1716
|
+
read_loc(data, ie)
|
|
1717
|
+
expect_end_tag(data)
|
|
1718
|
+
return ie
|
|
1719
|
+
else:
|
|
1720
|
+
assert False, tag
|
|
1721
|
+
|
|
1722
|
+
|
|
1723
|
+
def read_fstring_items(state: State, data: ReadBuffer) -> Expression:
|
|
1724
|
+
n = read_int(data)
|
|
1725
|
+
items = [read_fstring_item(state, data) for _ in range(n)]
|
|
1726
|
+
return build_fstring_join(data, items)
|
|
1727
|
+
|
|
1728
|
+
|
|
1729
|
+
def build_fstring_join(
|
|
1730
|
+
data: ReadBuffer, items: list[Expression], set_has_surrogates: bool = False
|
|
1731
|
+
) -> Expression:
|
|
1732
|
+
items = collapse_consecutive_str_items(items)
|
|
1733
|
+
if len(items) == 1:
|
|
1734
|
+
expr = items[0]
|
|
1735
|
+
if set_has_surrogates:
|
|
1736
|
+
if isinstance(expr, StrExpr):
|
|
1737
|
+
target = expr
|
|
1738
|
+
else:
|
|
1739
|
+
assert isinstance(expr, CallExpr) and isinstance(expr.callee, MemberExpr)
|
|
1740
|
+
# It doesn't really matter where to set the surrogates flag,
|
|
1741
|
+
# so we set it on the outermost format string.
|
|
1742
|
+
target = expr.callee.expr
|
|
1743
|
+
assert isinstance(target, StrExpr)
|
|
1744
|
+
target.has_surrogates = read_bool(data)
|
|
1745
|
+
read_loc(data, expr)
|
|
1746
|
+
return expr
|
|
1747
|
+
args = ListExpr(items)
|
|
1748
|
+
str_expr = StrExpr("")
|
|
1749
|
+
member = MemberExpr(str_expr, "join")
|
|
1750
|
+
call = CallExpr(member, [args], [ARG_POS], [None])
|
|
1751
|
+
if set_has_surrogates:
|
|
1752
|
+
str_expr.has_surrogates = read_bool(data)
|
|
1753
|
+
read_loc(data, call)
|
|
1754
|
+
set_line_column(args, call)
|
|
1755
|
+
set_line_column(str_expr, call)
|
|
1756
|
+
set_line_column(member, call)
|
|
1757
|
+
return call
|
|
1758
|
+
|
|
1759
|
+
|
|
1760
|
+
def collapse_consecutive_str_items(items: list[Expression]) -> list[Expression]:
|
|
1761
|
+
if len(items) <= 1:
|
|
1762
|
+
return items
|
|
1763
|
+
last = items[0]
|
|
1764
|
+
new_items = [last]
|
|
1765
|
+
for item in items[1:]:
|
|
1766
|
+
if isinstance(last, StrExpr) and isinstance(item, StrExpr):
|
|
1767
|
+
last.value += item.value
|
|
1768
|
+
last.end_line = item.end_line
|
|
1769
|
+
last.end_column = item.end_column
|
|
1770
|
+
else:
|
|
1771
|
+
new_items.append(item)
|
|
1772
|
+
last = item
|
|
1773
|
+
return new_items
|
|
1774
|
+
|
|
1775
|
+
|
|
1776
|
+
def read_fstring_item(state: State, data: ReadBuffer) -> Expression:
|
|
1777
|
+
t = read_tag(data)
|
|
1778
|
+
if t == LITERAL_STR:
|
|
1779
|
+
str_expr = StrExpr(read_str_bare(data))
|
|
1780
|
+
read_loc(data, str_expr)
|
|
1781
|
+
return str_expr
|
|
1782
|
+
elif t == nodes.FSTRING_INTERPOLATION:
|
|
1783
|
+
expr = read_expression(state, data)
|
|
1784
|
+
|
|
1785
|
+
# Read conversion flag such as !r
|
|
1786
|
+
has_conv = read_bool(data)
|
|
1787
|
+
if has_conv:
|
|
1788
|
+
c = read_str(data)
|
|
1789
|
+
fmt = "{" + c + ":{}}"
|
|
1790
|
+
else:
|
|
1791
|
+
fmt = "{:{}}"
|
|
1792
|
+
|
|
1793
|
+
# Read format spec such as <30 (which may have nested {...})
|
|
1794
|
+
has_spec = read_bool(data)
|
|
1795
|
+
if has_spec:
|
|
1796
|
+
spec = read_fstring_items(state, data)
|
|
1797
|
+
else:
|
|
1798
|
+
spec = StrExpr("")
|
|
1799
|
+
|
|
1800
|
+
member = MemberExpr(StrExpr(fmt), "format")
|
|
1801
|
+
set_line_column(member, expr)
|
|
1802
|
+
call = CallExpr(member, [expr, spec], [ARG_POS, ARG_POS], [None, None])
|
|
1803
|
+
set_line_column(call, expr)
|
|
1804
|
+
expect_end_tag(data)
|
|
1805
|
+
return call
|
|
1806
|
+
else:
|
|
1807
|
+
raise ValueError(f"Unexpected tag {t}")
|
|
1808
|
+
|
|
1809
|
+
|
|
1810
|
+
def set_line_column(target: Context, src: Context) -> None:
|
|
1811
|
+
target.line = src.line
|
|
1812
|
+
target.column = src.column
|
|
1813
|
+
|
|
1814
|
+
|
|
1815
|
+
def set_line_column_range(target: Context, src: Context) -> None:
|
|
1816
|
+
target.line = src.line
|
|
1817
|
+
target.column = src.column
|
|
1818
|
+
target.end_line = src.end_line
|
|
1819
|
+
target.end_column = src.end_column
|
|
1820
|
+
|
|
1821
|
+
|
|
1822
|
+
def read_expression_list(state: State, data: ReadBuffer) -> list[Expression]:
|
|
1823
|
+
expect_tag(data, LIST_GEN)
|
|
1824
|
+
n = read_int_bare(data)
|
|
1825
|
+
return [read_expression(state, data) for i in range(n)]
|
|
1826
|
+
|
|
1827
|
+
|
|
1828
|
+
def read_generator_expr(state: State, data: ReadBuffer) -> GeneratorExpr:
|
|
1829
|
+
"""Helper function to read comprehension data (shared by Generator, ListComp, SetComp)"""
|
|
1830
|
+
left_expr = read_expression(state, data)
|
|
1831
|
+
if isinstance(left_expr, StarExpr):
|
|
1832
|
+
state.check_min_version(
|
|
1833
|
+
"Unpacking in comprehensions", (3, 15), left_expr.line, left_expr.column
|
|
1834
|
+
)
|
|
1835
|
+
n_generators = read_int(data)
|
|
1836
|
+
indices = [read_expression(state, data) for _ in range(n_generators)]
|
|
1837
|
+
sequences = [read_expression(state, data) for _ in range(n_generators)]
|
|
1838
|
+
condlists = [read_expression_list(state, data) for _ in range(n_generators)]
|
|
1839
|
+
is_async = [read_bool(data) for _ in range(n_generators)]
|
|
1840
|
+
return GeneratorExpr(left_expr, indices, sequences, condlists, is_async)
|
|
1841
|
+
|
|
1842
|
+
|
|
1843
|
+
def read_loc(data: ReadBuffer, node: Context) -> None:
|
|
1844
|
+
expect_tag(data, LOCATION)
|
|
1845
|
+
line = read_int_bare(data)
|
|
1846
|
+
node.line = line
|
|
1847
|
+
column = read_int_bare(data)
|
|
1848
|
+
node.column = column
|
|
1849
|
+
node.end_line = line + read_int_bare(data)
|
|
1850
|
+
node.end_column = column + read_int_bare(data)
|
|
1851
|
+
|
|
1852
|
+
|
|
1853
|
+
def strip_contents_from_if_stmt(stmt: IfStmt) -> None:
|
|
1854
|
+
"""Remove contents from IfStmt.
|
|
1855
|
+
|
|
1856
|
+
Needed to still be able to check the conditions after the contents
|
|
1857
|
+
have been merged with the surrounding function overloads.
|
|
1858
|
+
"""
|
|
1859
|
+
if len(stmt.body) == 1:
|
|
1860
|
+
stmt.body[0].body = []
|
|
1861
|
+
if stmt.else_body and len(stmt.else_body.body) == 1:
|
|
1862
|
+
if isinstance(stmt.else_body.body[0], IfStmt):
|
|
1863
|
+
strip_contents_from_if_stmt(stmt.else_body.body[0])
|
|
1864
|
+
else:
|
|
1865
|
+
stmt.else_body.body = []
|
|
1866
|
+
|
|
1867
|
+
|
|
1868
|
+
def is_stripped_if_stmt(stmt: Statement) -> bool:
|
|
1869
|
+
"""Check stmt to make sure it is a stripped IfStmt.
|
|
1870
|
+
|
|
1871
|
+
See also: strip_contents_from_if_stmt
|
|
1872
|
+
"""
|
|
1873
|
+
if not isinstance(stmt, IfStmt):
|
|
1874
|
+
return False
|
|
1875
|
+
|
|
1876
|
+
if not (len(stmt.body) == 1 and len(stmt.body[0].body) == 0):
|
|
1877
|
+
# Body not empty
|
|
1878
|
+
return False
|
|
1879
|
+
|
|
1880
|
+
if not stmt.else_body or len(stmt.else_body.body) == 0:
|
|
1881
|
+
# No or empty else_body
|
|
1882
|
+
return True
|
|
1883
|
+
|
|
1884
|
+
# For elif, IfStmt are stored recursively in else_body
|
|
1885
|
+
return is_stripped_if_stmt(stmt.else_body.body[0])
|
|
1886
|
+
|
|
1887
|
+
|
|
1888
|
+
def fail_merge_overload(state: State, node: IfStmt) -> None:
|
|
1889
|
+
"""Report an error when overloads cannot be merged due to unknown condition."""
|
|
1890
|
+
state.add_error(
|
|
1891
|
+
message_registry.FAILED_TO_MERGE_OVERLOADS.value,
|
|
1892
|
+
node.line,
|
|
1893
|
+
node.column,
|
|
1894
|
+
blocker=False,
|
|
1895
|
+
code="misc",
|
|
1896
|
+
)
|
|
1897
|
+
|
|
1898
|
+
|
|
1899
|
+
def check_ifstmt_for_overloads(
|
|
1900
|
+
stmt: IfStmt, current_overload_name: str | None = None
|
|
1901
|
+
) -> str | None:
|
|
1902
|
+
"""Check if IfStmt contains only overloads with the same name.
|
|
1903
|
+
Return overload_name if found, None otherwise.
|
|
1904
|
+
"""
|
|
1905
|
+
# Check that block only contains a single Decorator, FuncDef, or OverloadedFuncDef.
|
|
1906
|
+
# Multiple overloads have already been merged as OverloadedFuncDef.
|
|
1907
|
+
if not (
|
|
1908
|
+
len(stmt.body[0].body) == 1
|
|
1909
|
+
and (
|
|
1910
|
+
isinstance(stmt.body[0].body[0], (Decorator, OverloadedFuncDef))
|
|
1911
|
+
or current_overload_name is not None
|
|
1912
|
+
and isinstance(stmt.body[0].body[0], FuncDef)
|
|
1913
|
+
)
|
|
1914
|
+
or len(stmt.body[0].body) > 1
|
|
1915
|
+
and isinstance(stmt.body[0].body[-1], OverloadedFuncDef)
|
|
1916
|
+
and all(is_stripped_if_stmt(if_stmt) for if_stmt in stmt.body[0].body[:-1])
|
|
1917
|
+
):
|
|
1918
|
+
return None
|
|
1919
|
+
|
|
1920
|
+
overload_name = cast(Decorator | FuncDef | OverloadedFuncDef, stmt.body[0].body[-1]).name
|
|
1921
|
+
if stmt.else_body is None or stmt.else_body.is_unreachable:
|
|
1922
|
+
return overload_name
|
|
1923
|
+
|
|
1924
|
+
if len(stmt.else_body.body) == 1:
|
|
1925
|
+
# For elif: else_body contains an IfStmt itself -> do a recursive check.
|
|
1926
|
+
if (
|
|
1927
|
+
isinstance(stmt.else_body.body[0], (Decorator, FuncDef, OverloadedFuncDef))
|
|
1928
|
+
and stmt.else_body.body[0].name == overload_name
|
|
1929
|
+
):
|
|
1930
|
+
return overload_name
|
|
1931
|
+
if (
|
|
1932
|
+
isinstance(stmt.else_body.body[0], IfStmt)
|
|
1933
|
+
and check_ifstmt_for_overloads(stmt.else_body.body[0], current_overload_name)
|
|
1934
|
+
== overload_name
|
|
1935
|
+
):
|
|
1936
|
+
return overload_name
|
|
1937
|
+
|
|
1938
|
+
return None
|
|
1939
|
+
|
|
1940
|
+
|
|
1941
|
+
def get_executable_if_block_with_overloads(
|
|
1942
|
+
stmt: IfStmt, options: Options
|
|
1943
|
+
) -> tuple[Block | None, IfStmt | None]:
|
|
1944
|
+
"""Return block from IfStmt that will get executed.
|
|
1945
|
+
|
|
1946
|
+
Return
|
|
1947
|
+
0 -> A block if sure that alternative blocks are unreachable.
|
|
1948
|
+
1 -> An IfStmt if the reachability of it can't be inferred,
|
|
1949
|
+
i.e. the truth value is unknown.
|
|
1950
|
+
"""
|
|
1951
|
+
infer_reachability_of_if_statement(stmt, options)
|
|
1952
|
+
if stmt.else_body is None and stmt.body[0].is_unreachable is True:
|
|
1953
|
+
# always False condition with no else
|
|
1954
|
+
return None, None
|
|
1955
|
+
if (
|
|
1956
|
+
stmt.else_body is None
|
|
1957
|
+
or stmt.body[0].is_unreachable is False
|
|
1958
|
+
and stmt.else_body.is_unreachable is False
|
|
1959
|
+
):
|
|
1960
|
+
# The truth value is unknown, thus not conclusive
|
|
1961
|
+
return None, stmt
|
|
1962
|
+
if stmt.else_body.is_unreachable:
|
|
1963
|
+
# else_body will be set unreachable if condition is always True
|
|
1964
|
+
return stmt.body[0], None
|
|
1965
|
+
if stmt.body[0].is_unreachable is True:
|
|
1966
|
+
# body will be set unreachable if condition is always False
|
|
1967
|
+
# else_body can contain an IfStmt itself (for elif) -> do a recursive check
|
|
1968
|
+
if isinstance(stmt.else_body.body[0], IfStmt):
|
|
1969
|
+
return get_executable_if_block_with_overloads(stmt.else_body.body[0], options)
|
|
1970
|
+
return stmt.else_body, None
|
|
1971
|
+
return None, stmt
|
|
1972
|
+
|
|
1973
|
+
|
|
1974
|
+
def fix_function_overloads(state: State, stmts: list[Statement]) -> list[Statement]:
|
|
1975
|
+
"""Merge consecutive function overloads into OverloadedFuncDef nodes.
|
|
1976
|
+
|
|
1977
|
+
Also handles conditional overloads (overloads inside if statements).
|
|
1978
|
+
"""
|
|
1979
|
+
ret: list[Statement] = []
|
|
1980
|
+
current_overload: list[OverloadPart] = []
|
|
1981
|
+
current_overload_name: str | None = None
|
|
1982
|
+
last_unconditional_func_def: str | None = None
|
|
1983
|
+
last_if_stmt: IfStmt | None = None
|
|
1984
|
+
last_if_overload: Decorator | FuncDef | OverloadedFuncDef | None = None
|
|
1985
|
+
last_if_stmt_overload_name: str | None = None
|
|
1986
|
+
last_if_unknown_truth_value: IfStmt | None = None
|
|
1987
|
+
skipped_if_stmts: list[IfStmt] = []
|
|
1988
|
+
for stmt in stmts:
|
|
1989
|
+
if_overload_name: str | None = None
|
|
1990
|
+
if_block_with_overload: Block | None = None
|
|
1991
|
+
if_unknown_truth_value: IfStmt | None = None
|
|
1992
|
+
if isinstance(stmt, IfStmt):
|
|
1993
|
+
# Check IfStmt block to determine if function overloads can be merged
|
|
1994
|
+
if_overload_name = check_ifstmt_for_overloads(stmt, current_overload_name)
|
|
1995
|
+
if if_overload_name is not None:
|
|
1996
|
+
if_block_with_overload, if_unknown_truth_value = (
|
|
1997
|
+
get_executable_if_block_with_overloads(stmt, state.options)
|
|
1998
|
+
)
|
|
1999
|
+
|
|
2000
|
+
if (
|
|
2001
|
+
current_overload_name is not None
|
|
2002
|
+
and isinstance(stmt, (Decorator, FuncDef))
|
|
2003
|
+
and stmt.name == current_overload_name
|
|
2004
|
+
):
|
|
2005
|
+
if last_if_stmt is not None:
|
|
2006
|
+
skipped_if_stmts.append(last_if_stmt)
|
|
2007
|
+
if last_if_overload is not None:
|
|
2008
|
+
# Last stmt was an IfStmt with same overload name
|
|
2009
|
+
# Add overloads to current_overload
|
|
2010
|
+
if isinstance(last_if_overload, OverloadedFuncDef):
|
|
2011
|
+
current_overload.extend(last_if_overload.items)
|
|
2012
|
+
else:
|
|
2013
|
+
current_overload.append(last_if_overload)
|
|
2014
|
+
last_if_stmt, last_if_overload = None, None
|
|
2015
|
+
if last_if_unknown_truth_value:
|
|
2016
|
+
fail_merge_overload(state, last_if_unknown_truth_value)
|
|
2017
|
+
last_if_unknown_truth_value = None
|
|
2018
|
+
current_overload.append(stmt)
|
|
2019
|
+
if isinstance(stmt, FuncDef):
|
|
2020
|
+
# This is, strictly speaking, wrong: there might be a decorated
|
|
2021
|
+
# implementation. However, it only affects the error message we show:
|
|
2022
|
+
# ideally it's "already defined", but "implementation must come last"
|
|
2023
|
+
# is also reasonable.
|
|
2024
|
+
# TODO: can we get rid of this completely and just always emit
|
|
2025
|
+
# "implementation must come last" instead?
|
|
2026
|
+
last_unconditional_func_def = stmt.name
|
|
2027
|
+
elif (
|
|
2028
|
+
current_overload_name is not None
|
|
2029
|
+
and isinstance(stmt, IfStmt)
|
|
2030
|
+
and if_overload_name == current_overload_name
|
|
2031
|
+
and last_unconditional_func_def != current_overload_name
|
|
2032
|
+
):
|
|
2033
|
+
# IfStmt only contains stmts relevant to current_overload.
|
|
2034
|
+
# Check if stmts are reachable and add them to current_overload,
|
|
2035
|
+
# otherwise skip IfStmt to allow subsequent overload
|
|
2036
|
+
# or function definitions.
|
|
2037
|
+
skipped_if_stmts.append(stmt)
|
|
2038
|
+
if if_block_with_overload is None:
|
|
2039
|
+
if if_unknown_truth_value is not None:
|
|
2040
|
+
fail_merge_overload(state, if_unknown_truth_value)
|
|
2041
|
+
continue
|
|
2042
|
+
if last_if_overload is not None:
|
|
2043
|
+
# Last stmt was an IfStmt with same overload name
|
|
2044
|
+
# Add overloads to current_overload
|
|
2045
|
+
if isinstance(last_if_overload, OverloadedFuncDef):
|
|
2046
|
+
current_overload.extend(last_if_overload.items)
|
|
2047
|
+
else:
|
|
2048
|
+
current_overload.append(last_if_overload)
|
|
2049
|
+
last_if_stmt, last_if_overload = None, None
|
|
2050
|
+
if isinstance(if_block_with_overload.body[-1], OverloadedFuncDef):
|
|
2051
|
+
skipped_if_stmts.extend(cast(list[IfStmt], if_block_with_overload.body[:-1]))
|
|
2052
|
+
current_overload.extend(if_block_with_overload.body[-1].items)
|
|
2053
|
+
else:
|
|
2054
|
+
current_overload.append(cast(Decorator | FuncDef, if_block_with_overload.body[0]))
|
|
2055
|
+
else:
|
|
2056
|
+
if last_if_stmt is not None:
|
|
2057
|
+
ret.append(last_if_stmt)
|
|
2058
|
+
last_if_stmt_overload_name = current_overload_name
|
|
2059
|
+
last_if_stmt, last_if_overload = None, None
|
|
2060
|
+
last_if_unknown_truth_value = None
|
|
2061
|
+
|
|
2062
|
+
if current_overload and current_overload_name == last_if_stmt_overload_name:
|
|
2063
|
+
# Remove last stmt (IfStmt) from ret if the overload names matched
|
|
2064
|
+
# Only happens if no executable block had been found in IfStmt
|
|
2065
|
+
popped = ret.pop()
|
|
2066
|
+
assert isinstance(popped, IfStmt)
|
|
2067
|
+
skipped_if_stmts.append(popped)
|
|
2068
|
+
if current_overload and skipped_if_stmts:
|
|
2069
|
+
# Add bare IfStmt (without overloads) to ret
|
|
2070
|
+
# Required for mypy to be able to still check conditions
|
|
2071
|
+
for if_stmt in skipped_if_stmts:
|
|
2072
|
+
strip_contents_from_if_stmt(if_stmt)
|
|
2073
|
+
ret.append(if_stmt)
|
|
2074
|
+
skipped_if_stmts = []
|
|
2075
|
+
if len(current_overload) == 1:
|
|
2076
|
+
ret.append(current_overload[0])
|
|
2077
|
+
elif len(current_overload) > 1:
|
|
2078
|
+
ret.append(OverloadedFuncDef(current_overload))
|
|
2079
|
+
|
|
2080
|
+
# If we have multiple decorated functions named "_" next to each, we want to treat
|
|
2081
|
+
# them as a series of regular FuncDefs instead of one OverloadedFuncDef because
|
|
2082
|
+
# most of mypy/mypyc assumes that all the functions in an OverloadedFuncDef are
|
|
2083
|
+
# related, but multiple underscore functions next to each other aren't necessarily
|
|
2084
|
+
# related
|
|
2085
|
+
last_unconditional_func_def = None
|
|
2086
|
+
if isinstance(stmt, Decorator) and not unnamed_function(stmt.name):
|
|
2087
|
+
current_overload = [stmt]
|
|
2088
|
+
current_overload_name = stmt.name
|
|
2089
|
+
elif isinstance(stmt, IfStmt) and if_overload_name is not None:
|
|
2090
|
+
current_overload = []
|
|
2091
|
+
current_overload_name = if_overload_name
|
|
2092
|
+
last_if_stmt = stmt
|
|
2093
|
+
last_if_stmt_overload_name = None
|
|
2094
|
+
if if_block_with_overload is not None:
|
|
2095
|
+
skipped_if_stmts.extend(cast(list[IfStmt], if_block_with_overload.body[:-1]))
|
|
2096
|
+
last_if_overload = cast(
|
|
2097
|
+
Decorator | FuncDef | OverloadedFuncDef, if_block_with_overload.body[-1]
|
|
2098
|
+
)
|
|
2099
|
+
last_if_unknown_truth_value = if_unknown_truth_value
|
|
2100
|
+
else:
|
|
2101
|
+
current_overload = []
|
|
2102
|
+
current_overload_name = None
|
|
2103
|
+
ret.append(stmt)
|
|
2104
|
+
|
|
2105
|
+
if current_overload and skipped_if_stmts:
|
|
2106
|
+
# Add bare IfStmt (without overloads) to ret
|
|
2107
|
+
# Required for mypy to be able to still check conditions
|
|
2108
|
+
for if_stmt in skipped_if_stmts:
|
|
2109
|
+
strip_contents_from_if_stmt(if_stmt)
|
|
2110
|
+
ret.append(if_stmt)
|
|
2111
|
+
if len(current_overload) == 1:
|
|
2112
|
+
ret.append(current_overload[0])
|
|
2113
|
+
elif len(current_overload) > 1:
|
|
2114
|
+
ret.append(OverloadedFuncDef(current_overload))
|
|
2115
|
+
elif last_if_overload is not None:
|
|
2116
|
+
ret.append(last_if_overload)
|
|
2117
|
+
elif last_if_stmt is not None:
|
|
2118
|
+
ret.append(last_if_stmt)
|
|
2119
|
+
return ret
|
|
2120
|
+
|
|
2121
|
+
|
|
2122
|
+
def deserialize_imports(import_bytes: bytes) -> list[ImportBase]:
|
|
2123
|
+
"""Deserialize import metadata from bytes into mypy AST nodes."""
|
|
2124
|
+
if not import_bytes:
|
|
2125
|
+
return []
|
|
2126
|
+
|
|
2127
|
+
data = ReadBuffer(import_bytes)
|
|
2128
|
+
|
|
2129
|
+
expect_tag(data, LIST_GEN)
|
|
2130
|
+
n_imports = read_int_bare(data)
|
|
2131
|
+
|
|
2132
|
+
imports: list[ImportBase] = []
|
|
2133
|
+
|
|
2134
|
+
for _ in range(n_imports):
|
|
2135
|
+
tag = read_tag(data)
|
|
2136
|
+
|
|
2137
|
+
if tag == IMPORT_METADATA:
|
|
2138
|
+
name = read_str(data)
|
|
2139
|
+
relative = read_int(data)
|
|
2140
|
+
|
|
2141
|
+
has_asname = read_bool(data)
|
|
2142
|
+
if has_asname:
|
|
2143
|
+
asname = read_str(data)
|
|
2144
|
+
else:
|
|
2145
|
+
asname = None
|
|
2146
|
+
|
|
2147
|
+
# Note: relative imports are handled via ImportFrom, so relative should be 0 here
|
|
2148
|
+
stmt = Import([(name, asname)])
|
|
2149
|
+
_read_and_set_import_metadata(data, stmt)
|
|
2150
|
+
imports.append(stmt)
|
|
2151
|
+
|
|
2152
|
+
elif tag == IMPORTFROM_METADATA:
|
|
2153
|
+
module = read_str(data)
|
|
2154
|
+
relative = read_int(data)
|
|
2155
|
+
|
|
2156
|
+
expect_tag(data, LIST_GEN)
|
|
2157
|
+
n_names = read_int_bare(data)
|
|
2158
|
+
names: list[tuple[str, str | None]] = []
|
|
2159
|
+
|
|
2160
|
+
for _ in range(n_names):
|
|
2161
|
+
name = read_str(data)
|
|
2162
|
+
has_asname = read_bool(data)
|
|
2163
|
+
if has_asname:
|
|
2164
|
+
asname = read_str(data)
|
|
2165
|
+
else:
|
|
2166
|
+
asname = None
|
|
2167
|
+
names.append((name, asname))
|
|
2168
|
+
|
|
2169
|
+
stmt = ImportFrom(module, relative, names)
|
|
2170
|
+
_read_and_set_import_metadata(data, stmt)
|
|
2171
|
+
imports.append(stmt)
|
|
2172
|
+
|
|
2173
|
+
elif tag == IMPORTALL_METADATA:
|
|
2174
|
+
module = read_str(data)
|
|
2175
|
+
relative = read_int(data)
|
|
2176
|
+
|
|
2177
|
+
stmt = ImportAll(module, relative)
|
|
2178
|
+
_read_and_set_import_metadata(data, stmt)
|
|
2179
|
+
imports.append(stmt)
|
|
2180
|
+
|
|
2181
|
+
else:
|
|
2182
|
+
raise ValueError(f"Unexpected tag in import metadata: {tag}")
|
|
2183
|
+
|
|
2184
|
+
return imports
|
|
2185
|
+
|
|
2186
|
+
|
|
2187
|
+
def _read_and_set_import_metadata(data: ReadBuffer, stmt: Import | ImportFrom | ImportAll) -> None:
|
|
2188
|
+
read_loc(data, stmt)
|
|
2189
|
+
|
|
2190
|
+
# Metadata flags as a single integer bitfield
|
|
2191
|
+
flags = read_int(data)
|
|
2192
|
+
|
|
2193
|
+
# Extract individual flags using bitwise operations
|
|
2194
|
+
# Bit 0: is_top_level
|
|
2195
|
+
# Bit 1: is_unreachable
|
|
2196
|
+
# Bit 2: is_mypy_only
|
|
2197
|
+
stmt.is_top_level = (flags & 0x01) != 0
|
|
2198
|
+
stmt.is_unreachable = (flags & 0x02) != 0
|
|
2199
|
+
stmt.is_mypy_only = (flags & 0x04) != 0
|