Browse Source

autopep8 on celery.

Omer Katz 7 years ago
parent
commit
ae5190d40a

+ 1 - 0
celery/__init__.py

@@ -145,6 +145,7 @@ def maybe_patch_concurrency(argv=sys.argv,
         from celery import concurrency
         concurrency.get_implementation(pool)
 
+
 # Lazy loading
 from . import local  # noqa
 

+ 1 - 1
celery/app/amqp.py

@@ -524,7 +524,7 @@ class AMQP(object):
 
             # convert to anon-exchange, when exchange not set and direct ex.
             if (not exchange or not routing_key) and exchange_type == 'direct':
-                    exchange, routing_key = '', qname
+                exchange, routing_key = '', qname
             elif exchange is None:
                 # not topic exchange, and exchange not undefined
                 exchange = queue.exchange.name or default_exchange

+ 2 - 0
celery/app/base.py

@@ -1266,4 +1266,6 @@ class Celery(object):
                 if not conf.timezone:
                     return timezone.local
         return timezone.get_timezone(tz)
+
+
 App = Celery  # noqa: E305 XXX compat

+ 2 - 0
celery/app/task.py

@@ -1009,4 +1009,6 @@ class Task(object):
     @property
     def __name__(self):
         return self.__class__.__name__
+
+
 BaseTask = Task  # noqa: E305 XXX compat alias

+ 5 - 3
celery/app/trace.py

@@ -141,12 +141,12 @@ def get_log_policy(task, einfo, exc):
             return log_policy_expected
         return log_policy_unexpected
 
-    
+
 def get_task_name(request, default):
     """Use 'shadow' in request for the task name if applicable."""
     # request.shadow could be None or an empty string. If so, we should use default.
     return getattr(request, 'shadow', None) or default
-    
+
 
 class TraceInfo(object):
     """Information about task execution."""
@@ -156,7 +156,7 @@ class TraceInfo(object):
     def __init__(self, state, retval=None):
         self.state = state
         self.retval = retval
-        
+
     def handle_error_state(self, task, req,
                            eager=False, call_errbacks=True):
         store_errors = not eager
@@ -521,6 +521,8 @@ def _trace_task_ret(name, uuid, request, body, content_type,
     R, I, T, Rstr = trace_task(app.tasks[name],
                                uuid, args, kwargs, request, app=app)
     return (1, R, T) if I else (0, Rstr, T)
+
+
 trace_task_ret = _trace_task_ret  # noqa: E305
 
 

+ 3 - 3
celery/apps/beat.py

@@ -115,9 +115,9 @@ class Beat(object):
         c = self.colored
         return text_t(  # flake8: noqa
             c.blue('__    ', c.magenta('-'),
-            c.blue('    ... __   '), c.magenta('-'),
-            c.blue('        _\n'),
-            c.reset(self.startup_info(service))),
+                   c.blue('    ... __   '), c.magenta('-'),
+                   c.blue('        _\n'),
+                   c.reset(self.startup_info(service))),
         )
 
     def init_loader(self):

+ 2 - 0
celery/backends/base.py

@@ -520,6 +520,8 @@ class SyncBackendMixin(object):
 
 class BaseBackend(Backend, SyncBackendMixin):
     """Base (synchronous) result backend."""
+
+
 BaseDictBackend = BaseBackend  # noqa: E305 XXX compat
 
 

+ 5 - 5
celery/backends/mongodb.py

@@ -117,11 +117,11 @@ class MongoBackend(BaseBackend):
             self.options.update(config)
 
     def _prepare_client_options(self):
-            if pymongo.version_tuple >= (3,):
-                return {'maxPoolSize': self.max_pool_size}
-            else:  # pragma: no cover
-                return {'max_pool_size': self.max_pool_size,
-                        'auto_start_request': False}
+        if pymongo.version_tuple >= (3,):
+            return {'maxPoolSize': self.max_pool_size}
+        else:  # pragma: no cover
+            return {'max_pool_size': self.max_pool_size,
+                    'auto_start_request': False}
 
     def _get_connection(self):
         """Connect to the MongoDB server."""

+ 1 - 1
celery/bin/base.py

@@ -85,7 +85,7 @@ def _add_optparse_argument(parser, opt, typemap={
     # store_true sets value to "('NO', 'DEFAULT')" for some
     # crazy reason, so not to set a sane default here.
     if opt.action == 'store_true' and opt.default is None:
-            opt.default = False
+        opt.default = False
     parser.add_argument(
         *opt._long_opts + opt._short_opts,
         **dictfilter({

+ 4 - 0
celery/canvas.py

@@ -1372,6 +1372,8 @@ def signature(varies, *args, **kwargs):
             return varies.clone()
         return Signature.from_dict(varies, app=app)
     return Signature(varies, *args, **kwargs)
+
+
 subtask = signature  # noqa: E305 XXX compat
 
 
@@ -1400,4 +1402,6 @@ def maybe_signature(d, app=None, clone=False):
         if app is not None:
             d._app = app
     return d
+
+
 maybe_subtask = maybe_signature  # noqa: E305 XXX compat

+ 2 - 0
celery/events/state.py

@@ -101,6 +101,8 @@ class CallableDefaultdict(defaultdict):
 
     def __call__(self, *args, **kwargs):
         return self.fun(*args, **kwargs)
+
+
 Callable.register(CallableDefaultdict)  # noqa: E305
 
 

+ 4 - 0
celery/exceptions.py

@@ -159,6 +159,8 @@ class Retry(TaskPredicate):
 
     def __reduce__(self):
         return self.__class__, (self.message, self.excs, self.when)
+
+
 RetryTaskError = Retry  # noqa: E305 XXX compat
 
 
@@ -242,6 +244,8 @@ class CDeprecationWarning(DeprecationWarning):
 
 class WorkerTerminate(SystemExit):
     """Signals that the worker should terminate immediately."""
+
+
 SystemTerminate = WorkerTerminate  # noqa: E305 XXX compat
 
 

+ 2 - 0
celery/platforms.py

@@ -229,6 +229,8 @@ class Pidfile(object):
                     "Inconsistency: Pidfile content doesn't match at re-read")
         finally:
             rfh.close()
+
+
 PIDFile = Pidfile  # noqa: E305 XXX compat alias
 
 

+ 2 - 2
celery/schedules.py

@@ -484,8 +484,8 @@ class crontab(BaseSchedule):
                                          months_of_year[datedata.moy],
                                          days_of_month[datedata.dom]) or
                         (self.maybe_make_aware(datetime(datedata.year,
-                         months_of_year[datedata.moy],
-                         days_of_month[datedata.dom])) < last_run_at))
+                                                        months_of_year[datedata.moy],
+                                                        days_of_month[datedata.dom])) < last_run_at))
 
                 if flag:
                     datedata.dom = 0

