eaiovnaovbqoebvqoeavibavo B YI~d*@sddlZddlZddlmZddlZddlmZdgZGdddeddZdej_ d ej _ d ej _ d ej _ d ej _ eZGd ddZdS)N) namedtuple) monotonic schedulerc@s8eZdZgZddZddZddZddZd d Zd S) EventcCs|j|jf|j|jfkS)N)timepriority)sor */opt/alt/python37/lib64/python3.7/sched.py__eq__$z Event.__eq__cCs|j|jf|j|jfkS)N)rr)rr r r r __lt__%r z Event.__lt__cCs|j|jf|j|jfkS)N)rr)rr r r r __le__&r z Event.__le__cCs|j|jf|j|jfkS)N)rr)rr r r r __gt__'r z Event.__gt__cCs|j|jf|j|jfkS)N)rr)rr r r r __ge__(r z Event.__ge__N) __name__ __module__ __qualname__ __slots__r rrrrr r r r r"s rz(time, priority, 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.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|_||_||_dS)N)_queue threadingRLock_locktimefunc delayfunc)selfrrr r r __init__9s zscheduler.__init__r c Cs@|tkr i}t|||||}|jt|j|WdQRX|S)N) _sentinelrrheapqheappushr)rrractionargumentkwargseventr r r enterabsAs zscheduler.enterabscCs||}||||||S)N)rr%)rdelayrr!r"r#rr r r enterOs zscheduler.enterc Cs.|j|j|t|jWdQRXdS)N)rrremoverheapify)rr$r r r cancelXs zscheduler.cancelc Cs|j |j SQRXdS)N)rr)rr r r emptycszscheduler.emptyTc Cs|j}|j}|j}|j}tj}x||>|s,P|d\}}} } } |} || krRd} n d} ||WdQRX| r|sx|| S||| q | | | |dq WdS)NrTF)rrrrrheappop)rZblockinglockqrrpoprrr!r"r#Znowr&r r r runhs* z scheduler.runc Cs:|j|jdd}WdQRXtttj|gt|S)N)rrlistmaprr,len)rZeventsr r r queues zscheduler.queueN)T)rrr_timerZsleeprrr%r'r*r+r0propertyr4r r r r r7s   2)rr collectionsrrrr5__all__r__doc__rr!r"r#objectrrr r r r s