(cls_node)
one-line classes don't get a suite in the parse tree so we add
        one to normalize the tree
one-line classes don't get a suite in the parse tree so we add
        one to normalize the tree
one - line classes don t get a suite in the parse tree so we add one to normalize the tree
def fixup_parse_tree(cls_node):
    """ one-line classes don't get a suite in the parse tree so we add
        one to normalize the tree
    """
    for node in cls_node.children:
        if node.type == syms.suite:
            # already in the preferred format, do nothing
            return

    # !%@#! one-liners have no suite node, we have to fake one up
    for i, node in enumerate(cls_node.children):
        if node.type == token.COLON:
            break
    else:
        raise ValueError("No class suite and no ':'!")

    # move everything into a suite node
    suite = Node(syms.suite, [])
    while cls_node.children[i+1:]:
        move_node = cls_node.children[i+1]
        suite.append_child(move_node.clone())
        move_node.remove()
    cls_node.append_child(suite)
    node = suite
def fixup_parse_tree ( cls_node ) : for node in cls_node . children : if node . type == syms . suite : # already in the preferred format, do nothing return # !%@#! one-liners have no suite node, we have to fake one up for i , node in enumerate ( cls_node . children ) : if node . type == token . COLON : break else : raise ValueError ( "No class suite and no ':'!" ) # move everything into a suite node suite = Node ( syms . suite , [ ] ) while cls_node . children [ i + 1 : ] : move_node = cls_node . children [ i + 1 ] suite . append_child ( move_node . clone ( ) ) move_node . remove ( ) cls_node . append_child ( suite ) node = suite