diff --git a/django_q/brokers/__init__.py b/django_q/brokers/__init__.py index e9130e5..167ff62 100644 --- a/django_q/brokers/__init__.py +++ b/django_q/brokers/__init__.py @@ -5,7 +5,7 @@ from django.core.cache import caches, InvalidCacheBackendError from django_q.conf import Conf -class Broker(object): +class Broker: def __init__(self, list_key=Conf.PREFIX): self.connection = self.get_connection(list_key) self.list_key = list_key diff --git a/django_q/cluster.py b/django_q/cluster.py index 4457cee..e9dac34 100644 --- a/django_q/cluster.py +++ b/django_q/cluster.py @@ -1,9 +1,3 @@ -# Future -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - import ast # Standard @@ -36,7 +30,7 @@ from django_q.signing import SignedPackage, BadSignature from django_q.status import Stat, Status -class Cluster(object): +class Cluster: def __init__(self, broker=None): self.broker = broker or get_broker() self.sentinel = None @@ -120,7 +114,7 @@ class Cluster(object): return self.start_event is None and self.stop_event is None and self.sentinel -class Sentinel(object): +class Sentinel: def __init__( self, stop_event, diff --git a/django_q/conf.py b/django_q/conf.py index baa4671..3c0b6a1 100644 --- a/django_q/conf.py +++ b/django_q/conf.py @@ -22,7 +22,7 @@ except ImportError: psutil = None -class Conf(object): +class Conf: """ Configuration class """ @@ -195,7 +195,7 @@ if not logger.handlers: # Error Reporting Interface -class ErrorReporter(object): +class ErrorReporter: # initialize with iterator of reporters (better name, targets?) def __init__(self, reporters): diff --git a/django_q/humanhash.py b/django_q/humanhash.py index feac001..a7ba160 100644 --- a/django_q/humanhash.py +++ b/django_q/humanhash.py @@ -50,7 +50,7 @@ DEFAULT_WORDLIST = ( 'zulu') -class HumanHasher(object): +class HumanHasher: """ Transforms hex digests to human-readable strings. diff --git a/django_q/queues.py b/django_q/queues.py index 20f082f..978b068 100644 --- a/django_q/queues.py +++ b/django_q/queues.py @@ -7,7 +7,7 @@ import multiprocessing import multiprocessing.queues -class SharedCounter(object): +class SharedCounter: """ A synchronized shared counter. The locking done by multiprocessing.Value ensures that only a single diff --git a/django_q/signing.py b/django_q/signing.py index 2460aaa..474d0cf 100644 --- a/django_q/signing.py +++ b/django_q/signing.py @@ -11,7 +11,7 @@ from django_q.conf import Conf BadSignature = signing.BadSignature -class SignedPackage(object): +class SignedPackage: """Wraps Django's signing module with custom Pickle serializer.""" @@ -31,7 +31,7 @@ class SignedPackage(object): serializer=PickleSerializer) -class PickleSerializer(object): +class PickleSerializer: """Simple wrapper around Pickle for signing.dumps and signing.loads.""" diff --git a/django_q/status.py b/django_q/status.py index f3f9450..7f0fa8f 100644 --- a/django_q/status.py +++ b/django_q/status.py @@ -5,7 +5,7 @@ from django_q.conf import Conf, logger from django_q.signing import SignedPackage, BadSignature -class Status(object): +class Status: """Cluster status base class.""" def __init__(self, pid, cluster_id): diff --git a/django_q/tasks.py b/django_q/tasks.py index ccc333b..1d9780a 100644 --- a/django_q/tasks.py +++ b/django_q/tasks.py @@ -480,7 +480,7 @@ def async_chain(chain, group=None, cached=Conf.CACHED, sync=Conf.SYNC, broker=No return group -class Iter(object): +class Iter: """ An async task with iterable arguments """ @@ -550,7 +550,7 @@ class Iter(object): return len(self.args) -class Chain(object): +class Chain: """ A sequential chain of tasks """ @@ -634,7 +634,7 @@ class Chain(object): return len(self.chain) -class AsyncTask(object): +class AsyncTask: """ an async task """ diff --git a/django_q/tests/test_cluster.py b/django_q/tests/test_cluster.py index c39b717..97d320a 100644 --- a/django_q/tests/test_cluster.py +++ b/django_q/tests/test_cluster.py @@ -22,7 +22,7 @@ from django_q.tests.tasks import multiply, TaskError from django_q.queues import Queue -class WordClass(object): +class WordClass: def __init__(self): self.word_list = DEFAULT_WORDLIST diff --git a/runtests.py b/runtests.py index 4ecd607..a31b744 100644 --- a/runtests.py +++ b/runtests.py @@ -3384,7 +3384,7 @@ import sys import base64 import zlib -class DictImporter(object): +class DictImporter: def __init__(self, sources): self.sources = sources