Browse Source

Use new kombu.utils modules

Ask Solem 8 years ago
parent
commit
de180b7528

+ 1 - 1
celery/app/amqp.py

@@ -12,8 +12,8 @@ from weakref import WeakValueDictionary
 from kombu import pools
 from kombu import Connection, Consumer, Exchange, Producer, Queue
 from kombu.common import Broadcast
-from kombu.utils import cached_property
 from kombu.utils.functional import maybe_list
+from kombu.utils.objects import cached_property
 
 from celery import signals
 from celery.five import items, string_t

+ 3 - 1
celery/app/base.py

@@ -12,7 +12,9 @@ from operator import attrgetter
 from kombu import pools
 from kombu.clocks import LamportClock
 from kombu.common import oid_from
-from kombu.utils import cached_property, register_after_fork, uuid
+from kombu.utils.compat import register_after_fork
+from kombu.utils.objects import cached_property
+from kombu.utils.uuid import uuid
 from vine import starpromise
 from vine.utils import wraps
 

+ 1 - 1
celery/app/control.py

@@ -11,8 +11,8 @@ import warnings
 from billiard.common import TERM_SIGNAME
 
 from kombu.pidbox import Mailbox
-from kombu.utils import cached_property
 from kombu.utils.functional import lazy
+from kombu.utils.objects import cached_property
 
 from celery.exceptions import DuplicateNodenameWarning
 from celery.utils.text import pluralize

+ 1 - 1
celery/app/task.py

@@ -5,7 +5,7 @@ from __future__ import absolute_import, unicode_literals
 import sys
 
 from billiard.einfo import ExceptionInfo
-from kombu.utils import uuid
+from kombu.utils.uuid import uuid
 
 from celery import current_app, group
 from celery import states

+ 1 - 1
celery/backends/async.py

@@ -8,7 +8,7 @@ from time import sleep
 from weakref import WeakKeyDictionary
 
 from kombu.syn import detect_environment
-from kombu.utils import cached_property
+from kombu.utils.objects import cached_property
 
 from celery import states
 from celery.exceptions import TimeoutError

+ 1 - 1
celery/backends/cache.py

@@ -4,8 +4,8 @@ from __future__ import absolute_import, unicode_literals
 
 import sys
 
-from kombu.utils import cached_property
 from kombu.utils.encoding import bytes_to_str, ensure_bytes
+from kombu.utils.objects import cached_property
 
 from celery.exceptions import ImproperlyConfigured
 from celery.utils.functional import LRUCache

+ 1 - 1
celery/backends/database/session.py

@@ -7,7 +7,7 @@ from sqlalchemy.ext.declarative import declarative_base
 from sqlalchemy.orm import sessionmaker
 from sqlalchemy.pool import NullPool
 
-from kombu.utils import register_after_fork
+from kombu.utils.compat import register_after_fork
 
 ResultModelBase = declarative_base()
 

+ 2 - 1
celery/backends/mongodb.py

@@ -4,9 +4,10 @@ from __future__ import absolute_import, unicode_literals
 
 from datetime import datetime, timedelta
 
-from kombu.utils import cached_property
+from kombu.utils.objects import cached_property
 from kombu.utils.url import maybe_sanitize_url
 from kombu.exceptions import EncodeError
+
 from celery import states
 from celery.exceptions import ImproperlyConfigured
 from celery.five import string_t, items

+ 2 - 1
celery/backends/redis.py

@@ -4,7 +4,8 @@ from __future__ import absolute_import, unicode_literals
 
 from functools import partial
 
-from kombu.utils import cached_property, retry_over_time
+from kombu.utils.functional import retry_over_time
+from kombu.utils.objects import cached_property
 from kombu.utils.url import _parse_url
 
 from celery import states

+ 2 - 1
celery/backends/rpc.py

@@ -7,7 +7,8 @@ from __future__ import absolute_import, unicode_literals
 
 from kombu import Consumer, Exchange, Producer, Queue
 from kombu.common import maybe_declare
-from kombu.utils import cached_property, register_after_fork
+from kombu.utils.compat import register_after_fork
+from kombu.utils.objects import cached_property
 
 from celery import current_task
 from celery import states

+ 2 - 2
celery/beat.py

@@ -17,8 +17,8 @@ from threading import Event, Thread
 from billiard import ensure_multiprocessing
 from billiard.context import Process
 from billiard.common import reset_signals
-from kombu.utils import cached_property, reprcall
-from kombu.utils.functional import maybe_evaluate
+from kombu.utils.functional import maybe_evaluate, reprcall
+from kombu.utils.objects import cached_property
 
 from . import __version__
 from . import platforms

+ 1 - 1
celery/bin/multi.py

@@ -106,8 +106,8 @@ from functools import partial
 from subprocess import Popen
 from time import sleep
 
-from kombu.utils import cached_property
 from kombu.utils.encoding import from_utf8
+from kombu.utils.objects import cached_property
 
 from celery import VERSION_BANNER
 from celery.five import items

+ 1 - 1
celery/bootsteps.py

@@ -6,8 +6,8 @@ from collections import deque
 from threading import Event
 
 from kombu.common import ignore_errors
-from kombu.utils import symbol_by_name
 from kombu.utils.encoding import bytes_to_str
+from kombu.utils.imports import symbol_by_name
 
 from .five import bytes_if_py2, values, with_metaclass
 from .utils.graph import DependencyGraph, GraphFormatter

+ 3 - 1
celery/canvas.py

@@ -15,7 +15,9 @@ from functools import partial as _partial, reduce
 from operator import itemgetter
 from itertools import chain as _chain
 
-from kombu.utils import cached_property, fxrange, reprcall, uuid
+from kombu.utils.functional import fxrange, reprcall
+from kombu.utils.objects import cached_property
+from kombu.utils.uuid import uuid
 from vine import barrier
 
 from celery._state import current_app

+ 1 - 1
celery/concurrency/__init__.py

@@ -5,7 +5,7 @@ from __future__ import absolute_import, unicode_literals
 # Import from kombu directly as it's used
 # early in the import stage, where celery.utils loads
 # too much (e.g. for eventlet patching)
-from kombu.utils import symbol_by_name
+from kombu.utils.imports import symbol_by_name
 
 __all__ = ['get_implementation']
 

+ 1 - 1
celery/concurrency/asynpool.py

@@ -37,8 +37,8 @@ from billiard.compat import buf_t, setblocking, isblocking
 from billiard.queues import _SimpleQueue
 from kombu.async import READ, WRITE, ERR
 from kombu.serialization import pickle as _pickle
-from kombu.utils import fxrange
 from kombu.utils.eventio import SELECT_BAD_FD
+from kombu.utils.functional import fxrange
 from vine import promise
 
 from celery.five import Counter, items, values

+ 2 - 1
celery/events/__init__.py

@@ -19,8 +19,9 @@ from operator import itemgetter
 from kombu import Exchange, Queue, Producer
 from kombu.connection import maybe_channel
 from kombu.mixins import ConsumerMixin
-from kombu.utils import cached_property, uuid
+from kombu.utils.objects import cached_property
 
+from celery import uuid
 from celery.app import app_or_default
 from celery.five import items
 from celery.utils.functional import dictfilter

+ 1 - 1
celery/events/state.py

@@ -28,7 +28,7 @@ from time import time
 from weakref import WeakSet, ref
 
 from kombu.clocks import timetuple
-from kombu.utils import cached_property
+from kombu.utils.objects import cached_property
 
 from celery import states
 from celery.five import items, python_2_unicode_compatible, values

+ 2 - 1
celery/fixups/django.py

@@ -5,7 +5,8 @@ import os
 import sys
 import warnings
 
-from kombu.utils import cached_property, symbol_by_name
+from kombu.utils.imports import symbol_by_name
+from kombu.utils.objects import cached_property
 
 from datetime import datetime
 from importlib import import_module

+ 1 - 1
celery/platforms.py

@@ -17,7 +17,7 @@ from collections import namedtuple
 
 from billiard.compat import get_fdmax, close_open_fds
 # fileno used to be in this module
-from kombu.utils import maybe_fileno
+from kombu.utils.compat import maybe_fileno
 from kombu.utils.encoding import safe_str
 from contextlib import contextmanager
 

+ 1 - 1
celery/result.py

@@ -8,7 +8,7 @@ from collections import OrderedDict, deque
 from contextlib import contextmanager
 from copy import copy
 
-from kombu.utils import cached_property
+from kombu.utils.objects import cached_property
 from vine import Thenable, barrier, promise
 
 from . import current_app

+ 1 - 1
celery/schedules.py

@@ -9,7 +9,7 @@ from bisect import bisect, bisect_left
 from collections import Iterable, namedtuple
 from datetime import datetime, timedelta
 
-from kombu.utils import cached_property
+from kombu.utils.objects import cached_property
 
 from . import current_app
 from .five import python_2_unicode_compatible, range, string_t

+ 1 - 1
celery/tests/case.py

@@ -13,7 +13,7 @@ from datetime import datetime, timedelta
 from functools import partial
 
 from kombu import Queue
-from kombu.utils import symbol_by_name
+from kombu.utils.imports import symbol_by_name
 from vine.utils import wraps
 
 from celery import Celery

+ 1 - 1
celery/tests/worker/test_control.py

@@ -7,7 +7,7 @@ from collections import defaultdict
 from datetime import datetime, timedelta
 
 from kombu import pidbox
-from kombu.utils import uuid
+from kombu.utils.uuid import uuid
 
 from celery.five import Queue as FastQueue
 from celery.utils.timer2 import Timer

+ 1 - 1
celery/tests/worker/test_request.py

@@ -10,8 +10,8 @@ import sys
 from datetime import datetime, timedelta
 
 from billiard.einfo import ExceptionInfo
-from kombu.utils import uuid
 from kombu.utils.encoding import default_encode, from_utf8, safe_str, safe_repr
+from kombu.utils.uuid import uuid
 
 from celery import states
 from celery.app.trace import (

+ 1 - 1
celery/tests/worker/test_worker.py

@@ -14,7 +14,7 @@ from kombu import Connection
 from kombu.common import QoS, ignore_errors
 from kombu.transport.base import Message
 from kombu.transport.memory import Transport
-from kombu.utils import uuid
+from kombu.utils.uuid import uuid
 
 from celery.bootsteps import RUN, CLOSE, TERMINATE, StartStopStep
 from celery.concurrency.base import BasePool

+ 2 - 1
celery/utils/__init__.py

@@ -26,5 +26,6 @@ from .imports import (          # noqa
     instantiate, import_from_cwd, gen_task_name,
 )
 from .functional import chunks, noop                    # noqa
-from kombu.utils import cached_property, uuid   # noqa
+from kombu.utils.objects import cached_property
+from kombu.utils.uuid import uuid   # noqa
 gen_unique_id = uuid

+ 1 - 1
celery/utils/imports.py

@@ -9,7 +9,7 @@ import sys
 
 from contextlib import contextmanager
 
-from kombu.utils import symbol_by_name
+from kombu.utils.imports import symbol_by_name
 
 from celery.five import reload
 

+ 1 - 1
celery/utils/sysinfo.py

@@ -6,7 +6,7 @@ import os
 
 from math import ceil
 
-from kombu.utils import cached_property
+from kombu.utils.objects import cached_property
 
 __all__ = ['load_average', 'df']
 

+ 2 - 1
celery/utils/timeutils.py

@@ -10,7 +10,8 @@ import time as _time
 from calendar import monthrange
 from datetime import date, datetime, timedelta, tzinfo
 
-from kombu.utils import cached_property, reprcall
+from kombu.utils.functional import reprcall
+from kombu.utils.objects import cached_property
 
 from pytz import timezone as _timezone, AmbiguousTimeError, FixedOffset
 

+ 1 - 1
celery/worker/request.py

@@ -10,8 +10,8 @@ from datetime import datetime
 from weakref import ref
 
 from billiard.common import TERM_SIGNAME
-from kombu.utils import cached_property
 from kombu.utils.encoding import safe_repr, safe_str
+from kombu.utils.objects import cached_property
 
 from celery import signals
 from celery.app.trace import trace_task, trace_task_ret

+ 1 - 1
celery/worker/state.py

@@ -14,7 +14,7 @@ import weakref
 import zlib
 
 from kombu.serialization import pickle, pickle_protocol
-from kombu.utils import cached_property
+from kombu.utils.objects import cached_property
 
 from celery import __version__
 from celery.exceptions import WorkerShutdown, WorkerTerminate