+ 6 - 0
celery/utils/collections.py

@@ -229,6 +229,8 @@ class DictAttribute(object):
         def values(self):
             # type: () -> List[Any]
             return list(self._iterate_values())
+
+
 MutableMapping.register(DictAttribute)  # noqa: E305
 
 
@@ -707,6 +709,8 @@ class LimitedSet(object):
         # type: () -> float
         """Compute how much is heap bigger than data [percents]."""
         return len(self._heap) * 100 / max(len(self._data), 1) - 100
+
+
 MutableSet.register(LimitedSet)  # noqa: E305
 
 
@@ -809,6 +813,8 @@ class Messagebuffer(Evictable):
     def _evictcount(self):
         # type: () -> int
         return len(self)
+
+
 Sequence.register(Messagebuffer)  # noqa: E305
 
 

+ 1 - 1
celery/utils/time.py

@@ -362,7 +362,7 @@ class ffwd(object):
         month = self.month or other.month
         day = min(monthrange(year, month)[1], self.day or other.day)
         ret = other.replace(**dict(dictfilter(self._fields()),
-                            year=year, month=month, day=day))
+                                   year=year, month=month, day=day))
         if self.weekday is not None:
             ret += timedelta(days=(7 - ret.weekday() + self.weekday) % 7)
         return ret + timedelta(days=self.days)

+ 2 - 0
celery/worker/request.py

@@ -53,6 +53,8 @@ def __optimize__():
     global _does_info
     _does_debug = logger.isEnabledFor(logging.DEBUG)
     _does_info = logger.isEnabledFor(logging.INFO)
+
+
 __optimize__()  # noqa: E305
 
 # Localize