You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jd...@apache.org on 2023/04/10 22:16:08 UTC

[qpid-python] branch main updated (9651001 -> 86bea7c)

This is an automated email from the ASF dual-hosted git repository.

jdanek pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-python.git


    from 9651001  QPID-8631: enable `absolute_import` from `__future__` and fix relative imports
     new bf7eec3  QPID-8631: use the `list.sort(key=` parameter
     new 127ca4a  QPID-8631: fix some deprecation warnings by using new `notify_all`, `is_set`, `is_alive`, `daemon`
     new d4d9296  QPID-8631: prefer list comprehension syntax over `map()` and `filter()`
     new 5f4b01e  QPID-8631: replace use of `string.joinfields` function
     new 86bea7c  QPID-8631: remove extraneous semicolons

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 examples/api/hello                   |  2 +-
 qpid-python-test                     |  6 +++---
 qpid/client.py                       |  2 +-
 qpid/codec.py                        |  2 +-
 qpid/codec010.py                     |  4 ++--
 qpid/connection.py                   |  2 +-
 qpid/connection08.py                 |  3 ++-
 qpid/datatypes.py                    |  4 ++--
 qpid/delegates.py                    |  2 +-
 qpid/management.py                   |  4 ++--
 qpid/managementdata.py               |  4 ++--
 qpid/messaging/driver.py             |  2 +-
 qpid/messaging/util.py               |  2 +-
 qpid/peer.py                         | 24 ++++++++++-----------
 qpid/queue.py                        |  4 ++--
 qpid/selector.py                     |  4 ++--
 qpid/spec08.py                       |  2 +-
 qpid/tests/codec.py                  |  2 +-
 qpid/tests/connection.py             |  4 ++--
 qpid/tests/messaging/__init__.py     |  2 +-
 qpid/tests/messaging/endpoints.py    |  2 +-
 qpid/util.py                         |  2 +-
 qpid_tests/broker_0_10/exchange.py   | 10 ++++-----
 qpid_tests/broker_0_10/message.py    |  2 +-
 qpid_tests/broker_0_10/msg_groups.py | 42 ++++++++++++++++++------------------
 qpid_tests/broker_0_10/new_api.py    | 16 +++++++-------
 qpid_tests/broker_0_10/priority.py   |  9 +-------
 qpid_tests/broker_0_10/queue.py      |  2 +-
 qpid_tests/broker_0_8/basic.py       |  2 +-
 qpid_tests/broker_0_8/exchange.py    |  4 ++--
 qpid_tests/broker_0_8/queue.py       |  2 +-
 qpid_tests/broker_0_8/testlib.py     |  4 ++--
 32 files changed, 86 insertions(+), 92 deletions(-)


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


[qpid-python] 01/05: QPID-8631: use the `list.sort(key=` parameter

Posted by jd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jdanek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-python.git

commit bf7eec3d294a3ba0990f69d8a37fe9e54285503b
Author: Jiri Daněk <jd...@redhat.com>
AuthorDate: Sat Apr 8 18:27:08 2023 +0200

    QPID-8631: use the `list.sort(key=` parameter
---
 qpid_tests/broker_0_10/priority.py | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/qpid_tests/broker_0_10/priority.py b/qpid_tests/broker_0_10/priority.py
