From 739a832d87c00e3b5977a24bba5654fa5ea7a702 Mon Sep 17 00:00:00 2001 From: sigoden Date: Fri, 7 Jun 2024 15:16:31 +0800 Subject: feat: js/py generate declarations from comments (#30) --- tools/may_execute_py_code.py | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'tools/may_execute_py_code.py') diff --git a/tools/may_execute_py_code.py b/tools/may_execute_py_code.py index 01a59b9..8e55a8d 100644 --- a/tools/may_execute_py_code.py +++ b/tools/may_execute_py_code.py @@ -1,21 +1,6 @@ -def declarate(): - return { - "name": "may_execute_py_code", - "description": "Runs the python code.", - "parameters": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "Python code to execute, such as `print(\"hello world\")`" - } - }, - "required": [ - "code" - ] - } - } - - -def execute(data): - exec(data["code"]) +def main(code: str): + """Runs the python code. + Args: + code: Python code to execute, such as `print("hello world")` + """ + exec(code) -- cgit v1.2.3