narupatools.util.timing¶
Code for managing timings.
Functions
Decorator that prevents a function from being called more than once every wait period. |
|
Wait for a given predicate to evaluate to true. |
-
narupatools.util.timing.throttle(wait: float) → Any¶ Decorator that prevents a function from being called more than once every wait period.
-
narupatools.util.timing.wait_for(predicate: Callable[[…], bool], *, timeout: float = 2, check_interval: float = 0.1) → None¶ Wait for a given predicate to evaluate to true.
- Parameters
predicate – Event to wait for.
timeout – Time to wait in seconds.
check_interval – Interval to check predicate in seconds.
- Raises
TimeoutError – Timeout is reached and the predicate hasn’t returned true.