From 9b34292e1f1a2035ca1d229fbe4138edb6de6e41 Mon Sep 17 00:00:00 2001 From: Enzo Bonato Date: Sat, 27 Jul 2024 09:19:31 -0400 Subject: [PATCH 1/3] feat: final version ast extractor --- libs/.gitignore | 1 + libs/ast_extractor.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 libs/.gitignore create mode 100644 libs/ast_extractor.py diff --git a/libs/.gitignore b/libs/.gitignore new file mode 100644 index 0000000..ed8ebf5 --- /dev/null +++ b/libs/.gitignore @@ -0,0 +1 @@ +__pycache__ \ No newline at end of file diff --git a/libs/ast_extractor.py b/libs/ast_extractor.py new file mode 100644 index 0000000..d53bd4a --- /dev/null +++ b/libs/ast_extractor.py @@ -0,0 +1,16 @@ +import subprocess +import json + +def filepath_vyper_to_ast(file_path): + try: + result = subprocess.run( + ['vyper', '-f', 'ast', file_path], + capture_output=True, + text=True, + check=True + ) + ast = json.loads(result.stdout) + return ast + except subprocess.CalledProcessError as e: + print(f"Error compiling Vyper code: {e.stderr}") + return None \ No newline at end of file From 280022fcc2974694693d8f5b43c420b0da9cc9d2 Mon Sep 17 00:00:00 2001 From: Enzo Bonato Date: Mon, 5 Aug 2024 13:42:32 -0400 Subject: [PATCH 2/3] temporary change about ast --- libs/{ => ast_extractor}/.gitignore | 0 libs/ast_extractor/README.md | 1 + libs/ast_extractor/ast_extractor/__init__.py | 0 .../ast_extractor}/ast_extractor.py | 0 libs/ast_extractor/pyproject.toml | 14 ++++++++++++++ libs/ast_extractor/tests/__init__.py | 0 servers/servers/README.md | 0 servers/servers/poetry.lock | 19 +++++++++++++++++++ servers/servers/pyproject.toml | 14 ++++++++++++++ servers/servers/servers/__init__.py | 0 servers/servers/servers/ast.py | 0 servers/servers/tests/__init__.py | 0 12 files changed, 48 insertions(+) rename libs/{ => ast_extractor}/.gitignore (100%) create mode 100644 libs/ast_extractor/README.md create mode 100644 libs/ast_extractor/ast_extractor/__init__.py rename libs/{ => ast_extractor/ast_extractor}/ast_extractor.py (100%) create mode 100644 libs/ast_extractor/pyproject.toml create mode 100644 libs/ast_extractor/tests/__init__.py create mode 100644 servers/servers/README.md create mode 100644 servers/servers/poetry.lock create mode 100644 servers/servers/pyproject.toml create mode 100644 servers/servers/servers/__init__.py create mode 100644 servers/servers/servers/ast.py create mode 100644 servers/servers/tests/__init__.py diff --git a/libs/.gitignore b/libs/ast_extractor/.gitignore similarity index 100% rename from libs/.gitignore rename to libs/ast_extractor/.gitignore diff --git a/libs/ast_extractor/README.md b/libs/ast_extractor/README.md new file mode 100644 index 0000000..c1b16ed --- /dev/null +++ b/libs/ast_extractor/README.md @@ -0,0 +1 @@ +# Ast extractor for vyper using a file_path in input \ No newline at end of file diff --git a/libs/ast_extractor/ast_extractor/__init__.py b/libs/ast_extractor/ast_extractor/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/libs/ast_extractor.py b/libs/ast_extractor/ast_extractor/ast_extractor.py similarity index 100% rename from libs/ast_extractor.py rename to libs/ast_extractor/ast_extractor/ast_extractor.py diff --git a/libs/ast_extractor/pyproject.toml b/libs/ast_extractor/pyproject.toml new file mode 100644 index 0000000..1268496 --- /dev/null +++ b/libs/ast_extractor/pyproject.toml @@ -0,0 +1,14 @@ +[tool.poetry] +name = "ast_extractor" +version = "0.1.0" +description = "" +authors = ["Enzo Bonato "] +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.10" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/libs/ast_extractor/tests/__init__.py b/libs/ast_extractor/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/servers/servers/README.md b/servers/servers/README.md new file mode 100644 index 0000000..e69de29 diff --git a/servers/servers/poetry.lock b/servers/servers/poetry.lock new file mode 100644 index 0000000..261911e --- /dev/null +++ b/servers/servers/poetry.lock @@ -0,0 +1,19 @@ +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. + +[[package]] +name = "ast-extractor" +version = "0.1.0" +description = "" +optional = false +python-versions = "^3.10" +files = [] +develop = false + +[package.source] +type = "directory" +url = "../../libs/ast_extractor" + +[metadata] +lock-version = "2.0" +python-versions = "^3.10" +content-hash = "b9b2e8b262e8f93ea685f7af3ca505f1577e61ab03eeabc880f6cb6ca73a0cf2" diff --git a/servers/servers/pyproject.toml b/servers/servers/pyproject.toml new file mode 100644 index 0000000..7ab8551 --- /dev/null +++ b/servers/servers/pyproject.toml @@ -0,0 +1,14 @@ +[tool.poetry] +name = "servers" +version = "0.1.0" +description = "" +authors = ["Enzo Bonato "] +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.10" +ast_extractor = { path = "../../libs/ast_extractor" } + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/servers/servers/servers/__init__.py b/servers/servers/servers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/servers/servers/servers/ast.py b/servers/servers/servers/ast.py new file mode 100644 index 0000000..e69de29 diff --git a/servers/servers/tests/__init__.py b/servers/servers/tests/__init__.py new file mode 100644 index 0000000..e69de29 From cb09cb5ca539c95ad6e7b3e8907cc5209e1db44f Mon Sep 17 00:00:00 2001 From: 0xtekgrinder <0xtekgrinder@protonmail.com> Date: Thu, 12 Sep 2024 21:16:50 +0200 Subject: [PATCH 3/3] feat: poetry setup --- .../ast_extractor/__init__.py => ast-extractor/README.md} | 0 .../tests => ast-extractor/ast_extractor}/__init__.py | 0 .../ast_extractor.py => ast-extractor/ast_extractor/ast.py} | 2 +- libs/{ast_extractor => ast-extractor}/pyproject.toml | 4 ++-- libs/ast-extractor/tests/__init__.py | 0 libs/ast_extractor/.gitignore | 1 - libs/ast_extractor/README.md | 1 - servers/servers/poetry.lock | 4 ++-- servers/servers/pyproject.toml | 5 +++-- 9 files changed, 8 insertions(+), 9 deletions(-) rename libs/{ast_extractor/ast_extractor/__init__.py => ast-extractor/README.md} (100%) rename libs/{ast_extractor/tests => ast-extractor/ast_extractor}/__init__.py (100%) rename libs/{ast_extractor/ast_extractor/ast_extractor.py => ast-extractor/ast_extractor/ast.py} (100%) rename libs/{ast_extractor => ast-extractor}/pyproject.toml (71%) create mode 100644 libs/ast-extractor/tests/__init__.py delete mode 100644 libs/ast_extractor/.gitignore delete mode 100644 libs/ast_extractor/README.md diff --git a/libs/ast_extractor/ast_extractor/__init__.py b/libs/ast-extractor/README.md similarity index 100% rename from libs/ast_extractor/ast_extractor/__init__.py rename to libs/ast-extractor/README.md diff --git a/libs/ast_extractor/tests/__init__.py b/libs/ast-extractor/ast_extractor/__init__.py similarity index 100% rename from libs/ast_extractor/tests/__init__.py rename to libs/ast-extractor/ast_extractor/__init__.py diff --git a/libs/ast_extractor/ast_extractor/ast_extractor.py b/libs/ast-extractor/ast_extractor/ast.py similarity index 100% rename from libs/ast_extractor/ast_extractor/ast_extractor.py rename to libs/ast-extractor/ast_extractor/ast.py index d53bd4a..7394303 100644 --- a/libs/ast_extractor/ast_extractor/ast_extractor.py +++ b/libs/ast-extractor/ast_extractor/ast.py @@ -1,5 +1,5 @@ -import subprocess import json +import subprocess def filepath_vyper_to_ast(file_path): try: diff --git a/libs/ast_extractor/pyproject.toml b/libs/ast-extractor/pyproject.toml similarity index 71% rename from libs/ast_extractor/pyproject.toml rename to libs/ast-extractor/pyproject.toml index 1268496..f60602d 100644 --- a/libs/ast_extractor/pyproject.toml +++ b/libs/ast-extractor/pyproject.toml @@ -1,8 +1,8 @@ [tool.poetry] -name = "ast_extractor" +name = "ast-extractor" version = "0.1.0" description = "" -authors = ["Enzo Bonato "] +authors = ["0xtekgrinder <0xtekgrinder@protonmail.com>"] readme = "README.md" [tool.poetry.dependencies] diff --git a/libs/ast-extractor/tests/__init__.py b/libs/ast-extractor/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/libs/ast_extractor/.gitignore b/libs/ast_extractor/.gitignore deleted file mode 100644 index ed8ebf5..0000000 --- a/libs/ast_extractor/.gitignore +++ /dev/null @@ -1 +0,0 @@ -__pycache__ \ No newline at end of file diff --git a/libs/ast_extractor/README.md b/libs/ast_extractor/README.md deleted file mode 100644 index c1b16ed..0000000 --- a/libs/ast_extractor/README.md +++ /dev/null @@ -1 +0,0 @@ -# Ast extractor for vyper using a file_path in input \ No newline at end of file diff --git a/servers/servers/poetry.lock b/servers/servers/poetry.lock index 261911e..b0e4d80 100644 --- a/servers/servers/poetry.lock +++ b/servers/servers/poetry.lock @@ -11,9 +11,9 @@ develop = false [package.source] type = "directory" -url = "../../libs/ast_extractor" +url = "../../libs/ast-extractor" [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "b9b2e8b262e8f93ea685f7af3ca505f1577e61ab03eeabc880f6cb6ca73a0cf2" +content-hash = "b6b9e38b3eb45d988280df7ddecfb5261929e439b1d516427e2617b981a79fc3" diff --git a/servers/servers/pyproject.toml b/servers/servers/pyproject.toml index 7ab8551..0fbee0c 100644 --- a/servers/servers/pyproject.toml +++ b/servers/servers/pyproject.toml @@ -2,12 +2,13 @@ name = "servers" version = "0.1.0" description = "" -authors = ["Enzo Bonato "] +authors = ["0xtekgrinder <0xtekgrinder@protonmail.com>"] readme = "README.md" [tool.poetry.dependencies] python = "^3.10" -ast_extractor = { path = "../../libs/ast_extractor" } +ast-extractor = {path = "../../libs/ast-extractor"} + [build-system] requires = ["poetry-core"]