l.s.t.with_timeout : class documentation

Part of lp.services.timeout View In Hierarchy

Make sure the decorated function doesn't exceed a time out.

This will execute the function in a separate thread. If the function doesn't complete in the timeout, a TimeoutError is raised. The clean-up function will be called to "stop" the thread. (If it's possible to do so.)

Method __init__ Creates the function decorator.
Method __call__ Wraps the method.
def __init__(self, cleanup=None, timeout=None):
Creates the function decorator.
ParameterscleanupThat may be a callable or a string. If it's a string, a method under that name will be looked up. That callable will be called if the timeout is exceeded.
timeoutThe number of seconds to wait for.
def __call__(self, f):
Wraps the method.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.