Explorar o código

Apparently (x,) is legal now, so no need for (x, )

Ask Solem %!s(int64=9) %!d(string=hai) anos
pai
achega
72b16ac7c4
Modificáronse 83 ficheiros con 191 adicións e 190 borrados
  1. 1 1
      celery/app/amqp.py
  2. 1 1
      celery/app/annotations.py
  3. 3 3
      celery/app/base.py
  4. 1 1
      celery/app/routes.py
  5. 3 4
      celery/app/task.py
  6. 3 3
      celery/app/trace.py
  7. 1 1
      celery/apps/worker.py
  8. 2 2
      celery/backends/base.py
  9. 1 1
      celery/backends/mongodb.py
  10. 1 1
      celery/backends/redis.py
  11. 1 1
      celery/bin/logtool.py
  12. 3 3
      celery/bin/multi.py
  13. 2 2
      celery/bootsteps.py
  14. 5 5
      celery/canvas.py
  15. 5 5
      celery/concurrency/asynpool.py
  16. 1 1
      celery/concurrency/gevent.py
  17. 1 1
      celery/contrib/batches.py
  18. 1 1
      celery/events/cursesmon.py
  19. 1 1
      celery/events/snapshot.py
  20. 3 3
      celery/five.py
  21. 1 1
      celery/fixups/django.py
  22. 2 2
      celery/local.py
  23. 1 1
      celery/platforms.py
  24. 1 1
      celery/schedules.py
  25. 2 2
      celery/security/serialization.py
  26. 1 1
      celery/security/utils.py
  27. 1 1
      celery/task/base.py
  28. 1 1
      celery/tests/app/test_annotations.py
  29. 1 1
      celery/tests/app/test_app.py
  30. 1 1
      celery/tests/app/test_loaders.py
  31. 3 3
      celery/tests/bin/test_base.py
  32. 1 1
      celery/tests/bin/test_celeryevdump.py
  33. 3 3
      celery/tests/case.py
  34. 1 1
      celery/tests/compat_modules/test_compat.py
  35. 8 8
      celery/tests/compat_modules/test_sets.py
  36. 2 2
      celery/tests/concurrency/test_concurrency.py
  37. 1 1
      celery/tests/concurrency/test_pool.py
  38. 4 4
      celery/tests/concurrency/test_prefork.py
  39. 2 2
      celery/tests/events/test_state.py
  40. 2 2
      celery/tests/fixups/test_django.py
  41. 2 2
      celery/tests/security/test_security.py
  42. 5 5
      celery/tests/tasks/test_canvas.py
  43. 1 1
      celery/tests/tasks/test_chord.py
  44. 5 5
      celery/tests/tasks/test_trace.py
  45. 1 1
      celery/tests/utils/test_datastructures.py
  46. 1 1
      celery/tests/utils/test_imports.py
  47. 1 1
      celery/tests/utils/test_pickle.py
  48. 2 2
      celery/tests/utils/test_timer2.py
  49. 1 1
      celery/tests/utils/test_utils.py
  50. 2 2
      celery/tests/worker/test_bootsteps.py
  51. 2 2
      celery/tests/worker/test_consumer.py
  52. 3 3
      celery/tests/worker/test_control.py
  53. 3 3
      celery/tests/worker/test_hub.py
  54. 2 2
      celery/tests/worker/test_loops.py
  55. 3 3
      celery/tests/worker/test_request.py
  56. 8 8
      celery/tests/worker/test_worker.py
  57. 2 2
      celery/utils/functional.py
  58. 1 1
      celery/utils/serialization.py
  59. 1 1
      celery/worker/__init__.py
  60. 1 1
      celery/worker/autoreload.py
  61. 1 1
      celery/worker/autoscale.py
  62. 3 3
      celery/worker/components.py
  63. 9 9
      celery/worker/consumer.py
  64. 1 1
      celery/worker/heartbeat.py
  65. 1 1
      celery/worker/request.py
  66. 1 1
      celery/worker/strategy.py
  67. 1 1
      docs/configuration.rst
  68. 1 1
      docs/getting-started/brokers/django.rst
  69. 3 3
      docs/history/changelog-2.5.rst
  70. 1 1
      docs/history/changelog-3.1.rst
  71. 1 1
      docs/internals/deprecation.rst
  72. 1 1
      docs/userguide/application.rst
  73. 1 1
      docs/userguide/calling.rst
  74. 2 2
      docs/userguide/canvas.rst
  75. 17 17
      docs/userguide/extending.rst
  76. 2 2
      docs/userguide/monitoring.rst
  77. 9 7
      docs/userguide/routing.rst
  78. 1 1
      docs/whatsnew-2.5.rst
  79. 3 3
      docs/whatsnew-3.0.rst
  80. 1 1
      examples/eventlet/README.rst
  81. 1 1
      examples/gevent/celeryconfig.py
  82. 1 1
      funtests/suite/config.py
  83. 3 3
      setup.py

+ 1 - 1
celery/app/amqp.py

