Browse Source

Cosmetics

Ask Solem 14 years ago
parent
commit
7da86c7ba0
2 changed files with 9 additions and 6 deletions
  1. 8 5
      celery/app/amqp.py
  2. 1 1
      examples/app/myapp.py

+ 8 - 5
celery/app/amqp.py

@@ -14,7 +14,7 @@ from UserDict import UserDict
 
 from celery import routes
 from celery import signals
-from celery.utils import gen_unique_id, mitemgetter, textindent
+from celery.utils import gen_unique_id, textindent
 
 from kombu import compat as messaging
 from kombu import BrokerConnection
@@ -30,14 +30,17 @@ BROKER_FORMAT = """\
 %(transport)s://%(userid)s@%(hostname)s%(port)s%(virtual_host)s\
 """
 
-get_msg_options = mitemgetter(*MSG_OPTIONS)
-extract_msg_options = lambda d: dict(zip(MSG_OPTIONS, get_msg_options(d)))
-
-
+#: Set to :cosnt:`True` when the configured queues has been declared.
 _queues_declared = False
+
+#: Set of exchange names that has already been declared.
 _exchanges_declared = set()
 
 
+def extract_msg_options(options, keep=MSG_OPTIONS):
+    return dict((name, options.get(name) for name in keep))
+
+
 class Queues(UserDict):
 
     def __init__(self, queues):

+ 1 - 1
examples/app/myapp.py

@@ -23,7 +23,7 @@ celery.conf.update(BROKER_HOST="localhost")
 
 
 @celery.task
-def add(x, y, **kwargs):
+def add(x, y):
     return x + y
 
 if __name__ == "__main__":