index 8311a3a..c49ef65 100644
--- a/qpid_tests/broker_0_10/priority.py
+++ b/qpid_tests/broker_0_10/priority.py
@@ -242,12 +242,5 @@ def sorted_(msgs, key=None, reverse=False):
     of keyword arguments to list.sort()
     """
     temp = [m for m in msgs]
-    temp.sort(key_to_cmp(key, reverse=reverse))
+    temp.sort(key=key, reverse=reverse)
     return temp
-
-def key_to_cmp(key, reverse=False):
-    if key:
-        if reverse: return lambda a, b: cmp(key(b), key(a))
-        else: return lambda a, b: cmp(key(a), key(b))  
-    else:
-        return None


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


[qpid-python] 05/05: QPID-8631: remove extraneous semicolons

Posted by jd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jdanek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-python.git

commit 86bea7c3a9a97cbf71ed7bf5a39a8d53a3015bfb
Author: Jiri Daněk <jd...@redhat.com>
AuthorDate: Sat Apr 8 18:33:45 2023 +0200

    QPID-8631: remove extraneous semicolons
---
 examples/api/hello                   |  2 +-
 qpid-python-test                     |  6 +++---
 qpid/client.py                       |  2 +-
 qpid/codec.py                        |  2 +-
 qpid/connection08.py                 |  3 ++-
 qpid/delegates.py                    |  2 +-
 qpid/management.py                   |  4 ++--
 qpid/managementdata.py               |  4 ++--
 qpid/messaging/driver.py             |  2 +-
 qpid/peer.py                         | 14 ++++++------
 qpid/selector.py                     |  2 +-
 qpid/tests/messaging/__init__.py     |  2 +-
 qpid/tests/messaging/endpoints.py    |  2 +-
 qpid_tests/broker_0_10/exchange.py   | 10 ++++-----
 qpid_tests/broker_0_10/message.py    |  2 +-
 qpid_tests/broker_0_10/msg_groups.py | 42 ++++++++++++++++++------------------
 qpid_tests/broker_0_10/new_api.py    | 16 +++++++-------
 qpid_tests/broker_0_10/queue.py      |  2 +-
 qpid_tests/broker_0_8/basic.py       |  2 +-
 qpid_tests/broker_0_8/exchange.py    |  4 ++--
 qpid_tests/broker_0_8/queue.py       |  2 +-
 qpid_tests/broker_0_8/testlib.py     |  4 ++--
 22 files changed, 66 insertions(+), 65 deletions(-)

diff --git a/examples/api/hello b/examples/api/hello
index dffff88..ac2311e 100755
--- a/examples/api/hello
+++ b/examples/api/hello
@@ -41,7 +41,7 @@ try:
   sender = session.sender(address)
   receiver = session.receiver(address)
 
-  sender.send(Message("Hello world!"));
+  sender.send(Message("Hello world!"))
 
   message = receiver.fetch()
   print(message.content)
diff --git a/qpid-python-test b/qpid-python-test
index 791f38b..ac7d70b 100755
--- a/qpid-python-test
+++ b/qpid-python-test
@@ -201,7 +201,7 @@ def indent(text):
 class JunitXmlStyleReporter:
 
   def __init__(self, file):
-    self.f = open(file, "w");
+    self.f = open(file, "w")
 
   def begin(self):
     self.f.write('<?xml version="1.0" encoding="UTF-8" ?>\n')
@@ -575,8 +575,8 @@ ignored = [t for t in h.tests if is_ignored(t.name())]
 total = len(filtered) + len(ignored)
 
 if opts.xml and not list_only:
-   xmlr = JunitXmlStyleReporter(opts.xml);
-   xmlr.begin();
+   xmlr = JunitXmlStyleReporter(opts.xml)
+   xmlr.begin()
 else:
    xmlr = None
 
diff --git a/qpid/client.py b/qpid/client.py
index b062ea5..305f6b3 100644
--- a/qpid/client.py
+++ b/qpid/client.py
@@ -137,7 +137,7 @@ class Client:
     if self.peer:
       try:
         if not self.closed:
-          channel = self.channel(0);
+          channel = self.channel(0)
           if channel and not channel._closed:
              try:
                channel.connection_close(reply_code=200)
diff --git a/qpid/codec.py b/qpid/codec.py
index 4297704..a300dc5 100644
--- a/qpid/codec.py
+++ b/qpid/codec.py
@@ -536,7 +536,7 @@ class Codec:
     set = []
     for i in range(0, count):
       set.append(self.decode_long())
-    return set;
+    return set
 
   def encode_uuid(self, s):
     self.pack("16s", s)
diff --git a/qpid/connection08.py b/qpid/connection08.py
index 527e9b6..4272c01 100644
--- a/qpid/connection08.py
+++ b/qpid/connection08.py
@@ -305,7 +305,8 @@ class Connection:
     return self.read_0_10()
 
   def close(self):
-    self.io.close();
+    self.io.close()
+
 
 class Frame:
 
diff --git a/qpid/delegates.py b/qpid/delegates.py
index 8071296..482f59f 100644
--- a/qpid/delegates.py
+++ b/qpid/delegates.py
@@ -90,7 +90,7 @@ class Delegate:
     self.connection.detach(d.name, ch)
 
   def session_request_timeout(self, ch, rt):
-    ch.session_timeout(rt.timeout);
+    ch.session_timeout(rt.timeout)
 
   def session_command_point(self, ch, cp):
     ssn = ch.session
diff --git a/qpid/management.py b/qpid/management.py
index 7d5e39a..1f11535 100644
--- a/qpid/management.py
+++ b/qpid/management.py
@@ -656,7 +656,7 @@ class managementClient:
     name        = codec.read_str8()
     classKey    = (packageName, className, hash)
     if classKey not in self.schema:
-      return;
+      return
     schemaClass = self.schema[classKey]
     row = []
     es = schemaClass['E']
@@ -880,7 +880,7 @@ class managementClient:
     elif opcode == 'g':
       self.parseContent (ch, 'B', codec, seq)
     else:
-      raise ValueError ("Unknown opcode: %c" % opcode);
+      raise ValueError ("Unknown opcode: %c" % opcode)
 
   def method (self, channel, userSequence, objId, classId, methodName, args):
     """ Invoke a method on an object """
diff --git a/qpid/managementdata.py b/qpid/managementdata.py
index b6338ee..514dd6f 100644
--- a/qpid/managementdata.py
+++ b/qpid/managementdata.py
@@ -162,10 +162,10 @@ class ManagementData:
       pass
 
   def configHandler (self, context, className, list, timestamps):
-    self.dataHandler (0, className, list, timestamps);
+    self.dataHandler (0, className, list, timestamps)
 
   def instHandler (self, context, className, list, timestamps):
-    self.dataHandler (1, className, list, timestamps);
+    self.dataHandler (1, className, list, timestamps)
 
   def methodReply (self, broker, sequence, status, sText, args):
     """ Callback for method-reply messages """
diff --git a/qpid/messaging/driver.py b/qpid/messaging/driver.py
index 1106635..cb6c931 100644
--- a/qpid/messaging/driver.py
+++ b/qpid/messaging/driver.py
@@ -767,7 +767,7 @@ class Engine:
         _text=str(e)
       raise AuthenticationFailure(text=_text)
 
-    client_properties = get_client_properties_with_defaults(provided_client_properties=self.connection.client_properties);
+    client_properties = get_client_properties_with_defaults(provided_client_properties=self.connection.client_properties)
     self.write_op(ConnectionStartOk(client_properties=client_properties,
                                     mechanism=mech, response=initial))
 
diff --git a/qpid/peer.py b/qpid/peer.py
index 6386584..290ff3f 100644
--- a/qpid/peer.py
+++ b/qpid/peer.py
@@ -161,18 +161,18 @@ class Peer:
 
   def stop(self):
     try:
-      self.work.close();
-      self.outgoing.close();
-      self.conn.close();
+      self.work.close()
+      self.outgoing.close()
+      self.conn.close()
     finally:
-      timeout = 1;
-      self.worker_thread.join(timeout);
+      timeout = 1
+      self.worker_thread.join(timeout)
       if self.worker_thread.is_alive():
         log.warn("Worker thread failed to shutdown within timeout")
-      self.reader_thread.join(timeout);
+      self.reader_thread.join(timeout)
       if self.reader_thread.is_alive():
         log.warn("Reader thread failed to shutdown within timeout")
-      self.writer_thread.join(timeout);
+      self.writer_thread.join(timeout)
       if self.writer_thread.is_alive():
         log.warn("Writer thread failed to shutdown within timeout")
 
diff --git a/qpid/selector.py b/qpid/selector.py
index d26829d..ef7b441 100644
--- a/qpid/selector.py
+++ b/qpid/selector.py
@@ -126,7 +126,7 @@ class Selector:
     _check(self.exception)
     self.thread = Thread(target=self.run)
     self.thread.daemon = True
-    self.thread.start();
+    self.thread.start()
 
   def run(self):
     try:
diff --git a/qpid/tests/messaging/__init__.py b/qpid/tests/messaging/__init__.py
index 29d9bab..1753eec 100644
--- a/qpid/tests/messaging/__init__.py
+++ b/qpid/tests/messaging/__init__.py
@@ -201,7 +201,7 @@ class VersionTest (Base):
   def create_connection(self, version="amqp1.0", force=False):
     opts = self.connection_options()
     if force or not 'protocol' in opts:
-      opts['protocol'] = version;
+      opts['protocol'] = version
     return Connection.establish(self.broker, **opts)
 
   def setup_connection(self):
diff --git a/qpid/tests/messaging/endpoints.py b/qpid/tests/messaging/endpoints.py
index 1320ac2..a5c6d17 100644
--- a/qpid/tests/messaging/endpoints.py
+++ b/qpid/tests/messaging/endpoints.py
@@ -681,7 +681,7 @@ class SessionTests(Base):
     deadline = time.time() + self.timeout()
     while time.time() < deadline:
         if cb.handler_called:
-            break;
+            break
     assert cb.handler_called
     assert cb.ssn == self.ssn
     snd.close()
diff --git a/qpid_tests/broker_0_10/exchange.py b/qpid_tests/broker_0_10/exchange.py
index 0cd0a55..83c71f4 100644
--- a/qpid_tests/broker_0_10/exchange.py
+++ b/qpid_tests/broker_0_10/exchange.py
@@ -185,7 +185,7 @@ class StandardExchangeVerifier:
             headers = {"name":"fred", "age":3}
             self.assertPublishGet(q, exchange=ex, properties=headers)
             self.session.message_transfer(destination=ex) # No headers, won't deliver
-            self.assertEmpty(q);
+            self.assertEmpty(q)
         finally:
             if unbind:
                 self.session.exchange_unbind(queue="q", exchange=ex, binding_key="")
@@ -546,19 +546,19 @@ class AutodeleteTests(TestHelper, StandardExchangeVerifier):
     def testAutodeleteFanout(self):
         self.session.exchange_declare(exchange="e", type="fanout", auto_delete=True)
         self.verifyFanOutExchange("e", unbind=True)
-        self.checkNotExists("e");
+        self.checkNotExists("e")
 
     def testAutodeleteDirect(self):
         self.session.exchange_declare(exchange="e", type="direct", auto_delete=True)
         self.verifyDirectExchange("e", unbind=True)
-        self.checkNotExists("e");
+        self.checkNotExists("e")
 
     def testAutodeleteTopic(self):
         self.session.exchange_declare(exchange="e", type="topic", auto_delete=True)
         self.verifyTopicExchange("e", unbind=True)
-        self.checkNotExists("e");
+        self.checkNotExists("e")
 
     def testAutodeleteHeaders(self):
         self.session.exchange_declare(exchange="e", type="headers", auto_delete=True)
         self.verifyHeadersExchange("e", unbind=True)
-        self.checkNotExists("e");
+        self.checkNotExists("e")
diff --git a/qpid_tests/broker_0_10/message.py b/qpid_tests/broker_0_10/message.py
index 9b9a051..76813e4 100644
--- a/qpid_tests/broker_0_10/message.py
+++ b/qpid_tests/broker_0_10/message.py
@@ -1028,7 +1028,7 @@ class MessageTests(TestBase010):
         session.message_flow(unit = session.credit_unit.message, value = 10, destination = "a")
 
         # receive all messages into list
-        messages = [];
+        messages = []
         for i in range(1, 11):
             msg = a.get(timeout = 1)
             self.assertEquals("message-%d" % (i), msg.body)
diff --git a/qpid_tests/broker_0_10/msg_groups.py b/qpid_tests/broker_0_10/msg_groups.py
index 124625a..ca229e6 100644
--- a/qpid_tests/broker_0_10/msg_groups.py
+++ b/qpid_tests/broker_0_10/msg_groups.py
@@ -71,24 +71,24 @@ class MultiConsumerMsgGroupTests(Base):
 
         # C1 should acquire A-0, then C2 should acquire B-3
 
-        m1 = c1.fetch(0);
+        m1 = c1.fetch(0)
         assert m1.properties['THE-GROUP'] == 'A'
         assert m1.content['index'] == 0
 
-        m2 = c2.fetch(0);
+        m2 = c2.fetch(0)
         assert m2.properties['THE-GROUP'] == 'B'
         assert m2.content['index'] == 3
 
         # C1 Acknowledge A-0
-        c1.session.acknowledge(m1);
+        c1.session.acknowledge(m1)
 
         # C2 should next acquire A-1
-        m3 = c2.fetch(0);
+        m3 = c2.fetch(0)
         assert m3.properties['THE-GROUP'] == 'A'
         assert m3.content['index'] == 1
 
         # C1 should next acquire C-6, since groups A&B are held by c2
-        m4 = c1.fetch(0);
+        m4 = c1.fetch(0)
         assert m4.properties['THE-GROUP'] == 'C'
         assert m4.content['index'] == 6
 
@@ -96,13 +96,13 @@ class MultiConsumerMsgGroupTests(Base):
         ## Owners= ---, ^C2, +C2, ^C2, +C2, +C2, ^C1, +C1, +C1,
 
         # C2 Acknowledge B-3, freeing up the rest of B group
-        c2.session.acknowledge(m2);
+        c2.session.acknowledge(m2)
 
         ## Queue = XXX, a-1, a-2, XXX, b-4, b-5, c-6, c-7, c-8...
         ## Owners= ---, ^C2, +C2, ---, ---, ---, ^C1, +C1, +C1,
 
         # C1 should now acquire B-4, since it is next "free"
-        m5 = c1.fetch(0);
+        m5 = c1.fetch(0)
         assert m5.properties['THE-GROUP'] == 'B'
         assert m5.content['index'] == 4
 
@@ -116,11 +116,11 @@ class MultiConsumerMsgGroupTests(Base):
         ## Owners= ---, ^C2, +C2, ---, ^C1, +C1, ---, ---, ---
 
         # C2 should next fetch A-2, followed by C-7
-        m7 = c2.fetch(0);
+        m7 = c2.fetch(0)
         assert m7.properties['THE-GROUP'] == 'A'
         assert m7.content['index'] == 2
 
-        m8 = c2.fetch(0);
+        m8 = c2.fetch(0)
         assert m8.properties['THE-GROUP'] == 'C'
         assert m8.content['index'] == 7
 
@@ -134,7 +134,7 @@ class MultiConsumerMsgGroupTests(Base):
         ## Owners= ---, ---, ---, ---, ^C1, +C1, ---, ---, ---
 
         # the next fetch of C2 would get C-8, since B-5 is "owned"
-        m9 = c2.fetch(0);
+        m9 = c2.fetch(0)
         assert m9.properties['THE-GROUP'] == 'C'
         assert m9.content['index'] == 8
 
@@ -148,7 +148,7 @@ class MultiConsumerMsgGroupTests(Base):
         ## Owners= ---, ---, ---, ---, ---, ^C2, ---, ---, ^C2
 
         # the next fetch of C2 would get B-5
-        m10 = c2.fetch(0);
+        m10 = c2.fetch(0)
         assert m10.properties['THE-GROUP'] == 'B'
         assert m10.content['index'] == 5
 
@@ -194,13 +194,13 @@ class MultiConsumerMsgGroupTests(Base):
         s2 = self.setup_session()
         b1 = s2.receiver("msg-group-q; {mode: browse}", options={"capacity":0})
 
-        m2 = b1.fetch(0);
+        m2 = b1.fetch(0)
         assert m2.properties['THE-GROUP'] == 'A'
         assert m2.content['index'] == 0
 
         # C1 should acquire A-0
 
-        m1 = c1.fetch(0);
+        m1 = c1.fetch(0)
         assert m1.properties['THE-GROUP'] == 'A'
         assert m1.content['index'] == 0
 
@@ -222,7 +222,7 @@ class MultiConsumerMsgGroupTests(Base):
         assert m2.content['index'] == 3
 
         # verify the consumer can own groups currently seen by the browser
-        m3 = c1.fetch(0);
+        m3 = c1.fetch(0)
         assert m3.properties['THE-GROUP'] == 'B'
         assert m3.content['index'] == 1
 
@@ -337,7 +337,7 @@ class MultiConsumerMsgGroupTests(Base):
         assert m2.content['index'] == 2
 
         # C1 shuffles off the mortal coil...
-        c1.close();
+        c1.close()
 
         # but the session (s1) remains active, so "A" remains blocked
         # from c2, c2 should fetch the next B-3
@@ -1024,7 +1024,7 @@ class MultiConsumerMsgGroupTests(Base):
         c2 = s2.receiver("msg-group-q", options={"capacity":0})
 
         # C1 should acquire A-0
-        m1 = c1.fetch(0);
+        m1 = c1.fetch(0)
         assert m1.properties['THE-GROUP'] == 'A'
         assert m1.content['index'] == 0
 
@@ -1138,7 +1138,7 @@ class MultiConsumerMsgGroupTests(Base):
             m.content['index'] = index
             index += 1
             if m.properties['THE-GROUP'] == 'B':
-                m.ttl = 1;
+                m.ttl = 1
             snd.send(m)
 
         sleep(2)  # let all B's expire
@@ -1152,19 +1152,19 @@ class MultiConsumerMsgGroupTests(Base):
         # C1 should acquire A-0, then C2 should acquire C-2, Group B should
         # expire and never be fetched
 
-        m1 = c1.fetch(0);
+        m1 = c1.fetch(0)
         assert m1.properties['THE-GROUP'] == 'A'
         assert m1.content['index'] == 0
 
-        m2 = c2.fetch(0);
+        m2 = c2.fetch(0)
         assert m2.properties['THE-GROUP'] == 'C'
         assert m2.content['index'] == 2
 
-        m1 = c1.fetch(0);
+        m1 = c1.fetch(0)
         assert m1.properties['THE-GROUP'] == 'A'
         assert m1.content['index'] == 3
 
-        m2 = c2.fetch(0);
+        m2 = c2.fetch(0)
         assert m2.properties['THE-GROUP'] == 'C'
         assert m2.content['index'] == 5
 
diff --git a/qpid_tests/broker_0_10/new_api.py b/qpid_tests/broker_0_10/new_api.py
index 301b0ad..48a4691 100644
--- a/qpid_tests/broker_0_10/new_api.py
+++ b/qpid_tests/broker_0_10/new_api.py
@@ -156,12 +156,12 @@ class GeneralTests(Base):
         conn2 = Connection.establish(self.broker, **self.connection_options())
         ssn2 = conn2.session()
 
-        s1 = self.ssn.sender("holding_q; {create:always, delete:always, node:{x-declare:{alternate-exchange:'amq.fanout'}}}");
-        s2 = ssn2.sender("holding_q");
+        s1 = self.ssn.sender("holding_q; {create:always, delete:always, node:{x-declare:{alternate-exchange:'amq.fanout'}}}")
+        s2 = ssn2.sender("holding_q")
 
-        s2.send(Message("a"));
-        s1.send(Message("b"));
-        s2.send(Message("c"));
+        s2.send(Message("a"))
+        s1.send(Message("b"))
+        s2.send(Message("c"))
 
         r = self.ssn.receiver("amq.fanout; {link:{x-declare:{arguments:{'no-local':True}}}}")
 
@@ -181,15 +181,15 @@ class GeneralTests(Base):
         self.assertEqual(received, ["a", "c"])
 
     def _node_disambiguation_test(self, e, q, ambiguous_send=False):
-        s1 = self.ssn.sender("ambiguous; {node:{type:topic}}");
-        s2 = self.ssn.sender("ambiguous; {node:{type:queue}}");
+        s1 = self.ssn.sender("ambiguous; {node:{type:topic}}")
+        s2 = self.ssn.sender("ambiguous; {node:{type:queue}}")
         s1.send(Message("a"))
         s2.send(Message("b"))
         if ambiguous_send:
             # pure python client defaults to using the queue when the
             # node name is ambiguous and no type is specified; the
             # swigged version treats this as an error
-            s3 = self.ssn.sender("ambiguous");
+            s3 = self.ssn.sender("ambiguous")
             s3.send(Message("c"))
         self.assertEqual(e.fetch().content, "a")
         self.assertEqual(q.fetch().content, "b")
diff --git a/qpid_tests/broker_0_10/queue.py b/qpid_tests/broker_0_10/queue.py
index a3de6cb..2416afa 100644
--- a/qpid_tests/broker_0_10/queue.py
+++ b/qpid_tests/broker_0_10/queue.py
@@ -43,7 +43,7 @@ class QueueTests(TestBase010):
         self.assertEqual(3, reply.message_count)
 
         #now do the purge, then test that three messages are purged and the count drops to 0
-        session.queue_purge(queue="test-queue");
+        session.queue_purge(queue="test-queue")
         reply = session.queue_query(queue="test-queue")
         self.assertEqual(0, reply.message_count)        
 
diff --git a/qpid_tests/broker_0_8/basic.py b/qpid_tests/broker_0_8/basic.py
index 4638a9f..286acb0 100644
--- a/qpid_tests/broker_0_8/basic.py
+++ b/qpid_tests/broker_0_8/basic.py
@@ -375,7 +375,7 @@ class BasicTests(TestBase):
 
         #make sure that a single oversized message still gets delivered
         large = "abcdefghijklmnopqrstuvwxyz"
-        large = large + "-" + large;
+        large = large + "-" + large
         channel.basic_publish(routing_key="test-prefetch-size", content=Content(large))
         msg = queue.get(timeout=self.recv_timeout())
         self.assertEqual(large, msg.content.body)
diff --git a/qpid_tests/broker_0_8/exchange.py b/qpid_tests/broker_0_8/exchange.py
index bd496b0..3a24784 100644
--- a/qpid_tests/broker_0_8/exchange.py
+++ b/qpid_tests/broker_0_8/exchange.py
@@ -80,8 +80,8 @@ class StandardExchangeVerifier:
         headers = {"name":"fred", "age":3}
         self.assertPublishGet(q, exchange=ex, properties={'headers':headers})
         self.channel.basic_publish(exchange=ex) # No headers, won't deliver
-        self.assertEmpty(q);                 
-        
+        self.assertEmpty(q)
+
 
 class RecommendedTypesRuleTests(TestBase, StandardExchangeVerifier):
     """
