nodify.utils.traverse_tree_forward

nodify.utils.traverse_tree_forward(roots: Sequence[Node], func: Callable[[Node], Any]) None[source]

Traverse a tree of nodes in a forward fashion.

Parameters:
  • roots (Sequence[Node]) – The roots of the tree to traverse.

  • func (Callable[[Node], Any]) – The function to apply to each node in the tree. Note that you can raise a StopTraverse exception to stop the traversal of the tree for any reason.