roboto.waiters#

Module Contents#

roboto.waiters.Condition#
roboto.waiters.Interval#
exception roboto.waiters.TimeoutError(msg)#

Bases: TimeoutError

A wait gave up before its condition was met.

Subclasses the built-in TimeoutError, so except TimeoutError catches it whether or not the caller imported this class.

Parameters:

msg (str)

msg: str#

What was being waited for, and where it stood when the wait gave up.

roboto.waiters.wait_for(condition, args=None, timeout=60 * 5, interval=5, timeout_msg='wait_for timed out')#

Wait for a condition to be truthy.

Parameters:
  • condition (Condition) – The condition to wait for. This should be a callable that returns a boolean.

  • args (Optional[collections.abc.Sequence[Any]]) – The arguments to pass to the condition callable on each iteration.

  • timeout (float) – The maximum amount of time to wait for the condition to be truthy.

  • interval (Interval) – The amount of time to wait between iterations. This can be an integer or a callable. If it is a callable, it will be called with the iteration number and should return an integer.

  • timeout_msg (str) – The message to include in the TimeoutError if the timeout is reached.

Raises:

TimeoutError – If the timeout is reached before the condition is truthy.

Returns:

None

Return type:

None