QfH ddlZddlZddlmZddlmZddlZddlmZdgZ eddZ de j_ d e j_ d e j_ d e j_ d e j_ d e j _ eZGddZy)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.cheZdZeej fdZdefdZdefdZ dZ dZ d dZ e dZy ) rc g|_tj|_||_||_t |_yN)_queue threadingRLock_locktimefunc delayfuncr_sequence_generator)selfrrs ,/opt/alt/python312/lib64/python3.12/sched.py__init__zscheduler.__init__5s4  __&   "#(7 c  |turi}|j5t||t|j|||}t j |j|ddd|S#1swYSxYwr ) _sentinelrrnextrheapqheappushr )rtimepriorityactionargumentkwargsevents renterabszscheduler.enterabs>sj Y F ZZ$$t/G/G*H (F4E NN4;; .  s AA&&A0cT |j|z}|j|||||Sr )rr")rdelayrrrr rs renterzscheduler.enterNs0 }}&}}T8VXvFFrc |j5|jj|tj|jdddy#1swYyxYwr )rr removerheapify)rr!s rcancelzscheduler.cancelWs< ZZ KK  u % MM$++ &ZZs ;AAcb |j5|j cdddS#1swYyxYwr )rr )rs remptyzscheduler.emptybs$/ ZZ{{? # #ZZs %.cb |j}|j}|j}|j}tj } |5|s dddy|d\}}} } } } |} || kDrd}n d}||dddr|s z S| z n  i |db#1swY/xYw)NTrF)rr rrrheappop)rblockinglockqrrpoprrsequencerrr nowr$s rrunz scheduler.rungs 2zz KKNN ==mm  &'qT#x66j#: E!EF#:%$*%+F+! %sB%%B%%B.c  |j5|jdd}dddtttj gt |zS#1swY9xYwr )rr listmaprr-len)reventss rqueuezscheduler.queuesK ZZ[[^FC xF ';<==Zs AAN)T)__name__ __module__ __qualname___timersleeprrr"r%r)r+r4propertyr:rrrrr3sM %+9;9 79G '# 1f > >r)rr collectionsr itertoolsrr rr>__all__r__doc__rr2rrr objectrrrrrrFs2 "# -7PQ0 #8   H t>t>r