MCPcopy
hub / github.com/celery/celery / as_dict

Method as_dict

celery/utils/collections.py:610–624  ·  view source on GitHub ↗

Whole set as serializable dictionary. Example: >>> s = LimitedSet(maxlen=200) >>> r = LimitedSet(maxlen=200) >>> for i in range(500): ... s.add(i) ... >>> r.update(s.as_dict()) >>> r == s Tru

(self)

Source from the content-addressed store, hash-verified

608 return default
609
610 def as_dict(self):
611 # type: () -> Dict
612 """Whole set as serializable dictionary.
613
614 Example:
615 >>> s = LimitedSet(maxlen=200)
616 >>> r = LimitedSet(maxlen=200)
617 >>> for i in range(500):
618 ... s.add(i)
619 ...
620 >>> r.update(s.as_dict())
621 >>> r == s
622 True
623 """
624 return {key: inserted for inserted, key in self._data.values()}
625
626 def __eq__(self, other):
627 # type: (Any) -> bool

Callers 4

test_updateMethod · 0.95
test_as_dictMethod · 0.95
__reduce__Method · 0.95
jsonifyFunction · 0.45

Calls

no outgoing calls

Tested by 2

test_updateMethod · 0.76
test_as_dictMethod · 0.76