From b8d425b318567073a8343b8f884547b62ced810d Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Fri, 30 Jan 2015 09:23:07 +0100 Subject: [PATCH] Various PEP8 fixes. --- rq/queue.py | 1 - rq/suspension.py | 2 +- rq/utils.py | 2 +- rq/version.py | 1 + rq/worker.py | 7 ++----- tests/test_cli.py | 6 ------ tests/test_job.py | 2 +- tests/test_queue.py | 2 +- tests/test_worker.py | 2 +- 9 files changed, 8 insertions(+), 17 deletions(-) diff --git a/rq/queue.py b/rq/queue.py index 9815f7e..3f59a50 100644 --- a/rq/queue.py +++ b/rq/queue.py @@ -253,7 +253,6 @@ class Queue(object): If Queue is instantiated with async=False, job is executed immediately. """ - with self.connection._pipeline() as pipeline: # Add Queue key set self.connection.sadd(self.redis_queues_keys, self.key) diff --git a/rq/suspension.py b/rq/suspension.py index b734acd..93152b9 100644 --- a/rq/suspension.py +++ b/rq/suspension.py @@ -15,4 +15,4 @@ def suspend(connection, ttl=None): def resume(connection): - return connection.delete(WORKERS_SUSPENDED) \ No newline at end of file + return connection.delete(WORKERS_SUSPENDED) diff --git a/rq/utils.py b/rq/utils.py index 7bcb392..3e44a98 100644 --- a/rq/utils.py +++ b/rq/utils.py @@ -217,4 +217,4 @@ def enum(name, *sequential, **named): # On Python 2 type() requires a byte string (which is str() on Python 2). # On Python 3 it does not matter, so we'll use str(), which acts as # a no-op. - return type(str(name), (), values) \ No newline at end of file + return type(str(name), (), values) diff --git a/rq/version.py b/rq/version.py index 30d837a..0d96ce8 100644 --- a/rq/version.py +++ b/rq/version.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) + VERSION = '0.5.0' diff --git a/rq/worker.py b/rq/worker.py index 0c53409..201dfed 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -12,7 +12,6 @@ import sys import time import traceback import warnings -from datetime import datetime from rq.compat import as_text, string_types, text_type @@ -54,8 +53,8 @@ def compact(l): return [x for x in l if x is not None] _signames = dict((getattr(signal, signame), signame) - for signame in dir(signal) - if signame.startswith('SIG') and '_' not in signame) + for signame in dir(signal) + if signame.startswith('SIG') and '_' not in signame) def signal_name(signum): @@ -367,7 +366,6 @@ class Worker(object): if before_state: self.set_state(before_state) - def work(self, burst=False): """Starts the work loop. @@ -416,7 +414,6 @@ class Worker(object): self.register_death() return did_perform_work - def dequeue_job_and_maintain_ttl(self, timeout): result = None qnames = self.queue_names() diff --git a/tests/test_cli.py b/tests/test_cli.py index 3977006..f1b7fd4 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -101,9 +101,3 @@ class TestRQCli(RQTestCase): self.assertEqual(result.exit_code, 1) self.assertIn("Duration must be an integer greater than 1", result.output) - - - - - - diff --git a/tests/test_job.py b/tests/test_job.py index 89adf6d..e117ea9 100644 --- a/tests/test_job.py +++ b/tests/test_job.py @@ -339,7 +339,7 @@ class TestJob(RQTestCase): job = Job.create(func=say_hello, origin=origin) job._dependency_id = 'id' job.save() - + self.assertEqual(registry.get_job_ids(), []) job.register_dependency() self.assertEqual(as_text(self.testconn.spop('rq:job:id:dependents')), job.id) diff --git a/tests/test_queue.py b/tests/test_queue.py index 175a1c0..e4e9253 100644 --- a/tests/test_queue.py +++ b/tests/test_queue.py @@ -340,7 +340,7 @@ class TestQueue(RQTestCase): self.assertFalse(self.testconn.exists(parent_job.dependents_key)) # DeferredJobRegistry should also be empty - self.assertEqual(registry.get_job_ids(), []) + self.assertEqual(registry.get_job_ids(), []) def test_enqueue_job_with_dependency(self): """Jobs are enqueued only when their dependencies are finished.""" diff --git a/tests/test_worker.py b/tests/test_worker.py index 8a35d03..c47a62e 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -334,7 +334,7 @@ class TestWorker(RQTestCase): raise q = Queue() - job = q.enqueue(create_file, SENTINEL_FILE) + q.enqueue(create_file, SENTINEL_FILE) w = Worker([q])