U viV@shddlmZddlmZmZddlmZmZddlmZmZddl m Z edZ Gdd d e ej Z d S) )datetime)OptionalTypeVar)abctyping) DisposableMultipleAssignmentDisposable) Scheduler_TStatec@s4eZdZdZdejejeeee j dddZ dS)PeriodicSchedulerz{Base class for the various periodic scheduler implementations in this package as well as the mainloop sub-package. N)periodactionstatereturncsNt||dtjttttdfdd |j||d_S)aSchedules 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) schedulerrrcsdjr dS|j}z |}Wntk r:YnX|j|}|j||d_dS)Nr)Z is_disposednow ExceptionZdispose total_secondsschedule_relative disposable)rrrtimerZdispperiodicsecondsV/opt/alt/python38/lib/python3.8/site-packages/reactivex/scheduler/periodicscheduler.pyr(s z5PeriodicScheduler.schedule_periodic..periodicr)N) rZ to_secondsrZ SchedulerBaserr rrr)selfr rrrrrschedule_periodics z#PeriodicScheduler.schedule_periodic)N) __name__ __module__ __qualname____doc__rZ RelativeTimeZScheduledPeriodicActionr rrZDisposableBaserrrrrr sr N)rrrrZ reactivexrZreactivex.disposablerrrr r ZPeriodicSchedulerBaser rrrrs