You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kg...@apache.org on 2015/06/22 14:57:17 UTC

[14/34] qpid-proton git commit: PROTON-490: covert python examples using 2to3

PROTON-490: covert python examples using 2to3


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/d31100aa
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/d31100aa
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/d31100aa

Branch: refs/heads/master
Commit: d31100aae5b8e539111fc65a13f1bc8b782c787e
Parents: 64cb4fa
Author: Ken Giusti <kg...@apache.org>
Authored: Mon Apr 27 17:04:10 2015 -0400
Committer: Ken Giusti <kg...@apache.org>
Committed: Mon Apr 27 17:25:32 2015 -0400

----------------------------------------------------------------------
 examples/python/db_common.py                 | 6 +++++-
 examples/python/db_send.py                   | 7 ++++++-
 examples/python/helloworld.py                | 2 +-
 examples/python/helloworld_blocking.py       | 2 +-
 examples/python/helloworld_direct.py         | 2 +-
 examples/python/helloworld_direct_tornado.py | 2 +-
 examples/python/helloworld_tornado.py        | 2 +-
 examples/python/messenger/async.py           | 2 +-
 examples/python/messenger/send.py            | 2 +-
 examples/python/selected_recv.py             | 2 +-
 proton-c/bindings/python/proton/reactor.py   | 2 +-
 11 files changed, 20 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d31100aa/examples/python/db_common.py
----------------------------------------------------------------------
diff --git a/examples/python/db_common.py b/examples/python/db_common.py
index 85f8191..54af87b 100755
--- a/examples/python/db_common.py
+++ b/examples/python/db_common.py
@@ -18,7 +18,11 @@
 # under the License.
 #
 
-import Queue
+try:
+    import Queue
+except:
+    import queue as Queue
+
 import sqlite3
 import threading
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d31100aa/examples/python/db_send.py
----------------------------------------------------------------------
diff --git a/examples/python/db_send.py b/examples/python/db_send.py
index 99558d5..dc85df9 100755
--- a/examples/python/db_send.py
+++ b/examples/python/db_send.py
@@ -20,8 +20,13 @@
 
 from __future__ import print_function
 import optparse
-import Queue
 import time
+try:
+    import Queue
+except:
+    import queue as Queue
+
+
 from proton import Message
 from proton.handlers import MessagingHandler
 from proton.reactor import ApplicationEvent, Container, EventInjector

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d31100aa/examples/python/helloworld.py
----------------------------------------------------------------------
diff --git a/examples/python/helloworld.py b/examples/python/helloworld.py
index d73a4cb..9fcd6f1 100755
--- a/examples/python/helloworld.py
+++ b/examples/python/helloworld.py
@@ -35,7 +35,7 @@ class HelloWorld(MessagingHandler):
         event.container.create_sender(conn, self.address)
 
     def on_sendable(self, event):
-        event.sender.send(Message(body=u"Hello World!"))
+        event.sender.send(Message(body="Hello World!"))
         event.sender.close()
 
     def on_message(self, event):

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d31100aa/examples/python/helloworld_blocking.py
----------------------------------------------------------------------
diff --git a/examples/python/helloworld_blocking.py b/examples/python/helloworld_blocking.py
index 049f148..5a5ce6d 100755
--- a/examples/python/helloworld_blocking.py
+++ b/examples/python/helloworld_blocking.py
@@ -26,7 +26,7 @@ from proton.handlers import IncomingMessageHandler
 conn = BlockingConnection("localhost:5672")
 receiver = conn.create_receiver("examples")
 sender = conn.create_sender("examples")
-sender.send(Message(body=u"Hello World!"));
+sender.send(Message(body="Hello World!"));
 msg = receiver.receive(timeout=30)
 print(msg.body)
 receiver.accept()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d31100aa/examples/python/helloworld_direct.py
----------------------------------------------------------------------
diff --git a/examples/python/helloworld_direct.py b/examples/python/helloworld_direct.py
index d6374a2..264e5b8 100755
--- a/examples/python/helloworld_direct.py
+++ b/examples/python/helloworld_direct.py
@@ -33,7 +33,7 @@ class HelloWorld(MessagingHandler):
         event.container.create_sender(self.url)
 
     def on_sendable(self, event):
