Skip to content

Commit

Permalink
Cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Jan 25, 2012
1 parent 3401d63 commit eb24813
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
16 changes: 8 additions & 8 deletions celery/abstract.py
Expand Up @@ -27,8 +27,8 @@ class Namespace(object):
mapping of unclaimed components. The components will be
claimed when the namespace they belong to is created.
:keyword name: Set the name of this namespace.
:keyword app: Set the Celery app for this namespace.
:keyword name: Set the name of this namespace.
:keyword app: Set the Celery app for this namespace.
"""
name = None
Expand Down Expand Up @@ -67,23 +67,23 @@ def apply(self, parent, **kwargs):
self.components = self._claim()
self._debug("Building boot step graph.")
self.boot_steps = [self.bind_component(name, parent, **kwargs)
for name in self._finalize_boot_steps()]
for name in self._finalize_boot_steps()]
self._debug("New boot order: %r" % (
[c.name for c in self.boot_steps], ))

for component in self.boot_steps:
component.include(parent)
return self

def import_module(self, module):
return import_module(module)

def bind_component(self, name, parent, **kwargs):
"""Bind component to parent object and this namespace."""
comp = self[name](parent, **kwargs)
comp.namespace = self
return comp

def import_module(self, module):
return import_module(module)

def __getitem__(self, name):
return self.components[name]

Expand Down Expand Up @@ -132,10 +132,10 @@ def __new__(cls, name, bases, attrs):
class Component(object):
"""A component.
The :meth:`__init__` method called when the component
The :meth:`__init__` method is called when the component
is bound to a parent object, and can as such be used
to initialize attributes in the parent object at
parent-instantiaton time.
parent instantiation-time.
"""
__metaclass__ = ComponentType
Expand Down
12 changes: 6 additions & 6 deletions celery/app/__init__.py
Expand Up @@ -29,6 +29,7 @@


class AppPickler(object):
"""Default application pickler/unpickler."""

def __call__(self, cls, *args):
kwargs = self.build_kwargs(*args)
Expand Down Expand Up @@ -123,15 +124,14 @@ def Beat(self, **kwargs):

def TaskSet(self, *args, **kwargs):
"""Create new :class:`~celery.task.sets.TaskSet`."""
from ..task.sets import TaskSet
kwargs["app"] = self
return TaskSet(*args, **kwargs)
return instantiate("celery.task.sets:TaskSet",
app=self, *args, **kwargs)

def worker_main(self, argv=None):
"""Run :program:`celeryd` using `argv`. Uses :data:`sys.argv`
if `argv` is not specified."""
from ..bin.celeryd import WorkerCommand
return WorkerCommand(app=self).execute_from_commandline(argv)
return instantiate("celery.bin.celeryd:WorkerCommand", app=self) \
.execute_from_commandline(argv)

def task(self, *args, **options):
"""Decorator to create a task class out of any callable.
Expand Down Expand Up @@ -175,7 +175,7 @@ def _create_task_cls(fun):
"run": staticmethod(fun),
"__doc__": fun.__doc__,
"__module__": fun.__module__}, **options))()
return registry.tasks[T.name] # global instance.
return registry.tasks[T.name] # global instance.

return _create_task_cls

Expand Down
2 changes: 1 addition & 1 deletion celery/app/amqp.py
Expand Up @@ -24,7 +24,7 @@
#: List of known options to a Kombu producers send method.
#: Used to extract the message related options out of any `dict`.
MSG_OPTIONS = ("mandatory", "priority", "immediate", "routing_key",
"serializer", "delivery_mode", "compression")
"serializer", "delivery_mode", "compression")

#: Human readable queue declaration.
QUEUE_FORMAT = """
Expand Down
12 changes: 6 additions & 6 deletions celery/app/base.py
Expand Up @@ -28,7 +28,7 @@
from .defaults import DEFAULTS, find_deprecated_settings, find

import kombu
if kombu.VERSION < (1, 1, 0):
if kombu.VERSION < (2, 0):
raise ImportError("Celery requires Kombu version 1.1.0 or higher.")

BUGREPORT_INFO = """
Expand Down Expand Up @@ -305,9 +305,9 @@ def merge(self, l, r):

def _get_backend(self):
from ..backends import get_backend_cls
backend_cls = self.backend_cls or self.conf.CELERY_RESULT_BACKEND
backend_cls = get_backend_cls(backend_cls, loader=self.loader)
return backend_cls(app=self)
return get_backend_cls(
self.backend_cls or self.conf.CELERY_RESULT_BACKEND,
loader=self.loader)(app=self)

def _get_config(self):
return Settings({}, [self.prepare_config(self.loader.conf),
Expand Down Expand Up @@ -338,8 +338,8 @@ def pool(self):
register_after_fork(self, self._after_fork)
except ImportError:
pass
limit = self.conf.BROKER_POOL_LIMIT
self._pool = self.broker_connection().Pool(limit)
self._pool = self.broker_connection().Pool(
limit=self.conf.BROKER_POOL_LIMIT)
return self._pool

@cached_property
Expand Down
2 changes: 0 additions & 2 deletions funtests/suite/test_basic.py
Expand Up @@ -12,11 +12,9 @@
from celery.tests.functional import tasks
from celery.tests.functional.case import WorkerCase


from celery.task.control import broadcast



class test_basic(WorkerCase):

def test_started(self):
Expand Down

0 comments on commit eb24813

Please sign in to comment.