Skip to content

Commit

Permalink
__all__ is everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Sep 12, 2013
1 parent 5da734d commit 154b574
Show file tree
Hide file tree
Showing 109 changed files with 342 additions and 51 deletions.
2 changes: 1 addition & 1 deletion celery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
__homepage__ = 'http://celeryproject.org'
__docformat__ = 'restructuredtext'
__all__ = [
'celery', 'bugreport', 'shared_task', 'task',
'Celery', 'bugreport', 'shared_task', 'task',
'current_app', 'current_task',
'chain', 'chord', 'chunks', 'group', 'subtask',
'xmap', 'xstarmap', 'uuid', 'version', '__version__',
Expand Down
2 changes: 2 additions & 0 deletions celery/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from os.path import basename

__all__ = ['main']

DEPRECATED_FMT = """
The {old!r} command is deprecated, please use {new!r} instead:
Expand Down
3 changes: 3 additions & 0 deletions celery/_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
from celery.local import Proxy
from celery.utils.threads import LocalStack

__all__ = ['set_default_app', 'get_current_app', 'get_current_task',
'get_current_worker_task', 'current_app', 'current_task']

#: Global default app used when no current app.
default_app = None

Expand Down
8 changes: 6 additions & 2 deletions celery/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from celery.local import Proxy
from celery import _state
from celery._state import ( # noqa
from celery._state import (
set_default_app,
get_current_app as current_app,
get_current_task as current_task,
Expand All @@ -23,7 +23,11 @@
from celery.utils import gen_task_name

from .builtins import shared_task as _shared_task
from .base import Celery, AppPickler # noqa
from .base import Celery, AppPickler

__all__ = ['Celery', 'AppPickler', 'default_app', 'app_or_default',
'bugreport', 'enable_trace', 'disable_trace', 'shared_task',
'set_default_app', 'current_app', 'current_task']

#: Proxy always returning the app set as default.
default_app = Proxy(lambda: _state.default_app)
Expand Down
2 changes: 2 additions & 0 deletions celery/app/amqp.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
from . import app_or_default
from . import routes as _routes

__all__ = ['AMQP', 'Queues', 'TaskProducer', 'TaskConsumer']

#: Human readable queue declaration.
QUEUE_FORMAT = """
.> {0.name:<16} exchange={0.exchange.name}({0.exchange.type}) \
Expand Down
8 changes: 5 additions & 3 deletions celery/app/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
_first_match = firstmethod('annotate')
_first_match_any = firstmethod('annotate_any')


def resolve_all(anno, task):
return (x for x in (_first_match(anno, task), _first_match_any(anno)) if x)
__all__ = ['MapAnnotation', 'prepare', 'resolve_all']


class MapAnnotation(dict):
Expand Down Expand Up @@ -54,3 +52,7 @@ def expand_annotation(annotation):
elif not isinstance(annotations, (list, tuple)):
annotations = (annotations, )
return [expand_annotation(anno) for anno in annotations]


def resolve_all(anno, task):
return (x for x in (_first_match(anno, task), _first_match_any(anno)) if x)
2 changes: 2 additions & 0 deletions celery/app/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
AppPickler, Settings, bugreport, _unpickle_app, _unpickle_app_v2, appstr,
)

__all__ = ['Celery']