@@ -238,7 +238,7 @@ class AMQP(object):
         if not queues and conf.CELERY_DEFAULT_QUEUE:
             queues = (Queue(conf.CELERY_DEFAULT_QUEUE,
                             exchange=self.default_exchange,
-                            routing_key=conf.CELERY_DEFAULT_ROUTING_KEY), )
+                            routing_key=conf.CELERY_DEFAULT_ROUTING_KEY),)
         autoexchange = (self.autoexchange if autoexchange is None
                         else autoexchange)
         return self.queues_cls(

+ 1 - 1
celery/app/annotations.py

@@ -50,7 +50,7 @@ def prepare(annotations):
     if annotations is None:
         return ()
     elif not isinstance(annotations, (list, tuple)):
-        annotations = (annotations, )
+        annotations = (annotations,)
     return [expand_annotation(anno) for anno in annotations]
 
 

+ 3 - 3
celery/app/base.py

@@ -253,7 +253,7 @@ class Celery(object):
                     ret = self._task_from_fun(fun, **opts)
                 else:
                     # return a proxy object that evaluates on first use
-                    ret = PromiseProxy(self._task_from_fun, (fun, ), opts,
+                    ret = PromiseProxy(self._task_from_fun, (fun,), opts,
                                        __doc__=fun.__doc__)
                     self._pending.append(ret)
                 if _filt:
@@ -280,7 +280,7 @@ class Celery(object):
 
         if name not in self._tasks:
             run = fun if bind else staticmethod(fun)
-            task = type(fun.__name__, (base, ), dict({
+            task = type(fun.__name__, (base,), dict({
                 'app': self,
                 'name': name,
                 'run': run,
@@ -583,7 +583,7 @@ class Celery(object):
         if not keep_reduce:
             attrs['__reduce__'] = __reduce__
 
-        return type(name or Class.__name__, (Class, ), attrs)
+        return type(name or Class.__name__, (Class,), attrs)
 
     def _rgetattr(self, path):
         return attrgetter(path)(self)

+ 1 - 1
celery/app/routes.py

@@ -92,5 +92,5 @@ def prepare(routes):
     if routes is None:
         return ()
     if not isinstance(routes, (list, tuple)):
-        routes = (routes, )
+        routes = (routes,)
     return [expand_route(route) for route in routes]

+ 3 - 4
celery/app/task.py

@@ -470,15 +470,14 @@ class Task(object):
         # add 'self' if this is a "task_method".
         if self.__self__ is not None:
             args = args if isinstance(args, tuple) else tuple(args or ())
-            args = (self.__self__, ) + args
-            shadow = shadow or self.shadow_name(args, kwargs, final_options)
+            args = (self.__self__,) + args
 
         preopts = self._get_exec_options()
         options = dict(preopts, **options) if options else preopts
         return app.send_task(
             self.name, args, kwargs, task_id=task_id, producer=producer,
             link=link, link_error=link_error, result_cls=self.AsyncResult,
-            shadow=shadow,
+            shadow=shadow or self.shadow_name(args, kwargs, options),
             **options
         )
 
@@ -658,7 +657,7 @@ class Task(object):
         args = args or ()
         # add 'self' if this is a bound method.
         if self.__self__ is not None:
-            args = (self.__self__, ) + tuple(args)
+            args = (self.__self__,) + tuple(args)
         kwargs = kwargs or {}
         task_id = options.get('task_id') or uuid()
         retries = options.get('retries', 0)

+ 3 - 3
celery/app/trace.py

@@ -310,7 +310,7 @@ def build_tracer(name, task, loader=None, hostname=None, store_errors=True,
             group(
                 [signature(errback, app=app)
                  for errback in request.errbacks or []], app=app,
-            ).apply_async((uuid, ))
+            ).apply_async((uuid,))
         return I, R, I.state, I.retval
 
     def trace_task(uuid, args, kwargs, request=None):
@@ -392,9 +392,9 @@ def build_tracer(name, task, loader=None, hostname=None, store_errors=True,
                                     else:
                                         sigs.append(sig)
                                 for group_ in groups:
-                                    group.apply_async((retval, ))
+                                    group.apply_async((retval,))
                                 if sigs:
-                                    group(sigs).apply_async((retval, ))
+                                    group(sigs).apply_async((retval,))
                             else:
                                 signature(callbacks[0], app=app).delay(retval)
                         if publish_result:

+ 1 - 1
celery/apps/worker.py

@@ -175,7 +175,7 @@ class Worker(WorkController):
 
     def on_consumer_ready(self, consumer):
         signals.worker_ready.send(sender=consumer)
-        print('{0} ready.'.format(safe_str(self.hostname), ))
+        print('{0} ready.'.format(safe_str(self.hostname),))
 
     def setup_logging(self, colorize=None):
         if colorize is None and self.no_color is not None:

+ 2 - 2
celery/backends/base.py

@@ -131,7 +131,7 @@ class BaseBackend(object):
                 [app.signature(errback)
                  for errback in callback.options.get('link_error') or []],
                 app=app,
-            ).apply_async((callback.id, ))
+            ).apply_async((callback.id,))
         except Exception as eb_exc:
             return backend.fail_from_current_stack(callback.id, exc=eb_exc)
         else:
@@ -352,7 +352,7 @@ class BaseBackend(object):
                               countdown=1, **kwargs):
         kwargs['result'] = [r.as_tuple() for r in result]
         self.app.tasks['celery.chord_unlock'].apply_async(
-            (group_id, body, ), kwargs, countdown=countdown,
+            (group_id, body,), kwargs, countdown=countdown,
         )
 
     def apply_chord(self, header, partial_args, group_id, body,

+ 1 - 1
celery/backends/mongodb.py

@@ -126,7 +126,7 @@ class MongoBackend(BaseBackend):
             self.options.update(config)
 
     def _prepare_client_options(self):
-            if pymongo.version_tuple >= (3, ):
+            if pymongo.version_tuple >= (3,):
                 return {'maxPoolSize': self.max_pool_size}
             else:  # pragma: no cover
                 return {'max_pool_size': self.max_pool_size,

+ 1 - 1
celery/backends/redis.py

@@ -264,7 +264,7 @@ class RedisBackend(KeyValueStoreBackend):
 
     def __reduce__(self, args=(), kwargs={}):
         return super(RedisBackend, self).__reduce__(
-            (self.url, ), {'expires': self.expires},
+            (self.url,), {'expires': self.expires},
         )
 
     @deprecated_property(3.2, 3.3)

+ 1 - 1
celery/bin/logtool.py

@@ -162,7 +162,7 @@ class logtool(Command):
         audit = Audit()
         audit.run(files)
         for task_id in audit.incomplete_tasks():
-            self.error('Did not complete: %r' % (task_id, ))
+            self.error('Did not complete: %r' % (task_id,))
 
     def debug(self, files):
         Audit(on_debug=self.out).run(files)

+ 3 - 3
celery/bin/multi.py

@@ -160,7 +160,7 @@ if sys.version_info < (2, 7):
 
 
 def celery_exe(*args):
-    return ' '.join((CELERY_EXE, ) + args)
+    return ' '.join((CELERY_EXE,) + args)
 
 
 class MultiTool(object):
@@ -494,11 +494,11 @@ def multi_args(p, cmd='celery worker', append='', prefix='', suffix=''):
         if ns_name.isdigit():
             ns_index = int(ns_name) - 1
             if ns_index < 0:
-                raise KeyError('Indexes start at 1 got: %r' % (ns_name, ))
+                raise KeyError('Indexes start at 1 got: %r' % (ns_name,))
             try:
                 p.namespaces[names[ns_index]].update(ns_opts)
             except IndexError:
-                raise KeyError('No node at index %r' % (ns_name, ))
+                raise KeyError('No node at index %r' % (ns_name,))
 
     for name in names:
         hostname = suffix

+ 2 - 2
celery/bootsteps.py

@@ -21,7 +21,7 @@ from .utils.log import get_logger
 
 try:
     from greenlet import GreenletExit
-    IGNORE_ERRORS = (GreenletExit, )
+    IGNORE_ERRORS = (GreenletExit,)
 except ImportError:  # pragma: no cover
     IGNORE_ERRORS = ()
 
@@ -393,7 +393,7 @@ class StartStopStep(Step):
 
 
 class ConsumerStep(StartStopStep):
-    requires = ('celery.worker.consumer:Connection', )
+    requires = ('celery.worker.consumer:Connection',)
     consumers = None
 
     def get_consumers(self, channel):

+ 5 - 5
celery/canvas.py

@@ -280,12 +280,12 @@ class Signature(dict):
         if isinstance(other, group):
             other = maybe_unroll_group(other)
         if not isinstance(self, chain) and isinstance(other, chain):
-            return chain((self, ) + other.tasks, app=self._app)
+            return chain((self,) + other.tasks, app=self._app)
         elif isinstance(other, chain):
             return chain(*self.tasks + other.tasks, app=self._app)
         elif isinstance(other, Signature):
             if isinstance(self, chain):
-                return chain(*self.tasks + (other, ), app=self._app)
+                return chain(*self.tasks + (other,), app=self._app)
             return chain(self, other, app=self._app)
         return NotImplemented
 
@@ -299,7 +299,7 @@ class Signature(dict):
     def __reduce__(self):
         # for serialization, the task type is lazily loaded,
         # and not stored in the dict itself.
-        return signature, (dict(self), )
+        return signature, (dict(self),)
 
     def __json__(self):
         return dict(self)
@@ -484,7 +484,7 @@ class chain(Signature):
         last, fargs = None, args
         for task in self.tasks:
             res = task.clone(fargs).apply(
-                last and (last.get(), ), **dict(self.options, **options))
+                last and (last.get(),), **dict(self.options, **options))
             res.parent, last, fargs = last, res, None
         return last
 
@@ -835,7 +835,7 @@ class chord(Signature):
         tasks = (self.tasks.clone() if isinstance(self.tasks, group)
                  else group(self.tasks))
         return body.apply(
-            args=(tasks.apply().get(propagate=propagate), ),
+            args=(tasks.apply().get(propagate=propagate),),
         )
 
     def _traverse_tasks(self, tasks, value=None):

+ 5 - 5
celery/concurrency/asynpool.py

@@ -196,7 +196,7 @@ class Worker(_pool.Worker):
         # our version sends a WORKER_UP message when the process is ready
         # to accept work, this will tell the parent that the inqueue fd
         # is writable.
-        self.outq.put((WORKER_UP, (pid, )))
+        self.outq.put((WORKER_UP, (pid,)))
 
 
 class ResultHandler(_pool.ResultHandler):
@@ -644,8 +644,8 @@ class AsynPool(_pool.Pool):
         revoked_tasks = worker_state.revoked
         getpid = os.getpid
 
-        precalc = {ACK: self._create_payload(ACK, (0, )),
-                   NACK: self._create_payload(NACK, (0, ))}
+        precalc = {ACK: self._create_payload(ACK, (0,)),
+                   NACK: self._create_payload(NACK, (0,))}
 
         def _put_back(job, _time=time.time):
             # puts back at the end of the queue
@@ -854,7 +854,7 @@ class AsynPool(_pool.Pool):
             cor = _write_ack(fd, msg, callback=callback)
             mark_write_gen_as_active(cor)
             mark_write_fd_as_active(fd)
-            callback.args = (cor, )
+            callback.args = (cor,)
             add_writer(fd, cor)
         self.send_ack = send_ack
 
@@ -1225,7 +1225,7 @@ class AsynPool(_pool.Pool):
     def _help_stuff_finish_args(self):
         # Pool._help_stuff_finished is a classmethod so we have to use this
         # trick to modify the arguments passed to it.
-        return (self._pool, )
+        return (self._pool,)
 
     @classmethod
     def _help_stuff_finish(cls, pool):

+ 1 - 1
celery/concurrency/gevent.py

@@ -30,7 +30,7 @@ def apply_timeout(target, args=(), kwargs={}, callback=None,
         with Timeout(timeout):
             return apply_target(target, args, kwargs, callback,
                                 accept_callback, pid,
-                                propagate=(Timeout, ), **rest)
+                                propagate=(Timeout,), **rest)
     except Timeout:
         return timeout_callback(False, timeout)
 

+ 1 - 1
celery/contrib/batches.py

@@ -230,7 +230,7 @@ class Batches(Task):
 
     def flush(self, requests):
         return self.apply_buffer(requests, ([SimpleRequest.from_request(r)
-                                             for r in requests], ))
+                                             for r in requests],))
 
     def _do_flush(self):
         logger.debug('Batches: Wake-up to flush buffer...')

+ 1 - 1
celery/events/cursesmon.py

@@ -236,7 +236,7 @@ class CursesMonitor(object):  # pragma: no cover
                 if ch != -1:
                     if ch in (10, curses.KEY_ENTER):            # enter
                         break
-                    if ch in (27, ):
+                    if ch in (27,):
                         buffer = str()
                         break
                     buffer += chr(ch)

+ 1 - 1
celery/events/snapshot.py

@@ -29,7 +29,7 @@ logger = get_logger('celery.evcam')
 
 class Polaroid(object):
     timer = None
-    shutter_signal = Signal(providing_args=('state', ))
+    shutter_signal = Signal(providing_args=('state',))
     cleanup_signal = Signal()
     clear_after = False
 

+ 3 - 3
celery/five.py

@@ -160,7 +160,7 @@ class LazyModule(ModuleType):
         return list(set(self.__all__) | DEFAULT_ATTRS)
 
     def __reduce__(self):
-        return import_module, (self.__name__, )
+        return import_module, (self.__name__,)
 
 
 def create_module(name, attrs, cls_attrs=None, pkg=None,
@@ -174,7 +174,7 @@ def create_module(name, attrs, cls_attrs=None, pkg=None,
         attr_name: (prepare_attr(attr) if prepare_attr else attr)
         for attr_name, attr in items(attrs)
     }
-    module = sys.modules[fqdn] = type(modname, (base, ), cls_attrs)(name)
+    module = sys.modules[fqdn] = type(modname, (base,), cls_attrs)(name)
     module.__dict__.update(attrs)
     return module
 
@@ -206,7 +206,7 @@ def get_compat_module(pkg, name):
 
     def prepare(attr):
         if isinstance(attr, string_t):
-            return Proxy(getappattr, (attr, ))
+            return Proxy(getappattr, (attr,))
         return attr
 
     attrs = COMPAT_MODULES[pkg.__name__][name]

+ 1 - 1
celery/fixups/django.py

@@ -143,7 +143,7 @@ class DjangoWorkerFixup(object):
         except (ImportError, AttributeError):
             self._close_old_connections = None
         self.database_errors = (
-            (DatabaseError, ) +
+            (DatabaseError,) +
             _my_database_errors +
             _pg_database_errors +
             _lite_database_errors +

+ 2 - 2
celery/local.py

@@ -39,7 +39,7 @@ def _default_cls_attr(name, type_, cls_value):
     def __get__(self, obj, cls=None):
         return self.__getter(obj) if obj is not None else self
 
-    return type(name, (type_, ), {
+    return type(name, (type_,), {
         '__new__': __new__, '__get__': __get__,
     })
 
@@ -212,7 +212,7 @@ class PromiseProxy(Proxy):
 
     """
 
-    __slots__ = ('__pending__', )
+    __slots__ = ('__pending__',)
 
     def _get_current_object(self):
         try:

+ 1 - 1
celery/platforms.py

@@ -693,7 +693,7 @@ def ignore_errno(*errnos, **kwargs):
     :keyword types: A tuple of exceptions to ignore (when the errno matches),
                     defaults to :exc:`Exception`.
     """
-    types = kwargs.get('types') or (Exception, )
+    types = kwargs.get('types') or (Exception,)
     errnos = [get_errno_name(errno) for errno in errnos]
     try:
         yield

+ 1 - 1
celery/schedules.py

@@ -251,7 +251,7 @@ class crontab_parser(object):
             m = regex.match(part)
             if m:
                 return handler(m.groups())
-        return self._expand_range((part, ))
+        return self._expand_range((part,))
 
     def _expand_range(self, toks):
         fr = self._expand_number(toks[0])

+ 2 - 2
celery/security/serialization.py

@@ -33,7 +33,7 @@ class SecureSerializer(object):
         """serialize data structure into string"""
         assert self._key is not None
         assert self._cert is not None
-        with reraise_errors('Unable to serialize: {0!r}', (Exception, )):
+        with reraise_errors('Unable to serialize: {0!r}', (Exception,)):
             content_type, content_encoding, body = dumps(
                 bytes_to_str(data), serializer=self._serializer)
             # What we sign is the serialized body, not the body itself.
@@ -48,7 +48,7 @@ class SecureSerializer(object):
     def deserialize(self, data):
         """deserialize data structure from string"""
         assert self._cert_store is not None
-        with reraise_errors('Unable to deserialize: {0!r}', (Exception, )):
+        with reraise_errors('Unable to deserialize: {0!r}', (Exception,)):
             payload = self._unpack(data)
             signature, signer, body = (payload['signature'],
                                        payload['signer'],

+ 1 - 1
celery/security/utils.py

@@ -26,7 +26,7 @@ __all__ = ['reraise_errors']
 @contextmanager
 def reraise_errors(msg='{0!r}', errors=None):
     assert crypto is not None
-    errors = (crypto.Error, ) if errors is None else errors
+    errors = (crypto.Error,) if errors is None else errors
     try:
         yield
     except errors as exc:

+ 1 - 1
celery/task/base.py

@@ -40,7 +40,7 @@ class _CompatShared(object):
         return hash(self.name)
 
     def __repr__(self):
-        return '<OldTask: %r>' % (self.name, )
+        return '<OldTask: %r>' % (self.name,)
 
     def __call__(self, app):
         return self.cons(app)

+ 1 - 1
celery/tests/app/test_annotations.py

@@ -48,7 +48,7 @@ class test_prepare(AnnotationCase):
     def test_returns_list(self):
         self.assertListEqual(prepare(1), [1])
         self.assertListEqual(prepare([1]), [1])
-        self.assertListEqual(prepare((1, )), [1])
+        self.assertListEqual(prepare((1,)), [1])
         self.assertEqual(prepare(None), ())
 
     def test_evalutes_qualnames(self):

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

@@ -338,7 +338,7 @@ class test_App(AppCase):
         with self.assertRaises(TypeError):
             aawsX.apply_async(())
         with self.assertRaises(TypeError):
-            aawsX.apply_async((2, ))
+            aawsX.apply_async((2,))
 
         with patch('celery.app.amqp.AMQP.create_task_message') as create:
             with patch('celery.app.amqp.AMQP.send_task_message') as send:

+ 1 - 1
celery/tests/app/test_loaders.py

@@ -238,7 +238,7 @@ class test_AppLoader(AppCase):
         self.loader = AppLoader(app=self.app)
 
     def test_on_worker_init(self):
-        self.app.conf.CELERY_IMPORTS = ('subprocess', )
+        self.app.conf.CELERY_IMPORTS = ('subprocess',)
         sys.modules.pop('subprocess', None)
         self.loader.init_worker()
         self.assertIn('subprocess', sys.modules)

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

@@ -123,7 +123,7 @@ class test_Command(AppCase):
         c.run = run
 
         with self.assertRaises(c.UsageError):
-            c.verify_args((1, ))
+            c.verify_args((1,))
         c.verify_args((1, 2, 3))
 
     def test_run_interface(self):
@@ -186,7 +186,7 @@ class test_Command(AppCase):
     def test_with_custom_app(self):
         cmd = MockCommand(app=self.app)
         app = '.'.join([__name__, 'APP'])
-        cmd.setup_app_from_commandline(['--app=%s' % (app, ),
+        cmd.setup_app_from_commandline(['--app=%s' % (app,),
                                         '--loglevel=INFO'])
         self.assertIs(cmd.app, APP)
         cmd.setup_app_from_commandline(['-A', app,
@@ -311,7 +311,7 @@ class test_Command(AppCase):
 
     def test_parse_preload_options_shortopt(self):
         cmd = Command()
-        cmd.preload_options = (Option('-s', action='store', dest='silent'), )
+        cmd.preload_options = (Option('-s', action='store', dest='silent'),)
         acc = cmd.parse_preload_options(['-s', 'yes'])
         self.assertEqual(acc.get('silent'), 'yes')
 

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

@@ -58,7 +58,7 @@ class test_Dumper(AppCase):
 
             Conn = app.connection.return_value = Mock(name='conn')
             conn = Conn.clone.return_value = Mock(name='cloned_conn')
-            conn.connection_errors = (KeyError, )
+            conn.connection_errors = (KeyError,)
             conn.channel_errors = ()
 
             evdump(app)

+ 3 - 3
celery/tests/case.py

@@ -204,7 +204,7 @@ def skip_unless_module(module):
             try:
                 importlib.import_module(module)
             except ImportError:
-                raise SkipTest('Does not have %s' % (module, ))
+                raise SkipTest('Does not have %s' % (module,))
 
             return fun(*args, **kwargs)
 
@@ -362,11 +362,11 @@ class Case(unittest.TestCase):
         errors = []
         if missing:
             errors.append(
-                'Expected, but missing:\n    %s' % (safe_repr(missing), )
+                'Expected, but missing:\n    %s' % (safe_repr(missing),)
             )
         if unexpected:
             errors.append(
-                'Unexpected, but present:\n    %s' % (safe_repr(unexpected), )
+                'Unexpected, but present:\n    %s' % (safe_repr(unexpected),)
             )
         if errors:
             standardMsg = '\n'.join(errors)

+ 1 - 1
celery/tests/compat_modules/test_compat.py

@@ -29,7 +29,7 @@ class test_periodic_tasks(AppCase):
 
     def test_must_have_run_every(self):
         with self.assertRaises(NotImplementedError):
-            type('Foo', (PeriodicTask, ), {'__module__': __name__})
+            type('Foo', (PeriodicTask,), {'__module__': __name__})
 
     def test_remaining_estimate(self):
         s = self.my_periodic.run_every

+ 8 - 8
celery/tests/compat_modules/test_sets.py

@@ -95,7 +95,7 @@ class test_subtask(SetsCase):
 
     def test_delay_argmerge(self):
         s = self.MockTask.subtask(
-            (2, ), {'cache': True}, {'routing_key': 'CPU-bound'},
+            (2,), {'cache': True}, {'routing_key': 'CPU-bound'},
         )
         args, kwargs, options = s.delay(10, cache=False, other='foo')
         self.assertTupleEqual(args, (10, 2))
@@ -104,9 +104,9 @@ class test_subtask(SetsCase):
 
     def test_apply_async_argmerge(self):
         s = self.MockTask.subtask(
-            (2, ), {'cache': True}, {'routing_key': 'CPU-bound'},
+            (2,), {'cache': True}, {'routing_key': 'CPU-bound'},
         )
-        args, kwargs, options = s.apply_async((10, ),
+        args, kwargs, options = s.apply_async((10,),
                                               {'cache': False, 'other': 'foo'},
                                               routing_key='IO-bound',
                                               exchange='fast')
@@ -118,9 +118,9 @@ class test_subtask(SetsCase):
 
     def test_apply_argmerge(self):
         s = self.MockTask.subtask(
-            (2, ), {'cache': True}, {'routing_key': 'CPU-bound'},
+            (2,), {'cache': True}, {'routing_key': 'CPU-bound'},
         )
-        args, kwargs, options = s.apply((10, ),
+        args, kwargs, options = s.apply((10,),
                                         {'cache': False, 'other': 'foo'},
                                         routing_key='IO-bound',
                                         exchange='fast')
@@ -133,19 +133,19 @@ class test_subtask(SetsCase):
 
     def test_is_JSON_serializable(self):
         s = self.MockTask.subtask(
-            (2, ), {'cache': True}, {'routing_key': 'CPU-bound'},
+            (2,), {'cache': True}, {'routing_key': 'CPU-bound'},
         )
         # tuples are not preserved, but this doesn't matter.
         s.args = list(s.args)
         self.assertEqual(s, self.subtask(json.loads(json.dumps(s))))
 
     def test_repr(self):
-        s = self.MockTask.subtask((2, ), {'cache': True})
+        s = self.MockTask.subtask((2,), {'cache': True})
         self.assertIn('2', repr(s))
         self.assertIn('cache=True', repr(s))
 
     def test_reduce(self):
-        s = self.MockTask.subtask((2, ), {'cache': True})
+        s = self.MockTask.subtask((2,), {'cache': True})
         cls, args = s.__reduce__()
         self.assertDictEqual(dict(cls(*args)), dict(s))
 

+ 2 - 2
celery/tests/concurrency/test_concurrency.py

@@ -29,7 +29,7 @@ class test_BasePool(AppCase):
                      accept_callback=gen_callback('accept_callback'))
 
         self.assertDictContainsSubset(
-            {'target': (1, (8, 16)), 'callback': (2, (42, ))},
+            {'target': (1, (8, 16)), 'callback': (2, (42,))},
             scratch,
         )
         pa1 = scratch['accept_callback']
@@ -45,7 +45,7 @@ class test_BasePool(AppCase):
                      accept_callback=None)
         self.assertDictEqual(scratch,
                              {'target': (3, (8, 16)),
-                              'callback': (4, (42, ))})
+                              'callback': (4, (42,))})
 
     def test_does_not_debug(self):
         x = BasePool(10)

+ 1 - 1
celery/tests/concurrency/test_pool.py

@@ -66,7 +66,7 @@ class test_TaskPool(AppCase):
         self.assertIsInstance(scratchpad[1]['ret_value'],
                               ExceptionInfo)
         self.assertEqual(scratchpad[1]['ret_value'].exception.args,
-                         ('FOO EXCEPTION', ))
+                         ('FOO EXCEPTION',))
 
         self.assertEqual(res3.get(), 400)
         time.sleep(0.5)

+ 4 - 4
celery/tests/concurrency/test_prefork.py

@@ -112,7 +112,7 @@ class ExeMockPool(MockPool):
     def apply_async(self, target, args=(), kwargs={}, callback=noop):
         from threading import Timer
         res = target(*args, **kwargs)
-        Timer(0.1, callback, (res, )).start()
+        Timer(0.1, callback, (res,)).start()
         return MockResult(res, next(self._current_proc))
 
 
@@ -227,7 +227,7 @@ class test_AsynPool(PoolCase):
 
     def test_promise(self):
         fun = Mock()
-        x = asynpool.promise(fun, (1, ), {'foo': 1})
+        x = asynpool.promise(fun, (1,), {'foo': 1})
         x()
         self.assertTrue(x.ready)
         fun.assert_called_with(1, foo=1)
@@ -235,7 +235,7 @@ class test_AsynPool(PoolCase):
     def test_Worker(self):
         w = asynpool.Worker(Mock(), Mock())
         w.on_loop_start(1234)
-        w.outq.put.assert_called_with((asynpool.WORKER_UP, (1234, )))
+        w.outq.put.assert_called_with((asynpool.WORKER_UP, (1234,)))
 
 
 class test_ResultHandler(PoolCase):
@@ -287,7 +287,7 @@ class test_TaskPool(PoolCase):
     def test_apply_async(self):
         pool = TaskPool(10)
         pool.start()
-        pool.apply_async(lambda x: x, (2, ), {})
+        pool.apply_async(lambda x: x, (2,), {})
 
     def test_grow_shrink(self):
         pool = TaskPool(10)

+ 2 - 2
celery/tests/events/test_state.py

@@ -253,8 +253,8 @@ class test_Task(AppCase):
         self.assertEqual(sorted(list(task._info_fields)),
                          sorted(task.info().keys()))
 
-        self.assertEqual(sorted(list(task._info_fields + ('received', ))),
-                         sorted(task.info(extra=('received', ))))
+        self.assertEqual(sorted(list(task._info_fields + ('received',))),
+                         sorted(task.info(extra=('received',))))
 
         self.assertEqual(sorted(['args', 'kwargs']),
                          sorted(task.info(['args', 'kwargs']).keys()))

+ 2 - 2
celery/tests/fixups/test_django.py

@@ -114,7 +114,7 @@ class test_DjangoWorkerFixup(FixupCase):
         self.app.conf = {'CELERY_DB_REUSE_MAX': None}
         self.app.loader = Mock()
         with self.fixup_context(self.app) as (f, _, _):
-            with patch_many('celery.fixups.django.signals') as (sigs, ):
+            with patch_many('celery.fixups.django.signals') as (sigs,):
                 f.install()
                 sigs.beat_embedded_init.connect.assert_called_with(
                     f.close_database,
@@ -207,7 +207,7 @@ class test_DjangoWorkerFixup(FixupCase):
         with self.fixup_context(self.app) as (f, _, _):
             conns = [Mock(), Mock(), Mock()]
             conns[1].close.side_effect = KeyError('already closed')
-            f.database_errors = (KeyError, )
+            f.database_errors = (KeyError,)
 
             f._db.connections = Mock()  # ConnectionHandler
             f._db.connections.all.side_effect = lambda: conns

+ 2 - 2
celery/tests/security/test_security.py

@@ -103,8 +103,8 @@ class test_security(SecurityCase):
 
     def test_reraise_errors(self):
         with self.assertRaises(SecurityError):
-            with reraise_errors(errors=(KeyError, )):
+            with reraise_errors(errors=(KeyError,)):
                 raise KeyError('foo')
         with self.assertRaises(KeyError):
-            with reraise_errors(errors=(ValueError, )):
+            with reraise_errors(errors=(ValueError,)):
                 raise KeyError('bar')

+ 5 - 5
celery/tests/tasks/test_canvas.py

@@ -17,7 +17,7 @@ from celery.result import EagerResult
 from celery.tests.case import AppCase, Mock
 
 SIG = Signature({'task': 'TASK',
-                 'args': ('A1', ),
+                 'args': ('A1',),
                  'kwargs': {'K1': 'V1'},
                  'options': {'task_id': 'TASK_ID'},
                  'subtask_type': ''})
@@ -54,7 +54,7 @@ class test_Signature(CanvasCase):
 
     def test_getitem_property(self):
         self.assertEqual(SIG.task, 'TASK')
-        self.assertEqual(SIG.args, ('A1', ))
+        self.assertEqual(SIG.args, ('A1',))
         self.assertEqual(SIG.kwargs, {'K1': 'V1'})
         self.assertEqual(SIG.options, {'task_id': 'TASK_ID'})
         self.assertEqual(SIG.subtask_type, '')
@@ -69,7 +69,7 @@ class test_Signature(CanvasCase):
 
     def test_replace(self):
         x = Signature('TASK', ('A'), {})
-        self.assertTupleEqual(x.replace(args=('B', )).args, ('B', ))
+        self.assertTupleEqual(x.replace(args=('B',)).args, ('B',))
         self.assertDictEqual(
             x.replace(kwargs={'FOO': 'BAR'}).kwargs,
             {'FOO': 'BAR'},
@@ -130,7 +130,7 @@ class test_Signature(CanvasCase):
 
     def test_merge_immutable(self):
         x = self.add.si(2, 2, foo=1)
-        args, kwargs, options = x._merge((4, ), {'bar': 2}, {'task_id': 3})
+        args, kwargs, options = x._merge((4,), {'bar': 2}, {'task_id': 3})
         self.assertTupleEqual(args, (2, 2))
         self.assertDictEqual(kwargs, {'foo': 1})
         self.assertDictEqual(options, {'task_id': 3})
@@ -247,7 +247,7 @@ class test_chain(CanvasCase):
         x = dict(self.add.s(2, 2) | self.add.s(4))
         x['args'] = None
         self.assertIsInstance(chain.from_dict(x), chain)
-        x['args'] = (2, )
+        x['args'] = (2,)
         self.assertIsInstance(chain.from_dict(x), chain)
 
     def test_accepts_generator_argument(self):

+ 1 - 1
celery/tests/tasks/test_chord.py

@@ -72,7 +72,7 @@ class test_unlock_chord_task(ChordCase):
 
         with self._chord_context(AlwaysReady) as (cb, retry, _):
             cb.type.apply_async.assert_called_with(
-                ([2, 4, 8, 6], ), {}, task_id=cb.id,
+                ([2, 4, 8, 6],), {}, task_id=cb.id,
             )
             # did not retry
             self.assertFalse(retry.call_count)

+ 5 - 5
celery/tests/tasks/test_trace.py

@@ -130,23 +130,23 @@ class test_trace(TraceCase):
 
     def test_trace_SystemExit(self):
         with self.assertRaises(SystemExit):
-            self.trace(self.raises, (SystemExit(), ), {})
+            self.trace(self.raises, (SystemExit(),), {})
 
     def test_trace_Retry(self):
         exc = Retry('foo', 'bar')
-        _, info = self.trace(self.raises, (exc, ), {})
+        _, info = self.trace(self.raises, (exc,), {})
         self.assertEqual(info.state, states.RETRY)
         self.assertIs(info.retval, exc)
 
     def test_trace_exception(self):
         exc = KeyError('foo')
-        _, info = self.trace(self.raises, (exc, ), {})
+        _, info = self.trace(self.raises, (exc,), {})
         self.assertEqual(info.state, states.FAILURE)
         self.assertIs(info.retval, exc)
 
     def test_trace_exception_propagate(self):
         with self.assertRaises(KeyError):
-            self.trace(self.raises, (KeyError('foo'), ), {}, propagate=True)
+            self.trace(self.raises, (KeyError('foo'),), {}, propagate=True)
 
     @patch('celery.app.trace.build_tracer')
     @patch('celery.app.trace.report_internal_error')
@@ -167,7 +167,7 @@ class test_trace(TraceCase):
 class test_TraceInfo(TraceCase):
 
     class TI(TraceInfo):
-        __slots__ = TraceInfo.__slots__ + ('__dict__', )
+        __slots__ = TraceInfo.__slots__ + ('__dict__',)
 
     def test_handle_error_state(self):
         x = self.TI(states.FAILURE)

+ 1 - 1
celery/tests/utils/test_datastructures.py

@@ -158,7 +158,7 @@ class test_ExceptionInfo(Case):
             self.assertEqual(str(einfo), einfo.traceback)
             self.assertIsInstance(einfo.exception, LookupError)
             self.assertTupleEqual(
-                einfo.exception.args, ('The quick brown fox jumps...', ),
+                einfo.exception.args, ('The quick brown fox jumps...',),
             )
             self.assertTrue(einfo.traceback)
 

+ 1 - 1
celery/tests/utils/test_imports.py

@@ -21,7 +21,7 @@ class test_import_utils(Case):
             find_module('foo.bar.baz', imp=imp)
 
     def test_qualname(self):
-        Class = type('Fox', (object, ), {'__module__': 'quick.brown'})
+        Class = type('Fox', (object,), {'__module__': 'quick.brown'})
         self.assertEqual(qualname(Class), 'quick.brown.Fox')
         self.assertEqual(qualname(Class()), 'quick.brown.Fox')
 

+ 1 - 1
celery/tests/utils/test_pickle.py

@@ -29,7 +29,7 @@ class test_Pickle(Case):
         exception = unpickled.get('exception')
         self.assertTrue(exception)
         self.assertIsInstance(exception, RegularException)
-        self.assertTupleEqual(exception.args, ('RegularException raised', ))
+        self.assertTupleEqual(exception.args, ('RegularException raised',))
 
     def test_pickle_arg_override_exception(self):
 

+ 2 - 2
celery/tests/utils/test_timer2.py

@@ -23,12 +23,12 @@ class test_Entry(Case):
         self.assertTupleEqual(scratch[0], (4, 4, 'baz'))
 
     def test_cancel(self):
-        tref = timer2.Entry(lambda x: x, (1, ), {})
+        tref = timer2.Entry(lambda x: x, (1,), {})
         tref.cancel()
         self.assertTrue(tref.cancelled)
 
     def test_repr(self):
-        tref = timer2.Entry(lambda x: x(1, ), {})
+        tref = timer2.Entry(lambda x: x(1,), {})
         self.assertTrue(repr(tref))
 
 

+ 1 - 1
celery/tests/utils/test_utils.py

@@ -87,7 +87,7 @@ class test_chunks(Case):
 class test_utils(Case):
 
     def test_is_iterable(self):
-        for a in 'f', ['f'], ('f', ), {'f': 'f'}:
+        for a in 'f', ['f'], ('f',), {'f': 'f'}:
             self.assertTrue(is_iterable(a))
         for b in object(), 1:
             self.assertFalse(is_iterable(b))

+ 2 - 2
celery/tests/worker/test_bootsteps.py

@@ -238,7 +238,7 @@ class test_Blueprint(AppCase):
         blueprint.send_all(parent, 'close', 'Closing', reverse=False)
 
     def test_join_raises_IGNORE_ERRORS(self):
-        prev, bootsteps.IGNORE_ERRORS = bootsteps.IGNORE_ERRORS, (KeyError, )
+        prev, bootsteps.IGNORE_ERRORS = bootsteps.IGNORE_ERRORS, (KeyError,)
         try:
             blueprint = self.Blueprint(app=self.app)
             blueprint.shutdown_complete = Mock()
@@ -278,7 +278,7 @@ class test_Blueprint(AppCase):
     def test_topsort_raises_KeyError(self):
 
         class Step(bootsteps.Step):
-            requires = ('xyxxx.fsdasewe.Unknown', )
+            requires = ('xyxxx.fsdasewe.Unknown',)
 
         b = self.Blueprint([Step], app=self.app)
         b.steps = b.claim_steps()

+ 2 - 2
celery/tests/worker/test_consumer.py

@@ -37,7 +37,7 @@ class test_Consumer(AppCase):
         consumer.blueprint = Mock()
         consumer._restart_state = Mock()
         consumer.connection = _amqp_connection()
-        consumer.connection_errors = (socket.error, OSError, )
+        consumer.connection_errors = (socket.error, OSError,)
         return consumer
 
     def test_taskbuckets_defaultdict(self):
@@ -88,7 +88,7 @@ class test_Consumer(AppCase):
             self.assertEqual(c._limit_order, limit_order + 1)
             bucket.can_consume.assert_called_with(4)
             c.timer.call_after.assert_called_with(
-                3.33, c._limit_move_to_pool, (request, ),
+                3.33, c._limit_move_to_pool, (request,),
                 priority=c._limit_order,
             )
             bucket.expected_time.assert_called_with(4)

+ 3 - 3
celery/tests/worker/test_control.py

@@ -198,7 +198,7 @@ class test_ControlPanel(AppCase):
         panel = self.create_panel(consumer=consumer)
         consumer.event_dispatcher.enabled = True
         panel.handle('heartbeat')
-        self.assertIn(('worker-heartbeat', ),
+        self.assertIn(('worker-heartbeat',),
                       consumer.event_dispatcher.send.call_args)
 
     def test_time_limit(self):
@@ -347,10 +347,10 @@ class test_ControlPanel(AppCase):
         self.assertFalse(panel.handle('dump_schedule'))
         r = Request(TaskMessage(self.mytask.name, 'CAFEBABE'), app=self.app)
         consumer.timer.schedule.enter_at(
-            consumer.timer.Entry(lambda x: x, (r, )),
+            consumer.timer.Entry(lambda x: x, (r,)),
             datetime.now() + timedelta(seconds=10))
         consumer.timer.schedule.enter_at(
-            consumer.timer.Entry(lambda x: x, (object(), )),
+            consumer.timer.Entry(lambda x: x, (object(),)),
             datetime.now() + timedelta(seconds=10))
         self.assertTrue(panel.handle('dump_schedule'))
 

+ 3 - 3
celery/tests/worker/test_hub.py

@@ -192,7 +192,7 @@ class test_Hub(Case):
         hub.timer = Mock()
         hub.scheduler = iter([(0, eback)])
         with self.assertRaises(KeyError):
-            hub.fire_timers(propagate=(KeyError, ))
+            hub.fire_timers(propagate=(KeyError,))
 
         eback.side_effect = ValueError('foo')
         hub.scheduler = iter([(0, eback)])
@@ -258,8 +258,8 @@ class test_Hub(Case):
             call(11, hub.READ | hub.ERR),
         ], any_order=True)
 
-        self.assertEqual(hub.readers[10], (read_A, (10, )))
-        self.assertEqual(hub.readers[11], (read_B, (11, )))
+        self.assertEqual(hub.readers[10], (read_A, (10,)))
+        self.assertEqual(hub.readers[11], (read_B, (11,)))
 
         hub.remove(10)
         self.assertNotIn(10, hub.readers)

+ 2 - 2
celery/tests/worker/test_loops.py

@@ -42,7 +42,7 @@ class X(object):
         )
         self.consumer.callbacks = []
         self.obj.strategies = {}
-        self.connection.connection_errors = (socket.error, )
+        self.connection.connection_errors = (socket.error,)
         self.hub.readers = {}
         self.hub.writers = {}
         self.hub.consolidate = set()
@@ -217,7 +217,7 @@ class test_asynloop(AppCase):
         x.hub.on_tick.add(x.closer(mod=2))
         asynloop(*x.args)
         x.qos.update.assert_called_with()
-        x.hub.fire_timers.assert_called_with(propagate=(socket.error, ))
+        x.hub.fire_timers.assert_called_with(propagate=(socket.error,))
 
     def test_poll_empty(self):
         x = X(self.app)

+ 3 - 3
celery/tests/worker/test_request.py

@@ -72,7 +72,7 @@ class test_mro_lookup(Case):
 
         A.x = 10
         self.assertEqual(mro_lookup(C, 'x'), A)
-        self.assertIsNone(mro_lookup(C, 'x', stop=(A, )))
+        self.assertIsNone(mro_lookup(C, 'x', stop=(A,)))
         B.x = 10
         self.assertEqual(mro_lookup(C, 'x'), B)
         C.x = 10
@@ -183,7 +183,7 @@ class test_trace_task(AppCase):
             self.app, uuid(), self.mytask_raising.name, [4], {},
         )
         self.assertIsInstance(ret, ExceptionInfo)
-        self.assertTupleEqual(ret.exception.args, (4, ))
+        self.assertTupleEqual(ret.exception.args, (4,))
 
     def test_execute_ignore_result(self):
 
@@ -234,7 +234,7 @@ class test_Request(AppCase):
             on_reject=Mock(name='on_reject'),
             eventer=Mock(name='eventer'),
             app=self.app,
-            connection_errors=(socket.error, ),
+            connection_errors=(socket.error,),
             task=sig.type,
             **kwargs
         )

+ 8 - 8
celery/tests/worker/test_worker.py

@@ -39,7 +39,7 @@ def MockStep(step=None):
     step = Mock() if step is None else step
     step.blueprint = Mock()
     step.blueprint.name = 'MockNS'
-    step.name = 'MockStep(%s)' % (id(step), )
+    step.name = 'MockStep(%s)' % (id(step),)
     return step
 
 
@@ -333,7 +333,7 @@ class test_Consumer(AppCase):
                          send_events=False, pool=BasePool(), app=self.app)
         l.controller = l.app.WorkController()
         l.pool = l.controller.pool = Mock()
-        l.channel_errors = (KeyError, )
+        l.channel_errors = (KeyError,)
         with self.assertRaises(KeyError):
             l.start()
         l.timer.stop()
@@ -354,7 +354,7 @@ class test_Consumer(AppCase):
         l.controller = l.app.WorkController()
         l.pool = l.controller.pool = Mock()
 
-        l.connection_errors = (KeyError, )
+        l.connection_errors = (KeyError,)
         self.assertRaises(SyntaxError, l.start)
         l.timer.stop()
 
@@ -424,8 +424,8 @@ class test_Consumer(AppCase):
 
     def test_ignore_errors(self):
         l = MyKombuConsumer(self.buffer.put, timer=self.timer, app=self.app)
-        l.connection_errors = (AttributeError, KeyError, )
-        l.channel_errors = (SyntaxError, )
+        l.connection_errors = (AttributeError, KeyError,)
+        l.channel_errors = (SyntaxError,)
         ignore_errors(l, Mock(side_effect=AttributeError('foo')))
         ignore_errors(l, Mock(side_effect=KeyError('foo')))
         ignore_errors(l, Mock(side_effect=SyntaxError('foo')))
@@ -547,7 +547,7 @@ class test_Consumer(AppCase):
 
         l.event_dispatcher = mock_event_dispatcher()
         l.update_strategies()
-        l.connection_errors = (socket.error, )
+        l.connection_errors = (socket.error,)
         m.reject = Mock()
         m.reject.side_effect = socket.error('foo')
         callback = self._get_on_message(l)
@@ -631,7 +631,7 @@ class test_Consumer(AppCase):
         chan = con.node.channel = Mock()
         l.connection = Mock()
         chan.close.side_effect = socket.error('foo')
-        l.connection_errors = (socket.error, )
+        l.connection_errors = (socket.error,)
         con.reset()
         chan.close.assert_called_with()
 
@@ -716,7 +716,7 @@ class test_Consumer(AppCase):
     def test_connect_errback(self, sleep, connect):
         l = MyKombuConsumer(self.buffer.put, timer=self.timer, app=self.app)
         from kombu.transport.memory import Transport
-        Transport.connection_errors = (ChannelError, )
+        Transport.connection_errors = (ChannelError,)
 
         def effect():
             if connect.call_count > 1:

+ 2 - 2
celery/utils/functional.py

@@ -158,7 +158,7 @@ def memoize(maxsize=None, keyfun=None, Cache=LRUCache):
             if keyfun:
                 key = keyfun(args, kwargs)
             else:
-                key = args + (KEYWORD_MARK, ) + tuple(sorted(kwargs.items()))
+                key = args + (KEYWORD_MARK,) + tuple(sorted(kwargs.items()))
             try:
                 with mutex:
                     value = cache[key]
@@ -314,7 +314,7 @@ class _regen(UserList, list):
         self.__it = it
 
     def __reduce__(self):
-        return list, (self.data, )
+        return list, (self.data,)
 
     def __length_hint__(self):
         return self.__it.__length_hint__()

+ 1 - 1
celery/utils/serialization.py

@@ -34,7 +34,7 @@ except NameError:  # pragma: no cover
 
 
 def subclass_exception(name, parent, module):  # noqa
-    return type(name, (parent, ), {'__module__': module})
+    return type(name, (parent,), {'__module__': module})
 
 
 def find_pickleable_exception(exc, loads=pickle.loads,

+ 1 - 1
celery/worker/__init__.py

@@ -218,7 +218,7 @@ class WorkController(object):
 
     def register_with_event_loop(self, hub):
         self.blueprint.send_all(
-            self, 'register_with_event_loop', args=(hub, ),
+            self, 'register_with_event_loop', args=(hub,),
             description='hub.register',
         )
 

+ 1 - 1
celery/worker/autoreload.py

@@ -46,7 +46,7 @@ logger = get_logger(__name__)
 class WorkerComponent(bootsteps.StartStopStep):
     label = 'Autoreloader'
     conditional = True
-    requires = (Pool, )
+    requires = (Pool,)
 
     def __init__(self, w, autoreload=None, **kwargs):
         self.enabled = w.autoreload = autoreload

+ 1 - 1
celery/worker/autoscale.py

@@ -39,7 +39,7 @@ AUTOSCALE_KEEPALIVE = float(os.environ.get('AUTOSCALE_KEEPALIVE', 30))
 class WorkerComponent(bootsteps.StartStopStep):
     label = 'Autoscaler'
     conditional = True
-    requires = (Pool, )
+    requires = (Pool,)
 
     def __init__(self, w, **kwargs):
         self.enabled = w.autoscale

+ 3 - 3
celery/worker/components.py

@@ -60,7 +60,7 @@ class Timer(bootsteps.Step):
 
 
 class Hub(bootsteps.StartStopStep):
-    requires = (Timer, )
+    requires = (Timer,)
 
     def __init__(self, w, **kwargs):
         w.hub = None
@@ -100,7 +100,7 @@ class Queues(bootsteps.Step):
     """This bootstep initializes the internal queues
     used by the worker."""
     label = 'Queues (intra)'
-    requires = (Hub, )
+    requires = (Hub,)
 
     def create(self, w):
         w.process_task = w._process_task
@@ -123,7 +123,7 @@ class Pool(bootsteps.StartStopStep):
         * min_concurrency
 
     """
-    requires = (Queues, )
+    requires = (Queues,)
 
     def __init__(self, w, autoscale=None, autoreload=None,
                  no_execv=False, optimization=None, **kwargs):

+ 9 - 9
celery/worker/consumer.py

@@ -262,7 +262,7 @@ class Consumer(object):
             hold = bucket.expected_time(tokens)
             pri = self._limit_order = (self._limit_order + 1) % 10
             self.timer.call_after(
-                hold, self._limit_move_to_pool, (request, ),
+                hold, self._limit_move_to_pool, (request,),
                 priority=pri,
             )
         else:
@@ -300,7 +300,7 @@ class Consumer(object):
 
     def register_with_event_loop(self, hub):
         self.blueprint.send_all(
-            self, 'register_with_event_loop', args=(hub, ),
+            self, 'register_with_event_loop', args=(hub,),
             description='Hub.register',
         )
 
@@ -522,7 +522,7 @@ class Connection(bootsteps.StartStopStep):
 
 
 class Events(bootsteps.StartStopStep):
-    requires = (Connection, )
+    requires = (Connection,)
 
     def __init__(self, c, send_events=None, **kwargs):
         self.send_events = True
@@ -563,7 +563,7 @@ class Events(bootsteps.StartStopStep):
 
 
 class Heart(bootsteps.StartStopStep):
-    requires = (Events, )
+    requires = (Events,)
 
     def __init__(self, c, without_heartbeat=False, heartbeat_interval=None,
                  **kwargs):
@@ -584,7 +584,7 @@ class Heart(bootsteps.StartStopStep):
 
 class Mingle(bootsteps.StartStopStep):
     label = 'Mingle'
-    requires = (Events, )
+    requires = (Events,)
     compatible_transports = {'amqp', 'redis'}
 
     def __init__(self, c, without_mingle=False, **kwargs):
@@ -617,7 +617,7 @@ class Mingle(bootsteps.StartStopStep):
 
 
 class Tasks(bootsteps.StartStopStep):
-    requires = (Mingle, )
+    requires = (Mingle,)
 
     def __init__(self, c, **kwargs):
         c.task_consumer = c.qos = None
@@ -664,7 +664,7 @@ class Tasks(bootsteps.StartStopStep):
 
 class Agent(bootsteps.StartStopStep):
     conditional = True
-    requires = (Connection, )
+    requires = (Connection,)
 
     def __init__(self, c, **kwargs):
         self.agent_cls = self.enabled = c.app.conf.CELERYD_AGENT
@@ -675,7 +675,7 @@ class Agent(bootsteps.StartStopStep):
 
 
 class Control(bootsteps.StartStopStep):
-    requires = (Tasks, )
+    requires = (Tasks,)
 
     def __init__(self, c, **kwargs):
         self.is_green = c.pool is not None and c.pool.is_green
@@ -690,7 +690,7 @@ class Control(bootsteps.StartStopStep):
 
 class Gossip(bootsteps.ConsumerStep):
     label = 'Gossip'
-    requires = (Mingle, )
+    requires = (Mingle,)
     _cons_stamp_fields = itemgetter(
         'id', 'clock', 'hostname', 'pid', 'topic', 'action', 'cver',
     )

+ 1 - 1
celery/worker/heartbeat.py

@@ -47,7 +47,7 @@ class Heart(object):
         if self.eventer.enabled:
             self._send('worker-online')
             self.tref = self.timer.call_repeatedly(
-                self.interval, self._send, ('worker-heartbeat', ),
+                self.interval, self._send, ('worker-heartbeat',),
             )
 
     def stop(self):

+ 1 - 1
celery/worker/request.py

@@ -328,7 +328,7 @@ class Request(object):
         task_ready(self)
 
         if isinstance(exc_info.exception, MemoryError):
-            raise MemoryError('Process got: %s' % (exc_info.exception, ))
+            raise MemoryError('Process got: %s' % (exc_info.exception,))
         elif isinstance(exc_info.exception, Reject):
             return self.reject(requeue=exc_info.exception.requeue)
         elif isinstance(exc_info.exception, Ignore):

+ 1 - 1
celery/worker/strategy.py

@@ -113,7 +113,7 @@ def default(task, app, consumer,
                 req.acknowledge()
             else:
                 consumer.qos.increment_eventually()
-                call_at(eta, apply_eta_task, (req, ), priority=6)
+                call_at(eta, apply_eta_task, (req,), priority=6)
         else:
             if rate_limits_enabled:
                 bucket = get_bucket(task.name)

+ 1 - 1
docs/configuration.rst

@@ -27,7 +27,7 @@ It should contain all you need to run a basic Celery set-up.
     BROKER_URL = 'amqp://guest:guest@localhost:5672//'
 
     # List of modules to import when celery starts.
-    CELERY_IMPORTS = ('myapp.tasks', )
+    CELERY_IMPORTS = ('myapp.tasks',)
 
     ## Using the database to store task state and results.
     CELERY_RESULT_BACKEND = 'db+sqlite:///results.db'

+ 1 - 1
docs/getting-started/brokers/django.rst

@@ -30,7 +30,7 @@ configuration values.
 
 #. Add :mod:`kombu.transport.django` to `INSTALLED_APPS`::
 
-    INSTALLED_APPS = ('kombu.transport.django', )
+    INSTALLED_APPS = ('kombu.transport.django',)
 
 #. Sync your database schema:
 

+ 3 - 3
docs/history/changelog-2.5.rst

@@ -76,7 +76,7 @@ News
 
         @task_sent.connect
         def on_task_sent(**kwargs):
-            print("sent task: %r" % (kwargs, ))
+            print("sent task: %r" % (kwargs,))
 
 - Invalid task messages are now rejected instead of acked.
 
@@ -96,8 +96,8 @@ News
 
     .. code-block:: python
 
-        >>> s = add.subtask((5, ))
-        >>> new = s.clone(args=(10, ), countdown=5})
+        >>> s = add.subtask((5,))
+        >>> new = s.clone(args=(10,), countdown=5})
         >>> new.args
         (10, 5)
 

+ 1 - 1
docs/history/changelog-3.1.rst

@@ -422,7 +422,7 @@ News
   exceptions.
 
 - **Worker**: No longer sends task error emails for expected errors (in
-  ``@task(throws=(..., )))``.
+  ``@task(throws=(...,)))``.
 
 - **Canvas**: Fixed problem with exception deserialization when using
   the JSON serializer (Issue #1987).

+ 1 - 1
docs/internals/deprecation.rst

@@ -122,7 +122,7 @@ for example::
 
     @task()
     def add(x, y, task_id=None):
-        print("My task id is %r" % (task_id, ))
+        print("My task id is %r" % (task_id,))
 
 should be rewritten into::
 

+ 1 - 1
docs/userguide/application.rst

@@ -430,7 +430,7 @@ chain breaks:
 
         >>> from celery.execute import apply_async
 
-        >>> apply_async(hello, ('world!', ))
+        >>> apply_async(hello, ('world!',))
 
     or you could also create a ``Task`` class to set
     certain options, or override other behavior

+ 1 - 1
docs/userguide/calling.rst

@@ -41,7 +41,7 @@ The API defines a standard set of execution options, as well as three methods:
     - ``T.delay(arg, kwarg=value)``
         always a shortcut to ``.apply_async``.
 
-    - ``T.apply_async((arg, ), {'kwarg': value})``
+    - ``T.apply_async((arg,), {'kwarg': value})``
 
     - ``T.apply_async(countdown=10)``
         executes 10 seconds from now.

+ 2 - 2
docs/userguide/canvas.rst

@@ -110,7 +110,7 @@ creates partials:
 
     >>> partial = add.s(2)          # incomplete signature
     >>> partial.delay(4)            # 4 + 2
-    >>> partial.apply_async((4, ))  # same
+    >>> partial.apply_async((4,))  # same
 
 - Any keyword arguments added will be merged with the kwargs in the signature,
   with the new keyword arguments taking precedence::
@@ -130,7 +130,7 @@ You can also clone signatures to create derivatives:
     >>> s = add.s(2)
     proj.tasks.add(2)
 
-    >>> s.clone(args=(4, ), kwargs={'debug': True})
+    >>> s.clone(args=(4,), kwargs={'debug': True})
     proj.tasks.add(2, 4, debug=True)
 
 Immutability

+ 17 - 17
docs/userguide/extending.rst

@@ -65,7 +65,7 @@ whenever the connection is established:
     mechanisms.  The first one is the ``callbacks`` argument which accepts
     a list of callbacks with a ``(body, message)`` signature,
     the second one is the ``on_message`` argument which takes a single
-    callback with a ``(message, )`` signature.  The latter will not
+    callback with a ``(message,)`` signature.  The latter will not
     automatically decode and deserialize the payload which is useful
     in many cases:
 
@@ -146,7 +146,7 @@ Attributes
     .. code-block:: python
 
         class WorkerStep(bootsteps.StartStopStep):
-            requires = ('celery.worker.components:Hub', )
+            requires = ('celery.worker.components:Hub',)
 
 .. attribute:: pool
 
@@ -158,7 +158,7 @@ Attributes
     .. code-block:: python
 
         class WorkerStep(bootsteps.StartStopStep):
-            requires = ('celery.worker.components:Pool', )
+            requires = ('celery.worker.components:Pool',)
 
 .. attribute:: timer
 
@@ -169,7 +169,7 @@ Attributes
     .. code-block:: python
 
         class WorkerStep(bootsteps.StartStopStep):
-            requires = ('celery.worker.components:Timer', )
+            requires = ('celery.worker.components:Timer',)
 
 .. attribute:: statedb
 
@@ -183,7 +183,7 @@ Attributes
     .. code-block:: python
 
         class WorkerStep(bootsteps.StartStopStep):
-            requires = ('celery.worker.components:Statedb', )
+            requires = ('celery.worker.components:Statedb',)
 
 .. attribute:: autoscaler
 
@@ -197,7 +197,7 @@ Attributes
     .. code-block:: python
 
         class WorkerStep(bootsteps.StartStopStep):
-            requires = ('celery.worker.autoscaler:Autoscaler', )
+            requires = ('celery.worker.autoscaler:Autoscaler',)
 
 .. attribute:: autoreloader
 
@@ -210,7 +210,7 @@ Attributes
     .. code-block:: python
 
         class WorkerStep(bootsteps.StartStopStep):
-            requires = ('celery.worker.autoreloader:Autoreloader', )
+            requires = ('celery.worker.autoreloader:Autoreloader',)
 
 An example Worker bootstep could be:
 
@@ -219,7 +219,7 @@ An example Worker bootstep could be:
     from celery import bootsteps
 
     class ExampleWorkerStep(bootsteps.StartStopStep):
-        requires = ('Pool', )
+        requires = ('Pool',)
 
         def __init__(self, worker, **kwargs):
             print('Called when the WorkController instance is constructed')
@@ -252,7 +252,7 @@ Another example could use the timer to wake up at regular intervals:
 
 
     class DeadlockDetection(bootsteps.StartStopStep):
-        requires = ('Timer', )
+        requires = ('Timer',)
 
         def __init__(self, worker, deadlock_timeout=3600):
             self.timeout = deadlock_timeout
@@ -262,7 +262,7 @@ Another example could use the timer to wake up at regular intervals:
         def start(self, worker):
             # run every 30 seconds.
             self.tref = worker.timer.call_repeatedly(
-                30.0, self.detect, (worker, ), priority=10,
+                30.0, self.detect, (worker,), priority=10,
             )
 
         def stop(self, worker):
@@ -321,7 +321,7 @@ Attributes
     .. code-block:: python
 
         class WorkerStep(bootsteps.StartStopStep):
-            requires = ('celery.worker:Hub', )
+            requires = ('celery.worker:Hub',)
 
 
 .. attribute:: connection
@@ -334,7 +334,7 @@ Attributes
     .. code-block:: python
 
         class Step(bootsteps.StartStopStep):
-            requires = ('celery.worker.consumer:Connection', )
+            requires = ('celery.worker.consumer:Connection',)
 
 .. attribute:: event_dispatcher
 
@@ -345,7 +345,7 @@ Attributes
     .. code-block:: python
 
         class Step(bootsteps.StartStopStep):
-            requires = ('celery.worker.consumer:Events', )
+            requires = ('celery.worker.consumer:Events',)
 
 .. attribute:: gossip
 
@@ -357,7 +357,7 @@ Attributes
     .. code-block:: python
 
         class Step(bootsteps.StartStopStep):
-            requires = ('celery.worker.consumer:Events', )
+            requires = ('celery.worker.consumer:Events',)
 
 .. attribute:: pool
 
@@ -378,7 +378,7 @@ Attributes
     .. code-block:: python
 
         class Step(bootsteps.StartStopStep):
-            requires = ('celery.worker.consumer:Heart', )
+            requires = ('celery.worker.consumer:Heart',)
 
 .. attribute:: task_consumer
 
@@ -389,7 +389,7 @@ Attributes
     .. code-block:: python
 
         class Step(bootsteps.StartStopStep):
-            requires = ('celery.worker.consumer:Heart', )
+            requires = ('celery.worker.consumer:Heart',)
 
 .. attribute:: strategies
 
@@ -409,7 +409,7 @@ Attributes
     .. code-block:: python
 
         class Step(bootsteps.StartStopStep):
-            requires = ('celery.worker.consumer:Heart', )
+            requires = ('celery.worker.consumer:Heart',)
 
 
 .. attribute:: task_buckets

+ 2 - 2
docs/userguide/monitoring.rst

@@ -584,7 +584,7 @@ Combining these you can easily process events in real-time:
             task = state.tasks.get(event['uuid'])
 
             print('TASK FAILED: %s[%s] %s' % (
-                task.name, task.uuid, task.info(), ))
+                task.name, task.uuid, task.info(),))
 
         with app.connection() as connection:
             recv = app.events.Receiver(connection, handlers={
@@ -620,7 +620,7 @@ You can listen to specific events by specifying the handlers:
             task = state.tasks.get(event['uuid'])
 
             print('TASK FAILED: %s[%s] %s' % (
-                task.name, task.uuid, task.info(), ))
+                task.name, task.uuid, task.info(),))
 
         with app.connection() as connection:
             recv = app.events.Receiver(connection, handlers={

+ 9 - 7
docs/userguide/routing.rst

@@ -535,11 +535,11 @@ becomes -->
 You install router classes by adding them to the :setting:`CELERY_ROUTES`
 setting::
 
-    CELERY_ROUTES = (MyRouter(), )
+    CELERY_ROUTES = (MyRouter(),)
 
 Router classes can also be added by name::
 
-    CELERY_ROUTES = ('myapp.routers.MyRouter', )
+    CELERY_ROUTES = ('myapp.routers.MyRouter',)
 
 
 For simple task name -> route mappings like the router example above,
@@ -548,10 +548,12 @@ same behavior:
 
 .. code-block:: python
 
-    CELERY_ROUTES = ({'myapp.tasks.compress_video': {
-                            'queue': 'video',
-                            'routing_key': 'video.compress'
-                     }}, )
+    CELERY_ROUTES = (
+        {'myapp.tasks.compress_video': {
+            'queue': 'video',
+            'routing_key': 'video.compress',
+        }},
+    )
 
 The routers will then be traversed in order, it will stop at the first router
 returning a true value, and use that as the final route for the task.
@@ -567,7 +569,7 @@ copies of tasks to all workers connected to it:
 
     from kombu.common import Broadcast
 
-    CELERY_QUEUES = (Broadcast('broadcast_tasks'), )
+    CELERY_QUEUES = (Broadcast('broadcast_tasks'),)
 
     CELERY_ROUTES = {'tasks.reload_cache': {'queue': 'broadcast_tasks'}}
 

+ 1 - 1
docs/whatsnew-2.5.rst

@@ -288,7 +288,7 @@ You can change methods too, for example the ``on_failure`` handler:
 .. code-block:: python
 
     def my_on_failure(self, exc, task_id, args, kwargs, einfo):
-        print('Oh no! Task failed: %r' % (exc, ))
+        print('Oh no! Task failed: %r' % (exc,))
 
     CELERY_ANNOTATIONS = {'*': {'on_failure': my_on_failure}}
 

+ 3 - 3
docs/whatsnew-3.0.rst

@@ -315,7 +315,7 @@ Tasks can now have callbacks and errbacks, and dependencies are recorded
 
         # (2 + 2) * 8 / 2
         >>> res = chain(add.subtask((2, 2)),
-                        mul.subtask((8, )),
+                        mul.subtask((8,)),
                         div.subtask((2,))).apply_async()
         >>> res.get() == 16
 
@@ -633,7 +633,7 @@ without also initializing the app environment::
         abstract = True
 
         def __call__(self, *args, **kwargs):
-            print('CALLING %r' % (self, ))
+            print('CALLING %r' % (self,))
             return self.run(*args, **kwargs)
 
     >>> DebugTask
@@ -742,7 +742,7 @@ In Other News
 
             @wraps(fun)
             def _inner(*args, **kwargs):
-                print('ARGS: %r' % (args, ))
+                print('ARGS: %r' % (args,))
             return _inner
 
         CELERY_ANNOTATIONS = {

+ 1 - 1
examples/eventlet/README.rst

@@ -46,7 +46,7 @@ To open several URLs at once you can do::
     >>> result = group(urlopen.s(url)
     ...                     for url in LIST_OF_URLS).apply_async()
     >>> for incoming_result in result.iter_native():
-    ...     print(incoming_result, )
+    ...     print(incoming_result)
 
 * `webcrawler.crawl`
 

+ 1 - 1
examples/gevent/celeryconfig.py

@@ -10,4 +10,4 @@ CELERY_DISABLE_RATE_LIMITS = True
 CELERY_RESULT_BACKEND = 'amqp'
 CELERY_TASK_RESULT_EXPIRES = 30 * 60
 
-CELERY_IMPORTS = ('tasks', )
+CELERY_IMPORTS = ('tasks',)

+ 1 - 1
funtests/suite/config.py

@@ -12,7 +12,7 @@ CELERY_QUEUES = {'testcelery': {'routing_key': 'testcelery'}}
 
 CELERYD_LOG_COLOR = False
 
-CELERY_IMPORTS = ('celery.tests.functional.tasks', )
+CELERY_IMPORTS = ('celery.tests.functional.tasks',)
 
 
 @atexit.register

+ 3 - 3
setup.py

@@ -84,16 +84,16 @@ rq = lambda s: s.strip("\"'")
 
 def add_default(m):
     attr_name, attr_value = m.groups()
-    return ((attr_name, rq(attr_value)), )
+    return ((attr_name, rq(attr_value)),)
 
 
 def add_version(m):
     v = list(map(rq, m.groups()[0].split(', ')))
-    return (('VERSION', '.'.join(v[0:3]) + ''.join(v[3:])), )
+    return (('VERSION', '.'.join(v[0:3]) + ''.join(v[3:])),)
 
 
 def add_doc(m):
-    return (('doc', m.groups()[0]), )
+    return (('doc', m.groups()[0]),)
 
 pats = {re_meta: add_default,
         re_vers: add_version,