diff options
author | Ask Solem <ask@celeryproject.org> | 2011-04-05 15:50:51 +0200 |
---|---|---|
committer | Ask Solem <ask@celeryproject.org> | 2011-04-05 15:50:51 +0200 |
commit | 483928fd9bd166f74b4bad7620ae0fde5809787b (patch) | |
tree | 3bd186985b4a67bb4f279eb618cd0f29b2af30b5 /kombu/utils/compat.py | |
parent | 958f239637ba40cc1f20a67efc1a2b566a2f7222 (diff) | |
download | kombu-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.py | 17 |
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() |