summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmer Katz <omer.drow@gmail.com>2020-08-04 17:27:37 +0300
committerOmer Katz <omer.drow@gmail.com>2020-08-04 17:37:29 +0300
commit85578afc4fea28adc16afdd3d7418b240357d96e (patch)
tree81f7b78cc160aadba8eec61babc5a79b2f42a612
parenta130c4636796623aa038848202b02c1a549c1312 (diff)
downloadkombu-remove-python2-support.tar.gz
-rw-r--r--kombu/abstract.py1
-rw-r--r--kombu/asynchronous/debug.py4
-rw-r--r--kombu/connection.py2
-rw-r--r--kombu/matcher.py6
-rw-r--r--kombu/pools.py4
-rw-r--r--kombu/serialization.py3
-rw-r--r--kombu/simple.py2
-rw-r--r--kombu/transport/SLMQ.py2
-rw-r--r--kombu/transport/azurestoragequeues.py2
-rw-r--r--kombu/transport/base.py1
-rw-r--r--kombu/transport/filesystem.py2
-rw-r--r--kombu/transport/qpid.py8
-rw-r--r--kombu/transport/virtual/base.py2
-rw-r--r--kombu/utils/eventio.py5
-rw-r--r--kombu/utils/scheduling.py2
-rw-r--r--kombu/utils/url.py2
-rw-r--r--t/unit/transport/test_qpid.py1
-rw-r--r--t/unit/utils/test_encoding.py1
-rw-r--r--t/unit/utils/test_json.py2
19 files changed, 25 insertions, 27 deletions
diff --git a/kombu/abstract.py b/kombu/abstract.py
index 5372b5a1..38cff010 100644
--- a/kombu/abstract.py
+++ b/kombu/abstract.py
@@ -89,7 +89,6 @@ class MaybeChannelBound(Object):
def when_bound(self):
"""Callback called when the class is bound."""
- pass
def __repr__(self):
return self._repr_entity(type(self).__name__)
diff --git a/kombu/asynchronous/debug.py b/kombu/asynchronous/debug.py
index 1cbf61db..a77ade3b 100644
--- a/kombu/asynchronous/debug.py
+++ b/kombu/asynchronous/debug.py
@@ -7,8 +7,8 @@ from kombu.utils.functional import reprcall
def repr_flag(flag):
"""Return description of event loop flag."""
return '{}{}{}'.format('R' if flag & READ else '',
- 'W' if flag & WRITE else '',
- '!' if flag & ERR else '')
+ 'W' if flag & WRITE else '',
+ '!' if flag & ERR else '')
def _rcb(obj):
diff --git a/kombu/connection.py b/kombu/connection.py
index ff2f125a..7b4bd097 100644
--- a/kombu/connection.py
+++ b/kombu/connection.py
@@ -957,6 +957,8 @@ class Connection:
@property
def is_evented(self):
return self.transport.implements.asynchronous
+
+
BrokerConnection = Connection # noqa: E305
diff --git a/kombu/matcher.py b/kombu/matcher.py
index 471e7e35..63787ea9 100644
--- a/kombu/matcher.py
+++ b/kombu/matcher.py
@@ -10,8 +10,6 @@ from .utils.encoding import bytes_to_str
class MatcherNotInstalled(Exception):
"""Matcher not installed/found."""
- pass
-
class MatcherRegistry:
"""Pattern matching function registry."""
@@ -72,7 +70,6 @@ class MatcherRegistry:
#: Global registry of matchers.
registry = MatcherRegistry()
-
"""
.. function:: match(data, pattern, matcher=default_matcher,
matcher_kwargs=None):
@@ -96,7 +93,6 @@ registry = MatcherRegistry()
"""
match = registry.match
-
"""
.. function:: register(name, matcher):
Register a new matching method.
@@ -106,7 +102,6 @@ match = registry.match
"""
register = registry.register
-
"""
.. function:: unregister(name):
Unregister registered matching method.
@@ -133,7 +128,6 @@ register_pcre()
# Default matching method is 'glob'
registry._set_default_matcher('glob')
-
# Load entrypoints from installed extensions
for ep, args in entrypoints('kombu.matchers'):
register(ep.name, *args)
diff --git a/kombu/pools.py b/kombu/pools.py
index 9db8db8d..065a6ebb 100644
--- a/kombu/pools.py
+++ b/kombu/pools.py
@@ -105,6 +105,8 @@ class Connections(PoolGroup):
def create(self, connection, limit):
return connection.Pool(limit=limit)
+
+
connections = register_group(Connections(limit=use_global_limit)) # noqa: E305
@@ -113,6 +115,8 @@ class Producers(PoolGroup):
def create(self, connection, limit):
return ProducerPool(connections[connection], limit=limit)
+
+
producers = register_group(Producers(limit=use_global_limit)) # noqa: E305
diff --git a/kombu/serialization.py b/kombu/serialization.py
index cda52c66..e8d60c82 100644
--- a/kombu/serialization.py
+++ b/kombu/serialization.py
@@ -15,7 +15,8 @@ from contextlib import contextmanager
from io import BytesIO
from .exceptions import (
- reraise, ContentDisallowed, DecodeError, EncodeError, SerializerNotInstalled
+ reraise, ContentDisallowed, DecodeError,
+ EncodeError, SerializerNotInstalled
)
from .utils.compat import entrypoints
from .utils.encoding import bytes_to_str, str_to_bytes, bytes_t
diff --git a/kombu/simple.py b/kombu/simple.py
index fa9eee69..cdcf86f3 100644
--- a/kombu/simple.py
+++ b/kombu/simple.py
@@ -140,7 +140,7 @@ class SimpleQueue(SimpleBase):
routing_key=routing_key,
compression=compression)
super().__init__(channel, producer,
- consumer, no_ack, **kwargs)
+ consumer, no_ack, **kwargs)
class SimpleBuffer(SimpleQueue):
diff --git a/kombu/transport/SLMQ.py b/kombu/transport/SLMQ.py
index 4c9ea743..489db3bd 100644
--- a/kombu/transport/SLMQ.py
+++ b/kombu/transport/SLMQ.py
@@ -46,7 +46,7 @@ class Channel(virtual.Channel):
if no_ack:
self._noack_queues.add(queue)
return super().basic_consume(queue, no_ack,
- *args, **kwargs)
+ *args, **kwargs)
def basic_cancel(self, consumer_tag):
if consumer_tag in self._consumers:
diff --git a/kombu/transport/azurestoragequeues.py b/kombu/transport/azurestoragequeues.py
index b3a93662..a38aa748 100644
--- a/kombu/transport/azurestoragequeues.py
+++ b/kombu/transport/azurestoragequeues.py
@@ -59,7 +59,7 @@ class Channel(virtual.Channel):
self._noack_queues.add(queue)
return super().basic_consume(queue, no_ack,
- *args, **kwargs)
+ *args, **kwargs)
def entity_name(self, name, table=CHARS_REPLACE_TABLE):
"""Format AMQP queue name into a valid Azure Storage Queue name."""
diff --git a/kombu/transport/base.py b/kombu/transport/base.py
index 724b9078..1b7fa5b0 100644
--- a/kombu/transport/base.py
+++ b/kombu/transport/base.py
@@ -93,7 +93,6 @@ class StdChannel:
Reply queue semantics: can be used to delete the queue
after transient reply message received.
"""
- pass
def prepare_queue_arguments(self, arguments, **kwargs):
return arguments
diff --git a/kombu/transport/filesystem.py b/kombu/transport/filesystem.py
index 038632b9..5dc64162 100644
--- a/kombu/transport/filesystem.py
+++ b/kombu/transport/filesystem.py
@@ -66,7 +66,7 @@ class Channel(virtual.Channel):
def _put(self, queue, payload, **kwargs):
"""Put `message` onto `queue`."""
filename = '{}_{}.{}.msg'.format(int(round(monotonic() * 1000)),
- uuid.uuid4(), queue)
+ uuid.uuid4(), queue)
filename = os.path.join(self.data_folder_out, filename)
try:
diff --git a/kombu/transport/qpid.py b/kombu/transport/qpid.py
index 3d5a7029..897d9ba4 100644
--- a/kombu/transport/qpid.py
+++ b/kombu/transport/qpid.py
@@ -468,12 +468,12 @@ class Channel(base.StdChannel):
"""
if not exchange:
- address = '{}; {{assert: always, node: {{type: queue}}}}'.format(
- routing_key)
+ address = f'{routing_key}; ' \
+ '{{assert: always, node: {{type: queue}}}}'
msg_subject = None
else:
- address = '{}/{}; {{assert: always, node: {{type: topic}}}}'.format(
- exchange, routing_key)
+ address = f'{exchange}/{routing_key}; '\
+ '{{assert: always, node: {{type: topic}}}}'
msg_subject = str(routing_key)
sender = self.transport.session.sender(address)
qpid_message = qpid.messaging.Message(content=message,
diff --git a/kombu/transport/virtual/base.py b/kombu/transport/virtual/base.py
index f1477c66..1f1b563e 100644
--- a/kombu/transport/virtual/base.py
+++ b/kombu/transport/virtual/base.py
@@ -302,7 +302,6 @@ class QoS:
This is implementation optional, and currently only
used by the Redis transport.
"""
- pass
class Message(base.Message):
@@ -385,7 +384,6 @@ class AbstractChannel:
Your transport can override this method if it needs
to do something whenever a new queue is declared.
"""
- pass
def _has_queue(self, queue, **kwargs):
"""Verify that queue exists.
diff --git a/kombu/utils/eventio.py b/kombu/utils/eventio.py
index d6149f7e..fa7533d4 100644
--- a/kombu/utils/eventio.py
+++ b/kombu/utils/eventio.py
@@ -3,7 +3,6 @@
import errno
import math
import select as __select__
-import socket
import sys
from numbers import Integral
@@ -132,8 +131,8 @@ class _kqueue:
kevents = []
if events & WRITE:
kevents.append(kevent(fd,
- filter=KQ_FILTER_WRITE,
- flags=flags))
+ filter=KQ_FILTER_WRITE,
+ flags=flags))
if not kevents or events & READ:
kevents.append(
kevent(fd, filter=KQ_FILTER_READ, flags=flags),
diff --git a/kombu/utils/scheduling.py b/kombu/utils/scheduling.py
index be663e2e..1875fce4 100644
--- a/kombu/utils/scheduling.py
+++ b/kombu/utils/scheduling.py
@@ -57,7 +57,6 @@ class FairCycle:
def close(self):
"""Close cycle."""
- pass
def __repr__(self):
"""``repr(cycle)``."""
@@ -94,7 +93,6 @@ class priority_cycle(round_robin_cycle):
def rotate(self, last_used):
"""Unused in this implementation."""
- pass
class sorted_cycle(priority_cycle):
diff --git a/kombu/utils/url.py b/kombu/utils/url.py
index ec2fb3e8..0d35722a 100644
--- a/kombu/utils/url.py
+++ b/kombu/utils/url.py
@@ -79,6 +79,8 @@ def url_to_parts(url):
unquote(path or '') or None,
dict(parse_qsl(parts.query)),
)
+
+
_parse_url = url_to_parts # noqa
diff --git a/t/unit/transport/test_qpid.py b/t/unit/transport/test_qpid.py
index 42f1b90a..2200731f 100644
--- a/t/unit/transport/test_qpid.py
+++ b/t/unit/transport/test_qpid.py
@@ -5,6 +5,7 @@ import socket
import sys
import time
import uuid
+from queue import Empty
from collections import OrderedDict
diff --git a/t/unit/utils/test_encoding.py b/t/unit/utils/test_encoding.py
index 51fc5786..3eedbb24 100644
--- a/t/unit/utils/test_encoding.py
+++ b/t/unit/utils/test_encoding.py
@@ -45,6 +45,7 @@ class test_default_encoding:
class newbytes(bytes):
"""Mock class to simulate python-future newbytes class"""
+
def __repr__(self):
return 'b' + super().__repr__()
diff --git a/t/unit/utils/test_json.py b/t/unit/utils/test_json.py
index c5651d75..82de6ba4 100644
--- a/t/unit/utils/test_json.py
+++ b/t/unit/utils/test_json.py
@@ -5,7 +5,7 @@ from datetime import datetime
from decimal import Decimal
from uuid import uuid4
-from case import MagicMock, Mock, skip
+from case import MagicMock, Mock
from kombu.utils.encoding import str_to_bytes
from kombu.utils.json import _DecodeError, dumps, loads