diff --git a/qpid_tests/broker_0_8/queue.py b/qpid_tests/broker_0_8/queue.py
index f5e17e2..f755137 100644
--- a/qpid_tests/broker_0_8/queue.py
+++ b/qpid_tests/broker_0_8/queue.py
@@ -43,7 +43,7 @@ class QueueTests(TestBase):
         self.assertEqual(3, reply.message_count)
 
         #now do the purge, then test that three messages are purged and the count drops to 0
-        reply = channel.queue_purge(queue="test-queue");
+        reply = channel.queue_purge(queue="test-queue")
         self.assertEqual(3, reply.message_count)        
         reply = channel.queue_declare(queue="test-queue")
         self.assertEqual(0, reply.message_count)
diff --git a/qpid_tests/broker_0_8/testlib.py b/qpid_tests/broker_0_8/testlib.py
index 592eeaf..02e7ad7 100644
--- a/qpid_tests/broker_0_8/testlib.py
+++ b/qpid_tests/broker_0_8/testlib.py
@@ -34,7 +34,7 @@ import sys
 from traceback import *
 
 def mytrace(frame, event, arg):
-    print_stack(frame);
+    print_stack(frame)
     print("====")
     return mytrace
     
@@ -56,7 +56,7 @@ class TestBaseTest(TestBase):
         q = self.consume("full")
         self.channel.basic_publish(routing_key="full")
         try:
-            self.assertEmpty(q);
+            self.assertEmpty(q)
             self.fail("assertEmpty did not assert on non-empty queue")
         except AssertionError: None     # Ignore
 


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


[qpid-python] 03/05: QPID-8631: prefer list comprehension syntax over `map()` and `filter()`

Posted by jd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jdanek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-python.git

commit d4d92964fa586c6349edc86100567058d341dbb4
Author: Jiri Daněk <jd...@redhat.com>
AuthorDate: Mon Apr 10 11:13:42 2023 +0200

    QPID-8631: prefer list comprehension syntax over `map()` and `filter()`
---
 qpid/spec08.py      | 2 +-
 qpid/tests/codec.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/qpid/spec08.py b/qpid/spec08.py
index 343312e..d28aa64 100644
--- a/qpid/spec08.py
+++ b/qpid/spec08.py
@@ -364,7 +364,7 @@ def load(specfile, *errata):
   spec_root = doc["amqp"]
   spec = Spec(int(spec_root["@major"]), int(spec_root["@minor"]), specfile)
 
-  for root in [spec_root] + map(lambda x: mllib.xml_parse(x)["amqp"], errata):
+  for root in [spec_root] + [mllib.xml_parse(x)["amqp"] for x in errata]:
     # constants
     for nd in root.query["constant"]:
       val = nd["@value"]
