From b18800e8827209866282503d7d684df163677407 Mon Sep 17 00:00:00 2001 From: acassimiro Date: Wed, 21 Aug 2024 19:40:20 -0300 Subject: [PATCH 01/11] Instantiating krun --- Makefile | 2 +- rust-lite/.cruft.json | 18 + rust-lite/.flake8 | 7 + rust-lite/.gitignore | 3 + rust-lite/Makefile | 74 ++ rust-lite/README.md | 23 + rust-lite/flake.nix | 41 + rust-lite/poetry.lock | 1141 +++++++++++++++++ rust-lite/pyproject.toml | 56 + rust-lite/src/rust_lite/__init__.py | 8 + rust-lite/src/rust_lite/__main__.py | 33 + rust-lite/src/rust_lite/manager.py | 45 + rust-lite/src/tests/__init__.py | 0 rust-lite/src/tests/integration/__init__.py | 0 .../src/tests/integration/test_integration.py | 5 + rust-lite/src/tests/unit/__init__.py | 0 rust-lite/src/tests/unit/test_unit.py | 5 + 17 files changed, 1460 insertions(+), 1 deletion(-) create mode 100644 rust-lite/.cruft.json create mode 100644 rust-lite/.flake8 create mode 100644 rust-lite/.gitignore create mode 100644 rust-lite/Makefile create mode 100644 rust-lite/README.md create mode 100644 rust-lite/flake.nix create mode 100644 rust-lite/poetry.lock create mode 100644 rust-lite/pyproject.toml create mode 100644 rust-lite/src/rust_lite/__init__.py create mode 100644 rust-lite/src/rust_lite/__main__.py create mode 100644 rust-lite/src/rust_lite/manager.py create mode 100644 rust-lite/src/tests/__init__.py create mode 100644 rust-lite/src/tests/integration/__init__.py create mode 100644 rust-lite/src/tests/integration/test_integration.py create mode 100644 rust-lite/src/tests/unit/__init__.py create mode 100644 rust-lite/src/tests/unit/test_unit.py diff --git a/Makefile b/Makefile index b2af1fb..2611c39 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ indexing-test: $(INDEXING_OUTPUTS) echo $(INDEXING_OUTPUTS) $(RUST_TIMESTAMP): $(SEMANTICS_FILES) - $$(which kompile) rust-semantics/rust.md -o $(RUST_KOMPILED) + $$(which kompile) rust-semantics/rust.md --emit-json -o $(RUST_KOMPILED) $(SYNTAX_OUTPUT_DIR)/%.rs-parsed: $(SYNTAX_INPUT_DIR)/%.rs $(RUST_TIMESTAMP) mkdir -p $(SYNTAX_OUTPUT_DIR) diff --git a/rust-lite/.cruft.json b/rust-lite/.cruft.json new file mode 100644 index 0000000..9387500 --- /dev/null +++ b/rust-lite/.cruft.json @@ -0,0 +1,18 @@ +{ + "template": "https://github.com/runtimeverification/python-project-template", + "commit": "601d5e2a0e8a98c87dcb1ae694d22d76d0114e01", + "checkout": null, + "context": { + "cookiecutter": { + "project_name": "rust-lite", + "project_slug": "rust-lite", + "package_name": "rust_lite", + "version": "0.1.0", + "description": "Pyk scripts for running our Rust Lite Semantics", + "author_name": "Runtime Verification, Inc.", + "author_email": "contact@runtimeverification.com", + "_template": "https://github.com/runtimeverification/python-project-template" + } + }, + "directory": null +} diff --git a/rust-lite/.flake8 b/rust-lite/.flake8 new file mode 100644 index 0000000..a518873 --- /dev/null +++ b/rust-lite/.flake8 @@ -0,0 +1,7 @@ +[flake8] +max-line-length = 120 +extend-select = B9, TC1 +extend-ignore = B950,E,W1,W2,W3,W4,W5 +per-file-ignores = + */__init__.py: F401 +type-checking-strict = true diff --git a/rust-lite/.gitignore b/rust-lite/.gitignore new file mode 100644 index 0000000..98fe5a7 --- /dev/null +++ b/rust-lite/.gitignore @@ -0,0 +1,3 @@ +/dist/ +__pycache__/ +.coverage diff --git a/rust-lite/Makefile b/rust-lite/Makefile new file mode 100644 index 0000000..54cb6c8 --- /dev/null +++ b/rust-lite/Makefile @@ -0,0 +1,74 @@ +POETRY := poetry +POETRY_RUN := $(POETRY) run + + +default: check test-unit + +all: check cov + +.PHONY: clean +clean: + rm -rf dist .coverage cov-* .mypy_cache .pytest_cache + find -type d -name __pycache__ -prune -exec rm -rf {} \; + +.PHONY: build +build: + $(POETRY) build + +.PHONY: poetry-install +poetry-install: + $(POETRY) install + + +# Tests + +TEST_ARGS := + +test: test-all + +test-all: poetry-install + $(POETRY_RUN) pytest src/tests --maxfail=1 --verbose --durations=0 --numprocesses=4 --dist=worksteal $(TEST_ARGS) + +test-unit: poetry-install + $(POETRY_RUN) pytest src/tests/unit --maxfail=1 --verbose $(TEST_ARGS) + +test-integration: poetry-install + $(POETRY_RUN) pytest src/tests/integration --maxfail=1 --verbose --durations=0 --numprocesses=4 --dist=worksteal $(TEST_ARGS) + + +# Checks and formatting + +format: autoflake isort black +check: check-flake8 check-mypy check-autoflake check-isort check-black + +check-flake8: poetry-install + $(POETRY_RUN) flake8 src + +check-mypy: poetry-install + $(POETRY_RUN) mypy src + +autoflake: poetry-install + $(POETRY_RUN) autoflake --quiet --in-place src + +check-autoflake: poetry-install + $(POETRY_RUN) autoflake --quiet --check src + +isort: poetry-install + $(POETRY_RUN) isort src + +check-isort: poetry-install + $(POETRY_RUN) isort --check src + +black: poetry-install + $(POETRY_RUN) black src + +check-black: poetry-install + $(POETRY_RUN) black --check src + + +# Optional tools + +SRC_FILES := $(shell find src -type f -name '*.py') + +pyupgrade: poetry-install + $(POETRY_RUN) pyupgrade --py310-plus $(SRC_FILES) diff --git a/rust-lite/README.md b/rust-lite/README.md new file mode 100644 index 0000000..fd3d2f5 --- /dev/null +++ b/rust-lite/README.md @@ -0,0 +1,23 @@ +# rust-lite + + +## Installation + +Prerequsites: `python >= 3.10`, `pip >= 20.0.2`, `poetry >= 1.3.2`. + +```bash +make build +pip install dist/*.whl +``` + + +## For Developers + +Use `make` to run common tasks (see the [Makefile](Makefile) for a complete list of available targets). + +* `make build`: Build wheel +* `make check`: Check code style +* `make format`: Format code +* `make test-unit`: Run unit tests + +For interactive use, spawn a shell with `poetry shell` (after `poetry install`), then run an interpreter. diff --git a/rust-lite/flake.nix b/rust-lite/flake.nix new file mode 100644 index 0000000..0529cba --- /dev/null +++ b/rust-lite/flake.nix @@ -0,0 +1,41 @@ +{ + description = "rust-lite - Pyk scripts for running our Rust Lite Semantics"; + inputs = { + nixpkgs.url = "nixpkgs/nixos-22.05"; + flake-utils.url = "github:numtide/flake-utils"; + poetry2nix.url = "github:nix-community/poetry2nix"; + }; + outputs = { self, nixpkgs, flake-utils, poetry2nix }: + let + allOverlays = [ + poetry2nix.overlay + (final: prev: { + rust-lite = prev.poetry2nix.mkPoetryApplication { + python = prev.python310; + projectDir = ./.; + groups = []; + # We remove `dev` from `checkGroups`, so that poetry2nix does not try to resolve dev dependencies. + checkGroups = []; + }; + }) + ]; + in flake-utils.lib.eachSystem [ + "x86_64-linux" + "x86_64-darwin" + "aarch64-linux" + "aarch64-darwin" + ] (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = allOverlays; + }; + in { + packages = rec { + inherit (pkgs) rust-lite; + default = rust-lite; + }; + }) // { + overlay = nixpkgs.lib.composeManyExtensions allOverlays; + }; +} diff --git a/rust-lite/poetry.lock b/rust-lite/poetry.lock new file mode 100644 index 0000000..5bf344f --- /dev/null +++ b/rust-lite/poetry.lock @@ -0,0 +1,1141 @@ +# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. + +[[package]] +name = "attrs" +version = "24.2.0" +description = "Classes Without Boilerplate" +optional = false +python-versions = ">=3.7" +files = [ + {file = "attrs-24.2.0-py3-none-any.whl", hash = "sha256:81921eb96de3191c8258c199618104dd27ac608d9366f5e35d011eae1867ede2"}, + {file = "attrs-24.2.0.tar.gz", hash = "sha256:5cfb1b9148b5b086569baec03f20d7b6bf3bcacc9a42bebf87ffaaca362f6346"}, +] + +[package.extras] +benchmark = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-codspeed", "pytest-mypy-plugins", "pytest-xdist[psutil]"] +cov = ["cloudpickle", "coverage[toml] (>=5.3)", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] +dev = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] +docs = ["cogapp", "furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier (<24.7)"] +tests = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] +tests-mypy = ["mypy (>=1.11.1)", "pytest-mypy-plugins"] + +[[package]] +name = "autoflake" +version = "2.3.1" +description = "Removes unused imports and unused variables" +optional = false +python-versions = ">=3.8" +files = [ + {file = "autoflake-2.3.1-py3-none-any.whl", hash = "sha256:3ae7495db9084b7b32818b4140e6dc4fc280b712fb414f5b8fe57b0a8e85a840"}, + {file = "autoflake-2.3.1.tar.gz", hash = "sha256:c98b75dc5b0a86459c4f01a1d32ac7eb4338ec4317a4469515ff1e687ecd909e"}, +] + +[package.dependencies] +pyflakes = ">=3.0.0" +tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""} + +[[package]] +name = "black" +version = "24.8.0" +description = "The uncompromising code formatter." +optional = false +python-versions = ">=3.8" +files = [ + {file = "black-24.8.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:09cdeb74d494ec023ded657f7092ba518e8cf78fa8386155e4a03fdcc44679e6"}, + {file = "black-24.8.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:81c6742da39f33b08e791da38410f32e27d632260e599df7245cccee2064afeb"}, + {file = "black-24.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:707a1ca89221bc8a1a64fb5e15ef39cd755633daa672a9db7498d1c19de66a42"}, + {file = "black-24.8.0-cp310-cp310-win_amd64.whl", hash = "sha256:d6417535d99c37cee4091a2f24eb2b6d5ec42b144d50f1f2e436d9fe1916fe1a"}, + {file = "black-24.8.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:fb6e2c0b86bbd43dee042e48059c9ad7830abd5c94b0bc518c0eeec57c3eddc1"}, + {file = "black-24.8.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:837fd281f1908d0076844bc2b801ad2d369c78c45cf800cad7b61686051041af"}, + {file = "black-24.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:62e8730977f0b77998029da7971fa896ceefa2c4c4933fcd593fa599ecbf97a4"}, + {file = "black-24.8.0-cp311-cp311-win_amd64.whl", hash = "sha256:72901b4913cbac8972ad911dc4098d5753704d1f3c56e44ae8dce99eecb0e3af"}, + {file = "black-24.8.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:7c046c1d1eeb7aea9335da62472481d3bbf3fd986e093cffd35f4385c94ae368"}, + {file = "black-24.8.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:649f6d84ccbae73ab767e206772cc2d7a393a001070a4c814a546afd0d423aed"}, + {file = "black-24.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2b59b250fdba5f9a9cd9d0ece6e6d993d91ce877d121d161e4698af3eb9c1018"}, + {file = "black-24.8.0-cp312-cp312-win_amd64.whl", hash = "sha256:6e55d30d44bed36593c3163b9bc63bf58b3b30e4611e4d88a0c3c239930ed5b2"}, + {file = "black-24.8.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:505289f17ceda596658ae81b61ebbe2d9b25aa78067035184ed0a9d855d18afd"}, + {file = "black-24.8.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b19c9ad992c7883ad84c9b22aaa73562a16b819c1d8db7a1a1a49fb7ec13c7d2"}, + {file = "black-24.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1f13f7f386f86f8121d76599114bb8c17b69d962137fc70efe56137727c7047e"}, + {file = "black-24.8.0-cp38-cp38-win_amd64.whl", hash = "sha256:f490dbd59680d809ca31efdae20e634f3fae27fba3ce0ba3208333b713bc3920"}, + {file = "black-24.8.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:eab4dd44ce80dea27dc69db40dab62d4ca96112f87996bca68cd75639aeb2e4c"}, + {file = "black-24.8.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3c4285573d4897a7610054af5a890bde7c65cb466040c5f0c8b732812d7f0e5e"}, + {file = "black-24.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9e84e33b37be070ba135176c123ae52a51f82306def9f7d063ee302ecab2cf47"}, + {file = "black-24.8.0-cp39-cp39-win_amd64.whl", hash = "sha256:73bbf84ed136e45d451a260c6b73ed674652f90a2b3211d6a35e78054563a9bb"}, + {file = "black-24.8.0-py3-none-any.whl", hash = "sha256:972085c618ee94f402da1af548a4f218c754ea7e5dc70acb168bfaca4c2542ed"}, + {file = "black-24.8.0.tar.gz", hash = "sha256:2500945420b6784c38b9ee885af039f5e7471ef284ab03fa35ecdde4688cd83f"}, +] + +[package.dependencies] +click = ">=8.0.0" +mypy-extensions = ">=0.4.3" +packaging = ">=22.0" +pathspec = ">=0.9.0" +platformdirs = ">=2" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""} + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] +jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] +uvloop = ["uvloop (>=0.15.2)"] + +[[package]] +name = "classify-imports" +version = "4.2.0" +description = "Utilities for refactoring imports in python-like syntax." +optional = false +python-versions = ">=3.7" +files = [ + {file = "classify_imports-4.2.0-py2.py3-none-any.whl", hash = "sha256:dbbc264b70a470ed8c6c95976a11dfb8b7f63df44ed1af87328bbed2663f5161"}, + {file = "classify_imports-4.2.0.tar.gz", hash = "sha256:7abfb7ea92149b29d046bd34573d247ba6e68cc28100c801eba4af17964fc40e"}, +] + +[[package]] +name = "click" +version = "8.1.7" +description = "Composable command line interface toolkit" +optional = false +python-versions = ">=3.7" +files = [ + {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"}, + {file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "cmd2" +version = "2.4.3" +description = "cmd2 - quickly build feature-rich and user-friendly interactive command line applications in Python" +optional = false +python-versions = ">=3.6" +files = [ + {file = "cmd2-2.4.3-py3-none-any.whl", hash = "sha256:f1988ff2fff0ed812a2d25218a081b0fa0108d45b48ba2a9272bb98091b654e6"}, + {file = "cmd2-2.4.3.tar.gz", hash = "sha256:71873c11f72bd19e2b1db578214716f0d4f7c8fa250093c601265a9a717dee52"}, +] + +[package.dependencies] +attrs = ">=16.3.0" +pyperclip = ">=1.6" +pyreadline3 = {version = "*", markers = "sys_platform == \"win32\""} +wcwidth = ">=0.1.7" + +[package.extras] +dev = ["codecov", "doc8", "flake8", "invoke", "mypy", "nox", "pytest (>=4.6)", "pytest-cov", "pytest-mock", "sphinx", "sphinx-autobuild", "sphinx-rtd-theme", "twine (>=1.11)"] +test = ["codecov", "coverage", "gnureadline", "pytest (>=4.6)", "pytest-cov", "pytest-mock"] +validate = ["flake8", "mypy", "types-pkg-resources"] + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "coloredlogs" +version = "15.0.1" +description = "Colored terminal output for Python's logging module" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +files = [ + {file = "coloredlogs-15.0.1-py2.py3-none-any.whl", hash = "sha256:612ee75c546f53e92e70049c9dbfcc18c935a2b9a53b66085ce9ef6a6e5c0934"}, + {file = "coloredlogs-15.0.1.tar.gz", hash = "sha256:7c991aa71a4577af2f82600d8f8f3a89f936baeaf9b50a9c197da014e5bf16b0"}, +] + +[package.dependencies] +humanfriendly = ">=9.1" + +[package.extras] +cron = ["capturer (>=2.4)"] + +[[package]] +name = "coverage" +version = "7.6.1" +description = "Code coverage measurement for Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "coverage-7.6.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b06079abebbc0e89e6163b8e8f0e16270124c154dc6e4a47b413dd538859af16"}, + {file = "coverage-7.6.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:cf4b19715bccd7ee27b6b120e7e9dd56037b9c0681dcc1adc9ba9db3d417fa36"}, + {file = "coverage-7.6.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e61c0abb4c85b095a784ef23fdd4aede7a2628478e7baba7c5e3deba61070a02"}, + {file = "coverage-7.6.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fd21f6ae3f08b41004dfb433fa895d858f3f5979e7762d052b12aef444e29afc"}, + {file = "coverage-7.6.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f59d57baca39b32db42b83b2a7ba6f47ad9c394ec2076b084c3f029b7afca23"}, + {file = "coverage-7.6.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:a1ac0ae2b8bd743b88ed0502544847c3053d7171a3cff9228af618a068ed9c34"}, + {file = "coverage-7.6.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e6a08c0be454c3b3beb105c0596ebdc2371fab6bb90c0c0297f4e58fd7e1012c"}, + {file = "coverage-7.6.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:f5796e664fe802da4f57a168c85359a8fbf3eab5e55cd4e4569fbacecc903959"}, + {file = "coverage-7.6.1-cp310-cp310-win32.whl", hash = "sha256:7bb65125fcbef8d989fa1dd0e8a060999497629ca5b0efbca209588a73356232"}, + {file = "coverage-7.6.1-cp310-cp310-win_amd64.whl", hash = "sha256:3115a95daa9bdba70aea750db7b96b37259a81a709223c8448fa97727d546fe0"}, + {file = "coverage-7.6.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7dea0889685db8550f839fa202744652e87c60015029ce3f60e006f8c4462c93"}, + {file = "coverage-7.6.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ed37bd3c3b063412f7620464a9ac1314d33100329f39799255fb8d3027da50d3"}, + {file = "coverage-7.6.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d85f5e9a5f8b73e2350097c3756ef7e785f55bd71205defa0bfdaf96c31616ff"}, + {file = "coverage-7.6.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9bc572be474cafb617672c43fe989d6e48d3c83af02ce8de73fff1c6bb3c198d"}, + {file = "coverage-7.6.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0c0420b573964c760df9e9e86d1a9a622d0d27f417e1a949a8a66dd7bcee7bc6"}, + {file = "coverage-7.6.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1f4aa8219db826ce6be7099d559f8ec311549bfc4046f7f9fe9b5cea5c581c56"}, + {file = "coverage-7.6.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:fc5a77d0c516700ebad189b587de289a20a78324bc54baee03dd486f0855d234"}, + {file = "coverage-7.6.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:b48f312cca9621272ae49008c7f613337c53fadca647d6384cc129d2996d1133"}, + {file = "coverage-7.6.1-cp311-cp311-win32.whl", hash = "sha256:1125ca0e5fd475cbbba3bb67ae20bd2c23a98fac4e32412883f9bcbaa81c314c"}, + {file = "coverage-7.6.1-cp311-cp311-win_amd64.whl", hash = "sha256:8ae539519c4c040c5ffd0632784e21b2f03fc1340752af711f33e5be83a9d6c6"}, + {file = "coverage-7.6.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:95cae0efeb032af8458fc27d191f85d1717b1d4e49f7cb226cf526ff28179778"}, + {file = "coverage-7.6.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:5621a9175cf9d0b0c84c2ef2b12e9f5f5071357c4d2ea6ca1cf01814f45d2391"}, + {file = "coverage-7.6.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:260933720fdcd75340e7dbe9060655aff3af1f0c5d20f46b57f262ab6c86a5e8"}, + {file = "coverage-7.6.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07e2ca0ad381b91350c0ed49d52699b625aab2b44b65e1b4e02fa9df0e92ad2d"}, + {file = "coverage-7.6.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c44fee9975f04b33331cb8eb272827111efc8930cfd582e0320613263ca849ca"}, + {file = "coverage-7.6.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:877abb17e6339d96bf08e7a622d05095e72b71f8afd8a9fefc82cf30ed944163"}, + {file = "coverage-7.6.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:3e0cadcf6733c09154b461f1ca72d5416635e5e4ec4e536192180d34ec160f8a"}, + {file = "coverage-7.6.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c3c02d12f837d9683e5ab2f3d9844dc57655b92c74e286c262e0fc54213c216d"}, + {file = "coverage-7.6.1-cp312-cp312-win32.whl", hash = "sha256:e05882b70b87a18d937ca6768ff33cc3f72847cbc4de4491c8e73880766718e5"}, + {file = "coverage-7.6.1-cp312-cp312-win_amd64.whl", hash = "sha256:b5d7b556859dd85f3a541db6a4e0167b86e7273e1cdc973e5b175166bb634fdb"}, + {file = "coverage-7.6.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:a4acd025ecc06185ba2b801f2de85546e0b8ac787cf9d3b06e7e2a69f925b106"}, + {file = "coverage-7.6.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:a6d3adcf24b624a7b778533480e32434a39ad8fa30c315208f6d3e5542aeb6e9"}, + {file = "coverage-7.6.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d0c212c49b6c10e6951362f7c6df3329f04c2b1c28499563d4035d964ab8e08c"}, + {file = "coverage-7.6.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6e81d7a3e58882450ec4186ca59a3f20a5d4440f25b1cff6f0902ad890e6748a"}, + {file = "coverage-7.6.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:78b260de9790fd81e69401c2dc8b17da47c8038176a79092a89cb2b7d945d060"}, + {file = "coverage-7.6.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a78d169acd38300060b28d600344a803628c3fd585c912cacc9ea8790fe96862"}, + {file = "coverage-7.6.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:2c09f4ce52cb99dd7505cd0fc8e0e37c77b87f46bc9c1eb03fe3bc9991085388"}, + {file = "coverage-7.6.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6878ef48d4227aace338d88c48738a4258213cd7b74fd9a3d4d7582bb1d8a155"}, + {file = "coverage-7.6.1-cp313-cp313-win32.whl", hash = "sha256:44df346d5215a8c0e360307d46ffaabe0f5d3502c8a1cefd700b34baf31d411a"}, + {file = "coverage-7.6.1-cp313-cp313-win_amd64.whl", hash = "sha256:8284cf8c0dd272a247bc154eb6c95548722dce90d098c17a883ed36e67cdb129"}, + {file = "coverage-7.6.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:d3296782ca4eab572a1a4eca686d8bfb00226300dcefdf43faa25b5242ab8a3e"}, + {file = "coverage-7.6.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:502753043567491d3ff6d08629270127e0c31d4184c4c8d98f92c26f65019962"}, + {file = "coverage-7.6.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6a89ecca80709d4076b95f89f308544ec8f7b4727e8a547913a35f16717856cb"}, + {file = "coverage-7.6.1-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a318d68e92e80af8b00fa99609796fdbcdfef3629c77c6283566c6f02c6d6704"}, + {file = "coverage-7.6.1-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:13b0a73a0896988f053e4fbb7de6d93388e6dd292b0d87ee51d106f2c11b465b"}, + {file = "coverage-7.6.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:4421712dbfc5562150f7554f13dde997a2e932a6b5f352edcce948a815efee6f"}, + {file = "coverage-7.6.1-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:166811d20dfea725e2e4baa71fffd6c968a958577848d2131f39b60043400223"}, + {file = "coverage-7.6.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:225667980479a17db1048cb2bf8bfb39b8e5be8f164b8f6628b64f78a72cf9d3"}, + {file = "coverage-7.6.1-cp313-cp313t-win32.whl", hash = "sha256:170d444ab405852903b7d04ea9ae9b98f98ab6d7e63e1115e82620807519797f"}, + {file = "coverage-7.6.1-cp313-cp313t-win_amd64.whl", hash = "sha256:b9f222de8cded79c49bf184bdbc06630d4c58eec9459b939b4a690c82ed05657"}, + {file = "coverage-7.6.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6db04803b6c7291985a761004e9060b2bca08da6d04f26a7f2294b8623a0c1a0"}, + {file = "coverage-7.6.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:f1adfc8ac319e1a348af294106bc6a8458a0f1633cc62a1446aebc30c5fa186a"}, + {file = "coverage-7.6.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a95324a9de9650a729239daea117df21f4b9868ce32e63f8b650ebe6cef5595b"}, + {file = "coverage-7.6.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b43c03669dc4618ec25270b06ecd3ee4fa94c7f9b3c14bae6571ca00ef98b0d3"}, + {file = "coverage-7.6.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8929543a7192c13d177b770008bc4e8119f2e1f881d563fc6b6305d2d0ebe9de"}, + {file = "coverage-7.6.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:a09ece4a69cf399510c8ab25e0950d9cf2b42f7b3cb0374f95d2e2ff594478a6"}, + {file = "coverage-7.6.1-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:9054a0754de38d9dbd01a46621636689124d666bad1936d76c0341f7d71bf569"}, + {file = "coverage-7.6.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:0dbde0f4aa9a16fa4d754356a8f2e36296ff4d83994b2c9d8398aa32f222f989"}, + {file = "coverage-7.6.1-cp38-cp38-win32.whl", hash = "sha256:da511e6ad4f7323ee5702e6633085fb76c2f893aaf8ce4c51a0ba4fc07580ea7"}, + {file = "coverage-7.6.1-cp38-cp38-win_amd64.whl", hash = "sha256:3f1156e3e8f2872197af3840d8ad307a9dd18e615dc64d9ee41696f287c57ad8"}, + {file = "coverage-7.6.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:abd5fd0db5f4dc9289408aaf34908072f805ff7792632250dcb36dc591d24255"}, + {file = "coverage-7.6.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:547f45fa1a93154bd82050a7f3cddbc1a7a4dd2a9bf5cb7d06f4ae29fe94eaf8"}, + {file = "coverage-7.6.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:645786266c8f18a931b65bfcefdbf6952dd0dea98feee39bd188607a9d307ed2"}, + {file = "coverage-7.6.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9e0b2df163b8ed01d515807af24f63de04bebcecbd6c3bfeff88385789fdf75a"}, + {file = "coverage-7.6.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:609b06f178fe8e9f89ef676532760ec0b4deea15e9969bf754b37f7c40326dbc"}, + {file = "coverage-7.6.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:702855feff378050ae4f741045e19a32d57d19f3e0676d589df0575008ea5004"}, + {file = "coverage-7.6.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:2bdb062ea438f22d99cba0d7829c2ef0af1d768d1e4a4f528087224c90b132cb"}, + {file = "coverage-7.6.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:9c56863d44bd1c4fe2abb8a4d6f5371d197f1ac0ebdee542f07f35895fc07f36"}, + {file = "coverage-7.6.1-cp39-cp39-win32.whl", hash = "sha256:6e2cd258d7d927d09493c8df1ce9174ad01b381d4729a9d8d4e38670ca24774c"}, + {file = "coverage-7.6.1-cp39-cp39-win_amd64.whl", hash = "sha256:06a737c882bd26d0d6ee7269b20b12f14a8704807a01056c80bb881a4b2ce6ca"}, + {file = "coverage-7.6.1-pp38.pp39.pp310-none-any.whl", hash = "sha256:e9a6e0eb86070e8ccaedfbd9d38fec54864f3125ab95419970575b42af7541df"}, + {file = "coverage-7.6.1.tar.gz", hash = "sha256:953510dfb7b12ab69d20135a0662397f077c59b1e6379a768e97c59d852ee51d"}, +] + +[package.dependencies] +tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""} + +[package.extras] +toml = ["tomli"] + +[[package]] +name = "dill" +version = "0.3.8" +description = "serialize all of Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "dill-0.3.8-py3-none-any.whl", hash = "sha256:c36ca9ffb54365bdd2f8eb3eff7d2a21237f8452b57ace88b1ac615b7e815bd7"}, + {file = "dill-0.3.8.tar.gz", hash = "sha256:3ebe3c479ad625c4553aca177444d89b486b1d84982eeacded644afc0cf797ca"}, +] + +[package.extras] +graph = ["objgraph (>=1.7.2)"] +profile = ["gprof2dot (>=2022.7.29)"] + +[[package]] +name = "exceptiongroup" +version = "1.2.2" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, + {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "execnet" +version = "2.1.1" +description = "execnet: rapid multi-Python deployment" +optional = false +python-versions = ">=3.8" +files = [ + {file = "execnet-2.1.1-py3-none-any.whl", hash = "sha256:26dee51f1b80cebd6d0ca8e74dd8745419761d3bef34163928cbebbdc4749fdc"}, + {file = "execnet-2.1.1.tar.gz", hash = "sha256:5189b52c6121c24feae288166ab41b32549c7e2348652736540b9e6e7d4e72e3"}, +] + +[package.extras] +testing = ["hatch", "pre-commit", "pytest", "tox"] + +[[package]] +name = "filelock" +version = "3.15.4" +description = "A platform independent file lock." +optional = false +python-versions = ">=3.8" +files = [ + {file = "filelock-3.15.4-py3-none-any.whl", hash = "sha256:6ca1fffae96225dab4c6eaf1c4f4f28cd2568d3ec2a44e15a08520504de468e7"}, + {file = "filelock-3.15.4.tar.gz", hash = "sha256:2207938cbc1844345cb01a5a95524dae30f0ce089eba5b00378295a17e3e90cb"}, +] + +[package.extras] +docs = ["furo (>=2023.9.10)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.3.2)", "diff-cover (>=8.0.1)", "pytest (>=7.4.3)", "pytest-asyncio (>=0.21)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-timeout (>=2.2)", "virtualenv (>=20.26.2)"] +typing = ["typing-extensions (>=4.8)"] + +[[package]] +name = "flake8" +version = "7.1.1" +description = "the modular source code checker: pep8 pyflakes and co" +optional = false +python-versions = ">=3.8.1" +files = [ + {file = "flake8-7.1.1-py2.py3-none-any.whl", hash = "sha256:597477df7860daa5aa0fdd84bf5208a043ab96b8e96ab708770ae0364dd03213"}, + {file = "flake8-7.1.1.tar.gz", hash = "sha256:049d058491e228e03e67b390f311bbf88fce2dbaa8fa673e7aea87b7198b8d38"}, +] + +[package.dependencies] +mccabe = ">=0.7.0,<0.8.0" +pycodestyle = ">=2.12.0,<2.13.0" +pyflakes = ">=3.2.0,<3.3.0" + +[[package]] +name = "flake8-bugbear" +version = "24.8.19" +description = "A plugin for flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle." +optional = false +python-versions = ">=3.8.1" +files = [ + {file = "flake8_bugbear-24.8.19-py3-none-any.whl", hash = "sha256:25bc3867f7338ee3b3e0916bf8b8a0b743f53a9a5175782ddc4325ed4f386b89"}, + {file = "flake8_bugbear-24.8.19.tar.gz", hash = "sha256:9b77627eceda28c51c27af94560a72b5b2c97c016651bdce45d8f56c180d2d32"}, +] + +[package.dependencies] +attrs = ">=19.2.0" +flake8 = ">=6.0.0" + +[package.extras] +dev = ["coverage", "hypothesis", "hypothesmith (>=0.2)", "pre-commit", "pytest", "tox"] + +[[package]] +name = "flake8-comprehensions" +version = "3.15.0" +description = "A flake8 plugin to help you write better list/set/dict comprehensions." +optional = false +python-versions = ">=3.8" +files = [ + {file = "flake8_comprehensions-3.15.0-py3-none-any.whl", hash = "sha256:b7e027bbb52be2ceb779ee12484cdeef52b0ad3c1fcb8846292bdb86d3034681"}, + {file = "flake8_comprehensions-3.15.0.tar.gz", hash = "sha256:923c22603e0310376a6b55b03efebdc09753c69f2d977755cba8bb73458a5d4d"}, +] + +[package.dependencies] +flake8 = ">=3,<3.2 || >3.2" + +[[package]] +name = "flake8-quotes" +version = "3.4.0" +description = "Flake8 lint for quotes." +optional = false +python-versions = "*" +files = [ + {file = "flake8-quotes-3.4.0.tar.gz", hash = "sha256:aad8492fb710a2d3eabe68c5f86a1428de650c8484127e14c43d0504ba30276c"}, +] + +[package.dependencies] +flake8 = "*" +setuptools = "*" + +[[package]] +name = "flake8-type-checking" +version = "2.9.1" +description = "A flake8 plugin for managing type-checking imports & forward references" +optional = false +python-versions = ">=3.8" +files = [ + {file = "flake8_type_checking-2.9.1-py3-none-any.whl", hash = "sha256:9f9be261a2b1f2bbd25e6f14acbcd92d060ec59062af5724ebaa909c8bea0d7b"}, + {file = "flake8_type_checking-2.9.1.tar.gz", hash = "sha256:1a14f300c8e32183cef95798b86a650dc38463664ea10b0bf0884115b47d4cfe"}, +] + +[package.dependencies] +classify-imports = "*" +flake8 = "*" + +[[package]] +name = "graphviz" +version = "0.20.3" +description = "Simple Python interface for Graphviz" +optional = false +python-versions = ">=3.8" +files = [ + {file = "graphviz-0.20.3-py3-none-any.whl", hash = "sha256:81f848f2904515d8cd359cc611faba817598d2feaac4027b266aa3eda7b3dde5"}, + {file = "graphviz-0.20.3.zip", hash = "sha256:09d6bc81e6a9fa392e7ba52135a9d49f1ed62526f96499325930e87ca1b5925d"}, +] + +[package.extras] +dev = ["flake8", "pep8-naming", "tox (>=3)", "twine", "wheel"] +docs = ["sphinx (>=5,<7)", "sphinx-autodoc-typehints", "sphinx-rtd-theme"] +test = ["coverage", "pytest (>=7,<8.1)", "pytest-cov", "pytest-mock (>=3)"] + +[[package]] +name = "humanfriendly" +version = "10.0" +description = "Human friendly output for text interfaces using Python" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +files = [ + {file = "humanfriendly-10.0-py2.py3-none-any.whl", hash = "sha256:1697e1a8a8f550fd43c2865cd84542fc175a61dcb779b6fee18cf6b6ccba1477"}, + {file = "humanfriendly-10.0.tar.gz", hash = "sha256:6b0b831ce8f15f7300721aa49829fc4e83921a9a301cc7f606be6686a2288ddc"}, +] + +[package.dependencies] +pyreadline3 = {version = "*", markers = "sys_platform == \"win32\" and python_version >= \"3.8\""} + +[[package]] +name = "hypothesis" +version = "6.111.1" +description = "A library for property-based testing" +optional = false +python-versions = ">=3.8" +files = [ + {file = "hypothesis-6.111.1-py3-none-any.whl", hash = "sha256:9422adbac4b2104f6cf92dc6604b5c9df975efc08ffc7145ecc39bc617243835"}, + {file = "hypothesis-6.111.1.tar.gz", hash = "sha256:6ab6185a858fa692bf125c0d0a936134edc318bee01c05e407c71c9ead0b61c5"}, +] + +[package.dependencies] +attrs = ">=22.2.0" +exceptiongroup = {version = ">=1.0.0", markers = "python_version < \"3.11\""} +sortedcontainers = ">=2.1.0,<3.0.0" + +[package.extras] +all = ["backports.zoneinfo (>=0.2.1)", "black (>=19.10b0)", "click (>=7.0)", "crosshair-tool (>=0.0.66)", "django (>=3.2)", "dpcontracts (>=0.4)", "hypothesis-crosshair (>=0.0.12)", "lark (>=0.10.1)", "libcst (>=0.3.16)", "numpy (>=1.17.3)", "pandas (>=1.1)", "pytest (>=4.6)", "python-dateutil (>=1.4)", "pytz (>=2014.1)", "redis (>=3.0.0)", "rich (>=9.0.0)", "tzdata (>=2024.1)"] +cli = ["black (>=19.10b0)", "click (>=7.0)", "rich (>=9.0.0)"] +codemods = ["libcst (>=0.3.16)"] +crosshair = ["crosshair-tool (>=0.0.66)", "hypothesis-crosshair (>=0.0.12)"] +dateutil = ["python-dateutil (>=1.4)"] +django = ["django (>=3.2)"] +dpcontracts = ["dpcontracts (>=0.4)"] +ghostwriter = ["black (>=19.10b0)"] +lark = ["lark (>=0.10.1)"] +numpy = ["numpy (>=1.17.3)"] +pandas = ["pandas (>=1.1)"] +pytest = ["pytest (>=4.6)"] +pytz = ["pytz (>=2014.1)"] +redis = ["redis (>=3.0.0)"] +zoneinfo = ["backports.zoneinfo (>=0.2.1)", "tzdata (>=2024.1)"] + +[[package]] +name = "importlib-metadata" +version = "8.4.0" +description = "Read metadata from Python packages" +optional = false +python-versions = ">=3.8" +files = [ + {file = "importlib_metadata-8.4.0-py3-none-any.whl", hash = "sha256:66f342cc6ac9818fc6ff340576acd24d65ba0b3efabb2b4ac08b598965a4a2f1"}, + {file = "importlib_metadata-8.4.0.tar.gz", hash = "sha256:9a547d3bc3608b025f93d403fdd1aae741c24fbb8314df4b155675742ce303c5"}, +] + +[package.dependencies] +zipp = ">=0.5" + +[package.extras] +doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +perf = ["ipython"] +test = ["flufl.flake8", "importlib-resources (>=1.3)", "jaraco.test (>=5.4)", "packaging", "pyfakefs", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-perf (>=0.9.2)", "pytest-ruff (>=0.2.1)"] + +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + +[[package]] +name = "isort" +version = "5.13.2" +description = "A Python utility / library to sort Python imports." +optional = false +python-versions = ">=3.8.0" +files = [ + {file = "isort-5.13.2-py3-none-any.whl", hash = "sha256:8ca5e72a8d85860d5a3fa69b8745237f2939afe12dbf656afbcb47fe72d947a6"}, + {file = "isort-5.13.2.tar.gz", hash = "sha256:48fdfcb9face5d58a4f6dde2e72a1fb8dcaf8ab26f95ab49fab84c2ddefb0109"}, +] + +[package.extras] +colors = ["colorama (>=0.4.6)"] + +[[package]] +name = "kframework" +version = "7.1.102" +description = "" +optional = false +python-versions = "<4.0,>=3.10" +files = [ + {file = "kframework-7.1.102-py3-none-any.whl", hash = "sha256:6518e479f8ae53b83d5ac6891608dd1d22be824e57e3971dd7b6776fb195674e"}, + {file = "kframework-7.1.102.tar.gz", hash = "sha256:17f051454a0636df443023e642aba2f7abb43f8b238e9379e315fc7178822131"}, +] + +[package.dependencies] +cmd2 = ">=2.4.2,<3.0.0" +coloredlogs = ">=15.0.1,<16.0.0" +filelock = ">=3.9.0,<4.0.0" +graphviz = ">=0.20.1,<0.21.0" +hypothesis = ">=6.103.1,<7.0.0" +psutil = "5.9.5" +pybind11 = ">=2.10.3,<3.0.0" +pytest = "*" +textual = ">=0.27.0,<0.28.0" +tomli = ">=2.0.1,<3.0.0" +xdg-base-dirs = ">=6.0.1,<7.0.0" + +[[package]] +name = "linkify-it-py" +version = "2.0.3" +description = "Links recognition library with FULL unicode support." +optional = false +python-versions = ">=3.7" +files = [ + {file = "linkify-it-py-2.0.3.tar.gz", hash = "sha256:68cda27e162e9215c17d786649d1da0021a451bdc436ef9e0fa0ba5234b9b048"}, + {file = "linkify_it_py-2.0.3-py3-none-any.whl", hash = "sha256:6bcbc417b0ac14323382aef5c5192c0075bf8a9d6b41820a2b66371eac6b6d79"}, +] + +[package.dependencies] +uc-micro-py = "*" + +[package.extras] +benchmark = ["pytest", "pytest-benchmark"] +dev = ["black", "flake8", "isort", "pre-commit", "pyproject-flake8"] +doc = ["myst-parser", "sphinx", "sphinx-book-theme"] +test = ["coverage", "pytest", "pytest-cov"] + +[[package]] +name = "markdown-it-py" +version = "2.2.0" +description = "Python port of markdown-it. Markdown parsing, done right!" +optional = false +python-versions = ">=3.7" +files = [ + {file = "markdown-it-py-2.2.0.tar.gz", hash = "sha256:7c9a5e412688bc771c67432cbfebcdd686c93ce6484913dccf06cb5a0bea35a1"}, + {file = "markdown_it_py-2.2.0-py3-none-any.whl", hash = "sha256:5a35f8d1870171d9acc47b99612dc146129b631baf04970128b568f190d0cc30"}, +] + +[package.dependencies] +linkify-it-py = {version = ">=1,<3", optional = true, markers = "extra == \"linkify\""} +mdit-py-plugins = {version = "*", optional = true, markers = "extra == \"plugins\""} +mdurl = ">=0.1,<1.0" + +[package.extras] +benchmarking = ["psutil", "pytest", "pytest-benchmark"] +code-style = ["pre-commit (>=3.0,<4.0)"] +compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "mistletoe (>=1.0,<2.0)", "mistune (>=2.0,<3.0)", "panflute (>=2.3,<3.0)"] +linkify = ["linkify-it-py (>=1,<3)"] +plugins = ["mdit-py-plugins"] +profiling = ["gprof2dot"] +rtd = ["attrs", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx_book_theme"] +testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] + +[[package]] +name = "mccabe" +version = "0.7.0" +description = "McCabe checker, plugin for flake8" +optional = false +python-versions = ">=3.6" +files = [ + {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, + {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, +] + +[[package]] +name = "mdit-py-plugins" +version = "0.4.1" +description = "Collection of plugins for markdown-it-py" +optional = false +python-versions = ">=3.8" +files = [ + {file = "mdit_py_plugins-0.4.1-py3-none-any.whl", hash = "sha256:1020dfe4e6bfc2c79fb49ae4e3f5b297f5ccd20f010187acc52af2921e27dc6a"}, + {file = "mdit_py_plugins-0.4.1.tar.gz", hash = "sha256:834b8ac23d1cd60cec703646ffd22ae97b7955a6d596eb1d304be1e251ae499c"}, +] + +[package.dependencies] +markdown-it-py = ">=1.0.0,<4.0.0" + +[package.extras] +code-style = ["pre-commit"] +rtd = ["myst-parser", "sphinx-book-theme"] +testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] + +[[package]] +name = "mdurl" +version = "0.1.2" +description = "Markdown URL utilities" +optional = false +python-versions = ">=3.7" +files = [ + {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, + {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, +] + +[[package]] +name = "multiprocess" +version = "0.70.16" +description = "better multiprocessing and multithreading in Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "multiprocess-0.70.16-pp310-pypy310_pp73-macosx_10_13_x86_64.whl", hash = "sha256:476887be10e2f59ff183c006af746cb6f1fd0eadcfd4ef49e605cbe2659920ee"}, + {file = "multiprocess-0.70.16-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:d951bed82c8f73929ac82c61f01a7b5ce8f3e5ef40f5b52553b4f547ce2b08ec"}, + {file = "multiprocess-0.70.16-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:37b55f71c07e2d741374998c043b9520b626a8dddc8b3129222ca4f1a06ef67a"}, + {file = "multiprocess-0.70.16-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:ba8c31889abf4511c7308a8c52bb4a30b9d590e7f58523302ba00237702ca054"}, + {file = "multiprocess-0.70.16-pp39-pypy39_pp73-macosx_10_13_x86_64.whl", hash = "sha256:0dfd078c306e08d46d7a8d06fb120313d87aa43af60d66da43ffff40b44d2f41"}, + {file = "multiprocess-0.70.16-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:e7b9d0f307cd9bd50851afaac0dba2cb6c44449efff697df7c7645f7d3f2be3a"}, + {file = "multiprocess-0.70.16-py310-none-any.whl", hash = "sha256:c4a9944c67bd49f823687463660a2d6daae94c289adff97e0f9d696ba6371d02"}, + {file = "multiprocess-0.70.16-py311-none-any.whl", hash = "sha256:af4cabb0dac72abfb1e794fa7855c325fd2b55a10a44628a3c1ad3311c04127a"}, + {file = "multiprocess-0.70.16-py312-none-any.whl", hash = "sha256:fc0544c531920dde3b00c29863377f87e1632601092ea2daca74e4beb40faa2e"}, + {file = "multiprocess-0.70.16-py38-none-any.whl", hash = "sha256:a71d82033454891091a226dfc319d0cfa8019a4e888ef9ca910372a446de4435"}, + {file = "multiprocess-0.70.16-py39-none-any.whl", hash = "sha256:a0bafd3ae1b732eac64be2e72038231c1ba97724b60b09400d68f229fcc2fbf3"}, + {file = "multiprocess-0.70.16.tar.gz", hash = "sha256:161af703d4652a0e1410be6abccecde4a7ddffd19341be0a7011b94aeb171ac1"}, +] + +[package.dependencies] +dill = ">=0.3.8" + +[[package]] +name = "mypy" +version = "1.11.1" +description = "Optional static typing for Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "mypy-1.11.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a32fc80b63de4b5b3e65f4be82b4cfa362a46702672aa6a0f443b4689af7008c"}, + {file = "mypy-1.11.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c1952f5ea8a5a959b05ed5f16452fddadbaae48b5d39235ab4c3fc444d5fd411"}, + {file = "mypy-1.11.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e1e30dc3bfa4e157e53c1d17a0dad20f89dc433393e7702b813c10e200843b03"}, + {file = "mypy-1.11.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:2c63350af88f43a66d3dfeeeb8d77af34a4f07d760b9eb3a8697f0386c7590b4"}, + {file = "mypy-1.11.1-cp310-cp310-win_amd64.whl", hash = "sha256:a831671bad47186603872a3abc19634f3011d7f83b083762c942442d51c58d58"}, + {file = "mypy-1.11.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7b6343d338390bb946d449677726edf60102a1c96079b4f002dedff375953fc5"}, + {file = "mypy-1.11.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e4fe9f4e5e521b458d8feb52547f4bade7ef8c93238dfb5bbc790d9ff2d770ca"}, + {file = "mypy-1.11.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:886c9dbecc87b9516eff294541bf7f3655722bf22bb898ee06985cd7269898de"}, + {file = "mypy-1.11.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:fca4a60e1dd9fd0193ae0067eaeeb962f2d79e0d9f0f66223a0682f26ffcc809"}, + {file = "mypy-1.11.1-cp311-cp311-win_amd64.whl", hash = "sha256:0bd53faf56de9643336aeea1c925012837432b5faf1701ccca7fde70166ccf72"}, + {file = "mypy-1.11.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:f39918a50f74dc5969807dcfaecafa804fa7f90c9d60506835036cc1bc891dc8"}, + {file = "mypy-1.11.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0bc71d1fb27a428139dd78621953effe0d208aed9857cb08d002280b0422003a"}, + {file = "mypy-1.11.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b868d3bcff720dd7217c383474008ddabaf048fad8d78ed948bb4b624870a417"}, + {file = "mypy-1.11.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:a707ec1527ffcdd1c784d0924bf5cb15cd7f22683b919668a04d2b9c34549d2e"}, + {file = "mypy-1.11.1-cp312-cp312-win_amd64.whl", hash = "sha256:64f4a90e3ea07f590c5bcf9029035cf0efeae5ba8be511a8caada1a4893f5525"}, + {file = "mypy-1.11.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:749fd3213916f1751fff995fccf20c6195cae941dc968f3aaadf9bb4e430e5a2"}, + {file = "mypy-1.11.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b639dce63a0b19085213ec5fdd8cffd1d81988f47a2dec7100e93564f3e8fb3b"}, + {file = "mypy-1.11.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4c956b49c5d865394d62941b109728c5c596a415e9c5b2be663dd26a1ff07bc0"}, + {file = "mypy-1.11.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:45df906e8b6804ef4b666af29a87ad9f5921aad091c79cc38e12198e220beabd"}, + {file = "mypy-1.11.1-cp38-cp38-win_amd64.whl", hash = "sha256:d44be7551689d9d47b7abc27c71257adfdb53f03880841a5db15ddb22dc63edb"}, + {file = "mypy-1.11.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:2684d3f693073ab89d76da8e3921883019ea8a3ec20fa5d8ecca6a2db4c54bbe"}, + {file = "mypy-1.11.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:79c07eb282cb457473add5052b63925e5cc97dfab9812ee65a7c7ab5e3cb551c"}, + {file = "mypy-1.11.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:11965c2f571ded6239977b14deebd3f4c3abd9a92398712d6da3a772974fad69"}, + {file = "mypy-1.11.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a2b43895a0f8154df6519706d9bca8280cda52d3d9d1514b2d9c3e26792a0b74"}, + {file = "mypy-1.11.1-cp39-cp39-win_amd64.whl", hash = "sha256:1a81cf05975fd61aec5ae16501a091cfb9f605dc3e3c878c0da32f250b74760b"}, + {file = "mypy-1.11.1-py3-none-any.whl", hash = "sha256:0624bdb940255d2dd24e829d99a13cfeb72e4e9031f9492148f410ed30bcab54"}, + {file = "mypy-1.11.1.tar.gz", hash = "sha256:f404a0b069709f18bbdb702eb3dcfe51910602995de00bd39cea3050b5772d08"}, +] + +[package.dependencies] +mypy-extensions = ">=1.0.0" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typing-extensions = ">=4.6.0" + +[package.extras] +dmypy = ["psutil (>=4.0)"] +install-types = ["pip"] +mypyc = ["setuptools (>=50)"] +reports = ["lxml"] + +[[package]] +name = "mypy-extensions" +version = "1.0.0" +description = "Type system extensions for programs checked with the mypy type checker." +optional = false +python-versions = ">=3.5" +files = [ + {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, + {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, +] + +[[package]] +name = "packaging" +version = "24.1" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.8" +files = [ + {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, + {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, +] + +[[package]] +name = "pathos" +version = "0.3.2" +description = "parallel graph management and execution in heterogeneous computing" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pathos-0.3.2-py3-none-any.whl", hash = "sha256:d669275e6eb4b3fbcd2846d7a6d1bba315fe23add0c614445ba1408d8b38bafe"}, + {file = "pathos-0.3.2.tar.gz", hash = "sha256:4f2a42bc1e10ccf0fe71961e7145fc1437018b6b21bd93b2446abc3983e49a7a"}, +] + +[package.dependencies] +dill = ">=0.3.8" +multiprocess = ">=0.70.16" +pox = ">=0.3.4" +ppft = ">=1.7.6.8" + +[[package]] +name = "pathspec" +version = "0.12.1" +description = "Utility library for gitignore style pattern matching of file paths." +optional = false +python-versions = ">=3.8" +files = [ + {file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"}, + {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, +] + +[[package]] +name = "pep8-naming" +version = "0.14.1" +description = "Check PEP-8 naming conventions, plugin for flake8" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pep8-naming-0.14.1.tar.gz", hash = "sha256:1ef228ae80875557eb6c1549deafed4dabbf3261cfcafa12f773fe0db9be8a36"}, + {file = "pep8_naming-0.14.1-py3-none-any.whl", hash = "sha256:63f514fc777d715f935faf185dedd679ab99526a7f2f503abb61587877f7b1c5"}, +] + +[package.dependencies] +flake8 = ">=5.0.0" + +[[package]] +name = "platformdirs" +version = "4.2.2" +description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." +optional = false +python-versions = ">=3.8" +files = [ + {file = "platformdirs-4.2.2-py3-none-any.whl", hash = "sha256:2d7a1657e36a80ea911db832a8a6ece5ee53d8de21edd5cc5879af6530b1bfee"}, + {file = "platformdirs-4.2.2.tar.gz", hash = "sha256:38b7b51f512eed9e84a22788b4bce1de17c0adb134d6becb09836e37d8654cd3"}, +] + +[package.extras] +docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"] +type = ["mypy (>=1.8)"] + +[[package]] +name = "pluggy" +version = "1.5.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, + {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "pox" +version = "0.3.4" +description = "utilities for filesystem exploration and automated builds" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pox-0.3.4-py3-none-any.whl", hash = "sha256:651b8ae8a7b341b7bfd267f67f63106daeb9805f1ac11f323d5280d2da93fdb6"}, + {file = "pox-0.3.4.tar.gz", hash = "sha256:16e6eca84f1bec3828210b06b052adf04cf2ab20c22fd6fbef5f78320c9a6fed"}, +] + +[[package]] +name = "ppft" +version = "1.7.6.8" +description = "distributed and parallel Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "ppft-1.7.6.8-py3-none-any.whl", hash = "sha256:de2dd4b1b080923dd9627fbdea52649fd741c752fce4f3cf37e26f785df23d9b"}, + {file = "ppft-1.7.6.8.tar.gz", hash = "sha256:76a429a7d7b74c4d743f6dba8351e58d62b6432ed65df9fe204790160dab996d"}, +] + +[package.extras] +dill = ["dill (>=0.3.8)"] + +[[package]] +name = "psutil" +version = "5.9.5" +description = "Cross-platform lib for process and system monitoring in Python." +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +files = [ + {file = "psutil-5.9.5-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:be8929ce4313f9f8146caad4272f6abb8bf99fc6cf59344a3167ecd74f4f203f"}, + {file = "psutil-5.9.5-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:ab8ed1a1d77c95453db1ae00a3f9c50227ebd955437bcf2a574ba8adbf6a74d5"}, + {file = "psutil-5.9.5-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:4aef137f3345082a3d3232187aeb4ac4ef959ba3d7c10c33dd73763fbc063da4"}, + {file = "psutil-5.9.5-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:ea8518d152174e1249c4f2a1c89e3e6065941df2fa13a1ab45327716a23c2b48"}, + {file = "psutil-5.9.5-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:acf2aef9391710afded549ff602b5887d7a2349831ae4c26be7c807c0a39fac4"}, + {file = "psutil-5.9.5-cp27-none-win32.whl", hash = "sha256:5b9b8cb93f507e8dbaf22af6a2fd0ccbe8244bf30b1baad6b3954e935157ae3f"}, + {file = "psutil-5.9.5-cp27-none-win_amd64.whl", hash = "sha256:8c5f7c5a052d1d567db4ddd231a9d27a74e8e4a9c3f44b1032762bd7b9fdcd42"}, + {file = "psutil-5.9.5-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:3c6f686f4225553615612f6d9bc21f1c0e305f75d7d8454f9b46e901778e7217"}, + {file = "psutil-5.9.5-cp36-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7a7dd9997128a0d928ed4fb2c2d57e5102bb6089027939f3b722f3a210f9a8da"}, + {file = "psutil-5.9.5-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:89518112647f1276b03ca97b65cc7f64ca587b1eb0278383017c2a0dcc26cbe4"}, + {file = "psutil-5.9.5-cp36-abi3-win32.whl", hash = "sha256:104a5cc0e31baa2bcf67900be36acde157756b9c44017b86b2c049f11957887d"}, + {file = "psutil-5.9.5-cp36-abi3-win_amd64.whl", hash = "sha256:b258c0c1c9d145a1d5ceffab1134441c4c5113b2417fafff7315a917a026c3c9"}, + {file = "psutil-5.9.5-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:c607bb3b57dc779d55e1554846352b4e358c10fff3abf3514a7a6601beebdb30"}, + {file = "psutil-5.9.5.tar.gz", hash = "sha256:5410638e4df39c54d957fc51ce03048acd8e6d60abc0f5107af51e5fb566eb3c"}, +] + +[package.extras] +test = ["enum34", "ipaddress", "mock", "pywin32", "wmi"] + +[[package]] +name = "pybind11" +version = "2.13.4" +description = "Seamless operability between C++11 and Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pybind11-2.13.4-py3-none-any.whl", hash = "sha256:5932d63d570b3a12ece2f6678adb3846cc1c229dc1f8518a46d5b540f240f959"}, + {file = "pybind11-2.13.4.tar.gz", hash = "sha256:75a9e1f967d3cd3fd59f981eb39406f9de05e33a4dd8f5f18b8e29cae023e1d5"}, +] + +[package.extras] +global = ["pybind11-global (==2.13.4)"] + +[[package]] +name = "pycodestyle" +version = "2.12.1" +description = "Python style guide checker" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pycodestyle-2.12.1-py2.py3-none-any.whl", hash = "sha256:46f0fb92069a7c28ab7bb558f05bfc0110dac69a0cd23c61ea0040283a9d78b3"}, + {file = "pycodestyle-2.12.1.tar.gz", hash = "sha256:6838eae08bbce4f6accd5d5572075c63626a15ee3e6f842df996bf62f6d73521"}, +] + +[[package]] +name = "pyflakes" +version = "3.2.0" +description = "passive checker of Python programs" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pyflakes-3.2.0-py2.py3-none-any.whl", hash = "sha256:84b5be138a2dfbb40689ca07e2152deb896a65c3a3e24c251c5c62489568074a"}, + {file = "pyflakes-3.2.0.tar.gz", hash = "sha256:1c61603ff154621fb2a9172037d84dca3500def8c8b630657d1701f026f8af3f"}, +] + +[[package]] +name = "pygments" +version = "2.18.0" +description = "Pygments is a syntax highlighting package written in Python." +optional = false +python-versions = ">=3.8" +files = [ + {file = "pygments-2.18.0-py3-none-any.whl", hash = "sha256:b8e6aca0523f3ab76fee51799c488e38782ac06eafcf95e7ba832985c8e7b13a"}, + {file = "pygments-2.18.0.tar.gz", hash = "sha256:786ff802f32e91311bff3889f6e9a86e81505fe99f2735bb6d60ae0c5004f199"}, +] + +[package.extras] +windows-terminal = ["colorama (>=0.4.6)"] + +[[package]] +name = "pyperclip" +version = "1.9.0" +description = "A cross-platform clipboard module for Python. (Only handles plain text for now.)" +optional = false +python-versions = "*" +files = [ + {file = "pyperclip-1.9.0.tar.gz", hash = "sha256:b7de0142ddc81bfc5c7507eea19da920b92252b548b96186caf94a5e2527d310"}, +] + +[[package]] +name = "pyreadline3" +version = "3.4.1" +description = "A python implementation of GNU readline." +optional = false +python-versions = "*" +files = [ + {file = "pyreadline3-3.4.1-py3-none-any.whl", hash = "sha256:b0efb6516fd4fb07b45949053826a62fa4cb353db5be2bbb4a7aa1fdd1e345fb"}, + {file = "pyreadline3-3.4.1.tar.gz", hash = "sha256:6f3d1f7b8a31ba32b73917cefc1f28cc660562f39aea8646d30bd6eff21f7bae"}, +] + +[[package]] +name = "pytest" +version = "8.3.2" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest-8.3.2-py3-none-any.whl", hash = "sha256:4ba08f9ae7dcf84ded419494d229b48d0903ea6407b030eaec46df5e6a73bba5"}, + {file = "pytest-8.3.2.tar.gz", hash = "sha256:c132345d12ce551242c87269de812483f5bcc87cdbb4722e48487ba194f9fdce"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=1.5,<2" +tomli = {version = ">=1", markers = "python_version < \"3.11\""} + +[package.extras] +dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "pytest-cov" +version = "5.0.0" +description = "Pytest plugin for measuring coverage." +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest-cov-5.0.0.tar.gz", hash = "sha256:5837b58e9f6ebd335b0f8060eecce69b662415b16dc503883a02f45dfeb14857"}, + {file = "pytest_cov-5.0.0-py3-none-any.whl", hash = "sha256:4f0764a1219df53214206bf1feea4633c3b558a2925c8b59f144f682861ce652"}, +] + +[package.dependencies] +coverage = {version = ">=5.2.1", extras = ["toml"]} +pytest = ">=4.6" + +[package.extras] +testing = ["fields", "hunter", "process-tests", "pytest-xdist", "virtualenv"] + +[[package]] +name = "pytest-mock" +version = "3.14.0" +description = "Thin-wrapper around the mock package for easier use with pytest" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest-mock-3.14.0.tar.gz", hash = "sha256:2719255a1efeceadbc056d6bf3df3d1c5015530fb40cf347c0f9afac88410bd0"}, + {file = "pytest_mock-3.14.0-py3-none-any.whl", hash = "sha256:0b72c38033392a5f4621342fe11e9219ac11ec9d375f8e2a0c164539e0d70f6f"}, +] + +[package.dependencies] +pytest = ">=6.2.5" + +[package.extras] +dev = ["pre-commit", "pytest-asyncio", "tox"] + +[[package]] +name = "pytest-xdist" +version = "3.6.1" +description = "pytest xdist plugin for distributed testing, most importantly across multiple CPUs" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest_xdist-3.6.1-py3-none-any.whl", hash = "sha256:9ed4adfb68a016610848639bb7e02c9352d5d9f03d04809919e2dafc3be4cca7"}, + {file = "pytest_xdist-3.6.1.tar.gz", hash = "sha256:ead156a4db231eec769737f57668ef58a2084a34b2e55c4a8fa20d861107300d"}, +] + +[package.dependencies] +execnet = ">=2.1" +pytest = ">=7.0.0" + +[package.extras] +psutil = ["psutil (>=3.0)"] +setproctitle = ["setproctitle"] +testing = ["filelock"] + +[[package]] +name = "pyupgrade" +version = "3.17.0" +description = "A tool to automatically upgrade syntax for newer versions." +optional = false +python-versions = ">=3.9" +files = [ + {file = "pyupgrade-3.17.0-py2.py3-none-any.whl", hash = "sha256:cbc8f67a61d3f4e7ca9c2ef57b9aae67f023d3780ce30c99fccec78401723754"}, + {file = "pyupgrade-3.17.0.tar.gz", hash = "sha256:d5dd1dcaf9a016c31508bb9d3d09fd335d736578092f91df52bb26ac30c37919"}, +] + +[package.dependencies] +tokenize-rt = ">=5.2.0" + +[[package]] +name = "rich" +version = "13.7.1" +description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" +optional = false +python-versions = ">=3.7.0" +files = [ + {file = "rich-13.7.1-py3-none-any.whl", hash = "sha256:4edbae314f59eb482f54e9e30bf00d33350aaa94f4bfcd4e9e3110e64d0d7222"}, + {file = "rich-13.7.1.tar.gz", hash = "sha256:9be308cb1fe2f1f57d67ce99e95af38a1e2bc71ad9813b0e247cf7ffbcc3a432"}, +] + +[package.dependencies] +markdown-it-py = ">=2.2.0" +pygments = ">=2.13.0,<3.0.0" + +[package.extras] +jupyter = ["ipywidgets (>=7.5.1,<9)"] + +[[package]] +name = "setuptools" +version = "73.0.1" +description = "Easily download, build, install, upgrade, and uninstall Python packages" +optional = false +python-versions = ">=3.8" +files = [ + {file = "setuptools-73.0.1-py3-none-any.whl", hash = "sha256:b208925fcb9f7af924ed2dc04708ea89791e24bde0d3020b27df0e116088b34e"}, + {file = "setuptools-73.0.1.tar.gz", hash = "sha256:d59a3e788ab7e012ab2c4baed1b376da6366883ee20d7a5fc426816e3d7b1193"}, +] + +[package.extras] +core = ["importlib-metadata (>=6)", "importlib-resources (>=5.10.2)", "jaraco.text (>=3.7)", "more-itertools (>=8.8)", "packaging (>=24)", "platformdirs (>=2.6.2)", "tomli (>=2.0.1)", "wheel (>=0.43.0)"] +doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "pyproject-hooks (!=1.1)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier", "towncrier (<24.7)"] +test = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "importlib-metadata", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "jaraco.test", "mypy (==1.11.*)", "packaging (>=23.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-home (>=0.5)", "pytest-mypy", "pytest-perf", "pytest-ruff (<0.4)", "pytest-ruff (>=0.2.1)", "pytest-ruff (>=0.3.2)", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel (>=0.44.0)"] + +[[package]] +name = "sortedcontainers" +version = "2.4.0" +description = "Sorted Containers -- Sorted List, Sorted Dict, Sorted Set" +optional = false +python-versions = "*" +files = [ + {file = "sortedcontainers-2.4.0-py2.py3-none-any.whl", hash = "sha256:a163dcaede0f1c021485e957a39245190e74249897e2ae4b2aa38595db237ee0"}, + {file = "sortedcontainers-2.4.0.tar.gz", hash = "sha256:25caa5a06cc30b6b83d11423433f65d1f9d76c4c6a0c90e3379eaa43b9bfdb88"}, +] + +[[package]] +name = "textual" +version = "0.27.0" +description = "Modern Text User Interface framework" +optional = false +python-versions = ">=3.7,<4.0" +files = [ + {file = "textual-0.27.0-py3-none-any.whl", hash = "sha256:dc45eaf7da330686c56d6f76f59d05fd216ce6aad90fa44ee269881efc622151"}, + {file = "textual-0.27.0.tar.gz", hash = "sha256:8bdcb09dc35a706ef939b1276ccfdec10eaaee6147b41cb7587cf33298a8dd33"}, +] + +[package.dependencies] +importlib-metadata = ">=4.11.3" +markdown-it-py = {version = ">=2.1.0,<3.0.0", extras = ["linkify", "plugins"]} +rich = ">=13.3.3" +typing-extensions = ">=4.4.0,<5.0.0" + +[package.extras] +dev = ["aiohttp (>=3.8.1)", "click (>=8.1.2)", "msgpack (>=1.0.3)"] + +[[package]] +name = "tokenize-rt" +version = "6.0.0" +description = "A wrapper around the stdlib `tokenize` which roundtrips." +optional = false +python-versions = ">=3.8" +files = [ + {file = "tokenize_rt-6.0.0-py2.py3-none-any.whl", hash = "sha256:d4ff7ded2873512938b4f8cbb98c9b07118f01d30ac585a30d7a88353ca36d22"}, + {file = "tokenize_rt-6.0.0.tar.gz", hash = "sha256:b9711bdfc51210211137499b5e355d3de5ec88a85d2025c520cbb921b5194367"}, +] + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] + +[[package]] +name = "tomlkit" +version = "0.11.8" +description = "Style preserving TOML library" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomlkit-0.11.8-py3-none-any.whl", hash = "sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171"}, + {file = "tomlkit-0.11.8.tar.gz", hash = "sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3"}, +] + +[[package]] +name = "typing-extensions" +version = "4.12.2" +description = "Backported and Experimental Type Hints for Python 3.8+" +optional = false +python-versions = ">=3.8" +files = [ + {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, + {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, +] + +[[package]] +name = "uc-micro-py" +version = "1.0.3" +description = "Micro subset of unicode data files for linkify-it-py projects." +optional = false +python-versions = ">=3.7" +files = [ + {file = "uc-micro-py-1.0.3.tar.gz", hash = "sha256:d321b92cff673ec58027c04015fcaa8bb1e005478643ff4a500882eaab88c48a"}, + {file = "uc_micro_py-1.0.3-py3-none-any.whl", hash = "sha256:db1dffff340817673d7b466ec86114a9dc0e9d4d9b5ba229d9d60e5c12600cd5"}, +] + +[package.extras] +test = ["coverage", "pytest", "pytest-cov"] + +[[package]] +name = "wcwidth" +version = "0.2.13" +description = "Measures the displayed width of unicode strings in a terminal" +optional = false +python-versions = "*" +files = [ + {file = "wcwidth-0.2.13-py2.py3-none-any.whl", hash = "sha256:3da69048e4540d84af32131829ff948f1e022c1c6bdb8d6102117aac784f6859"}, + {file = "wcwidth-0.2.13.tar.gz", hash = "sha256:72ea0c06399eb286d978fdedb6923a9eb47e1c486ce63e9b4e64fc18303972b5"}, +] + +[[package]] +name = "xdg-base-dirs" +version = "6.0.1" +description = "Variables defined by the XDG Base Directory Specification" +optional = false +python-versions = ">=3.10,<4.0" +files = [ + {file = "xdg_base_dirs-6.0.1-py3-none-any.whl", hash = "sha256:63f6ebc1721ced2e86c340856e004ef829501a30a37e17079c52cfaf0e1741b9"}, + {file = "xdg_base_dirs-6.0.1.tar.gz", hash = "sha256:b4c8f4ba72d1286018b25eea374ec6fbf4fddda3d4137edf50de95de53e195a6"}, +] + +[[package]] +name = "zipp" +version = "3.20.0" +description = "Backport of pathlib-compatible object wrapper for zip files" +optional = false +python-versions = ">=3.8" +files = [ + {file = "zipp-3.20.0-py3-none-any.whl", hash = "sha256:58da6168be89f0be59beb194da1250516fdaa062ccebd30127ac65d30045e10d"}, + {file = "zipp-3.20.0.tar.gz", hash = "sha256:0145e43d89664cfe1a2e533adc75adafed82fe2da404b4bbb6b026c0157bdb31"}, +] + +[package.extras] +doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-itertools", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy", "pytest-ruff (>=0.2.1)"] + +[metadata] +lock-version = "2.0" +python-versions = "^3.10" +content-hash = "2bce5a69897baa33424c68df52ef86f851ff69ac381a8531c030708a8bae1a56" diff --git a/rust-lite/pyproject.toml b/rust-lite/pyproject.toml new file mode 100644 index 0000000..6e5d155 --- /dev/null +++ b/rust-lite/pyproject.toml @@ -0,0 +1,56 @@ +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry] +name = "rust-lite" +version = "0.1.0" +description = "Pyk scripts for running our Rust Lite Semantics" +authors = [ + "Runtime Verification, Inc. ", +] + +[tool.poetry.dependencies] +python = "^3.10" +pathos = "*" +kframework = "7.1.102" +tomlkit = "^0.11.6" + +[tool.poetry.group.dev.dependencies] +autoflake = "*" +black = "*" +flake8 = "*" +flake8-bugbear = "*" +flake8-comprehensions = "*" +flake8-quotes = "*" +flake8-type-checking = "*" +isort = "*" +mypy = "*" +pep8-naming = "*" +pytest = "*" +pytest-cov = "*" +pytest-mock = "*" +pytest-xdist = "*" +pyupgrade = "*" + +[tool.poetry.scripts] +rust = "rust_lite.__main__:main" + +[tool.isort] +profile = "black" +line_length = 120 + +[tool.autoflake] +recursive = true +expand-star-imports = true +remove-all-unused-imports = true +ignore-init-module-imports = true +remove-duplicate-keys = true +remove-unused-variables = true + +[tool.black] +line-length = 120 +skip-string-normalization = true + +[tool.mypy] +disallow_untyped_defs = true diff --git a/rust-lite/src/rust_lite/__init__.py b/rust-lite/src/rust_lite/__init__.py new file mode 100644 index 0000000..8770182 --- /dev/null +++ b/rust-lite/src/rust_lite/__init__.py @@ -0,0 +1,8 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from typing import Final + +VERSION: Final = '0.1.0' \ No newline at end of file diff --git a/rust-lite/src/rust_lite/__main__.py b/rust-lite/src/rust_lite/__main__.py new file mode 100644 index 0000000..f20e6b0 --- /dev/null +++ b/rust-lite/src/rust_lite/__main__.py @@ -0,0 +1,33 @@ +from __future__ import annotations + +import contextlib +import json +import logging +import sys +from collections.abc import Iterable +from typing import TYPE_CHECKING + +from .manager import RustLiteManager + +from . import VERSION + +if TYPE_CHECKING: + from argparse import Namespace + from collections.abc import Callable, Iterator + from typing import Any, Final, TypeVar + + T = TypeVar('T') + +_LOGGER: Final = logging.getLogger(__name__) +_LOG_FORMAT: Final = '%(levelname)s %(asctime)s %(name)s - %(message)s' + + +def main() -> None: + print("Instantiating module manager") + + module_manager = RustLiteManager() + + print("Module manager initiated") + + pass + diff --git a/rust-lite/src/rust_lite/manager.py b/rust-lite/src/rust_lite/manager.py new file mode 100644 index 0000000..476b0bc --- /dev/null +++ b/rust-lite/src/rust_lite/manager.py @@ -0,0 +1,45 @@ +from __future__ import annotations + +import contextlib +import json +import logging +import sys +from collections.abc import Iterable +from typing import TYPE_CHECKING +from pathlib import Path + +from pathos.pools import ProcessPool # type: ignore +from pyk.cli.pyk import parse_toml_args +from pyk.kast.inner import KApply, KSequence, KSort, KToken, Subst +from pyk.cterm import CTerm +from pyk.ktool.krun import KRun +from pyk.prelude.k import GENERATED_TOP_CELL +from pyk.kdist import kdist +from pyk.kore.prelude import top_cell_initializer +from pyk.kore.tools import kore_print +from pyk.utils import FrozenDict + +class RustLiteManager(): + krun: KRun + cterm: CTerm + + def __init__(self) -> None: + dir_path = Path(f'../.build/rust-kompiled') + self.krun = KRun(dir_path) + self._init_cterm() + + def _init_cterm(self) -> None: + self.krun.definition.empty_config(GENERATED_TOP_CELL) + + # init_subst = { + # '$PGM': KSequence([KEVM.sharp_execute()]), + # '$MODE': KApply('NORMAL'), + # '$SCHEDULE': KApply('SHANGHAI_EVM'), + # '$USEGAS': TRUE, + # '$CHAINID': intToken(0), + # } + + # init_config = set_cell(init_config, 'ACCOUNTS_CELL', KEVM.accounts(init_accounts_list)) + + # init_term = Subst(init_subst)(init_config) + # self.cterm = CTerm.from_kast(init_term) diff --git a/rust-lite/src/tests/__init__.py b/rust-lite/src/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/rust-lite/src/tests/integration/__init__.py b/rust-lite/src/tests/integration/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/rust-lite/src/tests/integration/test_integration.py b/rust-lite/src/tests/integration/test_integration.py new file mode 100644 index 0000000..9d1a72e --- /dev/null +++ b/rust-lite/src/tests/integration/test_integration.py @@ -0,0 +1,5 @@ +from rust_lite.hello import hello + + +def test_hello() -> None: + assert hello('World') == 'Hello, World!' diff --git a/rust-lite/src/tests/unit/__init__.py b/rust-lite/src/tests/unit/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/rust-lite/src/tests/unit/test_unit.py b/rust-lite/src/tests/unit/test_unit.py new file mode 100644 index 0000000..9d1a72e --- /dev/null +++ b/rust-lite/src/tests/unit/test_unit.py @@ -0,0 +1,5 @@ +from rust_lite.hello import hello + + +def test_hello() -> None: + assert hello('World') == 'Hello, World!' From 9c4c353de3676ab3d2634a53829433db0084a2ec Mon Sep 17 00:00:00 2001 From: acassimiro Date: Wed, 21 Aug 2024 20:08:11 -0300 Subject: [PATCH 02/11] Adding the capabilities to load data into the K cell --- rust-lite/src/rust_lite/__main__.py | 11 +++++++--- rust-lite/src/rust_lite/manager.py | 32 ++++++++++++++++++----------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/rust-lite/src/rust_lite/__main__.py b/rust-lite/src/rust_lite/__main__.py index f20e6b0..1e5ac84 100644 --- a/rust-lite/src/rust_lite/__main__.py +++ b/rust-lite/src/rust_lite/__main__.py @@ -23,11 +23,16 @@ def main() -> None: - print("Instantiating module manager") + print("Instantiating module manager;") module_manager = RustLiteManager() - print("Module manager initiated") + print("Module manager initiated; Trying to load program into K cell;") - pass + module_manager.load_program("Test") + + print("Program loaded; Trying to fetch the content of the K cell.") + + module_manager.fetch_k_cell_content() + diff --git a/rust-lite/src/rust_lite/manager.py b/rust-lite/src/rust_lite/manager.py index 476b0bc..0736671 100644 --- a/rust-lite/src/rust_lite/manager.py +++ b/rust-lite/src/rust_lite/manager.py @@ -4,6 +4,7 @@ import json import logging import sys +import pprint from collections.abc import Iterable from typing import TYPE_CHECKING from pathlib import Path @@ -11,6 +12,7 @@ from pathos.pools import ProcessPool # type: ignore from pyk.cli.pyk import parse_toml_args from pyk.kast.inner import KApply, KSequence, KSort, KToken, Subst +from pyk.kast.manip import set_cell from pyk.cterm import CTerm from pyk.ktool.krun import KRun from pyk.prelude.k import GENERATED_TOP_CELL @@ -18,6 +20,9 @@ from pyk.kore.prelude import top_cell_initializer from pyk.kore.tools import kore_print from pyk.utils import FrozenDict +from pyk.prelude.string import stringToken + +_PPRINT = pprint.PrettyPrinter(width=41, compact=True) class RustLiteManager(): krun: KRun @@ -30,16 +35,19 @@ def __init__(self) -> None: def _init_cterm(self) -> None: self.krun.definition.empty_config(GENERATED_TOP_CELL) + init_config = self.krun.definition.init_config(GENERATED_TOP_CELL) + self.cterm = CTerm.from_kast(init_config) + + def load_program(self, program: str) -> None: + # self.cterm = CTerm.from_kast(set_cell(self.cterm.config, 'K_CELL', KApply(program, []))) + self.cterm = CTerm.from_kast(set_cell(self.cterm.config, 'K_CELL', stringToken(program))) + pattern = self.krun.kast_to_kore(self.cterm.config, sort=GENERATED_TOP_CELL) + output_kore = self.krun.run_pattern(pattern, pipe_stderr=True) + self.cterm = CTerm.from_kast(self.krun.kore_to_kast(output_kore)) - # init_subst = { - # '$PGM': KSequence([KEVM.sharp_execute()]), - # '$MODE': KApply('NORMAL'), - # '$SCHEDULE': KApply('SHANGHAI_EVM'), - # '$USEGAS': TRUE, - # '$CHAINID': intToken(0), - # } - - # init_config = set_cell(init_config, 'ACCOUNTS_CELL', KEVM.accounts(init_accounts_list)) - - # init_term = Subst(init_subst)(init_config) - # self.cterm = CTerm.from_kast(init_term) + + def fetch_k_cell_content(self): + cell = self.cterm.cell('K_CELL') + # assert type(cell) is KToken + _PPRINT.pprint(cell) + return cell \ No newline at end of file From d02810d36fa6fb5daaf981410fa3ad2d39baa61c Mon Sep 17 00:00:00 2001 From: acassimiro Date: Wed, 21 Aug 2024 21:40:27 -0300 Subject: [PATCH 03/11] Loading the code from the actual contracts --- rust-lite/src/rust_lite/__main__.py | 6 ++++-- rust-lite/src/rust_lite/manager.py | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/rust-lite/src/rust_lite/__main__.py b/rust-lite/src/rust_lite/__main__.py index 1e5ac84..2a2effd 100644 --- a/rust-lite/src/rust_lite/__main__.py +++ b/rust-lite/src/rust_lite/__main__.py @@ -29,10 +29,12 @@ def main() -> None: print("Module manager initiated; Trying to load program into K cell;") - module_manager.load_program("Test") + contract_code = open('../tests/execution/empty.rs', 'r').read() + # contract_code = open('../tests/syntax/erc_20_token.rs', 'r').read() + + module_manager.load_program(contract_code) print("Program loaded; Trying to fetch the content of the K cell.") module_manager.fetch_k_cell_content() - diff --git a/rust-lite/src/rust_lite/manager.py b/rust-lite/src/rust_lite/manager.py index 0736671..d693384 100644 --- a/rust-lite/src/rust_lite/manager.py +++ b/rust-lite/src/rust_lite/manager.py @@ -39,7 +39,7 @@ def _init_cterm(self) -> None: self.cterm = CTerm.from_kast(init_config) def load_program(self, program: str) -> None: - # self.cterm = CTerm.from_kast(set_cell(self.cterm.config, 'K_CELL', KApply(program, []))) + self.cterm = CTerm.from_kast(set_cell(self.cterm.config, 'K_CELL', stringToken(program))) pattern = self.krun.kast_to_kore(self.cterm.config, sort=GENERATED_TOP_CELL) output_kore = self.krun.run_pattern(pattern, pipe_stderr=True) @@ -48,6 +48,5 @@ def load_program(self, program: str) -> None: def fetch_k_cell_content(self): cell = self.cterm.cell('K_CELL') - # assert type(cell) is KToken _PPRINT.pprint(cell) return cell \ No newline at end of file From 4422b7c54ea334ec4de254e6b99f8813176c2ff0 Mon Sep 17 00:00:00 2001 From: acassimiro Date: Thu, 22 Aug 2024 16:57:31 -0300 Subject: [PATCH 04/11] Loading parsed contract and placing it in the K cell --- rust-lite/src/rust_lite/__main__.py | 11 ++++--- rust-lite/src/rust_lite/manager.py | 50 ++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 9 deletions(-) diff --git a/rust-lite/src/rust_lite/__main__.py b/rust-lite/src/rust_lite/__main__.py index 2a2effd..60c2199 100644 --- a/rust-lite/src/rust_lite/__main__.py +++ b/rust-lite/src/rust_lite/__main__.py @@ -23,18 +23,21 @@ def main() -> None: - print("Instantiating module manager;") + print('Instantiating module manager;') module_manager = RustLiteManager() - print("Module manager initiated; Trying to load program into K cell;") + print('Module manager initiated; Trying to load program into K cell;') - contract_code = open('../tests/execution/empty.rs', 'r').read() + + contract_code = open('../.build/syntax-output/erc_20_token.rs-parsed', 'r').read() + # contract_code = open('../erc20.json', 'r').read() + # contract_code = open('../tests/execution/empty.rs', 'r').read() # contract_code = open('../tests/syntax/erc_20_token.rs', 'r').read() module_manager.load_program(contract_code) - print("Program loaded; Trying to fetch the content of the K cell.") + print('Program loaded; Trying to fetch the content of the K cell.') module_manager.fetch_k_cell_content() diff --git a/rust-lite/src/rust_lite/manager.py b/rust-lite/src/rust_lite/manager.py index d693384..f98280c 100644 --- a/rust-lite/src/rust_lite/manager.py +++ b/rust-lite/src/rust_lite/manager.py @@ -6,12 +6,13 @@ import sys import pprint from collections.abc import Iterable -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Mapping, Any from pathlib import Path from pathos.pools import ProcessPool # type: ignore from pyk.cli.pyk import parse_toml_args -from pyk.kast.inner import KApply, KSequence, KSort, KToken, Subst +from pyk.kast.inner import KApply, KSequence, KSort, KToken, KInner +from pyk.kast.parser import KAstParser from pyk.kast.manip import set_cell from pyk.cterm import CTerm from pyk.ktool.krun import KRun @@ -40,13 +41,52 @@ def _init_cterm(self) -> None: def load_program(self, program: str) -> None: - self.cterm = CTerm.from_kast(set_cell(self.cterm.config, 'K_CELL', stringToken(program))) + ## ATTEMPT 2 ------------------------------------------ + ## Perform the substitution of the $PGM. It seems to be equivalent to the other approaches used. + # self.krun.definition.empty_config(GENERATED_TOP_CELL) + # init_config = self.krun.definition.init_config(GENERATED_TOP_CELL) + + # init_subst = { + # '$PGM': stringToken(program), + # } + + # init_term = Subst(init_subst)(init_config) + # self.cterm = CTerm.from_kast(init_term) + + ## ATTEMPT 3 ------------------------------------------ + ## Manually call kast to get the stdout into a file. Load the file and use KAstParser to convert into a KList + parser = KAstParser(program) + parsed_program = parser.klist() + _PPRINT.pprint(parsed_program) + # return + + ## ATTEMPT 4 ------------------------------------------ + ## Using kast to generate a .json of the parsed contract. program should be the content of '../erc20.json' + # program_json = json.loads(program) + # parsed_program = KInner.from_dict(program_json) + # return + + self.cterm = CTerm.from_kast(set_cell(self.cterm.config, 'K_CELL', KSequence(KApply('crateParser(_)_RUST-INDEXING-SYNTAX_Initializer_Crate', parsed_program)))) pattern = self.krun.kast_to_kore(self.cterm.config, sort=GENERATED_TOP_CELL) - output_kore = self.krun.run_pattern(pattern, pipe_stderr=True) + output_kore = self.krun.run_pattern(pattern, pipe_stderr=False) self.cterm = CTerm.from_kast(self.krun.kore_to_kast(output_kore)) def fetch_k_cell_content(self): cell = self.cterm.cell('K_CELL') _PPRINT.pprint(cell) - return cell \ No newline at end of file + return cell + + + + + + +def load_json_dict(input_file: Path) -> Mapping[str, Any]: + with input_file.open() as f: + return json.load(f) + + +def load_json_kinner(input_file: Path) -> KInner: + value = load_json_dict(input_file) + return KInner.from_dict(value) \ No newline at end of file From 6f83f7a4c833fc61f7ecdf1b5c79b3dc8af3bbdd Mon Sep 17 00:00:00 2001 From: acassimiro Date: Thu, 22 Aug 2024 17:31:36 -0300 Subject: [PATCH 05/11] Syncing local with branch --- rust-lite/src/rust_lite/manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-lite/src/rust_lite/manager.py b/rust-lite/src/rust_lite/manager.py index f98280c..e657cd7 100644 --- a/rust-lite/src/rust_lite/manager.py +++ b/rust-lite/src/rust_lite/manager.py @@ -57,13 +57,13 @@ def load_program(self, program: str) -> None: ## Manually call kast to get the stdout into a file. Load the file and use KAstParser to convert into a KList parser = KAstParser(program) parsed_program = parser.klist() - _PPRINT.pprint(parsed_program) + # _PPRINT.pprint(parsed_program) # return ## ATTEMPT 4 ------------------------------------------ ## Using kast to generate a .json of the parsed contract. program should be the content of '../erc20.json' # program_json = json.loads(program) - # parsed_program = KInner.from_dict(program_json) + # parsed_program = KInner.from_dict(program_json['term']) # return self.cterm = CTerm.from_kast(set_cell(self.cterm.config, 'K_CELL', KSequence(KApply('crateParser(_)_RUST-INDEXING-SYNTAX_Initializer_Crate', parsed_program)))) From acbff61169dae14bbb83009b7fd3cfa540e3ec29 Mon Sep 17 00:00:00 2001 From: ACassimiro Date: Thu, 22 Aug 2024 17:41:43 -0300 Subject: [PATCH 06/11] Refactor and finish implementing trait preprocessing (#4) (#6) * Rename indexing -> preprocessing * Refactor trait initialization * Refactor addMethod * Function arguments test * Return type test --------- Co-authored-by: Virgil <25692529+virgil-serbanuta@users.noreply.github.com> --- .gitignore | 1 + Makefile | 2 +- rust-semantics/config.md | 6 +- rust-semantics/indexing.md | 19 --- rust-semantics/indexing/configuration.md | 32 ----- rust-semantics/indexing/helpers.md | 35 ------ rust-semantics/indexing/initialization.md | 119 ------------------ rust-semantics/indexing/syntax.md | 46 ------- rust-semantics/preprocessing.md | 19 +++ rust-semantics/preprocessing/configuration.md | 34 +++++ .../{indexing => preprocessing}/crate.md | 16 +-- rust-semantics/preprocessing/helpers.md | 96 ++++++++++++++ .../preprocessing/initialization.md | 68 ++++++++++ rust-semantics/preprocessing/syntax.md | 41 ++++++ .../trait-methods.md | 4 +- .../{indexing => preprocessing}/trait.md | 2 +- rust-semantics/representation.md | 4 + rust-semantics/rust.md | 4 +- tests/execution/function-arguments.rs | 24 ++++ tests/execution/function-return-type.rs | 17 +++ 20 files changed, 322 insertions(+), 267 deletions(-) delete mode 100644 rust-semantics/indexing.md delete mode 100644 rust-semantics/indexing/configuration.md delete mode 100644 rust-semantics/indexing/helpers.md delete mode 100644 rust-semantics/indexing/initialization.md delete mode 100644 rust-semantics/indexing/syntax.md create mode 100644 rust-semantics/preprocessing.md create mode 100644 rust-semantics/preprocessing/configuration.md rename rust-semantics/{indexing => preprocessing}/crate.md (86%) create mode 100644 rust-semantics/preprocessing/helpers.md create mode 100644 rust-semantics/preprocessing/initialization.md create mode 100644 rust-semantics/preprocessing/syntax.md rename rust-semantics/{indexing => preprocessing}/trait-methods.md (71%) rename rust-semantics/{indexing => preprocessing}/trait.md (76%) create mode 100644 tests/execution/function-arguments.rs create mode 100644 tests/execution/function-return-type.rs diff --git a/.gitignore b/.gitignore index 84d8b56..c733e44 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .build +.DS_store tmp diff --git a/Makefile b/Makefile index 2611c39..b78e2d9 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -SEMANTICS_FILES ::= $(shell find rust-semantics/ -type f -name '*') +SEMANTICS_FILES ::= $(shell find rust-semantics/ -type f -a '(' -name '*.md' -or -name '*.k' ')') RUST_KOMPILED ::= .build/rust-kompiled RUST_TIMESTAMP ::= $(RUST_KOMPILED)/timestamp SYNTAX_INPUT_DIR ::= tests/syntax diff --git a/rust-semantics/config.md b/rust-semantics/config.md index 5c6edc5..f072f87 100644 --- a/rust-semantics/config.md +++ b/rust-semantics/config.md @@ -1,17 +1,17 @@ ```k module RUST-CONFIGURATION - imports RUST-INDEXING-CONFIGURATION + imports RUST-PREPROCESSING-CONFIGURATION configuration - + endmodule module RUST-RUNNING-CONFIGURATION - imports private RUST-INDEXING-SYNTAX + imports private RUST-PREPROCESSING-SYNTAX imports RUST-CONFIGURATION configuration diff --git a/rust-semantics/indexing.md b/rust-semantics/indexing.md deleted file mode 100644 index bbe5319..0000000 --- a/rust-semantics/indexing.md +++ /dev/null @@ -1,19 +0,0 @@ -```k - -requires "indexing/crate.md" -requires "indexing/configuration.md" -requires "indexing/helpers.md" -requires "indexing/initialization.md" -requires "indexing/syntax.md" -requires "indexing/trait.md" -requires "indexing/trait-methods.md" - -module RUST-INDEXING - imports private CRATE - imports private INITIALIZATION - imports private TRAIT - imports private TRAIT-METHODS -endmodule - - -``` diff --git a/rust-semantics/indexing/configuration.md b/rust-semantics/indexing/configuration.md deleted file mode 100644 index f6498b1..0000000 --- a/rust-semantics/indexing/configuration.md +++ /dev/null @@ -1,32 +0,0 @@ -```k - -module RUST-INDEXING-CONFIGURATION - imports private RUST-REPRESENTATION - imports private RUST-SHARED-SYNTAX - - syntax Identifier ::= "my_identifier" [token] - - configuration - - - - my_identifier - tuple(.ValueList) - - - - my_identifier - - - my_identifier - .NormalizedFunctionParameterList - ():Type - empty:FunctionBodyRepresentation - - - - -endmodule - - -``` \ No newline at end of file diff --git a/rust-semantics/indexing/helpers.md b/rust-semantics/indexing/helpers.md deleted file mode 100644 index 7ebd3ea..0000000 --- a/rust-semantics/indexing/helpers.md +++ /dev/null @@ -1,35 +0,0 @@ -```k - -module RUST-INDEXING-PRIVATE-HELPERS - imports private RUST-REPRESENTATION - imports RUST-SHARED-SYNTAX - - syntax Identifier ::= getFunctionName(Function) [function, total] - rule getFunctionName(_Q:FunctionQualifiers F:FunctionWithoutQualifiers) - => getFunctionName(F) - rule getFunctionName(F:FunctionWithWhere _B:BlockExpression) - => getFunctionName(F ;) - rule getFunctionName(F:FunctionWithReturnType _W:WhereClause ;) - => getFunctionName(F ;) - rule getFunctionName(F:FunctionWithParams _R:FunctionReturnType ;) - => getFunctionName(F ;) - rule getFunctionName(fn Name:Identifier _P:GenericParams ( ) ;) - => Name - rule getFunctionName(fn Name:Identifier ( ) ;) - => Name - rule getFunctionName(fn Name:Identifier _P:GenericParams ( _Params:FunctionParameters ) ;) - => Name - rule getFunctionName(fn Name:Identifier ( _Params:FunctionParameters ) ;) - => Name - - syntax NormalizedFunctionParameterList ::= reverse(NormalizedFunctionParameterList) [function, total] - // See https://github.com/runtimeverification/k/issues/4587 - // for the "Non exhaustive match detected" warning - | #reverse(NormalizedFunctionParameterList, NormalizedFunctionParameterList) [function, total] - rule reverse(L:NormalizedFunctionParameterList) => #reverse(L, .NormalizedFunctionParameterList) - rule #reverse(.NormalizedFunctionParameterList, R) => R - rule #reverse((P:NormalizedFunctionParameter , L:NormalizedFunctionParameterList), R) - => #reverse(L, (P , R)) -endmodule - -``` diff --git a/rust-semantics/indexing/initialization.md b/rust-semantics/indexing/initialization.md deleted file mode 100644 index 1ced14d..0000000 --- a/rust-semantics/indexing/initialization.md +++ /dev/null @@ -1,119 +0,0 @@ -```k - -module INITIALIZATION - imports private RUST-RUNNING-CONFIGURATION - imports private RUST-INDEXING-PRIVATE-HELPERS - imports private RUST-INDEXING-PRIVATE-SYNTAX - - // rule - // crateInitializer - // ( ... constantNames:(ListItem(Name:Identifier) => .List) _Cts:List - // , constants: _Constants (Name |-> V:Value => .Map) - // ) - // ... - // - // - // - // .Bag => - // - // Name:Identifier - // V:Value - // - // - // ... - // - - rule (.K => addMethod(F, A)) - ~> crateInitializer - ( ... constantNames: .List - , functionNames: (ListItem(Name:Identifier) => .List) _Names:List - , functions: _Functions:Map - ((Name |-> (A:OuterAttributes F:Function):AssociatedItem) => .Map) - ) - rule - crateInitializer - ( ... constantNames : .List - , functionNames : .List - , traitName : Name:Identifier - ) => .K - ... - - - ... - - ... - _Name => Name:Identifier - - - - // rule addMethod(_Q:FunctionQualifiers F:FunctionWithoutQualifiers, A:OuterAttributes) - // => addMethod(F:FunctionWithoutQualifiers, A) - rule addMethod((F:FunctionWithWhere B:BlockExpressionOrSemicolon):FunctionWithoutQualifiers, A:OuterAttributes) - => addMethod1(F, B, A) - - // rule addMethod1(F:FunctionWithReturnType _W:WhereClause, B:BlockExpressionOrSemicolon, A:OuterAttributes) - // => addMethod1(F, B, A) - // rule addMethod1(F:FunctionWithParams -> RT:Type, B:BlockExpressionOrSemicolon, A:OuterAttributes) - // => addMethod2(F, RT, B, A) - rule addMethod1(F:FunctionWithParams, B:BlockExpressionOrSemicolon, A:OuterAttributes) - => addMethod2(F, (), B, A) - - // rule addMethod2(fn Name ( ), T:Type, B:BlockExpressionOrSemicolon, A:OuterAttributes) - // => addMethod4(Name, .NormalizedFunctionParameterList, T, B, A) - rule addMethod2(fn Name (_:SelfParam), T:Type, B:BlockExpressionOrSemicolon, A:OuterAttributes) - => addMethod4(Name, (self : $selftype), T, B, A) - // rule addMethod2(fn Name (_:SelfParam , ), T:Type, B:BlockExpressionOrSemicolon, A:OuterAttributes) - // => addMethod4(Name, (self : $selftype), T, B, A) - // rule addMethod2(fn Name (_:SelfParam , P:FunctionParameterList), T:Type, B:BlockExpressionOrSemicolon, A:OuterAttributes) - // => addMethod3(Name, (self : $selftype), P, T, B, A) - // rule addMethod2(fn Name (_:SelfParam , P:FunctionParameterList ,), T:Type, B:BlockExpressionOrSemicolon, A:OuterAttributes) - // => addMethod3(Name, (self : $selftype) , P, T, B, A) - - // rule addMethod3( - // _MethodName:Identifier, - // ReversedNormalizedParams:NormalizedFunctionParameterList - // => (ParamName : ParamType , ReversedNormalizedParams), - // (ParamName:Identifier : ParamType:Type , Params:FunctionParameterList) - // => Params, - // _MethodReturnType:Type, _B:BlockExpressionOrSemicolon, _A:OuterAttributes - // ) - // rule addMethod3( - // MethodName:Identifier, - // ReversedNormalizedParams:NormalizedFunctionParameterList, - // .FunctionParameterList, - // MethodReturnType:Type, B:BlockExpressionOrSemicolon, A:OuterAttributes - // ) - // => addMethod4( - // MethodName, - // reverse(ReversedNormalizedParams), - // MethodReturnType, B, A - // ) - - rule - addMethod4( - Name:Identifier, P:NormalizedFunctionParameterList, - R:Type, B:BlockExpression, - _A:OuterAttributes - ) => .K - ... - - - ... - - ... - - .Bag => - - Name:Identifier - P - R - block(B) - - ... - - - - -endmodule - -``` diff --git a/rust-semantics/indexing/syntax.md b/rust-semantics/indexing/syntax.md deleted file mode 100644 index 5313228..0000000 --- a/rust-semantics/indexing/syntax.md +++ /dev/null @@ -1,46 +0,0 @@ -```k - -module RUST-INDEXING-SYNTAX - imports RUST-SHARED-SYNTAX - - syntax Initializer ::= crateParser(crate: Crate) -endmodule - -module RUST-INDEXING-PRIVATE-SYNTAX - imports LIST - imports MAP - imports RUST-REPRESENTATION - imports RUST-SHARED-SYNTAX - - syntax Initializer ::= traitParser(Trait) - | traitMethodsParser(AssociatedItems, functions: Map, traitName:Identifier) - | crateInitializer - ( constantNames:List, constants: Map - , traitName: Identifier - , functionNames:List, functions: Map - ) - - syntax Initializer ::= addMethod(function: Function, atts:OuterAttributes) - | addMethod1( - FunctionWithWhere, BlockExpressionOrSemicolon, - OuterAttributes - ) - | addMethod2( - FunctionWithParams, Type, - BlockExpressionOrSemicolon, OuterAttributes - ) - | addMethod3( - Identifier, NormalizedFunctionParameterList, - FunctionParameterList, Type, - BlockExpressionOrSemicolon, OuterAttributes - ) - | addMethod4( - Identifier, NormalizedFunctionParameterList, Type, - BlockExpressionOrSemicolon, OuterAttributes - ) - - // TODO: Move to a more generic place - syntax Identifier ::= "self" [token] -endmodule - -``` diff --git a/rust-semantics/preprocessing.md b/rust-semantics/preprocessing.md new file mode 100644 index 0000000..030bf02 --- /dev/null +++ b/rust-semantics/preprocessing.md @@ -0,0 +1,19 @@ +```k + +requires "preprocessing/crate.md" +requires "preprocessing/configuration.md" +requires "preprocessing/helpers.md" +requires "preprocessing/initialization.md" +requires "preprocessing/syntax.md" +requires "preprocessing/trait.md" +requires "preprocessing/trait-methods.md" + +module RUST-PREPROCESSING + imports private CRATE + imports private INITIALIZATION + imports private TRAIT + imports private TRAIT-METHODS +endmodule + + +``` diff --git a/rust-semantics/preprocessing/configuration.md b/rust-semantics/preprocessing/configuration.md new file mode 100644 index 0000000..c2f5162 --- /dev/null +++ b/rust-semantics/preprocessing/configuration.md @@ -0,0 +1,34 @@ +```k + +module RUST-PREPROCESSING-CONFIGURATION + imports private RUST-REPRESENTATION + imports private RUST-SHARED-SYNTAX + + syntax Identifier ::= "my_identifier" [token] + + configuration + + + + my_identifier + tuple(.ValueList) + + + + + my_identifier:TypePath + + + my_identifier + .NormalizedFunctionParameterList + ():Type + empty:FunctionBodyRepresentation + + + + + +endmodule + + +``` \ No newline at end of file diff --git a/rust-semantics/indexing/crate.md b/rust-semantics/preprocessing/crate.md similarity index 86% rename from rust-semantics/indexing/crate.md rename to rust-semantics/preprocessing/crate.md index 2f310e7..7acd05d 100644 --- a/rust-semantics/indexing/crate.md +++ b/rust-semantics/preprocessing/crate.md @@ -3,8 +3,8 @@ module CRATE imports private LIST imports private MAP - imports private RUST-INDEXING-PRIVATE-SYNTAX - imports private RUST-INDEXING-SYNTAX + imports private RUST-PREPROCESSING-PRIVATE-SYNTAX + imports private RUST-PREPROCESSING-SYNTAX imports private RUST-REPRESENTATION imports private RUST-RUNNING-CONFIGURATION @@ -67,11 +67,13 @@ module CRATE , traitName : Name:Identifier , traitFunctions: Functions:Map ) - => crateInitializer - ( ... constantNames: keys_list(Constants), constants: Constants - , traitName: Name - , functionNames:keys_list(Functions), functions: Functions - ) + => constantInitializer + ( ... constantNames: keys_list(Constants), constants: Constants ) + ~> traitInitializer(Name) + ~> traitMethodInitializer + ( ... traitName: Name + , functionNames:keys_list(Functions), functions: Functions + ) endmodule ``` diff --git a/rust-semantics/preprocessing/helpers.md b/rust-semantics/preprocessing/helpers.md new file mode 100644 index 0000000..2da8f06 --- /dev/null +++ b/rust-semantics/preprocessing/helpers.md @@ -0,0 +1,96 @@ +```k + +module RUST-PREPROCESSING-PRIVATE-HELPERS + imports private RUST-PREPROCESSING-PRIVATE-SYNTAX + imports private RUST-REPRESENTATION + imports RUST-SHARED-SYNTAX + + syntax FunctionWithParams ::= getFunctionWithParams(Function) [function, total] + rule getFunctionWithParams(_Q:FunctionQualifiers F:FunctionWithoutQualifiers) + => getFunctionWithParams(F) + rule getFunctionWithParams(F:FunctionWithWhere _B:BlockExpression) + => getFunctionWithParams(F ;) + rule getFunctionWithParams(F:FunctionWithReturnType _W:WhereClause ;) + => getFunctionWithParams(F ;) + rule getFunctionWithParams(F:FunctionWithParams _R:FunctionReturnType ;) + => F + rule getFunctionWithParams(F:FunctionWithParams ;) + => F + + syntax Identifier ::= getFunctionWithParamsName(FunctionWithParams) [function, total] + rule getFunctionWithParamsName(fn Name:Identifier _P:GenericParams ( )) + => Name + rule getFunctionWithParamsName(fn Name:Identifier ( )) + => Name + rule getFunctionWithParamsName(fn Name:Identifier _P:GenericParams ( _Params:FunctionParameters )) + => Name + rule getFunctionWithParamsName(fn Name:Identifier ( _Params:FunctionParameters )) + => Name + + syntax Identifier ::= getFunctionName(Function) [function, total] + rule getFunctionName(F:Function) + => getFunctionWithParamsName(getFunctionWithParams(F)) + + syntax NormalizedFunctionParameterListOrError ::= extractFunctionNormalizedParams(Function) [function, total] + rule extractFunctionNormalizedParams(F) => extractFunctionWithParamsNormalizedParams(getFunctionWithParams(F)) + + syntax NormalizedFunctionParameterListOrError ::= extractFunctionWithParamsNormalizedParams(FunctionWithParams) [function, total] + rule extractFunctionWithParamsNormalizedParams(fn _Name:Identifier _P:GenericParams ( )) + => .NormalizedFunctionParameterList + rule extractFunctionWithParamsNormalizedParams(fn _Name:Identifier ( )) + => .NormalizedFunctionParameterList + rule extractFunctionWithParamsNormalizedParams(fn _Name:Identifier _P:GenericParams ( Params:FunctionParameters )) + => normalizeParams(Params) + rule extractFunctionWithParamsNormalizedParams(fn _Name:Identifier ( Params:FunctionParameters )) + => normalizeParams(Params) + + syntax NormalizedFunctionParameterListOrError ::= concat( + NormalizedFunctionParameterOrError, + NormalizedFunctionParameterListOrError + ) [function, total] + rule concat(P:NormalizedFunctionParameter, L:NormalizedFunctionParameterList) => P , L + rule concat(P:SemanticsError, _:NormalizedFunctionParameterListOrError) => P + rule concat(_:NormalizedFunctionParameter, L:SemanticsError) => L + + syntax NormalizedFunctionParameterListOrError ::= normalizeParams(FunctionParameters) [function, total] + // We should not need an explicit conactenation here, but the LLVM decision tree code crashes. + rule normalizeParams(_:SelfParam) => self : $selftype , .NormalizedFunctionParameterList + // We should not need an explicit conactenation here, but the LLVM decision tree code crashes. + rule normalizeParams(_:SelfParam , ) => self : $selftype , .NormalizedFunctionParameterList + rule normalizeParams(_:SelfParam , F:FunctionParameterList) => concat(self : $selftype, normalizeParams(F)) + rule normalizeParams(_:SelfParam , F:FunctionParameterList , ) => concat(self : $selftype, normalizeParams(F)) + rule normalizeParams(F:FunctionParameterList ,) => normalizeParams(F) + rule normalizeParams(.FunctionParameterList) => .NormalizedFunctionParameterList + rule normalizeParams(P:FunctionParam , F:FunctionParameterList) => concat(normalizeParam(P), normalizeParams(F)) + + syntax NormalizedFunctionParameterOrError ::= NormalizedFunctionParameter | SemanticsError + + syntax NormalizedFunctionParameterOrError ::= normalizeParam(FunctionParam) [function, total] + rule normalizeParam(_:OuterAttributes Name:Identifier : T:Type) => Name : T + rule normalizeParam(P:FunctionParam) + => error("unimplemented normalizedParam case", P:FunctionParam:KItem) + [owise] + + syntax BlockExpressionOrSemicolon ::= getFunctionBlockOrSemicolon(Function) [function, total] + rule getFunctionBlockOrSemicolon(_Q:FunctionQualifiers F:FunctionWithoutQualifiers) + => getFunctionBlockOrSemicolon(F) + rule getFunctionBlockOrSemicolon(_F:FunctionWithWhere B:BlockExpressionOrSemicolon) + => B + + syntax Type ::= getFunctionReturnType(Function) + rule getFunctionReturnType(_Q:FunctionQualifiers F:FunctionWithoutQualifiers) + => getFunctionReturnType(F) + rule getFunctionReturnType(F:FunctionWithWhere _B:BlockExpression) + => getFunctionReturnType(F ;) + rule getFunctionReturnType(F:FunctionWithReturnType _W:WhereClause ;) + => getFunctionReturnType(F ;) + rule getFunctionReturnType(_F:FunctionWithParams -> R:Type ;) + => R + // https://doc.rust-lang.org/stable/reference/items/functions.html + // If the output type is not explicitly stated, it is the unit type. + rule getFunctionReturnType(_F:FunctionWithParams ;) + => ( ):Type + +endmodule + +``` diff --git a/rust-semantics/preprocessing/initialization.md b/rust-semantics/preprocessing/initialization.md new file mode 100644 index 0000000..c455036 --- /dev/null +++ b/rust-semantics/preprocessing/initialization.md @@ -0,0 +1,68 @@ +```k + +module INITIALIZATION + imports private RUST-RUNNING-CONFIGURATION + imports private RUST-PREPROCESSING-PRIVATE-HELPERS + imports private RUST-PREPROCESSING-PRIVATE-SYNTAX + + rule constantInitializer(... constantNames : .List) => .K + + rule (.K => addMethod(TraitName, F, A)) + ~> traitMethodInitializer + ( ... traitName : TraitName:TypePath + , functionNames: (ListItem(Name:Identifier) => .List) _Names:List + , functions: _Functions:Map + ((Name |-> (A:OuterAttributes F:Function):AssociatedItem) => .Map) + ) + rule traitMethodInitializer(... functionNames: .List) => .K + + rule + traitInitializer(Name:TypePath) => .K + ... + + + ... + .Bag + => + Name + .Bag + + + + rule addMethod(Trait:TypePath, F:Function, A:OuterAttributes) + => #addMethod + ( Trait + , getFunctionName(F) + , extractFunctionNormalizedParams(F) + , getFunctionReturnType(F) + , getFunctionBlockOrSemicolon(F) + , A + ) + + rule + #addMethod( + Trait:TypePath, + Name:Identifier, P:NormalizedFunctionParameterList, + R:Type, B:BlockExpression, + _A:OuterAttributes + ) => .K + ... + + + ... + Trait + + .Bag => + + Name:Identifier + P + R + block(B) + + ... + + + +endmodule + +``` diff --git a/rust-semantics/preprocessing/syntax.md b/rust-semantics/preprocessing/syntax.md new file mode 100644 index 0000000..768bd1a --- /dev/null +++ b/rust-semantics/preprocessing/syntax.md @@ -0,0 +1,41 @@ +```k + +module RUST-PREPROCESSING-SYNTAX + imports RUST-SHARED-SYNTAX + + syntax Initializer ::= crateParser(crate: Crate) +endmodule + +module RUST-PREPROCESSING-PRIVATE-SYNTAX + imports LIST + imports MAP + imports RUST-REPRESENTATION + imports RUST-SHARED-SYNTAX + + syntax Initializer ::= traitParser(Trait) + | traitMethodsParser(AssociatedItems, functions: Map, traitName:Identifier) + | constantInitializer + ( constantNames: List, constants: Map ) + | traitInitializer + ( traitName: TypePath + ) + | traitMethodInitializer + ( traitName: TypePath + , functionNames:List, functions: Map + ) + + syntax Initializer ::= addMethod(traitName : TypePath, function: Function, atts:OuterAttributes) + | #addMethod( + TypePath, + Identifier, + NormalizedFunctionParameterListOrError, + Type, + BlockExpressionOrSemicolon, + OuterAttributes + ) + + // TODO: Move to a more generic place + syntax Identifier ::= "self" [token] +endmodule + +``` diff --git a/rust-semantics/indexing/trait-methods.md b/rust-semantics/preprocessing/trait-methods.md similarity index 71% rename from rust-semantics/indexing/trait-methods.md rename to rust-semantics/preprocessing/trait-methods.md index 84653c9..1b2c106 100644 --- a/rust-semantics/indexing/trait-methods.md +++ b/rust-semantics/preprocessing/trait-methods.md @@ -1,8 +1,8 @@ ```k module TRAIT-METHODS - imports private RUST-INDEXING-PRIVATE-HELPERS - imports private RUST-INDEXING-PRIVATE-SYNTAX + imports private RUST-PREPROCESSING-PRIVATE-HELPERS + imports private RUST-PREPROCESSING-PRIVATE-SYNTAX rule traitMethodsParser( (A:OuterAttributes F:Function) AIs:AssociatedItems => AIs, diff --git a/rust-semantics/indexing/trait.md b/rust-semantics/preprocessing/trait.md similarity index 76% rename from rust-semantics/indexing/trait.md rename to rust-semantics/preprocessing/trait.md index fc17017..97c0ce1 100644 --- a/rust-semantics/indexing/trait.md +++ b/rust-semantics/preprocessing/trait.md @@ -1,7 +1,7 @@ ```k module TRAIT - imports private RUST-INDEXING-PRIVATE-SYNTAX + imports private RUST-PREPROCESSING-PRIVATE-SYNTAX rule traitParser(trait Name:Identifier { .InnerAttributes Functions:AssociatedItems }) => traitMethodsParser(Functions, .Map, Name) diff --git a/rust-semantics/representation.md b/rust-semantics/representation.md index 96301e0..6e87048 100644 --- a/rust-semantics/representation.md +++ b/rust-semantics/representation.md @@ -10,12 +10,16 @@ module RUST-REPRESENTATION syntax MInt{32} syntax MInt{64} + syntax SemanticsError ::= error(String, KItem) + syntax FunctionBodyRepresentation ::= block(BlockExpression) | "empty" | storageAccessor(StringLiteral) syntax NormalizedFunctionParameter ::= Identifier ":" Type syntax NormalizedFunctionParameterList ::= List{NormalizedFunctionParameter, ","} + syntax NormalizedFunctionParameterListOrError ::= NormalizedFunctionParameterList | SemanticsError + syntax Value ::= i32(MInt{32}) | u32(MInt{32}) | i64(MInt{64}) diff --git a/rust-semantics/rust.md b/rust-semantics/rust.md index 965b45d..4b12db2 100644 --- a/rust-semantics/rust.md +++ b/rust-semantics/rust.md @@ -1,12 +1,12 @@ ```k requires "config.md" -requires "indexing.md" +requires "preprocessing.md" requires "representation.md" requires "syntax.md" module RUST imports RUST-CONFIGURATION - imports RUST-INDEXING + imports RUST-PREPROCESSING imports RUST-REPRESENTATION imports RUST-SHARED-SYNTAX diff --git a/tests/execution/function-arguments.rs b/tests/execution/function-arguments.rs new file mode 100644 index 0000000..46d79b6 --- /dev/null +++ b/tests/execution/function-arguments.rs @@ -0,0 +1,24 @@ +#![no_std] + +#[allow(unused_imports)] +use multiversx_sc::imports::*; + +#[multiversx_sc::contract] +pub trait Empty { + #[init] + fn init(&self) { + } + + #[upgrade] + fn upgrade(&self) {} + + fn self_with_comma(&self, ) {} + + fn self_and_arg(&self, first: BigUint) {} + + fn self_and_args(&self, first: BigUint, second: BigUint) {} + + fn self_and_args_comma(&self, first: BigUint, second: BigUint, ) {} + + fn reference_arg(&self, first: &BigUint) {} +} diff --git a/tests/execution/function-return-type.rs b/tests/execution/function-return-type.rs new file mode 100644 index 0000000..a970396 --- /dev/null +++ b/tests/execution/function-return-type.rs @@ -0,0 +1,17 @@ +#![no_std] + +#[allow(unused_imports)] +use multiversx_sc::imports::*; + +#[multiversx_sc::contract] +pub trait Empty { + #[init] + fn init(&self) { + } + + #[upgrade] + fn upgrade(&self) {} + + fn with_return_type(&self) -> BigUint {} + +} From d24de17cb569ed9f656ac449f155b12dffe662d2 Mon Sep 17 00:00:00 2001 From: acassimiro Date: Thu, 22 Aug 2024 18:11:54 -0300 Subject: [PATCH 07/11] Using _kast for parsing our contracts programmatically --- rust-lite/src/rust_lite/__main__.py | 8 +++----- rust-lite/src/rust_lite/manager.py | 29 +++++++++++++---------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/rust-lite/src/rust_lite/__main__.py b/rust-lite/src/rust_lite/__main__.py index 60c2199..384c59b 100644 --- a/rust-lite/src/rust_lite/__main__.py +++ b/rust-lite/src/rust_lite/__main__.py @@ -30,12 +30,10 @@ def main() -> None: print('Module manager initiated; Trying to load program into K cell;') - contract_code = open('../.build/syntax-output/erc_20_token.rs-parsed', 'r').read() - # contract_code = open('../erc20.json', 'r').read() - # contract_code = open('../tests/execution/empty.rs', 'r').read() - # contract_code = open('../tests/syntax/erc_20_token.rs', 'r').read() + # contract_path = '../tests/syntax/erc_20_token.rs' + contract_path = '../tests/execution/empty.rs' - module_manager.load_program(contract_code) + module_manager.load_program(contract_path) print('Program loaded; Trying to fetch the content of the K cell.') diff --git a/rust-lite/src/rust_lite/manager.py b/rust-lite/src/rust_lite/manager.py index e657cd7..c520c5c 100644 --- a/rust-lite/src/rust_lite/manager.py +++ b/rust-lite/src/rust_lite/manager.py @@ -14,8 +14,10 @@ from pyk.kast.inner import KApply, KSequence, KSort, KToken, KInner from pyk.kast.parser import KAstParser from pyk.kast.manip import set_cell +from pyk.kast.kast import kast_term from pyk.cterm import CTerm from pyk.ktool.krun import KRun +from pyk.ktool.kprint import _kast from pyk.prelude.k import GENERATED_TOP_CELL from pyk.kdist import kdist from pyk.kore.prelude import top_cell_initializer @@ -39,8 +41,16 @@ def _init_cterm(self) -> None: init_config = self.krun.definition.init_config(GENERATED_TOP_CELL) self.cterm = CTerm.from_kast(init_config) - def load_program(self, program: str) -> None: + def load_program(self, program_path: str) -> None: + returned_process = _kast(file=program_path, definition_dir=f'../.build/rust-kompiled') + + program = returned_process.stdout + # program = kast_term(json.loads(returned_process.stdout)) + + # print('kasted program') + # return + ## ATTEMPT 2 ------------------------------------------ ## Perform the substitution of the $PGM. It seems to be equivalent to the other approaches used. # self.krun.definition.empty_config(GENERATED_TOP_CELL) @@ -66,7 +76,7 @@ def load_program(self, program: str) -> None: # parsed_program = KInner.from_dict(program_json['term']) # return - self.cterm = CTerm.from_kast(set_cell(self.cterm.config, 'K_CELL', KSequence(KApply('crateParser(_)_RUST-INDEXING-SYNTAX_Initializer_Crate', parsed_program)))) + self.cterm = CTerm.from_kast(set_cell(self.cterm.config, 'K_CELL', KSequence(KApply('crateParser(_)_RUST-PREPROCESSING-SYNTAX_Initializer_Crate', parsed_program)))) pattern = self.krun.kast_to_kore(self.cterm.config, sort=GENERATED_TOP_CELL) output_kore = self.krun.run_pattern(pattern, pipe_stderr=False) self.cterm = CTerm.from_kast(self.krun.kore_to_kast(output_kore)) @@ -76,17 +86,4 @@ def fetch_k_cell_content(self): cell = self.cterm.cell('K_CELL') _PPRINT.pprint(cell) return cell - - - - - - -def load_json_dict(input_file: Path) -> Mapping[str, Any]: - with input_file.open() as f: - return json.load(f) - - -def load_json_kinner(input_file: Path) -> KInner: - value = load_json_dict(input_file) - return KInner.from_dict(value) \ No newline at end of file + \ No newline at end of file From d44aa43a4069c92a4f352b82448c3a3807db70ed Mon Sep 17 00:00:00 2001 From: acassimiro Date: Thu, 22 Aug 2024 23:20:52 -0300 Subject: [PATCH 08/11] Adding CLI for ease of usage --- rust-lite/pyproject.toml | 6 +- rust-lite/src/rust_lite/__main__.py | 62 ++++++++- rust-lite/src/rust_lite/cli.py | 202 ++++++++++++++++++++++++++++ 3 files changed, 267 insertions(+), 3 deletions(-) create mode 100644 rust-lite/src/rust_lite/cli.py diff --git a/rust-lite/pyproject.toml b/rust-lite/pyproject.toml index 6e5d155..e3dfc69 100644 --- a/rust-lite/pyproject.toml +++ b/rust-lite/pyproject.toml @@ -34,7 +34,11 @@ pytest-xdist = "*" pyupgrade = "*" [tool.poetry.scripts] -rust = "rust_lite.__main__:main" +main = "rust_lite.__main__:main" +empty = "rust_lite.__main__:exec_empty" +erc20 = "rust_lite.__main__:exec_erc20" +lending = "rust_lite.__main__:exec_lending" +staking = "rust_lite.__main__:exec_staking" [tool.isort] profile = "black" diff --git a/rust-lite/src/rust_lite/__main__.py b/rust-lite/src/rust_lite/__main__.py index 384c59b..580d902 100644 --- a/rust-lite/src/rust_lite/__main__.py +++ b/rust-lite/src/rust_lite/__main__.py @@ -6,6 +6,10 @@ import sys from collections.abc import Iterable from typing import TYPE_CHECKING +from .cli import _create_argument_parser, generate_options, get_argument_type_setter, get_option_string_destination +from pyk.cli.pyk import parse_toml_args +from pathlib import Path + from .manager import RustLiteManager @@ -15,6 +19,7 @@ from argparse import Namespace from collections.abc import Callable, Iterator from typing import Any, Final, TypeVar + from .cli import RunOptions T = TypeVar('T') @@ -23,15 +28,37 @@ def main() -> None: + sys.setrecursionlimit(15000000) + parser = _create_argument_parser() + args = parser.parse_args() + toml_args = parse_toml_args(args, get_option_string_destination, get_argument_type_setter) + logging.basicConfig(level=_loglevel(args), format=_LOG_FORMAT) + + stripped_args = toml_args | { + key: val for (key, val) in vars(args).items() if val is not None and not (isinstance(val, Iterable) and not val) + } + print(stripped_args) + options = generate_options(stripped_args) + + executor_name = 'exec_' + args.command.lower().replace('-', '_') + if executor_name not in globals(): + raise AssertionError(f'Unimplemented command: {args.command}') + + execute = globals()[executor_name] + execute(options) + + +def exec_run(options: RunOptions) -> None: + contract_path = str(options.input_file.resolve()) + print('Instantiating module manager;') module_manager = RustLiteManager() print('Module manager initiated; Trying to load program into K cell;') - # contract_path = '../tests/syntax/erc_20_token.rs' - contract_path = '../tests/execution/empty.rs' + # contract_path = '../tests/execution/empty.rs' module_manager.load_program(contract_path) @@ -39,3 +66,34 @@ def main() -> None: module_manager.fetch_k_cell_content() +def trigger_exec_run(stripped_args): + options = generate_options(stripped_args) + executor_name = 'exec_run' + execute = globals()[executor_name] + execute(options) + +def exec_empty() -> None: + stripped_args = {'command': 'run', 'input_file': Path('../tests/execution/empty.rs')} + trigger_exec_run(stripped_args) + +def exec_erc20() -> None: + stripped_args = {'command': 'run', 'input_file': Path('../tests/syntax/erc_20_token.rs')} + trigger_exec_run(stripped_args) + +def exec_staking() -> None: + stripped_args = {'command': 'run', 'input_file': Path('../tests/syntax/lending.rs')} + trigger_exec_run(stripped_args) + +def exec_lending() -> None: + stripped_args = {'command': 'run', 'input_file': Path('../tests/syntax/staking.rs')} + trigger_exec_run(stripped_args) + + +def _loglevel(args: Namespace) -> int: + if args.debug: + return logging.DEBUG + + if args.verbose: + return logging.INFO + + return logging.WARNING \ No newline at end of file diff --git a/rust-lite/src/rust_lite/cli.py b/rust-lite/src/rust_lite/cli.py new file mode 100644 index 0000000..6cb9331 --- /dev/null +++ b/rust-lite/src/rust_lite/cli.py @@ -0,0 +1,202 @@ +from __future__ import annotations + +import logging +from argparse import ArgumentParser +from functools import cached_property +from typing import TYPE_CHECKING, Any + +from pyk.cli.args import DisplayOptions as PykDisplayOptions +from pyk.cli.args import KCLIArgs, KDefinitionOptions, LoggingOptions, Options, SaveDirOptions +from pyk.cli.utils import file_path +from pyk.kast.inner import KSort +from pyk.kore.tools import PrintOutput +from pyk.ktool.krun import KRunOutput + +if TYPE_CHECKING: + from collections.abc import Callable + from pathlib import Path + from typing import Final, TypeVar + + T = TypeVar('T') + +_LOGGER: Final = logging.getLogger(__name__) + + +def generate_options(args: dict[str, Any]) -> LoggingOptions: + command = args['command'] + match command: + case 'version': + return VersionOptions(args) + case 'run': + return RunOptions(args) + case _: + raise ValueError(f'Unrecognized command: {command}') + + +def get_option_string_destination(command: str, option_string: str) -> str: + option_string_destinations = {} + match command: + case 'version': + option_string_destinations = VersionOptions.from_option_string() + case 'parse': + option_string_destinations = RunOptions.from_option_string() + + return option_string_destinations.get(option_string, option_string.replace('-', '_')) + + +def get_argument_type_setter(command: str, option_string: str) -> Callable[[str], Any]: + def func(par: str) -> str: + return par + + option_types = {} + match command: + case 'version': + option_types = VersionOptions.get_argument_type() + case 'parse': + option_types = RunOptions.get_argument_type() + + return option_types.get(option_string, func) + + +def _create_argument_parser() -> ArgumentParser: + rust_lite_cli_args = RustLiteCLIArgs() + parser = ArgumentParser(prog='rust-lite') + + command_parser = parser.add_subparsers(dest='command', required=True) + + # command_parser.add_parser('version', help='Print Rust-Lite version and exit.', parents=[rust_lite_cli_args.logging_args]) + + run_args = command_parser.add_parser( + 'run', + help='Run Rust-Lite program.', + parents=[ + rust_lite_cli_args.logging_args, + # rust_lite_cli_args.target_args, + # rust_lite_cli_args.k_args, + ], + ) + run_args.add_argument('input_file', type=file_path, help='Path to input file.') + # run_args.add_argument( + # '--output', + # type=PrintOutput, + # choices=list(PrintOutput), + # ) + # run_args.add_argument( + # '--sort', + # dest='sort', + # default=None, + # type=KSort, + # help='Sort to parse input as.', + # ) + + return parser + + +class KOptions(KDefinitionOptions): + definition_dir: Path | None + depth: int | None + + @staticmethod + def default() -> dict[str, Any]: + return { + 'definition_dir': None, + 'depth': None, + } + + @staticmethod + def from_option_string() -> dict[str, str]: + return KDefinitionOptions.from_option_string() | { + 'definition': 'definition_dir', + } + + @staticmethod + def get_argument_type() -> dict[str, Callable]: + return KDefinitionOptions.get_argument_type() + + +class TargetOptions(Options): + target: str | None + + @staticmethod + def default() -> dict[str, Any]: + return { + 'target': None, + } + + +class DisplayOptions(PykDisplayOptions): + sort_collections: bool + + @staticmethod + def default() -> dict[str, Any]: + return { + 'sort_collections': False, + } + + @staticmethod + def from_option_string() -> dict[str, str]: + return PykDisplayOptions.from_option_string() + + @staticmethod + def get_argument_type() -> dict[str, Callable]: + return PykDisplayOptions.get_argument_type() + + +class VersionOptions(LoggingOptions): + @staticmethod + def from_option_string() -> dict[str, str]: + return LoggingOptions.from_option_string() + + @staticmethod + def get_argument_type() -> dict[str, Callable]: + return LoggingOptions.get_argument_type() + +class RunOptions( + LoggingOptions +): + input_file: Path + + @staticmethod + def default() -> dict[str, Any]: + return { + 'input_file': None, + } + + @staticmethod + def from_option_string() -> dict[str, str]: + return ( + LoggingOptions.from_option_string() + ) + + @staticmethod + def get_argument_type() -> dict[str, Callable]: + return ( + { + 'input_file': file_path, + } + ) + +class RustLiteCLIArgs(KCLIArgs): + @cached_property + def target_args(self) -> ArgumentParser: + args = ArgumentParser(add_help=False) + args.add_argument('--target', choices=['llvm', 'haskell', 'haskell-standalone', 'foundry']) + return args + + @cached_property + def k_args(self) -> ArgumentParser: + args = super().definition_args + args.add_argument('--depth', type=int, help='Maximum depth to execute to.') + return args + + @cached_property + def display_args(self) -> ArgumentParser: + args = super().display_args + args.add_argument( + '--sort-collections', + dest='sort_collections', + default=None, + action='store_true', + help='Sort collections before outputting term.', + ) + return args \ No newline at end of file From 9f9d54b30b5fcc6e0e1bdec52adeecbcccdc8d54 Mon Sep 17 00:00:00 2001 From: acassimiro Date: Thu, 22 Aug 2024 23:33:30 -0300 Subject: [PATCH 09/11] Removing dead code --- rust-lite/src/rust_lite/__main__.py | 5 ---- rust-lite/src/rust_lite/manager.py | 40 +---------------------------- 2 files changed, 1 insertion(+), 44 deletions(-) diff --git a/rust-lite/src/rust_lite/__main__.py b/rust-lite/src/rust_lite/__main__.py index 580d902..d0b28ac 100644 --- a/rust-lite/src/rust_lite/__main__.py +++ b/rust-lite/src/rust_lite/__main__.py @@ -1,7 +1,5 @@ from __future__ import annotations -import contextlib -import json import logging import sys from collections.abc import Iterable @@ -57,9 +55,6 @@ def exec_run(options: RunOptions) -> None: print('Module manager initiated; Trying to load program into K cell;') - # contract_path = '../tests/syntax/erc_20_token.rs' - # contract_path = '../tests/execution/empty.rs' - module_manager.load_program(contract_path) print('Program loaded; Trying to fetch the content of the K cell.') diff --git a/rust-lite/src/rust_lite/manager.py b/rust-lite/src/rust_lite/manager.py index c520c5c..9b217ed 100644 --- a/rust-lite/src/rust_lite/manager.py +++ b/rust-lite/src/rust_lite/manager.py @@ -1,29 +1,17 @@ from __future__ import annotations -import contextlib -import json -import logging -import sys import pprint from collections.abc import Iterable from typing import TYPE_CHECKING, Mapping, Any from pathlib import Path -from pathos.pools import ProcessPool # type: ignore -from pyk.cli.pyk import parse_toml_args from pyk.kast.inner import KApply, KSequence, KSort, KToken, KInner from pyk.kast.parser import KAstParser from pyk.kast.manip import set_cell -from pyk.kast.kast import kast_term from pyk.cterm import CTerm from pyk.ktool.krun import KRun from pyk.ktool.kprint import _kast from pyk.prelude.k import GENERATED_TOP_CELL -from pyk.kdist import kdist -from pyk.kore.prelude import top_cell_initializer -from pyk.kore.tools import kore_print -from pyk.utils import FrozenDict -from pyk.prelude.string import stringToken _PPRINT = pprint.PrettyPrinter(width=41, compact=True) @@ -46,35 +34,9 @@ def load_program(self, program_path: str) -> None: returned_process = _kast(file=program_path, definition_dir=f'../.build/rust-kompiled') program = returned_process.stdout - # program = kast_term(json.loads(returned_process.stdout)) - - # print('kasted program') - # return - - ## ATTEMPT 2 ------------------------------------------ - ## Perform the substitution of the $PGM. It seems to be equivalent to the other approaches used. - # self.krun.definition.empty_config(GENERATED_TOP_CELL) - # init_config = self.krun.definition.init_config(GENERATED_TOP_CELL) - - # init_subst = { - # '$PGM': stringToken(program), - # } - - # init_term = Subst(init_subst)(init_config) - # self.cterm = CTerm.from_kast(init_term) - - ## ATTEMPT 3 ------------------------------------------ - ## Manually call kast to get the stdout into a file. Load the file and use KAstParser to convert into a KList + parser = KAstParser(program) parsed_program = parser.klist() - # _PPRINT.pprint(parsed_program) - # return - - ## ATTEMPT 4 ------------------------------------------ - ## Using kast to generate a .json of the parsed contract. program should be the content of '../erc20.json' - # program_json = json.loads(program) - # parsed_program = KInner.from_dict(program_json['term']) - # return self.cterm = CTerm.from_kast(set_cell(self.cterm.config, 'K_CELL', KSequence(KApply('crateParser(_)_RUST-PREPROCESSING-SYNTAX_Initializer_Crate', parsed_program)))) pattern = self.krun.kast_to_kore(self.cterm.config, sort=GENERATED_TOP_CELL) From 2fbfeccdea321addf91349024f5d819b32be262d Mon Sep 17 00:00:00 2001 From: acassimiro Date: Fri, 23 Aug 2024 11:19:46 -0300 Subject: [PATCH 10/11] Fixing messages --- rust-lite/src/rust_lite/__main__.py | 4 ++-- rust-lite/src/rust_lite/manager.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rust-lite/src/rust_lite/__main__.py b/rust-lite/src/rust_lite/__main__.py index d0b28ac..d40237c 100644 --- a/rust-lite/src/rust_lite/__main__.py +++ b/rust-lite/src/rust_lite/__main__.py @@ -35,7 +35,7 @@ def main() -> None: stripped_args = toml_args | { key: val for (key, val) in vars(args).items() if val is not None and not (isinstance(val, Iterable) and not val) } - print(stripped_args) + options = generate_options(stripped_args) executor_name = 'exec_' + args.command.lower().replace('-', '_') @@ -57,7 +57,7 @@ def exec_run(options: RunOptions) -> None: module_manager.load_program(contract_path) - print('Program loaded; Trying to fetch the content of the K cell.') + print('Performed all possible rewriting operations; Trying to fetch the content of the K cell.') module_manager.fetch_k_cell_content() diff --git a/rust-lite/src/rust_lite/manager.py b/rust-lite/src/rust_lite/manager.py index 9b217ed..d875fd8 100644 --- a/rust-lite/src/rust_lite/manager.py +++ b/rust-lite/src/rust_lite/manager.py @@ -45,6 +45,8 @@ def load_program(self, program_path: str) -> None: def fetch_k_cell_content(self): + print('--------------------------------------------------') + print('K CELL CONTENTS: ') cell = self.cterm.cell('K_CELL') _PPRINT.pprint(cell) return cell From 25648f483f17428715a41c31eaad9c837f5e0198 Mon Sep 17 00:00:00 2001 From: acassimiro Date: Fri, 23 Aug 2024 14:43:21 -0300 Subject: [PATCH 11/11] Removing dead code --- rust-lite/src/rust_lite/cli.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/rust-lite/src/rust_lite/cli.py b/rust-lite/src/rust_lite/cli.py index 6cb9331..655090f 100644 --- a/rust-lite/src/rust_lite/cli.py +++ b/rust-lite/src/rust_lite/cli.py @@ -64,30 +64,14 @@ def _create_argument_parser() -> ArgumentParser: command_parser = parser.add_subparsers(dest='command', required=True) - # command_parser.add_parser('version', help='Print Rust-Lite version and exit.', parents=[rust_lite_cli_args.logging_args]) - run_args = command_parser.add_parser( 'run', help='Run Rust-Lite program.', parents=[ rust_lite_cli_args.logging_args, - # rust_lite_cli_args.target_args, - # rust_lite_cli_args.k_args, ], ) run_args.add_argument('input_file', type=file_path, help='Path to input file.') - # run_args.add_argument( - # '--output', - # type=PrintOutput, - # choices=list(PrintOutput), - # ) - # run_args.add_argument( - # '--sort', - # dest='sort', - # default=None, - # type=KSort, - # help='Sort to parse input as.', - # ) return parser