rx.scheduler.
CatchScheduler
(scheduler, handler)¶__init__
(scheduler, handler)¶Wraps a scheduler, passed as constructor argument, adding exception handling for scheduled actions. The handler should return True to indicate it handled the exception successfully. Falsy return values will be taken to indicate that the exception should be escalated (raised by this scheduler).
scheduler (Scheduler
) – The scheduler to be wrapped.
handler (Callable
[[Exception
], bool
]) – Callable to handle exceptions raised by wrapped scheduler.
None
now
¶Represents a notion of time for this scheduler. Tasks being scheduled on a scheduler will adhere to the time denoted by this property.
datetime
The scheduler’s current time, as a datetime instance.
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
duetime (Union
[timedelta
, float
]) – Relative time after which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_periodic
(period, action, state=None)¶Schedules a periodic piece of work.
period (Union
[timedelta
, float
]) – Period in seconds or timedelta for running the
work periodically.
action (Callable
[[Optional
[~TState]], Optional
[~TState]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] Initial state passed to the action upon
the first iteration.
The disposable object used to cancel the scheduled recurring action (best effort).
rx.scheduler.
CurrentThreadScheduler
¶Represents an object that schedules units of work on the current thread. You should never schedule timeouts using the CurrentThreadScheduler, as that will block the thread while waiting.
Each instance manages a number of trampolines (and queues), one for each thread that calls a schedule method. These trampolines are automatically garbage-collected when threads disappear, because they’re stored in a weak key dictionary.
singleton
()¶Obtain a singleton instance for the current thread. Please note, if you pass this instance to another thread, it will effectively behave as if it were created by that other thread (separate trampoline and queue).
CurrentThreadScheduler
The singleton CurrentThreadScheduler instance.
__init__
()¶Creates a scheduler that bounces its work off the trampoline.
rx.scheduler.
EventLoopScheduler
(thread_factory=None, exit_if_empty=False)¶Creates an object that schedules units of work on a designated thread.
__init__
(thread_factory=None, exit_if_empty=False)¶Initialize self. See help(type(self)) for accurate signature.
None
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
duetime (Union
[timedelta
, float
]) – Relative time after which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_periodic
(period, action, state=None)¶Schedules a periodic piece of work.
period (Union
[timedelta
, float
]) – Period in seconds or timedelta for running the
work periodically.
action (Callable
[[Optional
[~TState]], Optional
[~TState]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] Initial state passed to the action upon
the first iteration.
The disposable object used to cancel the scheduled recurring action (best effort).
run
()¶Event loop scheduled on the designated event loop thread. The loop is suspended/resumed using the condition which gets notified by calls to Schedule or calls to dispose.
None
dispose
()¶Ends the thread associated with this scheduler. All remaining work in the scheduler queue is abandoned.
None
rx.scheduler.
HistoricalScheduler
(initial_clock=None)¶Provides a virtual time scheduler that uses datetime for absolute time and timedelta for relative time.
__init__
(initial_clock=None)¶Creates a new historical scheduler with the specified initial clock value.
initial_clock (Optional
[datetime
]) – Initial value for the clock.
None
now
¶Represents a notion of time for this scheduler. Tasks being scheduled on a scheduler will adhere to the time denoted by this property.
datetime
The scheduler’s current time, as a datetime instance.
add
(absolute, relative)¶Adds a relative time value to an absolute time value.
absolute (Union
[datetime
, float
]) – Absolute virtual time value.
relative (Union
[timedelta
, float
]) – Relative virtual time value to add.
Union
[datetime
, float
]
The resulting absolute virtual time sum value.
rx.scheduler.
ImmediateScheduler
¶Represents an object that schedules units of work to run immediately,
on the current thread. You’re not allowed to schedule timeouts using the
ImmediateScheduler since that will block the current thread while waiting.
Attempts to do so will raise a WouldBlockException
.
__new__
(cls)¶Create and return a new object. See help(type) for accurate signature.
ImmediateScheduler
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
duetime (Union
[timedelta
, float
]) – Relative time after which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
rx.scheduler.
NewThreadScheduler
(thread_factory=None)¶Creates an object that schedules each unit of work on a separate thread.
__init__
(thread_factory=None)¶Initialize self. See help(type(self)) for accurate signature.
None
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
duetime (Union
[timedelta
, float
]) – Relative time after which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_periodic
(period, action, state=None)¶Schedules a periodic piece of work.
period (Union
[timedelta
, float
]) – Period in seconds or timedelta for running the
work periodically.
action (Callable
[[Optional
[~TState]], Optional
[~TState]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] Initial state passed to the action upon
the first iteration.
The disposable object used to cancel the scheduled recurring action (best effort).
rx.scheduler.
ThreadPoolScheduler
(max_workers=None)¶A scheduler that schedules work via the thread pool.
ThreadPoolThread
(executor, target)¶Wraps a concurrent future as a thread.
__init__
(executor, target)¶Initialize self. See help(type(self)) for accurate signature.
__init__
(max_workers=None)¶Initialize self. See help(type(self)) for accurate signature.
None
rx.scheduler.
TimeoutScheduler
¶A scheduler that schedules work via a timed callback.
__new__
(cls)¶Create and return a new object. See help(type) for accurate signature.
TimeoutScheduler
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
duetime (Union
[timedelta
, float
]) – Relative time after which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
rx.scheduler.
TrampolineScheduler
¶Represents an object that schedules units of work on the trampoline. You should never schedule timeouts using the TrampolineScheduler, as it will block the thread while waiting.
Each instance has its own trampoline (and queue), and you can schedule work on it from different threads. Beware though, that the first thread to call a schedule method while the trampoline is idle will then remain occupied until the queue is empty.
__init__
()¶Creates a scheduler that bounces its work off the trampoline.
None
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
duetime (Union
[timedelta
, float
]) – Relative time after which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_required
()¶Test if scheduling is required.
Gets a value indicating whether the caller must call a schedule method. If the trampoline is active, then it returns False; otherwise, if the trampoline is not active, then it returns True.
bool
ensure_trampoline
(action)¶Method for testing the TrampolineScheduler.
rx.scheduler.
VirtualTimeScheduler
(initial_clock=0)¶Virtual Scheduler. This scheduler should work with either datetime/timespan or ticks as int/int
__init__
(initial_clock=0)¶Creates a new virtual time scheduler with the specified initial clock value.
initial_clock – Initial value for the clock.
None
now
¶Represents a notion of time for this scheduler. Tasks being scheduled on a scheduler will adhere to the time denoted by this property.
datetime
The scheduler’s current time, as a datetime instance.
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
duetime (Union
[timedelta
, float
]) – Relative time after which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
start
()¶Starts the virtual time scheduler.
None
stop
()¶Stops the virtual time scheduler.
None
advance_to
(time)¶Advances the schedulers clock to the specified absolute time, running all work til that point.
time (Union
[datetime
, float
]) – Absolute time to advance the schedulers clock to.
None
advance_by
(time)¶Advances the schedulers clock by the specified relative time, running all work scheduled for that timespan.
time (Union
[timedelta
, float
]) – Relative time to advance the schedulers clock by.
None
sleep
(time)¶Advances the schedulers clock by the specified relative time.
time (Union
[timedelta
, float
]) – Relative time to advance the schedulers clock by.
None
add
(absolute, relative)¶Adds a relative time value to an absolute time value.
absolute (Union
[datetime
, float
]) – Absolute virtual time value.
relative (Union
[timedelta
, float
]) – Relative virtual time value to add.
Union
[datetime
, float
]
The resulting absolute virtual time sum value.
rx.scheduler.eventloop.
AsyncIOScheduler
(loop)¶A scheduler that schedules work via the asyncio mainloop. This class does not use the asyncio threadsafe methods, if you need those please use the AsyncIOThreadSafeScheduler class.
__init__
(loop)¶Create a new AsyncIOScheduler.
loop (AbstractEventLoop
) – Instance of asyncio event loop to use; typically, you would
get this by asyncio.get_event_loop()
None
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
duetime (Union
[timedelta
, float
]) – Relative time after which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
now
¶Represents a notion of time for this scheduler. Tasks being scheduled on a scheduler will adhere to the time denoted by this property.
datetime
The scheduler’s current time, as a datetime instance.
rx.scheduler.eventloop.
AsyncIOThreadSafeScheduler
(loop)¶A scheduler that schedules work via the asyncio mainloop. This is a subclass of AsyncIOScheduler which uses the threadsafe asyncio methods.
__init__
(loop)¶Create a new AsyncIOThreadSafeScheduler.
loop (AbstractEventLoop
) – Instance of asyncio event loop to use; typically, you would
get this by asyncio.get_event_loop()
None
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
duetime (Union
[timedelta
, float
]) – Relative time after which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
rx.scheduler.eventloop.
EventletScheduler
(eventlet)¶A scheduler that schedules work via the eventlet event loop.
__init__
(eventlet)¶Create a new EventletScheduler.
eventlet (Any
) – The eventlet module to use; typically, you would get this
by import eventlet
None
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
duetime (Union
[timedelta
, float
]) – Relative time after which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
now
¶Represents a notion of time for this scheduler. Tasks being scheduled on a scheduler will adhere to the time denoted by this property.
datetime
The scheduler’s current time, as a datetime instance.
rx.scheduler.eventloop.
GEventScheduler
(gevent)¶A scheduler that schedules work via the GEvent event loop.
__init__
(gevent)¶Create a new GEventScheduler.
gevent (Any
) – The gevent module to use; typically ,you would get this by
import gevent
None
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
duetime (Union
[timedelta
, float
]) – Relative time after which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
now
¶Represents a notion of time for this scheduler. Tasks being scheduled on a scheduler will adhere to the time denoted by this property.
datetime
The scheduler’s current time, as a datetime instance.
rx.scheduler.eventloop.
IOLoopScheduler
(loop)¶A scheduler that schedules work via the Tornado I/O main event loop.
Note, as of Tornado 6, this is just a wrapper around the asyncio loop.
http://tornado.readthedocs.org/en/latest/ioloop.html
__init__
(loop)¶Create a new IOLoopScheduler.
loop (Any
) – The ioloop to use; typically, you would get this by
tornado import ioloop; ioloop.IOLoop.current()
None
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
duetime (Union
[timedelta
, float
]) – Relative time after which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
now
¶Represents a notion of time for this scheduler. Tasks being scheduled on a scheduler will adhere to the time denoted by this property.
datetime
The scheduler’s current time, as a datetime instance.
rx.scheduler.eventloop.
TwistedScheduler
(reactor)¶A scheduler that schedules work via the Twisted reactor mainloop.
__init__
(reactor)¶Create a new TwistedScheduler.
reactor (Any
) – The reactor to use; typically, you would get this
by from twisted.internet import reactor
None
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
duetime (Union
[timedelta
, float
]) – Relative time after which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
now
¶Represents a notion of time for this scheduler. Tasks being scheduled on a scheduler will adhere to the time denoted by this property.
datetime
The scheduler’s current time, as a datetime instance.
rx.scheduler.mainloop.
GtkScheduler
(glib)¶A scheduler that schedules work via the GLib main loop used in GTK+ applications.
See https://wiki.gnome.org/Projects/PyGObject
__init__
(glib)¶Create a new GtkScheduler.
glib (Any
) – The GLib module to use; typically, you would get this by
import gi; gi.require_version(‘Gtk’, ‘3.0’); from gi.repository import GLib
None
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
duetime (Union
[timedelta
, float
]) – Relative time after which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_periodic
(period, action, state=None)¶Schedules a periodic piece of work to be executed in the loop.
period (Union
[timedelta
, float
]) – Period in seconds for running the work repeatedly.
action (Callable
[[Optional
[~TState]], Optional
[~TState]]) – Action to be executed.
state (Optional
[~TState]) –
[Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
rx.scheduler.mainloop.
PyGameScheduler
(pygame)¶A scheduler that schedules works for PyGame.
Note that this class expects the caller to invoke run() repeatedly.
http://www.pygame.org/docs/ref/time.html http://www.pygame.org/docs/ref/event.html
__init__
(pygame)¶Create a new PyGameScheduler.
pygame (Any
) – The PyGame module to use; typically, you would get this by
import pygame
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
:type duetime: Union
[timedelta
, float
]
:param duetime: Relative time after which to execute the action.
:type action: Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]
:param action: Action to be executed.
:type state: Optional
[~TState]
:param state: [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
rx.scheduler.mainloop.
QtScheduler
(qtcore)¶A scheduler for a PyQt5/PySide2 event loop.
__init__
(qtcore)¶Create a new QtScheduler.
qtcore (Any
) – The QtCore instance to use; typically you would get this by
either import PyQt5.QtCore or import PySide2.QtCore
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
duetime (Union
[timedelta
, float
]) – Relative time after which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_periodic
(period, action, state=None)¶Schedules a periodic piece of work to be executed in the loop.
period (Union
[timedelta
, float
]) – Period in seconds for running the work repeatedly.
action (Callable
[[Optional
[~TState]], Optional
[~TState]]) – Action to be executed.
state (Optional
[~TState]) –
[Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
rx.scheduler.mainloop.
TkinterScheduler
(root)¶A scheduler that schedules work via the Tkinter main event loop.
http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/universal.html http://effbot.org/tkinterbook/widget.htm
__init__
(root)¶Create a new TkinterScheduler.
root (Any
) – The Tk instance to use; typically, you would get this by
import tkinter; tkinter.Tk()
None
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
duetime (Union
[timedelta
, float
]) – Relative time after which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
rx.scheduler.mainloop.
WxScheduler
(wx)¶A scheduler for a wxPython event loop.
__init__
(wx)¶Create a new WxScheduler.
wx (Any
) – The wx module to use; typically, you would get this by
import wx
None
cancel_all
()¶Cancel all scheduled actions.
Should be called when destroying wx controls to prevent accessing dead wx objects in actions that might be pending.
None
schedule
(action, state=None)¶Schedules an action to be executed.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_relative
(duetime, action, state=None)¶Schedules an action to be executed after duetime.
duetime (Union
[timedelta
, float
]) – Relative time after which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_absolute
(duetime, action, state=None)¶Schedules an action to be executed at duetime.
duetime (Union
[datetime
, float
]) – Absolute time at which to execute the action.
action (Callable
[[Scheduler
, Optional
[~TState]], Optional
[Disposable
]]) – Action to be executed.
state (Optional
[~TState]) – [Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).
schedule_periodic
(period, action, state=None)¶Schedules a periodic piece of work to be executed in the loop.
period (Union
[timedelta
, float
]) – Period in seconds for running the work repeatedly.
action (Callable
[[Optional
[~TState]], Optional
[~TState]]) – Action to be executed.
state (Optional
[~TState]) –
[Optional] state to be given to the action function.
The disposable object used to cancel the scheduled action (best effort).