Browse Source

Import cached_property from celery.utils instead of kombu.utils

Ask Solem 13 years ago
parent
commit
7f241b69e4

+ 1 - 3
celery/app/__init__.py

@@ -17,10 +17,8 @@ import threading
 from functools import wraps
 from inspect import getargspec
 
-from kombu.utils import cached_property
-
 from .. import registry
-from ..utils import instantiate
+from ..utils import cached_property, instantiate
 
 from . import base
 

+ 1 - 2
celery/app/amqp.py

@@ -14,11 +14,10 @@ from datetime import datetime, timedelta
 from kombu import BrokerConnection, Exchange
 from kombu import compat as messaging
 from kombu.pools import ProducerPool
-from kombu.utils import cached_property
 
 from .. import routes as _routes
 from .. import signals
-from ..utils import textindent, uuid
+from ..utils import cached_property, textindent, uuid
 
 #: List of known options to a Kombu producers send method.
 #: Used to extract the message related options out of any `dict`.

+ 1 - 3
celery/app/base.py

@@ -20,10 +20,8 @@ from copy import deepcopy
 from functools import wraps
 from threading import Lock
 
-from kombu.utils import cached_property
-
 from .. import datastructures
-from ..utils import instantiate, lpmerge
+from ..utils import cached_property, instantiate, lpmerge
 
 from .defaults import DEFAULTS
 

+ 1 - 2
celery/backends/cache.py

@@ -1,9 +1,8 @@
 from __future__ import absolute_import
 
-from kombu.utils import cached_property
-
 from ..datastructures import LocalCache
 from ..exceptions import ImproperlyConfigured
+from ..utils import cached_property
 
 from .base import KeyValueStoreBackend
 

+ 1 - 2
celery/backends/redis.py

@@ -1,8 +1,7 @@
 from __future__ import absolute_import
 
-from kombu.utils import cached_property
-
 from ..exceptions import ImproperlyConfigured
+from ..utils import cached_property
 
 from .base import KeyValueStoreBackend
 

+ 1 - 3
celery/beat.py

@@ -14,8 +14,6 @@ except ImportError:
 
 from datetime import datetime
 
-from kombu.utils import cached_property
-
 from . import __version__
 from . import platforms
 from . import registry
@@ -23,7 +21,7 @@ from . import signals
 from .app import app_or_default
 from .log import SilenceRepeated
 from .schedules import maybe_schedule, crontab
-from .utils import instantiate, maybe_promise
+from .utils import cached_property, instantiate, maybe_promise
 from .utils.timeutils import humanize_seconds
 
 

+ 1 - 3
celery/contrib/batches.py

@@ -42,11 +42,9 @@ Registering the click is done as follows:
 from itertools import count
 from Queue import Queue
 
-from kombu.utils import cached_property
-
 from celery.datastructures import consume_queue
 from celery.task import Task
-from celery.utils import timer2
+from celery.utils import cached_property, timer2
 from celery.worker import state
 
 

+ 2 - 2
celery/loaders/base.py

@@ -6,11 +6,11 @@ import re
 import warnings
 
 from anyjson import deserialize
-from kombu.utils import cached_property
 
 from ..datastructures import DictAttribute
 from ..exceptions import ImproperlyConfigured
-from ..utils import get_cls_by_name, import_from_cwd as _import_from_cwd
+from ..utils import (cached_property, get_cls_by_name,
+                     import_from_cwd as _import_from_cwd)
 
 BUILTIN_MODULES = frozenset(["celery.task"])
 

+ 1 - 2
celery/tests/test_backends/test_redis_unit.py

@@ -1,11 +1,10 @@
 from datetime import timedelta
 
 from mock import Mock, patch
-from kombu.utils import cached_property
 
 from celery import current_app
 from celery import states
-from celery.utils import uuid
+from celery.utils import cached_property, uuid
 from celery.utils.timeutils import timedelta_seconds
 
 from celery.tests.utils import unittest

+ 2 - 2
celery/tests/test_events/test_events_state.py

@@ -171,8 +171,8 @@ class test_State(unittest.TestCase):
 
         # RECEIVED
         r.next()
-        self.assertTrue(r.uuid in r.state.tasks)
-        task = r.state.tasks[r.uuid]
+        self.assertTrue(r.tid in r.state.tasks)
+        task = r.state.tasks[r.tid]
         self.assertEqual(task.state, states.RECEIVED)
         self.assertTrue(task.received)
         self.assertEqual(task.timestamp, task.received)

+ 1 - 2
celery/worker/state.py

@@ -6,10 +6,9 @@ import shelve
 
 from collections import defaultdict
 
-from kombu.utils import cached_property
-
 from .. import __version__
 from ..datastructures import LimitedSet
+from ..utils import cached_property
 
 #: Worker software/platform information.
 SOFTWARE_INFO = {"sw_ident": "celeryd",