rx.core.typing.
Disposable
¶Disposable abstract base class.
dispose
()¶Dispose the object: stop whatever we’re doing and release all of the resources we might be using.
None
rx.core.typing.
Scheduler
¶Scheduler abstract base class.
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).
to_seconds
(value)¶Converts time value to seconds. This method handles both absolute (datetime) and relative (timedelta) values. If the argument is already a float, it is simply returned unchanged.
value (Union
[datetime
, timedelta
, float
]) – the time value to convert to seconds.
float
The value converted to seconds.
to_datetime
(value)¶Converts time value to datetime. This method handles both absolute (float) and relative (timedelta) values. If the argument is already a datetime, it is simply returned unchanged.
value (Union
[datetime
, timedelta
, float
]) – the time value to convert to datetime.
datetime
The value converted to datetime.
to_timedelta
(value)¶Converts time value to timedelta. This method handles both absolute (datetime) and relative (float) values. If the argument is already a timedelta, it is simply returned unchanged. If the argument is an absolute time, the result value will be the timedelta since the epoch, January 1st, 1970, 00:00:00.
value (Union
[datetime
, timedelta
, float
]) – the time value to convert to timedelta.
timedelta
The value converted to timedelta.
rx.core.typing.
PeriodicScheduler
¶PeriodicScheduler abstract base class.
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.core.typing.
Observer
¶Observer abstract base class
An Observer is the entity that receives all emissions of a subscribed Observable.
on_next
(value)¶Notifies the observer of a new element in the sequence.
value (-T_in) – The received element.
None
on_error
(error)¶Notifies the observer that an exception has occurred.
error (Exception
) – The error that has occurred.
None
on_completed
()¶Notifies the observer of the end of the sequence.
None
rx.core.typing.
Observable
¶Observable abstract base class.
Represents a push-style collection.
subscribe
(observer=None, *, scheduler=None)¶Subscribe an observer to the observable sequence.
Disposable object representing an observer’s subscription to the observable sequence.
rx.core.typing.
Subject
¶Subject abstract base class.
Represents an object that is both an observable sequence as well as an observer.
subscribe
(observer=None, *, scheduler=None)¶Subscribe an observer to the observable sequence.
Disposable object representing an observer’s subscription to the observable sequence.
on_next
(value)¶Notifies the observer of a new element in the sequence.
value (-T_in) – The received element.
None
on_error
(error)¶Notifies the observer that an exception has occurred.
error (Exception
) – The error that has occurred.
None
on_completed
()¶Notifies the observer of the end of the sequence.
None