_EXECV = os.environ.get('FORKED_BY_MULTIPROCESSING')
BUILTIN_FIXUPS = frozenset([
'celery.fixups.django:fixup',
Expand Down
2 changes: 2 additions & 0 deletions celery/app/builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from celery._state import get_current_worker_task
from celery.utils import uuid

__all__ = ['shared_task', 'load_shared_tasks']

#: global list of functions defining tasks that should be
#: added to all apps.
_shared_tasks = []
Expand Down
2 changes: 2 additions & 0 deletions celery/app/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

from celery.exceptions import DuplicateNodenameWarning

__all__ = ['Inspect', 'Control', 'flatten_reply']

W_DUPNODE = """\
Received multiple replies from node name {0!r}.
Please make sure you give each node a unique nodename using the `-n` option.\
Expand Down
3 changes: 2 additions & 1 deletion celery/app/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
from celery.utils import strtobool
from celery.utils.functional import memoize

__all__ = ['Option', 'NAMESPACES', 'flatten', 'find']

is_jython = sys.platform.startswith('java')
is_pypy = hasattr(sys, 'pypy_version_info')

Expand Down Expand Up @@ -63,7 +65,6 @@ def __repr__(self):
return '<Option: type->{0} default->{1!r}>'.format(self.type,
self.default)


NAMESPACES = {
'BROKER': {
'URL': Option(None, type='string'),
Expand Down
2 changes: 2 additions & 0 deletions celery/app/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
)
from celery.utils.term import colored

__all__ = ['TaskFormatter', 'Logging']

MP_LOG = os.environ.get('MP_LOG', False)


Expand Down
2 changes: 2 additions & 0 deletions celery/app/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from celery.exceptions import NotRegistered
from celery.five import items

__all__ = ['TaskRegistry']


class TaskRegistry(dict):
NotRegistered = NotRegistered
Expand Down
2 changes: 2 additions & 0 deletions celery/app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from celery.utils.functional import firstmethod, mlazy
from celery.utils.imports import instantiate

__all__ = ['MapRoute', 'Router', 'prepare']

_first_route = firstmethod('route_for_task')


Expand Down
2 changes: 2 additions & 0 deletions celery/app/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
from .registry import _unpickle_task_v2
from .utils import appstr

__all__ = ['Context', 'Task']

#: extracts attributes related to publishing a message from an object.
extract_exec_options = mattrgetter(
'queue', 'routing_key', 'exchange', 'priority', 'expires',
Expand Down
3 changes: 3 additions & 0 deletions celery/app/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
get_pickleable_etype,
)

__all__ = ['TraceInfo', 'build_tracer', 'trace_task', 'eager_trace_task',
'setup_worker_optimizations', 'reset_worker_optimizations']

_logger = get_logger(__name__)

send_prerun = signals.task_prerun.send
Expand Down
2 changes: 2 additions & 0 deletions celery/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

from .defaults import find

__all__ = ['appstr', 'Settings', 'filter_hidden_settings', 'bugreport']

#: Format used to generate bugreport information.
BUGREPORT_INFO = """
software -> celery:{celery_v} kombu:{kombu_v} py:{py_v}
Expand Down
2 changes: 2 additions & 0 deletions celery/apps/beat.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from celery.utils.log import LOG_LEVELS, get_logger
from celery.utils.timeutils import humanize_seconds

__all__ = ['Beat']

STARTUP_INFO_FMT = """
Configuration ->
. broker -> {conninfo}
Expand Down
2 changes: 2 additions & 0 deletions celery/apps/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
from celery.utils.text import pluralize
from celery.worker import WorkController

__all__ = ['Worker']

logger = get_logger(__name__)
is_jython = sys.platform.startswith('java')
is_pypy = hasattr(sys, 'pypy_version_info')
Expand Down
2 changes: 2 additions & 0 deletions celery/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
from celery.utils.imports import symbol_by_name
from celery.utils.functional import memoize

__all__ = ['get_backend_cls', 'get_backend_by_url']

UNKNOWN_BACKEND = """\
Unknown result backend: {0!r}. Did you spell that correctly? ({1!r})\
"""
Expand Down
2 changes: 2 additions & 0 deletions celery/backends/amqp.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

from .base import BaseBackend

__all__ = ['BacklogLimitExceeded', 'AMQPBackend']

logger = get_logger(__name__)


Expand Down
2 changes: 2 additions & 0 deletions celery/backends/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
create_exception_cls,
)

__all__ = ['BaseBackend', 'KeyValueStoreBackend', 'DisabledBackend']

EXCEPTION_ABLE_CODECS = frozenset(['pickle', 'yaml'])
PY3 = sys.version_info >= (3, 0)

Expand Down
2 changes: 2 additions & 0 deletions celery/backends/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

from .base import KeyValueStoreBackend

__all__ = ['CacheBackend']

_imp = [None]

REQUIRES_BACKEND = """\
Expand Down
2 changes: 2 additions & 0 deletions celery/backends/cassandra.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

from .base import BaseBackend

__all__ = ['CassandraBackend']

logger = get_logger(__name__)


Expand Down
2 changes: 2 additions & 0 deletions celery/backends/couchbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

from .base import KeyValueStoreBackend

__all__ = ['CouchBaseBackend']


class CouchBaseBackend(KeyValueStoreBackend):
bucket = 'default'
Expand Down
2 changes: 2 additions & 0 deletions celery/backends/database/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from .models import Task, TaskSet
from .session import ResultSession

__all__ = ['DatabaseBackend']


def _sqlalchemy_installed():
try:
Expand Down
2 changes: 2 additions & 0 deletions celery/backends/database/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

from .session import ResultModelBase

__all__ = ['Task', 'TaskSet']


class Task(ResultModelBase):
"""Task result/status."""
Expand Down
2 changes: 2 additions & 0 deletions celery/backends/database/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
_ENGINES = {}
_SESSIONS = {}

__all__ = ['ResultSession', 'get_engine', 'create_session']


def get_engine(dburi, **kwargs):
if dburi not in _ENGINES:
Expand Down
2 changes: 2 additions & 0 deletions celery/backends/mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

from .base import BaseBackend

__all__ = ['MongoBackend']


class Bunch(object):

Expand Down
2 changes: 2 additions & 0 deletions celery/backends/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
redis = None # noqa
ConnectionError = None # noqa

__all__ = ['RedisBackend']

REDIS_MISSING = """\
You need to install the redis library in order to use \
the Redis result store backend."""
Expand Down
2 changes: 2 additions & 0 deletions celery/backends/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from celery import current_task
from celery.backends import amqp

__all__ = ['RPCBackend']


class RPCBackend(amqp.AMQPBackend):

Expand Down
3 changes: 3 additions & 0 deletions celery/beat.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
from .utils.timeutils import humanize_seconds
from .utils.log import get_logger

__all__ = ['SchedulingError', 'ScheduleEntry', 'Scheduler',
'PersistentScheduler', 'Service', 'EmbeddedService']

logger = get_logger(__name__)
debug, info, error, warning = (logger.debug, logger.info,
logger.error, logger.warning)
Expand Down
4 changes: 3 additions & 1 deletion celery/bin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import absolute_import

from .base import Option # noqa
from .base import Option

__all__ = ['Option']
2 changes: 2 additions & 0 deletions celery/bin/amqp.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
from celery.five import string_t
from celery.utils import strtobool

__all__ = ['AMQPAdmin', 'AMQShell', 'Spec', 'amqp']

# Map to coerce strings to other types.
COERCE = {bool: strtobool}

Expand Down
3 changes: 3 additions & 0 deletions celery/bin/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@
find_rst_ref = re.compile(r':\w+:`(.+?)`')
find_sformat = re.compile(r'%(\w)')

__all__ = ['Error', 'UsageError', 'Extensions', 'HelpFormatter',
'Command', 'Option', 'daemon_options']


class Error(Exception):
status = EX_FAILURE
Expand Down
2 changes: 2 additions & 0 deletions celery/bin/beat.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@

from celery.bin.base import Command, Option, daemon_options

__all__ = ['beat']


class beat(Command):
"""Start the beat periodic task scheduler.
Expand Down
2 changes: 2 additions & 0 deletions celery/bin/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
from celery.bin.graph import graph
from celery.bin.worker import worker

__all__ = ['CeleryCommand', 'main']

HELP = """
---- -- - - ---- Commands- -------------- --- ------------
Expand Down
2 changes: 2 additions & 0 deletions celery/bin/celeryd_detach.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

from celery.bin.base import daemon_options, Option

__all__ = ['detached_celeryd', 'detach']

logger = get_logger(__name__)

OPTION_LIST = daemon_options(default_pidfile='celeryd.pid') + (
Expand Down
2 changes: 2 additions & 0 deletions celery/bin/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
from celery.platforms import detached, set_process_title, strargv
from celery.bin.base import Command, Option, daemon_options

__all__ = ['events']


class events(Command):
"""Event-stream utilities.
Expand Down
2 changes: 2 additions & 0 deletions celery/bin/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

from .base import Command

__all__ = ['graph']


class graph(Command):
args = """<TYPE> [arguments]
Expand Down
2 changes: 2 additions & 0 deletions celery/bin/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@
from celery.utils import term, nodesplit
from celery.utils.text import pluralize

__all__ = ['MultiTool']

SIGNAMES = set(sig for sig in dir(signal)
if sig.startswith('SIG') and '_' not in sig)
SIGMAP = dict((getattr(signal, name), name) for name in SIGNAMES)
Expand Down
Loading

0 comments on commit 154b574

Please sign in to comment.