Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/misc/dumpqueue.py
diff options
context:
space:
mode:
Diffstat (limited to 'misc/dumpqueue.py')
-rw-r--r--misc/dumpqueue.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/misc/dumpqueue.py b/misc/dumpqueue.py
new file mode 100644
index 0000000..5a5b744
--- /dev/null
+++ b/misc/dumpqueue.py
@@ -0,0 +1,20 @@
+"""
+See documentation for dump_queue defined here.
+"""
+import Queue
+
+
+def dump_queue(queue):
+ """
+ Empties all pending items in a queue
+ and returns them in a list.
+ """
+ result=[]
+
+ while True:
+ try:
+ thing=queue.get(block=False)
+ result.append(thing)
+ except Queue.Empty:
+ return result
+