def swap_resources_into_scope(expr, scope):
 resources = expr._resources()
 symbol_dict = dict(((t, symbol(t._name, t.dshape)) for t in resources))
 resources = dict(((symbol_dict[k], v) for (k, v) in resources.items()))
 other_scope = dict(((k, v) for (k, v) in scope.items() if (k not in symbol_dict)))
 new_scope = toolz.merge(resources, other_scope)
 expr = expr._subs(symbol_dict)
 return (expr, new_scope)

def swap_resources_into_scope ( expr , scope ) : resources = expr . _resources ( ) symbol_dict = dict ( ( ( t , symbol ( t . _name , t . dshape ) ) for t in resources ) ) resources = dict ( ( ( symbol_dict [ k ] , v ) for ( k , v ) in resources . items ( ) ) ) other_scope = dict ( ( ( k , v ) for ( k , v ) in scope . items ( ) if ( k not in symbol_dict ) ) ) new_scope = toolz . merge ( resources , other_scope ) expr = expr . _subs ( symbol_dict ) return ( expr , new_scope )
translate interactive expressions into normal abstract expressions interactive blaze expressions link to data on their leaves .