summaryrefslogtreecommitdiff
path: root/kombu/utils/compat.py
diff options
context:
space:
mode:
authorAsk Solem <ask@celeryproject.org>2011-04-05 15:50:51 +0200
committerAsk Solem <ask@celeryproject.org>2011-04-05 15:50:51 +0200
commit483928fd9bd166f74b4bad7620ae0fde5809787b (patch)
tree3bd186985b4a67bb4f279eb618cd0f29b2af30b5 /kombu/utils/compat.py
parent958f239637ba40cc1f20a67efc1a2b566a2f7222 (diff)
downloadkombu-483928fd9bd166f74b4bad7620ae0fde5809787b.tar.gz
Adds compat LifoQueue, as it's only available in Python >= 2.6. Closes #33. Thanks to fladi
Diffstat (limited to 'kombu/utils/compat.py')
-rw-r--r--kombu/utils/compat.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/kombu/utils/compat.py b/kombu/utils/compat.py
index 51736278..e9251b15 100644
--- a/kombu/utils/compat.py
+++ b/kombu/utils/compat.py
@@ -245,3 +245,20 @@ try:
from collections import OrderedDict
except ImportError:
OrderedDict = CompatOrderedDict
+
+############## queue.LifoQueue ##############################################
+from Queue import Queue
+
+class LifoQueue(Queue):
+
+ def _init(self, maxsize):
+ self.queue = []
+
+ def _qsize(self, len=len):
+ return len(self.queue)
+
+ def _put(self, item):
+ self.queue.append(item)
+
+ def _get(self):
+ return self.queue.pop()