From 03c4b6982293c5be31d7eda89b6dcb8c1a7a8059 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sun, 19 May 2024 22:43:49 +0800 Subject: feat: supports functions in bash/js/python/ruby (#6) --- py/may_execute_py_code.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 py/may_execute_py_code.py (limited to 'py/may_execute_py_code.py') diff --git a/py/may_execute_py_code.py b/py/may_execute_py_code.py new file mode 100644 index 0000000..01a59b9 --- /dev/null +++ b/py/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