瀏覽代碼

Two spaces after period for monospaced fonts

Ask Solem 8 年之前
父節點
當前提交
2570e61a26

+ 2 - 3
celery/_state.py

@@ -28,9 +28,8 @@ default_app = None
 #: List of all app instances (weakrefs), mustn't be used directly.
 _apps = weakref.WeakSet()
 
-#: global set of functions to call whenever a new app is finalized
-#: E.g. Shared tasks, and built-in tasks are created
-#: by adding callbacks here.
+#: Global set of functions to call whenever a new app is finalized.
+#: Shared tasks, and built-in tasks are created by adding callbacks here.
 _on_app_finalizers = set()
 
 _task_join_will_block = False

+ 1 - 1
celery/app/base.py

@@ -117,7 +117,7 @@ class Celery(object):
         loader (str, type): The loader class, or the name of the loader
             class to use.  Default is :class:`celery.loaders.app.AppLoader`.
         backend (str, type): The result store backend class, or the name of the
-            backend class to use. Default is the value of the
+            backend class to use.  Default is the value of the
             :setting:`result_backend` setting.
         amqp (str, type): AMQP object or class name.
         events (str, type): Events object or class name.

+ 5 - 5
celery/app/task.py

@@ -433,7 +433,7 @@ class Task(object):
                 argument.
 
             routing_key (str): Custom routing key used to route the task to a
-                worker server. If in combination with a ``queue`` argument
+                worker server.  If in combination with a ``queue`` argument
                 only used to specify custom routing keys to topic exchanges.
 
             priority (int): The task priority, a number between 0 and 9.
@@ -448,8 +448,8 @@ class Task(object):
             compression (str): Optional compression method
                 to use.  Can be one of ``zlib``, ``bzip2``,
                 or any custom compression methods registered with
-                :func:`kombu.compression.register`. Defaults to
-                the :setting:`task_compression` setting.
+                :func:`kombu.compression.register`.
+                Defaults to the :setting:`task_compression` setting.
 
             link (~@Signature): A single, or a list of tasks signatures
                 to apply if the task returns successfully.
@@ -578,8 +578,8 @@ class Task(object):
             eta (~datetime.dateime): Explicit time and date to run the
                 retry at.
             max_retries (int): If set, overrides the default retry limit for
-                this execution. Changes to this parameter don't propagate to
-                subsequent task retry attempts. A value of :const:`None`, means
+                this execution.  Changes to this parameter don't propagate to
+                subsequent task retry attempts.  A value of :const:`None`, means
                 "use the default", so if you want infinite retries you'd
                 have to set the :attr:`max_retries` attribute of the task to
                 :const:`None` first.

+ 11 - 5
celery/backends/base.py

@@ -141,7 +141,7 @@ class Backend(object):
                         traceback=None, request=None,
                         store_result=True, call_errbacks=True,
                         state=states.FAILURE):
-        """Mark task as executed with failure. Stores the exception."""
+        """Mark task as executed with failure."""
         if store_result:
             self.store_result(task_id, exc, state,
                               traceback=traceback, request=request)
@@ -179,8 +179,11 @@ class Backend(object):
 
     def mark_as_retry(self, task_id, exc, traceback=None,
                       request=None, store_result=True, state=states.RETRY):
-        """Mark task as being retries. Stores the current
-        exception (if any)."""
+        """Mark task as being retries.
+
+        Note:
+            Stores the current exception (if any).
+        """
         return self.store_result(task_id, exc, state,
                                  traceback=traceback, request=request)
 
@@ -364,8 +367,11 @@ class Backend(object):
         return self._delete_group(group_id)
 
     def cleanup(self):
-        """Backend cleanup. Is run by
-        :class:`celery.task.DeleteExpiredTaskMetaTask`."""
+        """Backend cleanup.
+
+        Note:
+            This is run by :class:`celery.task.DeleteExpiredTaskMetaTask`.
+        """
         pass
 
     def process_cleanup(self):

+ 2 - 2
celery/backends/cassandra.py

