MCPcopy Index your code
hub / github.com/FastMAS/KVCOMM / get_output

Function get_output

KVCOMM/tools/coding/python_executor.py:21–30  ·  view source on GitHub ↗
(func: str, assert_statement: str, timeout: int = 5)

Source from the content-addressed store, hash-verified

19 return astunparse.unparse(call_str).strip()
20
21def get_output(func: str, assert_statement: str, timeout: int = 5) -> str:
22 try:
23 exec(f"from typing import *\n{func}", globals())
24 func_call = get_call_str(assert_statement)
25 output = function_with_timeout(eval, (func_call, globals()), timeout)
26 return output
27 except TimeoutError:
28 return "TIMEOUT"
29 except Exception as e:
30 return str(e)
31
32
33

Callers 1

executeMethod · 0.85

Calls 2

function_with_timeoutFunction · 0.90
get_call_strFunction · 0.85

Tested by

no test coverage detected