Ask Solem 8 年 前
コミット
10317e1314
3 ファイル変更13 行追加13 行削除
  1. 4 2
      celery/canvas.py
  2. 1 1
      celery/security/serialization.py
  3. 8 10
      celery/tests/backends/test_amqp.py

+ 4 - 2
celery/canvas.py

@@ -638,14 +638,16 @@ class chord(Signature):
 
         _chord = self.type
         if _chord.app.conf.CELERY_ALWAYS_EAGER:
-            return self.apply(partial_args, args, kwargs, task_id=task_id, **options)
+            return self.apply(partial_args, args, kwargs,
+                              task_id=task_id, **options)
         res = body.freeze(task_id)
         parent = _chord(self.tasks, body, partial_args, **options)
         res.parent = parent
         return res
 
     def __call__(self, body=None, **options):
-        return self.apply_async((), (), {'body': body} if body else {}, **options)
+        return self.apply_async(
+            (), (), {'body': body} if body else {}, **options)
 
     def clone(self, *args, **kwargs):
         s = Signature.clone(self, *args, **kwargs)

+ 1 - 1
celery/security/serialization.py

@@ -85,7 +85,7 @@ class SecureSerializer(object):
         signature = raw_payload[
             first_sep + len(sep):first_sep + len(sep) + sig_len
         ]
-        end_of_sig = first_sep + len(sep) + sig_len+len(sep)
+        end_of_sig = first_sep + len(sep) + sig_len + len(sep)
 
         v = raw_payload[end_of_sig:].split(sep)
 

+ 8 - 10
celery/tests/backends/test_amqp.py

@@ -230,8 +230,8 @@ class test_AMQPBackend(AppCase):
             )
 
     def test_poll_result_for_json_serializer(self):
-        with self._result_context(serializer='json') as \
-                (results, backend, Message):
+        with self._result_context(serializer='json') as (
+                results, backend, Message):
             tid = uuid()
             # FFWD's to the latest state.
             state_messages = [
@@ -242,16 +242,14 @@ class test_AMQPBackend(AppCase):
                             'exc_type': 'RuntimeError',
                             'exc_message': 'Mock'
                         }),
-                ]
+            ]
             for state_message in state_messages:
                 results.put(state_message)
             r1 = backend.get_task_meta(tid)
-            self.assertDictContainsSubset(
-                {
-                    'status': states.FAILURE,
-                    'seq': 3
-                }, r1, 'FFWDs to the last state',
-            )
+            self.assertDictContainsSubset({
+                'status': states.FAILURE,
+                'seq': 3
+            }, r1, 'FFWDs to the last state')
             self.assertEquals(type(r1['result']).__name__, 'RuntimeError')
             self.assertEqual(str(r1['result']), 'Mock')
 
@@ -270,7 +268,7 @@ class test_AMQPBackend(AppCase):
             self.assertEqual(
                 backend.get_task_meta(tid), 'hello',
                 'Returns cache if no new states',
-                )
+            )
 
     def test_wait_for(self):
         b = self.create_backend()