U
viV @ sh d dl m Z d dlmZmZ d dlmZmZ d dlmZmZ ddl m
Z
edZG dd d e
ejZ
d
S ) )datetime)OptionalTypeVar)abctyping)
DisposableMultipleAssignmentDisposable ) Scheduler_TStatec @ s4 e Zd ZdZdejeje ee e j
dddZdS )PeriodicSchedulerz{Base class for the various periodic scheduler implementations in this
package as well as the mainloop sub-package.
N)periodactionstatereturnc sN t | |dtjtt tt d fdd
| j||d_S )a Schedules a periodic piece of work.
Args:
period: Period in seconds or timedelta for running the
work periodically.
action: Action to be executed.
state: [Optional] Initial state passed to the action upon
the first iteration.
Returns:
The disposable object used to cancel the scheduled
recurring action (best effort).
N) schedulerr r c sd j r
d S | j}z |}W n tk
r: Y nX | j| }| j||d_d S )Nr )Zis_disposednow ExceptionZdispose
total_secondsschedule_relative
disposable)r r r timer Zdispperiodicseconds V/opt/alt/python38/lib/python3.8/site-packages/reactivex/scheduler/periodicscheduler.pyr ( s z5PeriodicScheduler.schedule_periodic.