MCPcopy Index your code
hub / github.com/zai-org/CodeGeeX2 / time_limit

Function time_limit

evaluation/execution.py:409–418  ·  view source on GitHub ↗
(seconds: float)

Source from the content-addressed store, hash-verified

407# ============================================================================
408@contextlib.contextmanager
409def time_limit(seconds: float):
410 def signal_handler(signum, frame):
411 raise TimeoutException("Timed out!")
412
413 signal.setitimer(signal.ITIMER_REAL, seconds)
414 signal.signal(signal.SIGALRM, signal_handler)
415 try:
416 yield
417 finally:
418 signal.setitimer(signal.ITIMER_REAL, 0)
419
420
421@contextlib.contextmanager

Callers 1

unsafe_executeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected