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:10 UTC
[qpid-python] 02/05: QPID-8631: fix some deprecation warnings by using new `notify_all`, `is_set`, `is_alive`, `daemon`
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