from toolbox.functools import timeout
- timeout(days, hours, minutes, seconds, error)#
Wait for time before quitting func run and returning None.
This decorator works with both asynchronous and synchronous functions. Note, however, that with synchronous function the signal module is used and therefore will not work with non-Unix based systems.
int) – Days to wait before timeout.
int) – Hours to wait before timeout.
int) – Minutes to wait before timeout.
int) – Seconds to wait before timeout.
bool) – Indicates whether or not to throw
TimeoutErrorerror once function timeouts.
from toolbox.functools.timeout import timeout @timeout(seconds=5) def func(): time.wait(15) func()
- Return type