Skip to content

Commit

Permalink
Wording
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Oct 1, 2013
1 parent ff42a7f commit cac1d18
Show file tree
Hide file tree
Showing 36 changed files with 76 additions and 73 deletions.
2 changes: 1 addition & 1 deletion celery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _find_option_with_arg(argv, short_opts=None, long_opts=None):
"""Search argv for option specifying its short and longopt
alternatives.
Returns the value of the option if found.
Return the value of the option if found.
"""
for i, arg in enumerate(argv):
Expand Down
6 changes: 3 additions & 3 deletions celery/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def disable_trace():


def shared_task(*args, **kwargs):
"""Task decorator that creates shared tasks,
and returns a proxy that always returns the task from the current apps
"""Create shared tasks (decorator).
Will return a proxy that always takes the task from the current apps
task registry.
This can be used by library authors to create tasks that will work
Expand Down Expand Up @@ -126,7 +126,7 @@ def __inner(fun):
with app._finalize_mutex:
app._task_from_fun(fun, **options)

# Returns a proxy that always gets the task from the current
# Return a proxy that always gets the task from the current
# apps task registry.
def task_by_cons():
app = current_app()
Expand Down
4 changes: 2 additions & 2 deletions celery/app/amqp.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def Queues(self, queues, create_missing=None, ha_policy=None,
)

def Router(self, queues=None, create_missing=None):
"""Returns the current task router."""
"""Return the current task router."""
return _routes.Router(self.routes, queues or self.queues,
self.app.either('CELERY_CREATE_MISSING_QUEUES',
create_missing), app=self.app)
Expand All @@ -386,7 +386,7 @@ def TaskConsumer(self):

@cached_property
def TaskProducer(self):
"""Returns publisher used to send tasks.
"""Return publisher used to send tasks.
You should use `app.send_task` instead.
Expand Down
2 changes: 1 addition & 1 deletion celery/app/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def __reduce_v1__(self):
)

