def _AnnotateIndents(tree):
 if (tree.parent is None):
  pytree_utils.SetNodeAnnotation(tree, pytree_utils.Annotation.CHILD_INDENT, '')
 for child in tree.children:
  if (child.type == token.INDENT):
   child_indent = pytree_utils.GetNodeAnnotation(tree, pytree_utils.Annotation.CHILD_INDENT)
   if ((child_indent is not None) and (child_indent != child.value)):
    raise RuntimeError('inconsistent indentation for child', (tree, child))
   pytree_utils.SetNodeAnnotation(tree, pytree_utils.Annotation.CHILD_INDENT, child.value)
  _AnnotateIndents(child)

def _AnnotateIndents ( tree ) : if ( tree . parent is None ) : pytree_utils . SetNodeAnnotation ( tree , pytree_utils . Annotation . CHILD_INDENT , '' ) for child in tree . children : if ( child . type == token . INDENT ) : child_indent = pytree_utils . GetNodeAnnotation ( tree , pytree_utils . Annotation . CHILD_INDENT ) if ( ( child_indent is not None ) and ( child_indent != child . value ) ) : raise RuntimeError ( 'inconsistent indentation for child' , ( tree , child ) ) pytree_utils . SetNodeAnnotation ( tree , pytree_utils . Annotation . CHILD_INDENT , child . value ) _AnnotateIndents ( child )
annotate the tree with child_indent annotations .