o ?Og@s ddlZddlZddlmZddlmZddlZddlmZdgZ eddZ de j_ d e j _ d e j _ d e j_ d e j_ d e j_ eZGdddZdS)N) namedtuple)count) monotonic schedulerEventz2time, priority, sequence, action, argument, kwargszaNumeric type compatible with the return value of the timefunc function passed to the constructor.zSEvents scheduled for the same time will be executed in the order of their priority.zbA continually increasing sequence number that separates events if time and priority are equal.z?Executing the event means executing action(*argument, **kwargs)zGargument is a sequence holding the positional arguments for the action.zDkwargs is a dictionary holding the keyword arguments for the action.c@s^eZdZeejfddZdefddZdefddZ dd Z d d Z dd dZ e ddZdS)rcCs* g|_t|_||_||_t|_dSN)_queue threadingRLock_locktimefunc delayfuncr_sequence_generator)selfr r r,/opt/alt/python310/lib64/python3.10/sched.py__init__5s   zscheduler.__init__rcCs` |turi}|jt||t|j|||}t|j|Wd|S1s)wY|Sr) _sentinelr rnextrheapqZheappushr)rtimepriorityactionargumentkwargseventrrrenterabs>s zscheduler.enterabscCs ||}||||||Sr)r r)rdelayrrrrrrrrenterNs zscheduler.entercCsF |j|j|t|jWddS1swYdSr)r rremoverZheapify)rrrrrcancelWs  "zscheduler.cancelcCs4 |j |j WdS1swYdSr)r r)rrrremptybs$zscheduler.emptyTcCs |j}|j}|j}|j}tj} |-|s WddS|d\}}} } } } |} || kr3d}nd}||Wdn1sCwY|rW|sP|| S||| n | | i| |dq)NTrF)r rr r rheappop)rZblockinglockqr r poprrsequencerrrZnowrrrrrungs8  z scheduler.runcCsP |j|jdd}Wdn1swYtttj|gt|Sr)r rlistmaprr"len)rZeventsrrrqueues  zscheduler.queueN)T)__name__ __module__ __qualname___timersleeprrrrr r!r'propertyr+rrrrr3s   3)rr collectionsr itertoolsrr rr/__all__r__doc__rr&rrrobjectrrrrrrs"