MCPcopy Create free account
hub / github.com/ElementsProject/elements / deep_eval

Function deep_eval

test/functional/feature_taproot.py:157–163  ·  view source on GitHub ↗

Recursively replace any callables c in expr (including inside lists) with c(ctx).

(ctx, expr)

Source from the content-addressed store, hash-verified

155g_genesis_hash = None
156
157def deep_eval(ctx, expr):
158 """Recursively replace any callables c in expr (including inside lists) with c(ctx)."""
159 while callable(expr):
160 expr = expr(ctx)
161 if isinstance(expr, list):
162 expr = [deep_eval(ctx, x) for x in expr]
163 return expr
164
165# Data type to represent fully-evaluated expressions in a context dict (so we can avoid reevaluating them).
166Final = namedtuple("Final", "value")

Callers 5

getFunction · 0.85
overrideFunction · 0.85
fnFunction · 0.85
zero_appenderFunction · 0.85
byte_popperFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected