Ask Solem 13 年之前
父节点
当前提交
f8d4bddc77

+ 6 - 3
celery/app/amqp.py

@@ -30,6 +30,7 @@ QUEUE_FORMAT = """
 . %(name)s exchange:%(exchange)s(%(exchange_type)s) binding:%(routing_key)s
 """
 
+
 class Queues(dict):
     """Queue name⇒ declaration mapping.
 
@@ -45,7 +46,8 @@ class Queues(dict):
     #: The rest of the queues are then used for routing only.
     _consume_from = None
 
-    def __init__(self, queues=None, default_exchange=None, create_missing=True):
+    def __init__(self, queues=None, default_exchange=None,
+            create_missing=True):
         dict.__init__(self)
         self.aliases = WeakValueDictionary()
         self.default_exchange = default_exchange
@@ -190,8 +192,8 @@ class TaskProducer(Producer):
              immediate=immediate, routing_key=routing_key,
              serializer=serializer or self.serializer,
              compression=compression or self.compression,
-             retry=retry, retry_policy=_rp, delivery_mode=delivery_mode, priority=priority,
-             declare=[self.queues[queue]] if queue else [],
+             retry=retry, retry_policy=_rp, delivery_mode=delivery_mode,
+             priority=priority, declare=[self.queues[queue]] if queue else [],
              **kwargs)
 
         signals.task_sent.send(sender=task_name, **body)
@@ -206,6 +208,7 @@ class TaskProducer(Producer):
                                                queue=queue)
         return task_id
 
+
 class TaskPublisher(TaskProducer):
     """Deprecated version of :class:`TaskProducer`."""
 

+ 0 - 1
celery/app/task.py

@@ -12,7 +12,6 @@
 from __future__ import absolute_import
 from __future__ import with_statement
 
-import logging
 import os
 import sys
 

+ 0 - 1
celery/tests/app/test_amqp.py

@@ -135,4 +135,3 @@ class test_Queues(AppCase):
         q = Queues()
         q.add(Queue("foo", alias="barfoo"))
         self.assertIs(q["barfoo"], q["foo"])
-

+ 3 - 1
celery/tests/app/test_app.py

@@ -110,6 +110,7 @@ class test_App(Case):
     def test_task_not_shared(self):
         with patch("celery.app.base.shared_task") as shared_task:
             app = Celery(set_as_current=False)
+
             @app.task(shared=False)
             def foo():
                 pass
@@ -175,7 +176,9 @@ class test_App(Case):
                 return y, z, x
 
         check = Mock()
+
         def deco(fun):
+
             def _inner(*args, **kwargs):
                 check(*args, **kwargs)
                 return fun(*args, **kwargs)
@@ -241,7 +244,6 @@ class test_App(Case):
         finally:
             _task_stack.pop()
 
-
     def test_TaskSet(self):
         ts = self.app.TaskSet()
         self.assertListEqual(ts.tasks, [])

+ 2 - 2
celery/tests/app/test_builtins.py

@@ -63,9 +63,9 @@ class test_chunks(Case):
 
         @app.task()
         def chunks_mul(l):
-            return x * y
+            return l
 
-        res = app.tasks["celery.chunks"](chunks_mul,
+        app.tasks["celery.chunks"](chunks_mul,
                 [(2, 2), (4, 4), (8, 8)], 1)
         self.assertTrue(apply_chunks.called)
 

+ 0 - 1
celery/tests/backends/test_backends.py

@@ -46,4 +46,3 @@ class test_backends(Case):
             sbn.side_effect = ValueError()
             with self.assertRaises(ValueError):
                 backends.get_backend_cls("xxx.xxx:foo")
-

+ 1 - 1
celery/tests/bin/test_base.py

@@ -124,6 +124,7 @@ class test_Command(AppCase):
         with patch("celery.bin.base.symbol_by_name") as sbn:
             from types import ModuleType
             x = ModuleType("proj")
+
             def on_sbn(*args, **kwargs):
 
                 def after(*args, **kwargs):
@@ -136,7 +137,6 @@ class test_Command(AppCase):
             x.__path__ = [True]
             self.assertEqual(cmd.find_app("proj"), "quick brown fox")
 
-
     def test_parse_preload_options_shortopt(self):
         cmd = Command()
         cmd.preload_options = (Option("-s", action="store", dest="silent"), )

+ 2 - 1
celery/tests/worker/test_hub.py

@@ -40,7 +40,7 @@ class test_BoundedSemaphore(Case):
         x = BoundedSemaphore(2)
 
         c1 = Mock()
-        x.acquire(c1, 1);
+        x.acquire(c1, 1)
         self.assertEqual(x.value, 1)
         c1.assert_called_with(1)
 
@@ -151,6 +151,7 @@ class test_Hub(Case):
 
         e1, e2, e3 = Mock(), Mock(), Mock()
         entries = [e1, e2, e3]
+
         def se():
             if entries:
                 return None, entries.pop()

+ 0 - 1
celery/tests/worker/test_request.py

@@ -228,7 +228,6 @@ class MockEventDispatcher(object):
 
 class test_TaskRequest(Case):
 
-
     def test_task_wrapper_repr(self):
         tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
         self.assertTrue(repr(tw))

+ 0 - 4
celery/worker/job.py

@@ -22,17 +22,13 @@ from datetime import datetime
 from kombu.utils import kwdict, reprcall
 from kombu.utils.encoding import safe_repr, safe_str
 
-from celery import current_app
 from celery import exceptions
 from celery.app import app_or_default
 from celery.datastructures import ExceptionInfo
 from celery.task.trace import (
-    build_tracer,
     trace_task,
     trace_task_ret,
-    report_internal_error,
 )
-from celery.platforms import set_mp_process_title as setps
 from celery.utils import fun_takes_kwargs
 from celery.utils.functional import noop
 from celery.utils.log import get_logger