summaryrefslogtreecommitdiff
path: root/kombu/transport/virtual/base.py
diff options
context:
space:
mode:
authorOmer Katz <omer.drow@gmail.com>2020-07-13 16:58:06 +0300
committerOmer Katz <omer.drow@gmail.com>2020-07-13 16:58:06 +0300
commit7a6e7cc45b9afe799770313a66c4211d1986ff30 (patch)
tree189c7fa2e7ca9835e14975093c12b7e5d3d8213b /kombu/transport/virtual/base.py
parent016f4accb634ebc3eb8fc66741f23552e5966ea7 (diff)
downloadkombu-7a6e7cc45b9afe799770313a66c4211d1986ff30.tar.gz
pyupgrade
Diffstat (limited to 'kombu/transport/virtual/base.py')
-rw-r--r--kombu/transport/virtual/base.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/kombu/transport/virtual/base.py b/kombu/transport/virtual/base.py
index c50a764e..9e496a32 100644
--- a/kombu/transport/virtual/base.py
+++ b/kombu/transport/virtual/base.py
@@ -2,7 +2,6 @@
Emulates the AMQ API for non-AMQ transports.
"""
-from __future__ import absolute_import, print_function, unicode_literals
import base64
import socket
@@ -61,7 +60,7 @@ queue_binding_t = namedtuple('queue_binding_t', (
))
-class Base64(object):
+class Base64:
"""Base64 codec."""
def encode(self, s):
@@ -79,7 +78,7 @@ class UndeliverableWarning(UserWarning):
"""The message could not be delivered to a queue."""
-class BrokerState(object):
+class BrokerState:
"""Broker state holds exchanges, queues and bindings."""
#: Mapping of exchange name to
@@ -149,7 +148,7 @@ class BrokerState(object):
)
-class QoS(object):
+class QoS:
"""Quality of Service guarantees.
Only supports `prefetch_count` at this point.
@@ -315,7 +314,7 @@ class Message(base.Message):
body = payload.get('body')
if body:
body = channel.decode_body(body, properties.get('body_encoding'))
- super(Message, self).__init__(
+ super().__init__(
body=body,
channel=channel,
delivery_tag=properties['delivery_tag'],
@@ -343,7 +342,7 @@ class Message(base.Message):
}
-class AbstractChannel(object):
+class AbstractChannel:
"""Abstract channel interface.
This is an abstract class defining the channel methods
@@ -470,7 +469,7 @@ class Channel(AbstractChannel, base.StdChannel):
self.channel_id = self.connection._avail_channel_ids.pop()
except IndexError:
raise ResourceError(
- 'No free channel ids, current={0}, channel_max={1}'.format(
+ 'No free channel ids, current={}, channel_max={}'.format(
len(self.connection.channels),
self.connection.channel_max), (20, 10),
)
@@ -491,7 +490,7 @@ class Channel(AbstractChannel, base.StdChannel):
if passive:
if exchange not in self.state.exchanges:
raise ChannelError(
- 'NOT_FOUND - no exchange {0!r} in vhost {1!r}'.format(
+ 'NOT_FOUND - no exchange {!r} in vhost {!r}'.format(
exchange, self.connection.client.virtual_host or '/'),
(50, 10), 'Channel.exchange_declare', '404',
)
@@ -523,7 +522,7 @@ class Channel(AbstractChannel, base.StdChannel):
queue = queue or 'amq.gen-%s' % uuid()
if passive and not self._has_queue(queue, **kwargs):
raise ChannelError(
- 'NOT_FOUND - no queue {0!r} in vhost {1!r}'.format(
+ 'NOT_FOUND - no queue {!r} in vhost {!r}'.format(
queue, self.connection.client.virtual_host or '/'),
(50, 10), 'Channel.queue_declare', '404',
)
@@ -853,7 +852,7 @@ class Management(base.Management):
"""Base class for the AMQP management API."""
def __init__(self, transport):
- super(Management, self).__init__(transport)
+ super().__init__(transport)
self.channel = transport.client.channel()
def get_bindings(self):
@@ -972,7 +971,7 @@ class Transport(base.Transport):
def _deliver(self, message, queue):
if not queue:
raise KeyError(
- 'Received message without destination queue: {0}'.format(
+ 'Received message without destination queue: {}'.format(
message))
try:
callback = self._callbacks[queue]
@@ -993,7 +992,7 @@ class Transport(base.Transport):
def on_message_ready(self, channel, message, queue):
if not queue or queue not in self._callbacks:
raise KeyError(
- 'Message for queue {0!r} without consumers: {1}'.format(
+ 'Message for queue {!r} without consumers: {}'.format(
queue, message))
self._callbacks[queue](message)