MCPcopy Create free account
hub / github.com/requests-cache/requests-cache / wrapper

Function wrapper

tests/conftest.py:304–324  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

302 def decorator(func):
303 @wraps(func)
304 def wrapper(*args, **kwargs):
305 result = None
306 exception = None
307
308 def target() -> None:
309 nonlocal result, exception
310 try:
311 result = func(*args, **kwargs)
312 except Exception as e:
313 exception = e
314
315 thread = threading.Thread(target=target)
316 thread.daemon = True
317 thread.start()
318 thread.join(timeout=timeout_seconds)
319
320 if thread.is_alive():
321 raise TimeoutError(f'Function timed out after {timeout_seconds} seconds')
322 if exception is not None:
323 raise exception
324 return result
325
326 return wrapper
327

Callers

nothing calls this directly

Calls 1

timeoutFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…