Home | History | Annotate | Download | only in Lib

Lines Matching defs:Event

1 """A generally useful event scheduler class.
19 event means calling the action function, passing it the argument
37 class Event(namedtuple('Event', 'time, priority, action, argument, kwargs')):
45 Event.time.__doc__ = ('''Numeric type compatible with the return value of the
47 Event.priority.__doc__ = ('''Events scheduled for the same time will be executed
49 Event.action.__doc__ = ('''Executing the event means executing
51 Event.argument.__doc__ = ('''argument is a sequence holding the positional
53 Event.kwargs.__doc__ = ('''kwargs is a dictionary holding the keyword
69 """Enter a new event in the queue at an absolute time.
71 Returns an ID for the event which can be used to remove it,
77 event = Event(time, priority, action, argument, kwargs)
79 heapq.heappush(self._queue, event)
80 return event # The ID
91 def cancel(self, event):
92 """Remove an event from the queue.
95 If the event is not in the queue, this raises ValueError.
99 self._queue.remove(event)
113 When there is a positive delay until the first event, the
114 delay function is called and the event is left in the queue;
115 otherwise, the event is removed from the queue and executed
126 just after an event is executed, a delay of 0 is executed, to