@@ -21,7 +21,7 @@ logger = get_logger(__name__)
 
 E_NO_CASSANDRA = """
 You need to install the cassandra-driver library to
-use the Cassandra backend. See https://github.com/datastax/python-driver
+use the Cassandra backend.  See https://github.com/datastax/python-driver
 """
 
 E_NO_SUCH_CASSANDRA_AUTH_PROVIDER = """
@@ -160,7 +160,7 @@ class CassandraBackend(BaseBackend):
 
             if write:
                 # Only possible writers "workers" are allowed to issue
-                # CREATE TABLE. This is to prevent conflicting situations
+                # CREATE TABLE.  This is to prevent conflicting situations
                 # where both task-creator and task-executor would issue it
                 # at the same time.
 

+ 1 - 1
celery/backends/database/__init__.py

@@ -53,7 +53,7 @@ def retry(fun):
                 return fun(*args, **kwargs)
             except (DatabaseError, InvalidRequestError, StaleDataError):
                 logger.warning(
-                    'Failed operation %s. Retrying %s more times.',
+                    'Failed operation %s.  Retrying %s more times.',
                     fun.__name__, max_retries - retries - 1,
                     exc_info=True)
                 if retries + 1 >= max_retries:

+ 3 - 3
celery/backends/mongodb.py

@@ -134,7 +134,7 @@ class MongoBackend(BaseBackend):
             if not host:
                 # The first pymongo.Connection() argument (host) can be
                 # a list of ['host:port'] elements or a mongodb connection
-                # URI. If this is the case, don't use self.port
+                # URI.  If this is the case, don't use self.port
                 # but let pymongo get the port(s) from the URI instead.
                 # This enables the use of replica sets and sharding.
                 # See pymongo.Connection() for more info.
@@ -268,7 +268,7 @@ class MongoBackend(BaseBackend):
         collection = self.database[self.taskmeta_collection]
 
         # Ensure an index on date_done is there, if not process the index
-        # in the background. Once completed cleanup will be much faster
+        # in the background.  Once completed cleanup will be much faster
         collection.ensure_index('date_done', background='true')
         return collection
 
@@ -278,7 +278,7 @@ class MongoBackend(BaseBackend):
         collection = self.database[self.groupmeta_collection]
 
         # Ensure an index on date_done is there, if not process the index
-        # in the background. Once completed cleanup will be much faster
+        # in the background.  Once completed cleanup will be much faster
         collection.ensure_index('date_done', background='true')
         return collection
 

+ 2 - 2
celery/beat.py

@@ -423,8 +423,8 @@ class PersistentScheduler(Scheduler):
         try:
             self._store = self._open_schedule()
             # In some cases there may be different errors from a storage
-            # backend for corrupted files. Example - DBPageNotFoundError
-            # exception from bsddb. In such case the file will be
+            # backend for corrupted files.  Example - DBPageNotFoundError
+            # exception from bsddb.  In such case the file will be
             # successfully opened but the error will be raised on first key
             # retrieving.
             self._store.keys()

+ 1 - 1
celery/bin/amqp.py

@@ -190,7 +190,7 @@ class AMQShell(cmd.Cmd):
         self._reconnect()
 
     def note(self, m):
-        """Say something to the user. Disabled if :attr:`silent`."""
+        """Say something to the user.  Disabled if :attr:`silent`."""
         if not self.silent:
             say(m, file=self.out)
 

+ 2 - 2
celery/bin/beat.py

@@ -13,7 +13,7 @@
 
 .. cmdoption:: -s, --schedule
 
-    Path to the schedule database. Defaults to `celerybeat-schedule`.
+    Path to the schedule database.  Defaults to `celerybeat-schedule`.
     The extension '.db' may be appended to the filename.
     Default is {default}.
 
@@ -28,7 +28,7 @@
 
 .. cmdoption:: -f, --logfile
 
-    Path to log file. If no logfile is specified, `stderr` is used.
+    Path to log file.  If no logfile is specified, `stderr` is used.
 
 .. cmdoption:: -l, --loglevel
 

+ 2 - 2
celery/bin/celery.py

@@ -50,7 +50,7 @@ in any command that also has a `--detach` option.
 
 .. cmdoption:: -f, --logfile
 
-    Path to log file. If no logfile is specified, `stderr` is used.
+    Path to log file.  If no logfile is specified, `stderr` is used.
 
 .. cmdoption:: --pidfile
 
@@ -601,7 +601,7 @@ class _RemoteControl(Command):
     def run(self, *args, **kwargs):
         if not args:
             raise self.UsageError(
-                'Missing {0.name} method. See --help'.format(self))
+                'Missing {0.name} method.  See --help'.format(self))
         return self.do_call_method(args, **kwargs)
 
     def _ensure_fanout_supported(self):

+ 1 - 1
celery/bin/events.py

@@ -34,7 +34,7 @@
 
 .. cmdoption:: -f, --logfile
 
-    Path to log file. If no logfile is specified, `stderr` is used.
+    Path to log file.  If no logfile is specified, `stderr` is used.
 
 .. cmdoption:: --pidfile
 

+ 10 - 10
celery/bin/worker.py

@@ -11,7 +11,7 @@ The :program:`celery worker` command (previously known as ``celeryd``)
 
 .. cmdoption:: -c, --concurrency
 
-    Number of child processes processing the queue. The default
+    Number of child processes processing the queue.  The default
     is the number of CPUs available on your system.
 
 .. cmdoption:: -P, --pool
@@ -22,12 +22,12 @@ The :program:`celery worker` command (previously known as ``celeryd``)
 
 .. cmdoption:: -n, --hostname
 
-    Set custom hostname, e.g. 'w1.%h'. Expands: %h (hostname),
+    Set custom hostname, e.g. 'w1.%h'.  Expands: %h (hostname),
     %n (name) and %d, (domain).
 
 .. cmdoption:: -B, --beat
 
-    Also run the `celery beat` periodic task scheduler. Please note that
+    Also run the `celery beat` periodic task scheduler.  Please note that
     there must only be one instance of this service.
 
 .. cmdoption:: -Q, --queues
@@ -50,7 +50,7 @@ The :program:`celery worker` command (previously known as ``celeryd``)
 .. cmdoption:: -s, --schedule
 
     Path to the schedule database if running with the `-B` option.
-    Defaults to `celerybeat-schedule`. The extension ".db" may be
+    Defaults to `celerybeat-schedule`.  The extension ".db" may be
     appended to the filename.
 
 .. cmdoption:: -O
@@ -63,13 +63,13 @@ The :program:`celery worker` command (previously known as ``celeryd``)
 
 .. cmdoption:: --scheduler
 
-    Scheduler class to use. Default is
+    Scheduler class to use.  Default is
     :class:`celery.beat.PersistentScheduler`
 
 .. cmdoption:: -S, --statedb
 
-    Path to the state database. The extension '.db' may
-    be appended to the filename. Default: {default}
+    Path to the state database.  The extension '.db' may
+    be appended to the filename.  Default: {default}
 
 .. cmdoption:: -E, --events
 
@@ -114,7 +114,7 @@ The :program:`celery worker` command (previously known as ``celeryd``)
 .. cmdoption:: --maxmemperchild
 
     Maximum amount of resident memory, in KiB, that may be consumed by a
-    child process before it will be replaced by a new one. If a single
+    child process before it will be replaced by a new one.  If a single
     task causes a child process to exceed this limit, the task will be
     completed and the child process will be replaced afterwards.
     Default: no limit.
@@ -125,7 +125,7 @@ The :program:`celery worker` command (previously known as ``celeryd``)
 
 .. cmdoption:: -f, --logfile
 
-    Path to log file. If no logfile is specified, `stderr` is used.
+    Path to log file.  If no logfile is specified, `stderr` is used.
 
 .. cmdoption:: -l, --loglevel
 
@@ -231,7 +231,7 @@ class worker(Command):
             try:
                 loglevel = mlevel(loglevel)
             except KeyError:  # pragma: no cover
-                self.die('Unknown level {0!r}. Please use one of {1}.'.format(
+                self.die('Unknown level {0!r}.  Please use one of {1}.'.format(
                     loglevel, '|'.join(
                         l for l in LOG_LEVELS if isinstance(l, string_t))))
 

+ 1 - 1
celery/concurrency/prefork.py

@@ -50,7 +50,7 @@ def process_initializer(app, hostname):
     platforms.signals.ignore(*WORKER_SIGIGNORE)
     platforms.set_mp_process_title('celeryd', hostname=hostname)
     # This is for Windows and other platforms not supporting
-    # fork(). Note that init_worker makes sure it's only
+    # fork().  Note that init_worker makes sure it's only
     # run once per process.
     app.loader.init_worker()
     app.loader.init_worker_process()

+ 4 - 4
celery/contrib/abortable.py

@@ -5,7 +5,7 @@ Abortable tasks overview
 =========================
 
 For long-running :class:`Task`'s, it can be desirable to support
-aborting during execution. Of course, these tasks should be built to
+aborting during execution.  Of course, these tasks should be built to
 support abortion specifically.
 
 The :class:`AbortableTask` serves as a base class for all :class:`Task`
@@ -16,7 +16,7 @@ objects that should support abortion by producers.
 
 * Consumers (workers) should periodically check (and honor!) the
   :meth:`is_aborted` method at controlled points in their task's
-  :meth:`run` method. The more often, the better.
+  :meth:`run` method.  The more often, the better.
 
 The necessary intermediate communication is dealt with by the
 :class:`AbortableTask` implementation.
@@ -72,8 +72,8 @@ In the producer:
         result.abort()
 
 After the `result.abort()` call, the task execution isn't
-aborted immediately. In fact, it's not guaranteed to abort at all. Keep
-checking `result.state` status, or call `result.get(timeout=)` to
+aborted immediately.  In fact, it's not guaranteed to abort at all.
+Keep checking `result.state` status, or call `result.get(timeout=)` to
 have it block until the task is finished.
 
 .. note::

+ 1 - 1
celery/contrib/migrate.py

@@ -127,7 +127,7 @@ def move(predicate, connection=None, exchange=None, routing_key=None,
     Arguments:
         predicate (Callable): Filter function used to decide which messages
             to move.  Must accept the standard signature of ``(body, message)``
-            used by Kombu consumer callbacks. If the predicate wants the
+            used by Kombu consumer callbacks.  If the predicate wants the
             message to be moved it must return either:
 
                 1) a tuple of ``(exchange, routing_key)``, or

+ 2 - 2
celery/events/__init__.py

@@ -85,8 +85,8 @@ class EventDispatcher(object):
 
         groups (Sequence[str]): List of groups to send events for.
             :meth:`send` will ignore send requests to groups not in this list.
-            If this is :const:`None`, all events will be sent. Example groups
-            include ``"task"`` and ``"worker"``.
+            If this is :const:`None`, all events will be sent.
+            Example groups include ``"task"`` and ``"worker"``.
 
         enabled (bool): Set to :const:`False` to not actually publish any
             events, making :meth:`send` a no-op.

+ 1 - 1
celery/events/cursesmon.py

@@ -499,7 +499,7 @@ class DisplayThread(threading.Thread):  # pragma: no cover
 def capture_events(app, state, display):  # pragma: no cover
 
     def on_connection_error(exc, interval):
-        print('Connection Error: {0!r}. Retry in {1}s.'.format(
+        print('Connection Error: {0!r}.  Retry in {1}s.'.format(
             exc, interval), file=sys.stderr)
 
     while 1:

+ 1 - 1
celery/events/dumper.py

@@ -2,7 +2,7 @@
 """Utility to dump events to screen.
 
 This is a simple program that dumps events to the console
