Skip to content

Commit

Permalink
Fixes typo kill -> _kill
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Apr 21, 2011
1 parent 440b46b commit 154431f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
22 changes: 10 additions & 12 deletions celery/app/amqp.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from celery import signals
from celery.utils import gen_unique_id, textindent
from celery.utils import promise, maybe_promise
from celery.utils.compat import UserDict

#: List of known options to a Kombu producers send method.
#: Used to extract the message related options out of any `dict`.
Expand All @@ -46,7 +45,7 @@ def extract_msg_options(options, keep=MSG_OPTIONS):
return dict((name, options.get(name)) for name in keep)


class Queues(UserDict):
class Queues(dict):
"""Queue name⇒ declaration mapping.
Celery will consult this mapping to find the options
Expand All @@ -60,7 +59,7 @@ class Queues(UserDict):
_consume_from = None

def __init__(self, queues):
self.data = {}
dict.__init__(self)
for queue_name, options in (queues or {}).items():
self.add(queue_name, **options)

Expand Down Expand Up @@ -90,12 +89,10 @@ def options(self, exchange, routing_key,

def format(self, indent=0, indent_first=True):
"""Format routing table into string for log dumps."""
queues = self
if self._consume_from is not None:
queues = self._consume_from
active = self.consume_from
info = [QUEUE_FORMAT.strip() % dict(
name=(name + ":").ljust(12), **config)
for name, config in sorted(queues.items())]
for name, config in sorted(active.iteritems())]
if indent_first:
return textindent("\n".join(info), indent)
return info[0] + "\n" + textindent("\n".join(info[1:]), indent)
Expand Down Expand Up @@ -125,6 +122,12 @@ def select_subset(self, wanted, create_missing=True):
self._consume_from = acc
self.update(acc)

@property
def consume_from(self):
if self._consume_from is not None:
return self._consume_from
return self

@classmethod
def with_defaults(cls, queues, default_exchange, default_exchange_type):
"""Alternate constructor that adds default exchange and
Expand All @@ -136,11 +139,6 @@ def with_defaults(cls, queues, default_exchange, default_exchange_type):
opts.setdefault("routing_key", opts.get("binding_key"))
return cls(queues)

@property
def consume_from(self):
if self._consume_from is not None:
return self._consume_from
return self


class TaskPublisher(messaging.Publisher):
Expand Down
2 changes: 1 addition & 1 deletion celery/concurrency/processes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def on_terminate(self):
self._pool = None

def terminate_job(self, pid, signal=None):
kill(pid, signal or _signal.SIGTERM)
_kill(pid, signal or _signal.SIGTERM)

def grow(self, n=1):
return self._pool.grow(n)
Expand Down
2 changes: 1 addition & 1 deletion celery/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def unregister(self, name):

def filter_types(self, type):
"""Return all tasks of a specific type."""
return dict((name, task) for name, task in self.data.iteritems()
return dict((name, task) for name, task in self.iteritems()
if task.type == type)

def __getitem__(self, key):
Expand Down
2 changes: 1 addition & 1 deletion celery/tests/test_task/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def assertRegisterUnregisterFunc(self, r, task, task_name):

def test_task_registry(self):
r = registry.TaskRegistry()
self.assertIsInstance(r dict,
self.assertIsInstance(r, dict,
"TaskRegistry is mapping")

self.assertRegisterUnregisterCls(r, TestTask)
Expand Down

0 comments on commit 154431f

Please sign in to comment.