diff --git a/qpid/tests/codec.py b/qpid/tests/codec.py
index e0ac26d..03f6fc2 100644
--- a/qpid/tests/codec.py
+++ b/qpid/tests/codec.py
@@ -661,7 +661,7 @@ def oldtests():
     """
     for value in ("1", "0", "110", "011", "11001", "10101", "10011"):
       for i in range(10):
-        dotest("bit", map(lambda x: x == "1", value*i))
+        dotest("bit", [x == "1" for x in value*i])
 
     for value in ({}, {"asdf": "fdsa", "fdsa": 1, "three": 3}, {"one": 1}):
       dotest("table", value)


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


[qpid-python] 04/05: QPID-8631: replace use of `string.joinfields` function

Posted by jd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jdanek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-python.git

commit 5f4b01e0292e46e862011338b3e5b4858f76833a
Author: Jiri Daněk <jd...@redhat.com>
AuthorDate: Sun Apr 9 12:06:10 2023 +0200

    QPID-8631: replace use of `string.joinfields` function
---
 qpid/codec010.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/qpid/codec010.py b/qpid/codec010.py
index a03e60e..bd6a3aa 100644
--- a/qpid/codec010.py
+++ b/qpid/codec010.py
@@ -18,7 +18,7 @@
 #
 
 from __future__ import absolute_import
-import datetime, string
+import datetime
 from .packer import Packer
 from .datatypes import serial, timestamp, RangedSet, Struct, UUID
 from .ops import Compound, PRIMITIVE, COMPOUND
@@ -258,7 +258,7 @@ class Codec(Packer):
     sc = StringCodec()
     if m is not None:
       sc.write_uint32(len(m))
-      sc.write(string.joinfields(map(self._write_map_elem, m.keys(), m.values()), ""))
+      sc.write(b"".join(map(self._write_map_elem, m.keys(), m.values())))
     self.write_vbin32(sc.encoded)
 
   def read_array(self):


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


[qpid-python] 02/05: QPID-8631: fix some deprecation warnings by using new `notify_all`, `is_set`, `is_alive`, `daemon`

Posted by jd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jdanek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-python.git

commit 127ca4a4082579f93ad38e9a9dc0146def65edb6
Author: Jiri Daněk <jd...@redhat.com>
AuthorDate: Mon Apr 10 10:53:17 2023 +0200

    QPID-8631: fix some deprecation warnings by using new `notify_all`, `is_set`, `is_alive`, `daemon`
---
 qpid/connection.py       |  2 +-
 qpid/datatypes.py        |  4 ++--
 qpid/messaging/util.py   |  2 +-
 qpid/peer.py             | 10 +++++-----
 qpid/queue.py            |  4 ++--
 qpid/selector.py         |  2 +-
 qpid/tests/connection.py |  4 ++--
 qpid/util.py             |  2 +-
 8 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/qpid/connection.py b/qpid/connection.py
index 498e638..0905aaa 100644
--- a/qpid/connection.py
+++ b/qpid/connection.py
@@ -64,7 +64,7 @@ class Connection(Framer):
     self.close_code = (None, "connection aborted")
 
     self.thread = Thread(target=self.run)
-    self.thread.setDaemon(True)
+    self.thread.daemon = True
 
     self.channel_max = 65535
     self.user_id = None
diff --git a/qpid/datatypes.py b/qpid/datatypes.py
index b6d5452..5fc6ee2 100644
--- a/qpid/datatypes.py
+++ b/qpid/datatypes.py
@@ -276,7 +276,7 @@ class Future:
 
   def get(self, timeout=None):
     self._set.wait(timeout)
-    if self._set.isSet():
+    if self._set.is_set():
       if self._error != None:
         raise self.exception(self._error)
       return self.value
@@ -284,7 +284,7 @@ class Future:
       raise Timeout()
 
   def is_set(self):
-    return self._set.isSet()
+    return self._set.is_set()
 
 try:
   from uuid import uuid4
diff --git a/qpid/messaging/util.py b/qpid/messaging/util.py
index f83106a..18e58d8 100644
--- a/qpid/messaging/util.py
+++ b/qpid/messaging/util.py
@@ -43,7 +43,7 @@ def auto_fetch_reconnect_urls(conn):
       ssn.acknowledge(msg, sync=False)
 
   thread = Thread(name="auto-fetch-reconnect-urls", target=main)
-  thread.setDaemon(True)
+  thread.daemon = True
   thread.start()
 
 
diff --git a/qpid/peer.py b/qpid/peer.py
index 5d863b3..6386584 100644
--- a/qpid/peer.py
+++ b/qpid/peer.py
@@ -167,13 +167,13 @@ class Peer:
     finally:
       timeout = 1;
       self.worker_thread.join(timeout);
-      if self.worker_thread.isAlive():
+      if self.worker_thread.is_alive():
         log.warn("Worker thread failed to shutdown within timeout")
       self.reader_thread.join(timeout);
-      if self.reader_thread.isAlive():
+      if self.reader_thread.is_alive():
         log.warn("Reader thread failed to shutdown within timeout")
       self.writer_thread.join(timeout);
-      if self.writer_thread.isAlive():
+      if self.writer_thread.is_alive():
         log.warn("Writer thread failed to shutdown within timeout")
 
 class Requester:
@@ -452,13 +452,13 @@ class Future:
 
   def get_response(self, timeout=None):
     self.completed.wait(timeout)
-    if self.completed.isSet():
+    if self.completed.is_set():
       return self.response
     else:
       return None
 
   def is_complete(self):
-    return self.completed.isSet()
+    return self.completed.is_set()
 
 class OutgoingCompletion:
   """
