- asdf.treeutil.walk_and_modify(top, callback, ignore_implicit_conversion=False, postorder=True, _context=None)[source]
Modify a tree by walking it with a callback function. It also has the effect of doing a deep copy.
The root of the tree. May be a dict, list or other Python object.
A function to call at each node in the tree. It takes either one or two arguments:
an instance from the tree
a json id (optional)
It may return a different instance in order to modify the tree. If the singleton instance
_RemoveNodeis returned, the node will be removed from the tree.
The json id is the context under which any relative URLs should be resolved. It may be
Noneif no ids are in the file
The tree is traversed depth-first, with order specified by the
Determines the order in which the callable is invoked on nodes of the tree. If
True, the callable will be invoked on children before their parents. If
False, the callable is invoked on the parents first. Defaults to
Controls whether warnings should be issued when implicitly converting a given type instance in the tree into a serializable object. The primary case for this is currently
The modified tree.