-as they happen. Think of it like a `tcpdump` for Celery events.
+as they happen.  Think of it like a `tcpdump` for Celery events.
 """
 from __future__ import absolute_import, print_function, unicode_literals
 

+ 2 - 2
celery/platforms.py

@@ -182,7 +182,7 @@ class Pidfile(object):
         try:
             pid = self.read_pid()
         except ValueError as exc:
-            print('Broken pidfile found. Removing it.', file=sys.stderr)
+            print('Broken pidfile found - Removing it.', file=sys.stderr)
             self.remove()
             return True
         if not pid:
@@ -193,7 +193,7 @@ class Pidfile(object):
             os.kill(pid, 0)
         except os.error as exc:
             if exc.errno == errno.ESRCH:
-                print('Stale pidfile exists. Removing it.', file=sys.stderr)
+                print('Stale pidfile exists - Removing it.', file=sys.stderr)
                 self.remove()
                 return True
         return False

+ 1 - 1
celery/result.py

@@ -416,7 +416,7 @@ class AsyncResult(ResultBase):
 
             *SUCCESS*
 
-                The task executed successfully. The :attr:`result` attribute
+                The task executed successfully.  The :attr:`result` attribute
                 then contains the tasks return value.
         """
         return self._get_task_meta()['status']

+ 4 - 4
celery/schedules.py