diff --git a/qpid/queue.py b/qpid/queue.py
index 86b5d98..aa190ad 100644
--- a/qpid/queue.py
+++ b/qpid/queue.py
@@ -69,7 +69,7 @@ class Queue(BaseQueue):
       if self.thread is not None:
         self.put(Queue.STOP)
         # loop and timed join permit keyboard interrupts to work
-        while self.thread.isAlive():
+        while self.thread.is_alive():
           self.thread.join(3)
         self.thread = None
 
@@ -78,7 +78,7 @@ class Queue(BaseQueue):
 
     if listener is not None and self.thread is None:
       self.thread = Thread(target = self.run)
-      self.thread.setDaemon(True)
+      self.thread.daemon = True
       self.thread.start()
 
   def run(self):
diff --git a/qpid/selector.py b/qpid/selector.py
index 72eca72..d26829d 100644
--- a/qpid/selector.py
+++ b/qpid/selector.py
@@ -125,7 +125,7 @@ class Selector:
   def start(self):
     _check(self.exception)
     self.thread = Thread(target=self.run)
-    self.thread.setDaemon(True)
+    self.thread.daemon = True
     self.thread.start();
 
   def run(self):
diff --git a/qpid/tests/connection.py b/qpid/tests/connection.py
index fe51367..f223501 100644
--- a/qpid/tests/connection.py
+++ b/qpid/tests/connection.py
@@ -85,11 +85,11 @@ class ConnectionTest(TestCase):
           pass
 
     self.server = Thread(target=run)
-    self.server.setDaemon(True)
+    self.server.daemon = True
     self.server.start()
 
     started.wait(3)
-    assert started.isSet()
+    assert started.is_set()
 
   def tearDown(self):
     self.running = False
diff --git a/qpid/util.py b/qpid/util.py
index 2e0984c..b91005a 100644
--- a/qpid/util.py
+++ b/qpid/util.py
@@ -120,7 +120,7 @@ def notify(condition, action=lambda: None):
   condition.acquire()
   try:
     action()
-    condition.notifyAll()
+    condition.notify_all()
   finally:
     condition.release()
 


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