diff --git a/AUTHORS b/AUTHORS index 5ffa4a09..df265337 100644 --- a/AUTHORS +++ b/AUTHORS @@ -83,6 +83,7 @@ Latitia M. Haskins Len Buckens Lorenzo Mancini Luyun Xie <2304310@qq.com> +Mads Jensen Mahendra M Marcin Lulek (ergo) Mark Lavin diff --git a/kombu/simple.py b/kombu/simple.py index 77177f75..eb0d82eb 100644 --- a/kombu/simple.py +++ b/kombu/simple.py @@ -144,8 +144,8 @@ class SimpleBuffer(SimpleQueue): """Simple API for ephemeral queues.""" no_ack = True - queue_opts = dict(durable=False, - auto_delete=True) - exchange_opts = dict(durable=False, - delivery_mode='transient', - auto_delete=True) + queue_opts = {'durable': False, + 'auto_delete': True} + exchange_opts = {'durable': False, + 'delivery_mode': 'transient', + 'auto_delete': True} diff --git a/kombu/transport/SQS.py b/kombu/transport/SQS.py index c1f4f52c..97b4a2dc 100644 --- a/kombu/transport/SQS.py +++ b/kombu/transport/SQS.py @@ -420,9 +420,9 @@ class Channel(virtual.Channel): aws_secret_access_key=self.conninfo.password, ) is_secure = self.is_secure if self.is_secure is not None else True - client_kwargs = dict( - use_ssl=is_secure - ) + client_kwargs = { + 'use_ssl': is_secure + } if self.endpoint_url is not None: client_kwargs['endpoint_url'] = self.endpoint_url self._sqs = session.client('sqs', **client_kwargs) diff --git a/kombu/transport/mongodb.py b/kombu/transport/mongodb.py index 75372ab0..db1e1c5e 100644 --- a/kombu/transport/mongodb.py +++ b/kombu/transport/mongodb.py @@ -381,15 +381,15 @@ class Channel(virtual.Channel): def _create_broadcast_cursor(self, exchange, routing_key, pattern, queue): if pymongo.version_tuple >= (3, ): - query = dict( - filter={'queue': exchange}, - cursor_type=CursorType.TAILABLE - ) + query = { + 'filter': {'queue': exchange}, + 'cursor_type': CursorType.TAILABLE, + } else: - query = dict( - query={'queue': exchange}, - tailable=True - ) + query = { + 'query': {'queue': exchange}, + 'tailable': True, + } cursor = self.broadcast.find(**query) ret = self._broadcast_cursors[queue] = BroadcastCursor(cursor) diff --git a/kombu/transport/virtual/base.py b/kombu/transport/virtual/base.py index 75bca055..7f2c61ad 100644 --- a/kombu/transport/virtual/base.py +++ b/kombu/transport/virtual/base.py @@ -857,7 +857,7 @@ class Management(base.Management): self.channel = transport.client.channel() def get_bindings(self): - return [dict(destination=q, source=e, routing_key=r) + return [{'destination': q, 'source': e, 'routing_key': r} for q, e, r in self.channel.list_bindings()] def close(self): diff --git a/t/mocks.py b/t/mocks.py index 8b4161b6..ef74974b 100644 --- a/t/mocks.py +++ b/t/mocks.py @@ -67,12 +67,12 @@ class Channel(base.StdChannel): def prepare_message(self, body, priority=0, content_type=None, content_encoding=None, headers=None, properties={}): self._called('prepare_message') - return dict(body=body, - headers=headers, - properties=properties, - priority=priority, - content_type=content_type, - content_encoding=content_encoding) + return {'body': body, + 'headers': headers, + 'properties': properties, + 'priority': priority, + 'content_type': content_type, + 'content_encoding': content_encoding} def basic_publish(self, message, exchange='', routing_key='', mandatory=False, immediate=False, **kwargs): diff --git a/t/unit/test_connection.py b/t/unit/test_connection.py index edeba2ad..df8d6c1d 100644 --- a/t/unit/test_connection.py +++ b/t/unit/test_connection.py @@ -65,38 +65,38 @@ class test_connection_utils: @pytest.mark.parametrize('url,expected', [ ('amqp://user:pass@host:10000/vhost', - dict(userid='user', password='pass', hostname='host', - port=10000, virtual_host='vhost')), + {'userid': 'user', 'password': 'pass', 'hostname': 'host', + 'port': 10000, 'virtual_host': 'vhost'}), ('amqp://user%61:%61pass@ho%61st:10000/v%2fhost', - dict(userid='usera', password='apass', hostname='hoast', - port=10000, virtual_host='v/host')), + {'userid': 'usera', 'password': 'apass', 'hostname': 'hoast', + 'port': 10000, 'virtual_host': 'v/host'}), ('amqp://', - dict(userid='guest', password='guest', hostname='localhost', - port=5672, virtual_host='/')), + {'userid': 'guest', 'password': 'guest', 'hostname': 'localhost', + 'port': 5672, 'virtual_host': '/'}), ('amqp://:@/', - dict(userid='guest', password='guest', hostname='localhost', - port=5672, virtual_host='/')), + {'userid': 'guest', 'password': 'guest', 'hostname': 'localhost', + 'port': 5672, 'virtual_host': '/'}), ('amqp://user@/', - dict(userid='user', password='guest', hostname='localhost', - port=5672, virtual_host='/')), + {'userid': 'user', 'password': 'guest', 'hostname': 'localhost', + 'port': 5672, 'virtual_host': '/'}), ('amqp://user:pass@/', - dict(userid='user', password='pass', hostname='localhost', - port=5672, virtual_host='/')), + {'userid': 'user', 'password': 'pass', 'hostname': 'localhost', + 'port': 5672, 'virtual_host': '/'}), ('amqp://host', - dict(userid='guest', password='guest', hostname='host', - port=5672, virtual_host='/')), + {'userid': 'guest', 'password': 'guest', 'hostname': 'host', + 'port': 5672, 'virtual_host': '/'}), ('amqp://:10000', - dict(userid='guest', password='guest', hostname='localhost', - port=10000, virtual_host='/')), + {'userid': 'guest', 'password': 'guest', 'hostname': 'localhost', + 'port': 10000, 'virtual_host': '/'}), ('amqp:///vhost', - dict(userid='guest', password='guest', hostname='localhost', - port=5672, virtual_host='vhost')), + {'userid': 'guest', 'password': 'guest', 'hostname': 'localhost', + 'port': 5672, 'virtual_host': 'vhost'}), ('amqp://host/', - dict(userid='guest', password='guest', hostname='host', - port=5672, virtual_host='/')), + {'userid': 'guest', 'password': 'guest', 'hostname': 'host', + 'port': 5672, 'virtual_host': '/'}), ('amqp://host/%2f', - dict(userid='guest', password='guest', hostname='host', - port=5672, virtual_host='/')), + {'userid': 'guest', 'password': 'guest', 'hostname': 'host', + 'port': 5672, 'virtual_host': '/'}), ]) def test_rabbitmq_example_urls(self, url, expected): # see Appendix A of http://www.rabbitmq.com/uri-spec.html diff --git a/t/unit/transport/virtual/test_base.py b/t/unit/transport/virtual/test_base.py index 70727414..69c1eafe 100644 --- a/t/unit/transport/virtual/test_base.py +++ b/t/unit/transport/virtual/test_base.py @@ -553,7 +553,7 @@ class test_Transport: self.transport = client().transport def test_custom_polling_interval(self): - x = client(transport_options=dict(polling_interval=32.3)) + x = client(transport_options={'polling_interval': 32.3}) assert x.transport.polling_interval == 32.3 def test_close_connection(self): diff --git a/t/unit/transport/virtual/test_exchange.py b/t/unit/transport/virtual/test_exchange.py index 93d48228..7b94e56c 100644 --- a/t/unit/transport/virtual/test_exchange.py +++ b/t/unit/transport/virtual/test_exchange.py @@ -145,12 +145,12 @@ class test_ExchangeType(ExchangeCase): 'rFoo', None, 'qFoo', ) - e1 = dict( - type='direct', - durable=True, - auto_delete=True, - arguments={}, - ) + e1 = { + 'type': 'direct', + 'durable': True, + 'auto_delete': True, + 'arguments': {}, + } e2 = dict(e1, arguments={'expires': 3000}) @pytest.mark.parametrize('ex,eq,name,type,durable,auto_delete,arguments', [