@@ -27,7 +27,7 @@ __all__ = [
 schedstate = namedtuple('schedstate', ('is_due', 'next'))
 
 CRON_PATTERN_INVALID = """\
-Invalid crontab pattern. Valid range is {min}-{max}. \
+Invalid crontab pattern.  Valid range is {min}-{max}. \
 '{value}' was found.\
 """
 
@@ -174,7 +174,7 @@ class schedule(object):
 
 
 class crontab_parser(object):
-    """Parser for Crontab expressions. Any expression of the form 'groups'
+    """Parser for Crontab expressions.  Any expression of the form 'groups'
     (see BNF grammar below) is accepted and expanded to a set of numbers.
     These numbers represent the units of time that the Crontab needs to
     run on:
@@ -300,7 +300,7 @@ class crontab(schedule):
     periodic task entry to add :manpage:`crontab(5)`-like scheduling.
 
     Like a :manpage:`cron(5)`-job, you can specify units of time of when
-    you'd like the task to execute. It's a reasonably complete
+    you'd like the task to execute.  It's a reasonably complete
     implementation of :command:`cron`'s features, so it should provide a fair
     degree of scheduling needs.
 
@@ -740,7 +740,7 @@ class solar(schedule):
                 start=last_run_at_utc, use_center=self.use_center,
             )
         except self.ephem.CircumpolarError:  # pragma: no cover
