MCPcopy Create free account
hub / github.com/celery/celery / mlazy

Class mlazy

celery/utils/functional.py:39–54  ·  view source on GitHub ↗

Memoized lazy evaluation. The function is only evaluated once, every subsequent access will return the same value.

Source from the content-addressed store, hash-verified

37
38
39class mlazy(lazy):
40 """Memoized lazy evaluation.
41
42 The function is only evaluated once, every subsequent access
43 will return the same value.
44 """
45
46 #: Set to :const:`True` after the object has been evaluated.
47 evaluated = False
48 _value = None
49
50 def evaluate(self):
51 if not self.evaluated:
52 self._value = super().evaluate()
53 self.evaluated = True
54 return self._value
55
56
57def noop(*args, **kwargs):

Callers 3

test_mlazyFunction · 0.90
expand_annotationFunction · 0.90
expand_routeFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_mlazyFunction · 0.72