def __reduce_keys__(self):
"""Returns keyword arguments used to reconstruct the object
"""Return keyword arguments used to reconstruct the object
when unpickling."""
return {
'main': self.main,
Expand Down
2 changes: 1 addition & 1 deletion celery/app/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def revoke(self, task_id, destination=None, terminate=False,
def ping(self, destination=None, timeout=1, **kwargs):
"""Ping all (or specific) workers.
Returns answer from alive workers.
Will return the list of answers.
See :meth:`broadcast` for supported keyword arguments.
Expand Down
2 changes: 1 addition & 1 deletion celery/app/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def setup_task_loggers(self, loglevel=None, logfile=None, format=None,
If `logfile` is not specified, then `sys.stderr` is used.
Returns logger object.
Will return the base task logger object.
"""
loglevel = mlevel(loglevel or self.loglevel)
Expand Down
2 changes: 1 addition & 1 deletion celery/app/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ def AsyncResult(self, task_id, **kwargs):
task_name=self.name, **kwargs)

def subtask(self, args=None, *starargs, **starkwargs):
"""Returns :class:`~celery.subtask` object for
"""Return :class:`~celery.subtask` object for
this task, wrapping arguments and execution options
for a single task invocation."""
starkwargs.setdefault('app', self.app)
Expand Down
6 changes: 3 additions & 3 deletions celery/app/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@


def task_has_custom(task, attr):
"""Returns true if the task or one of its bases
"""Return true if the task or one of its bases
defines ``attr`` (excluding the one in BaseTask)."""
return mro_lookup(task.__class__, attr, stop=(BaseTask, object),
monkey_patched=['celery.app.task'])
Expand Down Expand Up @@ -125,7 +125,7 @@ def handle_failure(self, task, store_errors=True):
def build_tracer(name, task, loader=None, hostname=None, store_errors=True,
Info=TraceInfo, eager=False, propagate=False, app=None,
IGNORE_STATES=IGNORE_STATES):
"""Returns a function that traces task execution; catches all
"""Return a function that traces task execution; catches all
exceptions and updates result backend with the state and result
If the call was successful, it saves the result to the task result
Expand All @@ -138,7 +138,7 @@ def build_tracer(name, task, loader=None, hostname=None, store_errors=True,
If the call results in an exception, it saves the exception as the task
result, and sets the task state to `"FAILURE"`.
Returns a function that takes the following arguments:
Return a function that takes the following arguments:
:param uuid: The id of the task.
:param args: List of positional args to pass on to the function.
Expand Down
8 changes: 4 additions & 4 deletions celery/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def CELERY_TIMEZONE(self):
return self.first('CELERY_TIMEZONE', 'TIME_ZONE')

def without_defaults(self):
"""Returns the current configuration, but without defaults."""
"""Return the current configuration, but without defaults."""
# the last stash is the default settings, so just skip that
return Settings({}, self._order[:-1])

Expand All @@ -96,7 +96,7 @@ def find_value_for_key(self, name, namespace='celery'):
return self.get_by_parts(*self.find_option(name, namespace)[:-1])

def get_by_parts(self, *parts):
"""Returns the current value for setting specified as a path.
"""Return the current value for setting specified as a path.
Example::
Expand All @@ -107,7 +107,7 @@ def get_by_parts(self, *parts):
return self['_'.join(part for part in parts if part)]

def humanize(self):
"""Returns a human readable string showing changes to the
"""Return a human readable string showing changes to the
configuration."""
return '\n'.join(
'{0}: {1}'.format(key, pretty(value, width=50))
Expand Down Expand Up @@ -164,7 +164,7 @@ def maybe_censor(key, value):


def bugreport(app):
"""Returns a string containing information useful in bug reports."""
"""Return a string containing information useful in bug reports."""
import billiard
import celery
import kombu
Expand Down
2 changes: 1 addition & 1 deletion celery/backends/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@


def unpickle_backend(cls, args, kwargs):
"""Returns an unpickled backend."""
"""Return an unpickled backend."""
from celery import current_app
return cls(*args, app=current_app._get_current_object(), **kwargs)

Expand Down
2 changes: 1 addition & 1 deletion celery/beat.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _default_now(self):
return self.schedule.now() if self.schedule else self.app.now()

def _next_instance(self, last_run_at=None):
"""Returns a new instance of the same class, but with
"""Return a new instance of the same class, but with
its date and count fields updated."""
return self.__class__(**dict(
self,
Expand Down
2 changes: 1 addition & 1 deletion celery/bin/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def parse_doc(self, doc):
return options

def with_pool_option(self, argv):
"""Returns tuple of ``(short_opts, long_opts)`` if the command
"""Return tuple of ``(short_opts, long_opts)`` if the command
supports a pool argument, and used to monkey patch eventlet/gevent
environments as early as possible.
Expand Down
2 changes: 1 addition & 1 deletion celery/bin/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def run_from_argv(self, prog_name, argv=None, command=None):
def maybe_detach(self, argv, dopts=['-D', '--detach']):
if any(arg in argv for arg in dopts):
argv = [v for v in argv if v not in dopts]
# never returns
# will never return
detached_celeryd(self.app).execute_from_commandline(argv)
raise SystemExit(0)

Expand Down
6 changes: 3 additions & 3 deletions celery/contrib/abortable.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class AbortableAsyncResult(AsyncResult):
"""

def is_aborted(self):
"""Returns :const:`True` if the task is (being) aborted."""
"""Return :const:`True` if the task is (being) aborted."""
return self.state == ABORTED

def abort(self):
Expand Down Expand Up @@ -146,14 +146,14 @@ class AbortableTask(Task):
abstract = True

def AsyncResult(self, task_id):
"""Returns the accompanying AbortableAsyncResult instance."""
"""Return the accompanying AbortableAsyncResult instance."""
return AbortableAsyncResult(task_id, backend=self.backend)

def is_aborted(self, **kwargs):
"""Checks against the backend whether this
:class:`AbortableAsyncResult` is :const:`ABORTED`.
Always returns :const:`False` in case the `task_id` parameter
Always return :const:`False` in case the `task_id` parameter
refers to a regular (non-abortable) :class:`Task`.
Be aware that invoking this method will cause a hit in the
Expand Down
2 changes: 1 addition & 1 deletion celery/contrib/rdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def set_quit(self):


def debugger():
"""Returns the current debugger instance (if any),
"""Return the current debugger instance (if any),
or creates a new one."""
rdb = _current[0]
if rdb is None or not rdb.active:
Expand Down
4 changes: 2 additions & 2 deletions celery/datastructures.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def topsort(self):
return [t[0] for t in graph._khan62()]

def valency_of(self, obj):
"""Returns the valency (degree) of a vertex in the graph."""
"""Return the valency (degree) of a vertex in the graph."""
try:
l = [len(self[obj])]
except KeyError:
Expand All @@ -207,7 +207,7 @@ def update(self, it):
self.add_edge(obj, dep)

def edges(self):
"""Returns generator that yields for all edges in the graph."""
"""Return generator that yields for all edges in the graph."""
return (obj for obj, adj in items(self) if adj)

def _khan62(self):
Expand Down
8 changes: 4 additions & 4 deletions celery/events/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def clear(self, ready=True):
def get_or_create_worker(self, hostname, **kwargs):
"""Get or create worker by hostname.
Returns tuple of ``(worker, was_created)``.
Return tuple of ``(worker, was_created)``.
"""
try:
worker = self.workers[hostname]
Expand Down Expand Up @@ -415,7 +415,7 @@ def tasks_by_time(self, limit=None):
def tasks_by_type(self, name, limit=None):
"""Get all tasks by type.
Returns a list of ``(uuid, Task)`` tuples.
Return a list of ``(uuid, Task)`` tuples.
"""
return islice(
Expand All @@ -435,11 +435,11 @@ def tasks_by_worker(self, hostname, limit=None):
)

def task_types(self):
"""Returns a list of all seen task types."""
"""Return a list of all seen task types."""
return list(sorted(set(task.name for task in values(self.tasks))))

def alive_workers(self):
"""Returns a list of (seemingly) alive workers."""
"""Return a list of (seemingly) alive workers."""
return [w for w in values(self.workers) if w.alive]

def __repr__(self):
Expand Down
10 changes: 5 additions & 5 deletions celery/platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@


def pyimplementation():
"""Returns string identifying the current Python implementation."""
"""Return string identifying the current Python implementation."""
if hasattr(_platform, 'python_implementation'):
return _platform.python_implementation()
elif sys.platform.startswith('java'):
Expand All @@ -80,7 +80,7 @@ class LockFailed(Exception):


def get_fdmax(default=None):
"""Returns the maximum number of open file descriptors
"""Return the maximum number of open file descriptors
on this system.
:keyword default: Value returned if there's no file
Expand Down Expand Up @@ -120,7 +120,7 @@ def acquire(self):
__enter__ = acquire

def is_locked(self):
"""Returns true if the pid lock exists."""
"""Return true if the pid lock exists."""
return os.path.exists(self.path)

def release(self, *args):
Expand All @@ -129,7 +129,7 @@ def release(self, *args):
__exit__ = release

def read_pid(self):
"""Reads and returns the current pid."""
"""Read and return the current pid."""
with ignore_errno('ENOENT'):
with open(self.path, 'r') as fh:
line = fh.readline()
Expand Down Expand Up @@ -540,7 +540,7 @@ def reset_alarm(self):
return _signal.alarm(0)

def supported(self, signal_name):
"""Returns true value if ``signal_name`` exists on this platform."""
"""Return true value if ``signal_name`` exists on this platform."""
try:
return self.signum(signal_name)
except AttributeError:
Expand Down
4 changes: 2 additions & 2 deletions celery/security/certificate.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ def has_expired(self):
return self._cert.has_expired()

def get_serial_number(self):
"""Returns the certificates serial number."""
"""Return the serial number in the certificate."""
return self._cert.get_serial_number()

def get_issuer(self):
"""Returns issuer (CA) as a string"""
"""Return issuer (CA) as a string"""
return ' '.join(bytes_to_str(x[1]) for x in
self._cert.get_issuer().get_components())

Expand Down
2 changes: 1 addition & 1 deletion celery/task/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def __init__(self, url, method, task_kwargs, **kwargs):
self.logger = kwargs.get('logger') or logger

def make_request(self, url, method, params):
"""Makes an HTTP request and returns the response."""
"""Perform HTTP request and return the response."""
request = Request(url, params)
for key, val in items(self.http_headers):
request.add_header(key, val)
Expand Down
2 changes: 1 addition & 1 deletion celery/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@


def worker_direct(hostname):
"""Returns :class:`kombu.Queue` that is a direct route to
"""Return :class:`kombu.Queue` that is a direct route to
a worker by hostname.
:param hostname: The fully qualified node name of a worker
Expand Down
4 changes: 2 additions & 2 deletions celery/utils/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ def humanbytes(s):


def mem_rss():
"""Returns RSS memory usage as a humanized string."""
"""Return RSS memory usage as a humanized string."""
p = ps()
if p is not None:
return humanbytes(p.get_memory_info().rss)


def ps():
"""Returns the global :class:`psutil.Process` instance,
"""Return the global :class:`psutil.Process` instance,
or :const:`None` if :mod:`psutil` is not installed."""
global _process
if _process is None and Process is not None:
Expand Down
4 changes: 2 additions & 2 deletions celery/utils/dispatch/saferef.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def __call__(self):
"""Return a strong reference to the bound method
If the target cannot be retrieved, then will
return None, otherwise returns a bound instance
return None, otherwise return a bound instance
method for our object and function.
Note:
Expand Down Expand Up @@ -253,7 +253,7 @@ def __call__(self):
"""Return a strong reference to the bound method
If the target cannot be retrieved, then will
return None, otherwise returns a bound instance
return None, otherwise return a bound instance
method for our object and function.
Note:
Expand Down
Loading

0 comments on commit cac1d18

Please sign in to comment.