redditwarp.util.shdlr#

A general purpose event scheduler.

This is just a reimplementation of the sched module from the standard library, but the names of the methods are different.

class redditwarp.util.shdlr.Entry(when: float, callback: Callable[[], None])[source]#

Bases: object

when: float#
callback: Callable[[], None]#
scheduled: bool#
cancelled: bool#
class redditwarp.util.shdlr.Handle(entry: Entry)[source]#

Bases: object

get_when() float[source]#
get_callback() Callable[[], None][source]#
is_scheduled() bool[source]#
is_cancelled() bool[source]#
cancel() None[source]#
class redditwarp.util.shdlr.Scheduler(*, time_func: ~typing.Callable[[], float] = <built-in function monotonic>, delay_func: ~typing.Callable[[float], None] = <built-in function sleep>)[source]#

Bases: Sized

time_func: Callable[[], float]#
delay_func: Callable[[float], None]#
empty() bool[source]#
time() float[source]#
call_at(when: float, callback: Callable[[], None]) Handle[source]#
call_later(delay: float, callback: Callable[[], None]) Handle[source]#
call_soon(callback: Callable[[], None]) Handle[source]#
jog() float[source]#

Run the scheduler while there are immediate events to be processed.

Return the amount of time it will take until the next event is ready. If there are no further scheduled events, the value -1 is returned.

run() None[source]#

Run the scheduller until all scheduled events are complete.