diff options
author | Omer Katz <omer.drow@gmail.com> | 2020-07-23 16:29:10 +0300 |
---|---|---|
committer | Omer Katz <omer.drow@gmail.com> | 2020-07-23 16:29:10 +0300 |
commit | ff48da68b7fd40d2d835bcc95ddd798269e92562 (patch) | |
tree | 85ca445c2c0d7ae32cc04f3fdcb56a76f15a4770 /kombu | |
parent | 7a6e7cc45b9afe799770313a66c4211d1986ff30 (diff) | |
download | kombu-ff48da68b7fd40d2d835bcc95ddd798269e92562.tar.gz |
Remove five usage from kombu/asynchronous.
Diffstat (limited to 'kombu')
-rw-r--r-- | kombu/asynchronous/aws/connection.py | 7 | ||||
-rw-r--r-- | kombu/asynchronous/debug.py | 7 | ||||
-rw-r--r-- | kombu/asynchronous/http/base.py | 4 | ||||
-rw-r--r-- | kombu/asynchronous/http/curl.py | 5 | ||||
-rw-r--r-- | kombu/asynchronous/hub.py | 3 | ||||
-rw-r--r-- | kombu/asynchronous/semaphore.py | 3 | ||||
-rw-r--r-- | kombu/asynchronous/timer.py | 3 |
7 files changed, 10 insertions, 22 deletions
diff --git a/kombu/asynchronous/aws/connection.py b/kombu/asynchronous/aws/connection.py index 2c5dc6f1..ada724f9 100644 --- a/kombu/asynchronous/aws/connection.py +++ b/kombu/asynchronous/aws/connection.py @@ -5,7 +5,6 @@ from vine import promise, transform from kombu.asynchronous.aws.ext import AWSRequest, get_response from kombu.asynchronous.http import Headers, Request, get_client -from kombu.five import items, python_2_unicode_compatible import io @@ -32,7 +31,6 @@ __all__ = ( ) -@python_2_unicode_compatible class AsyncHTTPResponse: """Async HTTP Response.""" @@ -48,7 +46,7 @@ class AsyncHTTPResponse: return self.response.headers.get(name, default) def getheaders(self): - return list(items(self.response.headers)) + return list(self.response.headers.items()) @property def msg(self): @@ -70,7 +68,6 @@ class AsyncHTTPResponse: return repr(self.response) -@python_2_unicode_compatible class AsyncHTTPSConnection: """Async HTTP Connection.""" @@ -99,7 +96,7 @@ class AsyncHTTPSConnection: else: self.body = read() if headers is not None: - self.headers.extend(list(items(headers))) + self.headers.extend(list(headers.items())) def getrequest(self): headers = Headers(self.headers) diff --git a/kombu/asynchronous/debug.py b/kombu/asynchronous/debug.py index 002c8ec9..1cbf61db 100644 --- a/kombu/asynchronous/debug.py +++ b/kombu/asynchronous/debug.py @@ -1,6 +1,5 @@ """Event-loop debugging tools.""" -from kombu.five import items, string_t from kombu.utils.eventio import READ, WRITE, ERR from kombu.utils.functional import reprcall @@ -15,7 +14,7 @@ def repr_flag(flag): def _rcb(obj): if obj is None: return '<missing>' - if isinstance(obj, string_t): + if isinstance(obj, str): return obj if isinstance(obj, tuple): cb, args = obj @@ -42,13 +41,13 @@ def repr_events(h, events): def repr_readers(h): """Return description of pending readers.""" return ['({}){}->{}'.format(fd, _rcb(cb), repr_flag(READ | ERR)) - for fd, cb in items(h.readers)] + for fd, cb in h.readers.items()] def repr_writers(h): """Return description of pending writers.""" return ['({}){}->{}'.format(fd, _rcb(cb), repr_flag(WRITE)) - for fd, cb in items(h.writers)] + for fd, cb in h.writers.items()] def callback_for(h, fd, flag, *default): diff --git a/kombu/asynchronous/http/base.py b/kombu/asynchronous/http/base.py index 894f13f6..d4ae4a9d 100644 --- a/kombu/asynchronous/http/base.py +++ b/kombu/asynchronous/http/base.py @@ -5,7 +5,6 @@ import sys from vine import Thenable, promise, maybe_promise from kombu.exceptions import HttpError -from kombu.five import items, python_2_unicode_compatible from kombu.utils.compat import coro from kombu.utils.encoding import bytes_to_str from kombu.utils.functional import maybe_list, memoize @@ -39,7 +38,6 @@ class Headers(dict): @Thenable.register -@python_2_unicode_compatible class Request: """A HTTP Request. @@ -122,7 +120,7 @@ class Request: self.on_prepare = maybe_promise(on_prepare) self.on_header = maybe_promise(on_header) if kwargs: - for k, v in items(kwargs): + for k, v in kwargs.items(): setattr(self, k, v) if not isinstance(headers, Headers): headers = Headers(headers or {}) diff --git a/kombu/asynchronous/http/curl.py b/kombu/asynchronous/http/curl.py index f4cdf523..9f972469 100644 --- a/kombu/asynchronous/http/curl.py +++ b/kombu/asynchronous/http/curl.py @@ -7,7 +7,6 @@ from time import time from kombu.asynchronous.hub import READ, WRITE, get_event_loop from kombu.exceptions import HttpError -from kombu.five import bytes_if_py2, items from kombu.utils.encoding import bytes_to_str from .base import BaseClient @@ -28,7 +27,7 @@ else: __all__ = ('CurlClient',) -DEFAULT_USER_AGENT = bytes_if_py2('Mozilla/5.0 (compatible; pycurl)') +DEFAULT_USER_AGENT = 'Mozilla/5.0 (compatible; pycurl)' EXTRA_METHODS = frozenset(['DELETE', 'OPTIONS', 'PATCH']) @@ -202,7 +201,7 @@ class CurlClient(BaseClient): setopt( _pycurl.HTTPHEADER, - ['{}: {}'.format(*h) for h in items(request.headers)], + ['{}: {}'.format(*h) for h in request.headers.items()], ) setopt( diff --git a/kombu/asynchronous/hub.py b/kombu/asynchronous/hub.py index 7f761796..c6846057 100644 --- a/kombu/asynchronous/hub.py +++ b/kombu/asynchronous/hub.py @@ -2,10 +2,10 @@ import errno from contextlib import contextmanager +from queue import Empty from time import sleep from types import GeneratorType as generator # noqa -from kombu.five import Empty, python_2_unicode_compatible, range from kombu.log import get_logger from kombu.utils.compat import fileno from kombu.utils.eventio import ERR, READ, WRITE, poll @@ -49,7 +49,6 @@ def set_event_loop(loop): return loop -@python_2_unicode_compatible class Hub: """Event loop object. diff --git a/kombu/asynchronous/semaphore.py b/kombu/asynchronous/semaphore.py index 270700a8..9fe34a04 100644 --- a/kombu/asynchronous/semaphore.py +++ b/kombu/asynchronous/semaphore.py @@ -2,12 +2,9 @@ from collections import deque -from kombu.five import python_2_unicode_compatible - __all__ = ('DummyLock', 'LaxBoundedSemaphore') -@python_2_unicode_compatible class LaxBoundedSemaphore: """Asynchronous Bounded Semaphore. diff --git a/kombu/asynchronous/timer.py b/kombu/asynchronous/timer.py index d159ab15..81a204bb 100644 --- a/kombu/asynchronous/timer.py +++ b/kombu/asynchronous/timer.py @@ -7,10 +7,10 @@ from collections import namedtuple from datetime import datetime from functools import total_ordering from weakref import proxy as weakrefproxy +from time import monotonic from vine.utils import wraps -from kombu.five import monotonic, python_2_unicode_compatible from kombu.log import get_logger from time import time as _time @@ -44,7 +44,6 @@ def to_timestamp(d, default_timezone=utc, time=monotonic): @total_ordering -@python_2_unicode_compatible class Entry: """Schedule Entry.""" |