summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAsk Solem <ask@celeryproject.org>2013-09-10 17:26:12 +0100
committerAsk Solem <ask@celeryproject.org>2013-09-10 17:26:12 +0100
commit554bddd2af198680b6e2ea5a4aa3448850e04c07 (patch)
treec7bc069e196dc90aedf1bff31d8d1286f790b8da /examples
parent2ff6f89c48143ae9101df91fe58cc61375aaca0b (diff)
downloadkombu-554bddd2af198680b6e2ea5a4aa3448850e04c07.tar.gz
Py3 fixes
Diffstat (limited to 'examples')
-rw-r--r--examples/complete_receive.py12
-rw-r--r--examples/simple_eventlet_receive.py4
-rw-r--r--examples/simple_eventlet_send.py2
-rw-r--r--examples/simple_task_queue/client.py4
-rw-r--r--examples/simple_task_queue/worker.py2
5 files changed, 11 insertions, 13 deletions
diff --git a/examples/complete_receive.py b/examples/complete_receive.py
index 3d9d44a9..373b74c1 100644
--- a/examples/complete_receive.py
+++ b/examples/complete_receive.py
@@ -40,9 +40,9 @@ with Connection('pyamqp://guest:guest@localhost:5672//') as connection:
#: any number of queues.
with Consumer(connection, queue, callbacks=[handle_message]):
- #: This waits for a single event. Note that this event may not
- #: be a message, or a message that is to be delivered to the consumers
- #: channel, but any event received on the connection.
- recv = eventloop(connection)
- while True:
- recv.next()
+ #: Each iteration waits for a single event. Note that this
+ #: event may not be a message, or a message that is to be
+ #: delivered to the consumers channel, but any event received
+ #: on the connection.
+ for _ in eventloop(connection):
+ pass
diff --git a/examples/simple_eventlet_receive.py b/examples/simple_eventlet_receive.py
index d70126df..f353d1c0 100644
--- a/examples/simple_eventlet_receive.py
+++ b/examples/simple_eventlet_receive.py
@@ -8,8 +8,6 @@ message sent.
"""
import eventlet
-from Queue import Empty
-
from kombu import Connection
eventlet.monkey_patch()
@@ -32,7 +30,7 @@ def wait_many(timeout=1):
while True:
try:
message = queue.get(block=False, timeout=timeout)
- except Empty:
+ except queue.Empty:
break
else:
message.ack()
diff --git a/examples/simple_eventlet_send.py b/examples/simple_eventlet_send.py
index 1ba87fbf..c2b3690d 100644
--- a/examples/simple_eventlet_send.py
+++ b/examples/simple_eventlet_send.py
@@ -31,7 +31,7 @@ def send_many(n):
queue.put({'hello': 'world%s' % (i, )})
pool = eventlet.GreenPool(10)
- for i in xrange(n):
+ for i in range(n):
pool.spawn(send_message, i)
pool.waitall()
diff --git a/examples/simple_task_queue/client.py b/examples/simple_task_queue/client.py
index 2cbd8f92..8e14381f 100644
--- a/examples/simple_task_queue/client.py
+++ b/examples/simple_task_queue/client.py
@@ -1,7 +1,7 @@
from kombu.common import maybe_declare
from kombu.pools import producers
-from queues import task_exchange
+from .queues import task_exchange
priority_to_routing_key = {'high': 'hipri',
'mid': 'midpri',
@@ -22,7 +22,7 @@ def send_as_task(connection, fun, args=(), kwargs={}, priority='mid'):
if __name__ == '__main__':
from kombu import Connection
- from tasks import hello_task
+ from .tasks import hello_task
connection = Connection('amqp://guest:guest@localhost:5672//')
send_as_task(connection, fun=hello_task, args=('Kombu', ), kwargs={},
diff --git a/examples/simple_task_queue/worker.py b/examples/simple_task_queue/worker.py
index 7f62445d..ded3aa73 100644
--- a/examples/simple_task_queue/worker.py
+++ b/examples/simple_task_queue/worker.py
@@ -2,7 +2,7 @@ from kombu.mixins import ConsumerMixin
from kombu.log import get_logger
from kombu.utils import kwdict, reprcall
-from queues import task_queues
+from .queues import task_queues
logger = get_logger(__name__)