diff --git a/kombu/connection.py b/kombu/connection.py index 3ad84645..03b3161d 100644 --- a/kombu/connection.py +++ b/kombu/connection.py @@ -2,7 +2,6 @@ import os import socket -from collections import OrderedDict from contextlib import contextmanager from itertools import count, cycle from operator import itemgetter @@ -658,7 +657,7 @@ class Connection: def info(self): """Get connection info.""" - return OrderedDict(self._info()) + return dict(self._info()) def __eqhash__(self): return HashedSeq(self.transport_cls, self.hostname, self.userid, diff --git a/kombu/transport/qpid.py b/kombu/transport/qpid.py index b0f8df13..2b2d1b18 100644 --- a/kombu/transport/qpid.py +++ b/kombu/transport/qpid.py @@ -92,7 +92,6 @@ import socket import ssl import sys import uuid -from collections import OrderedDict from gettext import gettext as _ from queue import Empty from time import monotonic @@ -189,7 +188,7 @@ class QoS: def __init__(self, session, prefetch_count=1): self.session = session self.prefetch_count = 1 - self._not_yet_acked = OrderedDict() + self._not_yet_acked = {} def can_consume(self): """Return True if the :class:`Channel` can consume more messages. @@ -229,8 +228,8 @@ class QoS: """Append message to the list of un-ACKed messages. Add a message, referenced by the delivery_tag, for ACKing, - rejecting, or getting later. Messages are saved into an - :class:`collections.OrderedDict` by delivery_tag. + rejecting, or getting later. Messages are saved into a + dict by delivery_tag. :param message: A received message that has not yet been ACKed. :type message: qpid.messaging.Message diff --git a/kombu/transport/virtual/base.py b/kombu/transport/virtual/base.py index d27cb375..1e18caa6 100644 --- a/kombu/transport/virtual/base.py +++ b/kombu/transport/virtual/base.py @@ -177,6 +177,8 @@ class QoS: self.channel = channel self.prefetch_count = prefetch_count or 0 + # Standard Python dictionaries do not support setting attributes + # on the object, hence the use of OrderedDict self._delivered = OrderedDict() self._delivered.restored = False self._dirty = set() diff --git a/t/unit/transport/test_qpid.py b/t/unit/transport/test_qpid.py index d3866364..95071e97 100644 --- a/t/unit/transport/test_qpid.py +++ b/t/unit/transport/test_qpid.py @@ -4,7 +4,6 @@ import ssl import sys import time import uuid -from collections import OrderedDict from collections.abc import Callable from itertools import count from queue import Empty @@ -57,7 +56,7 @@ class test_QoS__init__: assert qos_limit_two.prefetch_count == 1 def test__init___not_yet_acked_is_initialized(self): - assert isinstance(self.qos._not_yet_acked, OrderedDict) + assert isinstance(self.qos._not_yet_acked, dict) @pytest.mark.skip(reason='Not supported in Python3')