/usr/lib64/python2.6/site-packages/mx/Queue
NameSizeModeActions
mxQueue/-0755rm
COPYRIGHT10300644editdlrm
LICENSE45870644editdlrm
queuebench.pyc26770644editdlrm
queuebench.pyo26380644editdlrm
README1420644editdlrm
UserQueue.py14390644editdlrm
UserQueue.pyc27040644editdlrm
UserQueue.pyo27040644editdlrm
__init__.py3540644editdlrm
__init__.pyc5420644editdlrm
__init__.pyo5420644editdlrm
Edit: /usr/lib64/python2.6/site-packages/mx/Queue/UserQueue.py (1439B)
""" A pure Python Queue implementation modelled after mxQueue. Copyright (c) 2000, Marc-Andre Lemburg; mailto:mal@lemburg.com Copyright (c) 2000-2008, eGenix.com Software GmbH; mailto:info@egenix.com See the documentation for further information on copyrights, or contact the author. All Rights Reserved. """ __version__ = '0.1' class UserQueue: def __init__(self): self.queue = [] self.headindex = 0 def push(self,x): self.queue.append(x) def pop(self): headindex = self.headindex queue = self.queue x = queue[headindex] queue[headindex] = None # del. reference headindex = headindex + 1 if headindex > 100 and headindex > len(queue) / 2: # compactify self.queue = self.queue[headindex:] self.headindex = 0 else: self.headindex = headindex return x def not_empty(self): return self.headindex != len(self.queue) def head(self): return self.queue[self.headindex] def tail(self): return self.queue[-1] def __len__(self): return len(self.queue) - self.headindex def __repr__(self): l = self.queue[self.headindex:] l.reverse() return '' % repr(l)[1:-1] def __str__(self): l = self.queue[self.headindex:] l.reverse() return 'q' + repr(l)