(cache_updates, objects_to_walk)
Recursively walk an object tree, applying cache updates wherever necessary
Recursively walk an object tree, applying cache updates wherever necessary
Recursively walk an object tree applying cache updates wherever necessary
def apply_cache_updates(cache_updates, objects_to_walk):
    """Recursively walk an object tree, applying cache updates wherever necessary"""

    def f(data):
        if isinstance(data, list):
            for i in data: f(i)
        elif isinstance(data, dict):
            for k,v in data.items(): f(v)
        elif isinstance(data, LiveObjectProxy):
            update = cache_updates.get(data._spec["backend"], {})
            if data._spec["id"] in update:
                data._spec["itemCache"] = update[data._spec["id"]]

    f(objects_to_walk)
def apply_cache_updates ( cache_updates , objects_to_walk ) : def f ( data ) : if isinstance ( data , list ) : for i in data : f ( i ) elif isinstance ( data , dict ) : for k , v in data . items ( ) : f ( v ) elif isinstance ( data , LiveObjectProxy ) : update = cache_updates . get ( data . _spec [ "backend" ] , { } ) if data . _spec [ "id" ] in update : data . _spec [ "itemCache" ] = update [ data . _spec [ "id" ] ] f ( objects_to_walk )