diff --git a/examples/fib.py b/examples/fib.py index 91606cb..2130b3c 100644 --- a/examples/fib.py +++ b/examples/fib.py @@ -1,8 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - - def slow_fib(n): if n <= 1: return 1 diff --git a/examples/run_example.py b/examples/run_example.py index 771b6a8..93f62bd 100644 --- a/examples/run_example.py +++ b/examples/run_example.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - import os import time diff --git a/examples/run_worker.py b/examples/run_worker.py index 4feb217..84587ff 100644 --- a/examples/run_worker.py +++ b/examples/run_worker.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - from rq import Connection, Queue, Worker if __name__ == '__main__': diff --git a/rq/__init__.py b/rq/__init__.py index 4ee6fc5..abca97c 100644 --- a/rq/__init__.py +++ b/rq/__init__.py @@ -1,7 +1,4 @@ -# -*- coding: utf-8 -*- # flake8: noqa -from __future__ import (absolute_import, division, print_function, - unicode_literals) from .connections import (Connection, get_current_connection, pop_connection, push_connection, use_connection) diff --git a/rq/cli/cli.py b/rq/cli/cli.py index d79d214..9cd9525 100755 --- a/rq/cli/cli.py +++ b/rq/cli/cli.py @@ -1,9 +1,6 @@ -# -*- coding: utf-8 -*- """ RQ command line tool """ -from __future__ import (absolute_import, division, print_function, - unicode_literals) from functools import update_wrapper import os diff --git a/rq/cli/helpers.py b/rq/cli/helpers.py index 6004e87..31d9d62 100644 --- a/rq/cli/helpers.py +++ b/rq/cli/helpers.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - import sys import importlib import time diff --git a/rq/compat/__init__.py b/rq/compat/__init__.py index fee9c3f..64193e2 100644 --- a/rq/compat/__init__.py +++ b/rq/compat/__init__.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - import sys diff --git a/rq/compat/connections.py b/rq/compat/connections.py index 8e2b511..79510f3 100644 --- a/rq/compat/connections.py +++ b/rq/compat/connections.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - from functools import partial from redis import Redis diff --git a/rq/connections.py b/rq/connections.py index 7186056..d6a2036 100644 --- a/rq/connections.py +++ b/rq/connections.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - from contextlib import contextmanager from redis import Redis diff --git a/rq/contrib/legacy.py b/rq/contrib/legacy.py index 880d865..9c0ac1f 100644 --- a/rq/contrib/legacy.py +++ b/rq/contrib/legacy.py @@ -1,8 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - - import logging from rq import get_current_connection from rq import Worker diff --git a/rq/contrib/sentry.py b/rq/contrib/sentry.py index e897fcc..edf0fe4 100644 --- a/rq/contrib/sentry.py +++ b/rq/contrib/sentry.py @@ -1,8 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - - def register_sentry(sentry_dsn, **opts): """Given a Raven client and an RQ worker, registers exception handlers with the worker so exceptions are logged to Sentry. diff --git a/rq/decorators.py b/rq/decorators.py index 1f3a78e..6f93cab 100644 --- a/rq/decorators.py +++ b/rq/decorators.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - from functools import wraps from rq.compat import string_types diff --git a/rq/dummy.py b/rq/dummy.py index cdd1afc..3c9187d 100644 --- a/rq/dummy.py +++ b/rq/dummy.py @@ -1,9 +1,6 @@ -# -*- coding: utf-8 -*- """ Some dummy tasks that are well-suited for generating load for testing purposes. """ -from __future__ import (absolute_import, division, print_function, - unicode_literals) import random import time diff --git a/rq/exceptions.py b/rq/exceptions.py index 34e45b1..ee51753 100644 --- a/rq/exceptions.py +++ b/rq/exceptions.py @@ -1,8 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - - class NoSuchJobError(Exception): pass @@ -30,7 +25,7 @@ class DequeueTimeout(Exception): class ShutDownImminentException(Exception): def __init__(self, msg, extra_info): self.extra_info = extra_info - super(ShutDownImminentException, self).__init__(msg) + super().__init__(msg) class TimeoutFormatError(Exception): diff --git a/rq/job.py b/rq/job.py index 2901ae5..fde9c0c 100644 --- a/rq/job.py +++ b/rq/job.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - import inspect import json import pickle diff --git a/rq/local.py b/rq/local.py index 3e598fc..458cd83 100644 --- a/rq/local.py +++ b/rq/local.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # flake8: noqa """ werkzeug.local diff --git a/rq/logutils.py b/rq/logutils.py index 5759a11..b3f78b0 100644 --- a/rq/logutils.py +++ b/rq/logutils.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - import logging import sys diff --git a/rq/queue.py b/rq/queue.py index c8f5abf..167ad66 100644 --- a/rq/queue.py +++ b/rq/queue.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - import uuid import sys import warnings diff --git a/rq/registry.py b/rq/registry.py index 089a787..cc989c8 100644 --- a/rq/registry.py +++ b/rq/registry.py @@ -264,7 +264,7 @@ class ScheduledJobRegistry(BaseRegistry): key_template = 'rq:scheduled:{0}' def __init__(self, *args, **kwargs): - super(ScheduledJobRegistry, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # The underlying implementation of get_jobs_to_enqueue() is # the same as get_expired_job_ids, but get_expired_job_ids() doesn't # make sense in this context diff --git a/rq/timeouts.py b/rq/timeouts.py index eee061d..0e4c5d5 100644 --- a/rq/timeouts.py +++ b/rq/timeouts.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - import ctypes import signal import threading diff --git a/rq/utils.py b/rq/utils.py index 6b5380f..a0a3566 100644 --- a/rq/utils.py +++ b/rq/utils.py @@ -1,12 +1,9 @@ -# -*- coding: utf-8 -*- """ Miscellaneous helper functions. The formatter for ANSI colored console output is heavily based on Pygments terminal colorizing code, originally by Georg Brandl. """ -from __future__ import (absolute_import, division, print_function, - unicode_literals) import calendar import datetime @@ -102,7 +99,7 @@ class ColorizingStreamHandler(logging.StreamHandler): def __init__(self, exclude=None, *args, **kwargs): self.exclude = exclude - super(ColorizingStreamHandler, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) @property def is_tty(self): diff --git a/rq/version.py b/rq/version.py index 4c7666c..21f747b 100644 --- a/rq/version.py +++ b/rq/version.py @@ -1,5 +1 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - VERSION = '1.10.1' diff --git a/rq/worker.py b/rq/worker.py index 793e01f..ff8f071 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - import errno import logging import os diff --git a/tests/__init__.py b/tests/__init__.py index 2615a61..cb60399 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - import logging import os diff --git a/tests/config_files/dummy.py b/tests/config_files/dummy.py index dbc935f..1404250 100644 --- a/tests/config_files/dummy.py +++ b/tests/config_files/dummy.py @@ -1,5 +1 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - REDIS_HOST = "testhost.example.com" diff --git a/tests/config_files/dummy_override.py b/tests/config_files/dummy_override.py index 3f9830f..2b87a0c 100644 --- a/tests/config_files/dummy_override.py +++ b/tests/config_files/dummy_override.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - REDIS_HOST = "testhost.example.com" REDIS_PORT = 6378 REDIS_DB = 2 diff --git a/tests/config_files/sentry.py b/tests/config_files/sentry.py index 5ed25b1..163d305 100644 --- a/tests/config_files/sentry.py +++ b/tests/config_files/sentry.py @@ -1,6 +1,2 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - REDIS_HOST = "testhost.example.com" SENTRY_DSN = 'https://123@sentry.io/123' diff --git a/tests/fixtures.py b/tests/fixtures.py index 842e293..9895fed 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -1,10 +1,7 @@ -# -*- coding: utf-8 -*- """ This file contains all jobs that are used in tests. Each of these test fixtures has a slighty different characteristics. """ -from __future__ import (absolute_import, division, print_function, - unicode_literals) import os import time @@ -150,7 +147,7 @@ class UnicodeStringObject: return u'é' -class ClassWithAStaticMethod(object): +class ClassWithAStaticMethod: @staticmethod def static_method(): return u"I'm a static method" diff --git a/tests/test_cli.py b/tests/test_cli.py index a03aaf6..e428f92 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - from datetime import datetime, timezone, timedelta from time import sleep from uuid import uuid4 @@ -45,7 +41,7 @@ class TestRQCli(RQTestCase): """Test rq_cli script""" def setUp(self): - super(TestRQCli, self).setUp() + super().setUp() db_num = self.testconn.connection_pool.connection_kwargs['db'] self.redis_url = 'redis://127.0.0.1:6379/%d' % db_num self.connection = Redis.from_url(self.redis_url) diff --git a/tests/test_connection.py b/tests/test_connection.py index 2f8be86..fdfafbd 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - from redis import Redis from rq import Connection, Queue, use_connection, get_current_connection, pop_connection diff --git a/tests/test_decorator.py b/tests/test_decorator.py index 190f64d..7ad6198 100644 --- a/tests/test_decorator.py +++ b/tests/test_decorator.py @@ -1,8 +1,5 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - from unittest import mock + from redis import Redis from rq.decorators import job @@ -16,7 +13,7 @@ from tests.fixtures import decorated_job class TestDecorator(RQTestCase): def setUp(self): - super(TestDecorator, self).setUp() + super().setUp() def test_decorator_preserves_functionality(self): """Ensure that a decorated function's functionality is still preserved. diff --git a/tests/test_fixtures.py b/tests/test_fixtures.py index 1f98a58..383ba15 100644 --- a/tests/test_fixtures.py +++ b/tests/test_fixtures.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - from rq import Queue from tests import RQTestCase, fixtures diff --git a/tests/test_job.py b/tests/test_job.py index fecf5bb..df17f30 100644 --- a/tests/test_job.py +++ b/tests/test_job.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import json from rq.serializers import JSONSerializer import time diff --git a/tests/test_queue.py b/tests/test_queue.py index a4be208..d447d7f 100644 --- a/tests/test_queue.py +++ b/tests/test_queue.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - import json from datetime import datetime, timedelta, timezone from rq.serializers import DefaultSerializer, JSONSerializer diff --git a/tests/test_registry.py b/tests/test_registry.py index ba5add4..6193788 100644 --- a/tests/test_registry.py +++ b/tests/test_registry.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import - from datetime import datetime, timedelta from rq.serializers import JSONSerializer @@ -26,7 +23,7 @@ class CustomJob(Job): class TestRegistry(RQTestCase): def setUp(self): - super(TestRegistry, self).setUp() + super().setUp() self.registry = StartedJobRegistry(connection=self.testconn) def test_init(self): @@ -273,7 +270,7 @@ class TestRegistry(RQTestCase): class TestFinishedJobRegistry(RQTestCase): def setUp(self): - super(TestFinishedJobRegistry, self).setUp() + super().setUp() self.registry = FinishedJobRegistry(connection=self.testconn) def test_key(self): @@ -321,7 +318,7 @@ class TestFinishedJobRegistry(RQTestCase): class TestDeferredRegistry(RQTestCase): def setUp(self): - super(TestDeferredRegistry, self).setUp() + super().setUp() self.registry = DeferredJobRegistry(connection=self.testconn) def test_key(self): diff --git a/tests/test_sentry.py b/tests/test_sentry.py index 0e3b356..e63a5f6 100644 --- a/tests/test_sentry.py +++ b/tests/test_sentry.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - from rq import Queue from rq.cli import main from rq.cli.helpers import read_config_file @@ -25,7 +21,7 @@ class FakeSentry: class TestSentry(RQTestCase): def setUp(self): - super(TestSentry, self).setUp() + super().setUp() db_num = self.testconn.connection_pool.connection_kwargs['db'] self.redis_url = 'redis://127.0.0.1:6379/%d' % db_num diff --git a/tests/test_serializers.py b/tests/test_serializers.py index 1e3e671..0c50fa7 100644 --- a/tests/test_serializers.py +++ b/tests/test_serializers.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - import json import pickle import pickletools diff --git a/tests/test_utils.py b/tests/test_utils.py index ef6724b..7c69b72 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) import re import datetime from unittest import mock diff --git a/tests/test_worker.py b/tests/test_worker.py index 26caccc..7bc8fc0 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) - import json import os import psutil @@ -1254,7 +1250,7 @@ def schedule_access_self(): @pytest.mark.skipif(sys.platform == 'darwin', reason='Fails on OS X') class TestWorkerSubprocess(RQTestCase): def setUp(self): - super(TestWorkerSubprocess, self).setUp() + super().setUp() db_num = self.testconn.connection_pool.connection_kwargs['db'] self.redis_url = 'redis://127.0.0.1:6379/%d' % db_num @@ -1286,7 +1282,7 @@ class TestWorkerSubprocess(RQTestCase): @skipIf('pypy' in sys.version.lower(), 'these tests often fail on pypy') class HerokuWorkerShutdownTestCase(TimeoutTestCase, RQTestCase): def setUp(self): - super(HerokuWorkerShutdownTestCase, self).setUp() + super().setUp() self.sandbox = '/tmp/rq_shutdown/' os.makedirs(self.sandbox) @@ -1372,7 +1368,7 @@ class HerokuWorkerShutdownTestCase(TimeoutTestCase, RQTestCase): class TestExceptionHandlerMessageEncoding(RQTestCase): def setUp(self): - super(TestExceptionHandlerMessageEncoding, self).setUp() + super().setUp() self.worker = Worker("foo") self.worker._exc_handlers = [] # Mimic how exception info is actually passed forwards