MCPcopy Create free account
hub / github.com/PRIME-RL/PRIME / time_limit

Method time_limit

eval/utils/python_interpreter.py:86–95  ·  view source on GitHub ↗
(self, seconds)

Source from the content-addressed store, hash-verified

84
85 @contextmanager
86 def time_limit(self, seconds):
87 def signal_handler(signum, frame):
88 raise TimeoutError(f"Timed out after {seconds} seconds.")
89
90 signal.signal(signal.SIGALRM, signal_handler)
91 signal.alarm(seconds)
92 try:
93 yield
94 finally:
95 signal.alarm(0) # Disable the alarm
96
97 def __call__(self, query: str) -> str:
98 query = query.strip().split("\n")

Callers 1

__call__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected