MCPcopy Create free account
hub / github.com/BUPT-GAMMA/MASFactory / function_with_timeout

Function function_with_timeout

applications/lats/humaneval/timeout_utils.py:22–31  ·  view source on GitHub ↗
(func, args, timeout)

Source from the content-addressed store, hash-verified

20
21
22def function_with_timeout(func, args, timeout):
23 r = []
24 def w():
25 r.append(func(*args))
26 t = _PropagatingThread(target=w)
27 t.start()
28 t.join(timeout)
29 if t.is_alive():
30 raise TimeoutError()
31 return r[0]

Callers 3

run_internal_testsFunction · 0.85
get_test_outputFunction · 0.85
full_evaluateFunction · 0.85

Calls 3

_PropagatingThreadClass · 0.85
joinMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected