celery.datastructures

Custom types and data structures.

AttributeDict

class celery.datastructures.AttributeDict[源代码]

Dict subclass with attribute access.

class celery.datastructures.AttributeDictMixin[源代码]

Augment classes with a Mapping interface by adding attribute access.

I.e. d.key -> d[key].

DictAttribute

class celery.datastructures.DictAttribute(obj)[源代码]

Dict interface to attributes.

obj[k] -> obj.k obj[k] = val -> obj.k = val

ConfigurationView

class celery.datastructures.ConfigurationView(changes, defaults)[源代码]

A view over an applications configuration dicts.

Custom (but older) version of collections.ChainMap.

If the key does not exist in changes, the defaults dicts are consulted.

参数: - changes – Dict containing changes to the configuration. - defaults – List of dicts containing the default configuration.

Remove all changes, but keep defaults. - defaults = None - first(*keys*)[源代码] - get(key, default=None)[源代码] - items()[源代码] - iteritems() - iterkeys() - itervalues() - keys()[源代码] - setdefault(key, default)[源代码] - update(*args, **kwargs*)[源代码] - values()[源代码]

ExceptionInfo

class celery.datastructures.ExceptionInfo(exc_info=None, internal=False)

Exception wrapping an exception and its traceback.

参数: exc_info – The exception info tuple as returned by sys.exc_info().
  • exception = None

Exception instance. - internal = False

Set to true if this is an internal error. - tb = None

Pickleable traceback instance for use with traceback - traceback = None

String representation of the traceback. - type = None

Exception type.

LimitedSet

class celery.datastructures.LimitedSet(maxlen=None, expires=None, data=None, heap=None)[源代码]

Kind-of Set with limitations.

Good for when you need to test for membership (a in set), but the list might become to big.

参数: - maxlen – Maximum number of members before we start evicting expired members. - expires – Time in seconds, before a membership expires.

Add a new member. - as_dict()[源代码] - clear()[源代码]

Remove all members - discard(value)

Remove membership by finding value. - pop_value(value)[源代码]

Remove membership by finding value. - purge(limit=None, offset=0, now=)

Purge expired items. - update(other, heappush=)[源代码]

LRUCache

class celery.datastructures.LRUCache(limit=None)

LRU Cache implementation using a doubly linked list to track access.

参数: limit – The maximum number of keys to keep in the cache. When a new key is inserted and the limit has been exceeded, the Least Recently Used key will be discarded from the cache.
  • incr(key, delta=1)
  • items()
  • iteritems()
  • iterkeys()
  • itervalues()
  • keys()
  • update(*args,* **kwargs*)
  • values()