From bfb7d75fe47ea588495c5be8157a67b1fec67a13 Mon Sep 17 00:00:00 2001 From: sigoden Date: Thu, 6 Jun 2024 08:29:00 +0800 Subject: refactor: move tools/$lang/** to tools/** (#17) --- tools/may_execute_py_code.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tools/may_execute_py_code.py (limited to 'tools/may_execute_py_code.py') diff --git a/tools/may_execute_py_code.py b/tools/may_execute_py_code.py new file mode 100644 index 0000000..01a59b9 --- /dev/null +++ b/tools/may_execute_py_code.py @@ -0,0 +1,21 @@ +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"]) -- cgit v1.2.3