Procházet zdrojové kódy

PEP8ify + pyflakes

Ask Solem před 15 roky
rodič
revize
94de4a3d6a

+ 0 - 3
celery/backends/base.py

@@ -127,9 +127,6 @@ class BaseBackend(object):
                 "get_taskset is not supported by this backend.")
 
 
-
-
-
 class KeyValueStoreBackend(BaseBackend):
 
     capabilities = ["ResultStore"]

+ 1 - 1
celery/messaging.py

@@ -5,7 +5,7 @@ Sending and Receiving Messages
 """
 import socket
 
-from carrot.connection import DjangoBrokerConnection, AMQPConnectionException
+from carrot.connection import DjangoBrokerConnection
 from carrot.messaging import Publisher, Consumer, ConsumerSet
 from billiard.utils.functional import wraps
 

+ 1 - 5
celery/task/http.py

@@ -7,8 +7,7 @@ except ImportError:
 from urllib import urlencode
 from urlparse import urlparse
 
-from anyjson import serialize, deserialize
-from billiard.utils.functional import wraps
+from anyjson import deserialize
 
 from celery import __version__ as celery_version
 from celery.task.base import Task as BaseTask
@@ -64,7 +63,6 @@ class MutableURL(object):
         self.url = urlparse(url)
         self._query = dict(parse_qsl(self.url.query))
 
-
     def __str__(self):
         u = self.url
         query = urlencode(utf8dict(self.query.items()))
@@ -208,5 +206,3 @@ class URL(MutableURL):
 
     def post_async(self, **kwargs):
         return self.dispatcher.delay(str(self), "POST", **kwargs)
-
-

+ 2 - 1
celery/tests/test_models.py

@@ -53,7 +53,8 @@ class TestModels(unittest.TestCase):
         self.assertTrue(m1.taskset_id)
         self.assertTrue(isinstance(m1.date_done, datetime))
 
-        self.assertEquals(TaskSetMeta.objects.get_taskset(m1.taskset_id).taskset_id,
+        self.assertEquals(
+                TaskSetMeta.objects.get_taskset(m1.taskset_id).taskset_id,
                 m1.taskset_id)
 
         # Have to avoid save() because it applies the auto_now=True.

+ 2 - 1
celery/views.py

@@ -27,7 +27,8 @@ def task_view(task):
 
         result = task.apply_async(kwargs=kwargs)
         response_data = {"ok": "true", "task_id": result.task_id}
-        return HttpResponse(JSON_dump(response_data), mimetype="application/json")
+        return HttpResponse(JSON_dump(response_data),
+                            mimetype="application/json")
 
     return _applier
 

+ 2 - 1
celery/worker/listener.py

@@ -3,6 +3,7 @@ import warnings
 from datetime import datetime
 
 from dateutil.parser import parse as parse_iso8601
+from carrot.connection import AMQPConnectionException
 
 from celery import conf
 from celery import signals
@@ -12,7 +13,7 @@ from celery.worker.revoke import revoked
 from celery.worker.control import ControlDispatch
 from celery.worker.heartbeat import Heart
 from celery.events import EventDispatcher
-from celery.messaging import establish_connection, AMQPConnectionException
+from celery.messaging import establish_connection
 from celery.messaging import get_consumer_set, BroadcastConsumer
 from celery.exceptions import NotRegistered
 from celery.datastructures import SharedCounter

+ 3 - 1
examples/celery_http_gateway/manage.py

@@ -4,7 +4,9 @@ try:
     import settings # Assumed to be in the same directory.
 except ImportError:
     import sys
-    sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
+    sys.stderr.write(
+        "Error: Can't find the file 'settings.py' in the directory \
+         containing %r." % __file__)
     sys.exit(1)
 
 if __name__ == "__main__":

+ 19 - 7
examples/celery_http_gateway/settings.py

@@ -16,12 +16,23 @@ ADMINS = (
 
 MANAGERS = ADMINS
 
-DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-DATABASE_NAME = 'development.db'             # Or path to database file if using sqlite3.
-DATABASE_USER = ''             # Not used with sqlite3.
-DATABASE_PASSWORD = ''         # Not used with sqlite3.
-DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
-DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
+# 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+DATABASE_ENGINE = 'sqlite3'
+
+# path to database file if using sqlite3.
+DATABASE_NAME = 'development.db'
+
+# Not used with sqlite3.
+DATABASE_USER = ''
+
+# Not used with sqlite3.
+DATABASE_PASSWORD = ''
+
+# Set to empty string for localhost. Not used with sqlite3.
+DATABASE_HOST = ''
+
+# Set to empty string for default. Not used with sqlite3.
+DATABASE_PORT = ''
 
 # Local time zone for this installation. Choices can be found here:
 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
@@ -73,7 +84,8 @@ MIDDLEWARE_CLASSES = (
 ROOT_URLCONF = 'celery_http_gateway.urls'
 
 TEMPLATE_DIRS = (
-    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
+    # Put strings here, like "/home/html/django_templates" or
+    # "C:/www/django/templates".
     # Always use forward slashes, even on Windows.
     # Don't forget to use absolute paths, not relative paths.
 )

+ 3 - 1
examples/httpexample/manage.py

@@ -4,7 +4,9 @@ try:
     import settings # Assumed to be in the same directory.
 except ImportError:
     import sys
-    sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
+    sys.stderr.write(
+        "Error: Can't find the file 'settings.py' in the directory \
+         containing %r." % __file__)
     sys.exit(1)
 
 if __name__ == "__main__":

+ 18 - 7
examples/httpexample/settings.py

@@ -8,13 +8,23 @@ ADMINS = (
 )
 
 MANAGERS = ADMINS
+# 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+DATABASE_ENGINE = ''
 
-DATABASE_ENGINE = ''           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-DATABASE_NAME = ''             # Or path to database file if using sqlite3.
-DATABASE_USER = ''             # Not used with sqlite3.
-DATABASE_PASSWORD = ''         # Not used with sqlite3.
-DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
-DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
+# Pth to database file if using sqlite3.
+DATABASE_NAME = ''
+
+# Not used with sqlite3.
+DATABASE_USER = ''
+
+# Not used with sqlite3.
+DATABASE_PASSWORD = ''
+
+# Set to empty string for localhost. Not used with sqlite3.
+DATABASE_HOST = ''
+
+# Set to empty string for default. Not used with sqlite3.
+DATABASE_PORT = ''
 
 # Local time zone for this installation. Choices can be found here:
 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
@@ -66,7 +76,8 @@ MIDDLEWARE_CLASSES = (
 ROOT_URLCONF = 'httpexample.urls'
 
 TEMPLATE_DIRS = (
-    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
+    # Put strings here, like "/home/html/django_templates" or
+    # "C:/www/django/templates".
     # Always use forward slashes, even on Windows.
     # Don't forget to use absolute paths, not relative paths.
 )