You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

queue.py 497B

123456789101112131415161718192021
  1. import collections
  2. from ..packages import six
  3. from ..packages.six.moves import queue
  4. if six.PY2:
  5. # Queue is imported for side effects on MS Windows. See issue #229.
  6. import Queue as _unused_module_Queue # noqa: F401
  7. class LifoQueue(queue.Queue):
  8. def _init(self, _):
  9. self.queue = collections.deque()
  10. def _qsize(self, len=len):
  11. return len(self.queue)
  12. def _put(self, item):
  13. self.queue.append(item)
  14. def _get(self):
  15. return self.queue.pop()