Recursively replace any callables c in expr (including inside lists) with c(ctx).
(ctx, expr)
| 155 | g_genesis_hash = None |
| 156 | |
| 157 | def 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). |
| 166 | Final = namedtuple("Final", "value") |
no outgoing calls
no test coverage detected