[Python-checkins] cpython: sort last committed name in alphabetical order
giampaolo.rodola
python-checkins at python.org
Tue Nov 22 21:19:44 CET 2011
http://hg.python.org/cpython/rev/6a0da9b65e54
changeset: 73696:6a0da9b65e54
user: Giampaolo Rodola' <g.rodola at gmail.com>
date: Tue Nov 22 21:19:37 2011 +0100
summary:
sort last committed name in alphabetical order
files:
Lib/sched.py | 8 ++++++++
Misc/ACKS | 2 +-
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/Lib/sched.py b/Lib/sched.py
--- a/Lib/sched.py
+++ b/Lib/sched.py
@@ -35,6 +35,9 @@
__all__ = ["scheduler"]
class Event(namedtuple('Event', 'time, priority, action, argument, kwargs')):
+ def __init__(self, *args, **kwargs):
+ super(Event, self).__init__(*args, **kwargs)
+ self._scheduled = False
def __eq__(s, o): return (s.time, s.priority) == (o.time, o.priority)
def __ne__(s, o): return (s.time, s.priority) != (o.time, o.priority)
def __lt__(s, o): return (s.time, s.priority) < (o.time, o.priority)
@@ -59,6 +62,7 @@
"""
event = Event(time, priority, action, argument, kwargs)
+ event._scheduled = True
heapq.heappush(self._queue, event)
return event # The ID
@@ -81,6 +85,9 @@
self._queue.remove(event)
heapq.heapify(self._queue)
+ def is_scheduled(self, event):
+ return event._scheduled
+
def empty(self):
"""Check whether the queue is empty."""
return not self._queue
@@ -122,6 +129,7 @@
# Verify that the event was not removed or altered
# by another thread after we last looked at q[0].
if event is checked_event:
+ event._scheduled = False
action(*argument, **kwargs)
delayfunc(0) # Let other threads run
else:
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -11,7 +11,6 @@
PS: In the standard Python distribution, this file is encoded in UTF-8
and the list is in rough alphabetical order by last names.
-Chris Clark
Rajiv Abraham
David Abrahams
Ron Adam
@@ -179,6 +178,7 @@
Vadim Chugunov
David Cinege
Craig Citro
+Chris Clark
Mike Clarkson
Andrew Clegg
Brad Clements
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list