U vi1 @s|ddlmZddlmZmZmZddlmZddlm Z mZddl m Z ddl m Z ddlmZed ZGd d d eZd S) )Lock)MutableMappingOptionalTypeVar)WeakKeyDictionary)abctyping) DELTA_ZERO)WouldBlockException) Scheduler_TStatecseZdZUdZeZeZee dfe d<e ddfdd Z ddddZ dejeeeejd d d Zdejejeeeejd d dZdejejeeeejd ddZZS)ImmediateSchedulera'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 :class:`WouldBlockException`. _global)returnc sPtj@ztj|}Wn*tk r@t|}|tj|<YnXW5QRX|SN)r_lockrKeyErrorsuper__new__)clsself __class__W/opt/alt/python38/lib/python3.8/site-packages/reactivex/scheduler/immediatescheduler.py singletons zImmediateScheduler.singletoncCs|Sr)r)rrrrr"szImmediateScheduler.__new__N)actionstatercCs |||S)a!Schedules an action to be executed. Args: action: Action to be executed. state: [Optional] state to be given to the action function. Returns: The disposable object used to cancel the scheduled action (best effort). ) invoke_action)rrrrrrschedule%szImmediateScheduler.schedule)duetimerrrcCs$||}|tkrt|||S)auSchedules an action to be executed after duetime. Args: duetime: Relative time after which to execute the action. action: Action to be executed. state: [Optional] state to be given to the action function. Returns: The disposable object used to cancel the scheduled action (best effort). )Z to_timedeltar r rrr!rrrrrschedule_relative5s z$ImmediateScheduler.schedule_relativecCs||}|||j||S)aoSchedules an action to be executed at duetime. Args: duetime: Absolute time at which to execute the action. action: Action to be executed. state: [Optional] state to be given to the action function. Returns: The disposable object used to cancel the scheduled action (best effort). ) to_datetimer#nowr"rrrschedule_absoluteMs z$ImmediateScheduler.schedule_absolute)N)N)N)__name__ __module__ __qualname____doc__rrrrrtype__annotations__ classmethodrrrZScheduledActionr rrZDisposableBaser Z RelativeTimer#Z AbsoluteTimer& __classcell__rrrrrs4    rN) threadingrrrrrweakrefrZ reactivexrZreactivex.internal.constantsr Zreactivex.internal.exceptionsr Z schedulerr r rrrrrs