-        event.sender.send(Message(body=u"Hello World!"))
+        event.sender.send(Message(body="Hello World!"))
         event.sender.close()
 
     def on_message(self, event):

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d31100aa/examples/python/helloworld_direct_tornado.py
----------------------------------------------------------------------
diff --git a/examples/python/helloworld_direct_tornado.py b/examples/python/helloworld_direct_tornado.py
index 9ef2ed7..a3b017a 100755
--- a/examples/python/helloworld_direct_tornado.py
+++ b/examples/python/helloworld_direct_tornado.py
@@ -33,7 +33,7 @@ class HelloWorld(MessagingHandler):
         event.container.create_sender(self.url)
 
     def on_sendable(self, event):
-        event.sender.send(Message(body=u"Hello World!"))
+        event.sender.send(Message(body="Hello World!"))
         event.sender.close()
 
     def on_message(self, event):

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d31100aa/examples/python/helloworld_tornado.py
----------------------------------------------------------------------
diff --git a/examples/python/helloworld_tornado.py b/examples/python/helloworld_tornado.py
index 3cb2ad1..0781bbb 100755
--- a/examples/python/helloworld_tornado.py
+++ b/examples/python/helloworld_tornado.py
@@ -35,7 +35,7 @@ class HelloWorld(MessagingHandler):
         event.container.create_sender(conn, self.address)
 
     def on_sendable(self, event):
-        event.sender.send(Message(body=u"Hello World!"))
+        event.sender.send(Message(body="Hello World!"))
         event.sender.close()
 
     def on_message(self, event):

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d31100aa/examples/python/messenger/async.py
----------------------------------------------------------------------
diff --git a/examples/python/messenger/async.py b/examples/python/messenger/async.py
index b3f5c45..a1b0292 100755
--- a/examples/python/messenger/async.py
+++ b/examples/python/messenger/async.py
@@ -58,7 +58,7 @@ class CallbackAdapter:
         self._process_incoming()
 
     def _process_outgoing(self):
-        for t, on_status in self.tracked.items():
+        for t, on_status in list(self.tracked.items()):
             status = self.messenger.status(t)
             if status != PENDING:
                 on_status(status)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d31100aa/examples/python/messenger/send.py
----------------------------------------------------------------------
diff --git a/examples/python/messenger/send.py b/examples/python/messenger/send.py
index f40e7b1..c274656 100755
--- a/examples/python/messenger/send.py
+++ b/examples/python/messenger/send.py
@@ -36,7 +36,7 @@ mng.start()
 msg = Message()
 for m in args:
   msg.address = opts.address
-  msg.body = unicode(m)
+  msg.body = str(m)
   mng.put(msg)
 
 mng.send()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d31100aa/examples/python/selected_recv.py
----------------------------------------------------------------------
diff --git a/examples/python/selected_recv.py b/examples/python/selected_recv.py
index 2ea704b..dc062d5 100755
--- a/examples/python/selected_recv.py
+++ b/examples/python/selected_recv.py
@@ -28,7 +28,7 @@ class Recv(MessagingHandler):
 
     def on_start(self, event):
         conn = event.container.connect("localhost:5672")
-        event.container.create_receiver(conn, "examples", options=Selector(u"colour = 'green'"))
+        event.container.create_receiver(conn, "examples", options=Selector("colour = 'green'"))
 
     def on_message(self, event):
         print(event.message.body)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d31100aa/proton-c/bindings/python/proton/reactor.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/reactor.py b/proton-c/bindings/python/proton/reactor.py
index dd32648..b792c37 100644
--- a/proton-c/bindings/python/proton/reactor.py
+++ b/proton-c/bindings/python/proton/reactor.py
@@ -211,7 +211,7 @@ class EventInjector(object):
         of the reactor to which this EventInjector was added.
         """
         self.queue.put(event)
-        os.write(self.pipe[1], "!")
+        os.write(self.pipe[1], six.b("!"))
 
     def close(self):
         """


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org