-            # Sun won't rise/set today. Check again tomorrow
+            # Sun won't rise/set today.  Check again tomorrow
             # (specifically, after the next anti-transit).
             next_utc = (
                 self.cal.next_antitransit(self.ephem.Sun()) +

+ 2 - 2
celery/utils/collections.py

@@ -495,7 +495,7 @@ class LimitedSet(object):
             raise ValueError('expires cannot be negative!')
 
     def _refresh_heap(self):
-        """Time consuming recreating of heap. Don't run this too often."""
+        """Time consuming recreating of heap.  Don't run this too often."""
         self._heap[:] = [entry for entry in values(self._data)]
         heapify(self._heap)
 
@@ -546,7 +546,7 @@ class LimitedSet(object):
                 self.add(obj)
 
     def discard(self, item):
-        # mark an existing item as removed. If KeyError is not found, pass.
+        # mark an existing item as removed.  If KeyError is not found, pass.
         self._data.pop(item, None)
         self._maybe_refresh_heap()
     pop_value = discard

+ 4 - 4
celery/utils/dispatch/saferef.py

@@ -76,7 +76,7 @@ class BoundMethodWeakref(object):  # pragma: no cover
             class attribute pointing to all live
             BoundMethodWeakref objects indexed by the class's
             `calculate_key(target)` method applied to the target
-            objects. This weak value dictionary is used to
+            objects.  This weak value dictionary is used to
             short-circuit creation so that multiple references
             to the same (object, function) pair produce the
             same BoundMethodWeakref instance.
@@ -222,7 +222,7 @@ class BoundNonDescriptorMethodWeakref(BoundMethodWeakref):  # pragma: no cover
             ...     return 'foo'
             >>> A.bar = foo
 
-        But this shouldn't be a common use case. So, on platforms where methods
+        But this shouldn't be a common use case.  So, on platforms where methods
         aren't descriptors (such as Jython) this implementation has the
         advantage of working in the most cases.
     """
@@ -241,7 +241,7 @@ class BoundNonDescriptorMethodWeakref(BoundMethodWeakref):  # pragma: no cover
             on_delete (Callable): Optional callback which will be called
                 when this weak reference ceases to be valid
                 (i.e. either the object or the function is garbage
-                collected). Should take a single argument,
+                collected).  Should take a single argument,
                 which will be passed a pointer to this object.
         """
         assert getattr(target.__self__, target.__name__) == target
@@ -265,7 +265,7 @@ class BoundNonDescriptorMethodWeakref(BoundMethodWeakref):  # pragma: no cover
             function = self.weak_fun()
             if function is not None:
                 # Using curry() would be another option, but it erases the
-                # "signature" of the function. That is, after a function is
+                # "signature" of the function.  That is, after a function is
                 # curried, the inspect module can't be used to determine how
                 # many arguments the function expects, nor what keyword
                 # arguments it supports, and pydispatcher needs this

+ 9 - 9
celery/utils/dispatch/signal.py

@@ -57,7 +57,7 @@ class Signal(object):  # pragma: no cover
 
         Arguments:
             receiver (Callable): A function or an instance method which is to
-                receive signals. Receivers must be hashable objects.
+                receive signals.  Receivers must be hashable objects.
 
                 if weak is :const:`True`, then receiver must be
                 weak-referenceable (more precisely :func:`saferef.safe_ref()`
@@ -75,11 +75,11 @@ class Signal(object):  # pragma: no cover
 
             weak (bool): Whether to use weak references to the receiver.
                 By default, the module will attempt to use weak references to
-                the receiver objects. If this parameter is false, then strong
+                the receiver objects.  If this parameter is false, then strong
                 references will be used.
 
             dispatch_uid (Hashable): An identifier used to uniquely identify a
-                particular instance of a receiver. This will usually be a
+                particular instance of a receiver.  This will usually be a
                 string, though it may be anything hashable.
         """
         def _handle_options(sender=None, weak=True, dispatch_uid=None):
@@ -121,12 +121,12 @@ class Signal(object):  # pragma: no cover
                    dispatch_uid=None):
         """Disconnect receiver from sender for signal.
 
-        If weak references are used, disconnect needn't be called. The
-        receiver will be removed from dispatch automatically.
+        If weak references are used, disconnect needn't be called.
+        The receiver will be removed from dispatch automatically.
 
         Arguments:
-            receiver (Callable): The registered receiver to disconnect. May be
-                none if `dispatch_uid` is specified.
+            receiver (Callable): The registered receiver to disconnect.
+                May be none if `dispatch_uid` is specified.
 
             sender (Any): The registered sender to disconnect.
 
@@ -154,8 +154,8 @@ class Signal(object):  # pragma: no cover
         have all receivers called if a raises an error.
 
         Arguments:
-            sender (Any): The sender of the signal. Either a specific
-                object or :const:`None`.
+            sender (Any): The sender of the signal.
+                Either a specific object or :const:`None`.
             **named (Any): Named arguments which will be passed to receivers.
 
         Returns:

+ 1 - 1
celery/utils/log.py

@@ -240,7 +240,7 @@ class LoggingProxy(object):
         self.closed = True
 
     def isatty(self):
-        """Always return :const:`False`. Just here for file support."""
+        """Always return :const:`False`.  Just here for file support."""
         return False
 
 

+ 1 - 1
celery/utils/threads.py

@@ -245,7 +245,7 @@ class _LocalStack(object):
 
 @python_2_unicode_compatible
 class LocalManager(object):
-    """Local objects cannot manage themselves. For that you need a local
+    """Local objects cannot manage themselves.  For that you need a local
     manager.  You can pass a local manager multiple locals or add them
     later by appending them to ``manager.locals``.  Every time the manager
     cleans up, it will clean up all the data left in the locals for this

+ 1 - 1
celery/worker/consumer/consumer.py

@@ -65,7 +65,7 @@ Will retry using next failover.\
 """
 
 UNKNOWN_FORMAT = """\
-Received and deleted unknown message. Wrong destination?!?
+Received and deleted unknown message.  Wrong destination?!?
 
 The full contents of the message body was: %s
 """

+ 1 - 1
celery/worker/control.py

@@ -144,7 +144,7 @@ def revoke(state, task_id, terminate=False, signal=None, **kwargs):
 
     Keyword Arguments:
         terminate (bool): Also terminate the process if the task is active.
-        signal (str): Name of signal to use for terminate. E.g. ``KILL``.
+        signal (str): Name of signal to use for terminate.  E.g. ``KILL``.
     """
     # supports list argument since 3.1
     task_ids, task_id = set(maybe_list(task_id) or []), None