nodemap.py
def changes_to_yaml(changes):
    """ Return a multi-line string of pseudo-yaml from a nested dict produced by `diff()`.
    
        Output is like a yaml version of the original dicts, except that deletions are prefixed with '<'
        and additions with '>'. Note that:
            - Modified values are shown as a deletion and addition.
            - Keys present in both "left" and "right" sides (i.e. needed for changes at deeper nesting levels) are not prefixed with anything.
    """

    lines = []
    nindent = 4
    curr_keypath = []
    for (keypath, action, value) in changes:
        # calculate position in keys wrt previous output:
        common = [a for a, b in zip(curr_keypath, keypath) if a == b]
        new = keypath[len(common):]
        level = len(keypath) - 2
        # output intermediate keys (no action on these):
        for i, k in enumerate(new[:-1]):
            lines.append('%s%s:' % ((' ' * nindent * level), k))
        # output actual change:
        symbol = '<' if action == 'DEL' else '>'
        lines.append(symbol + (' ' * (nindent * (level+1) - 1)) + keypath[-1] + ': ' + (str(value) or repr(value)))
        
        curr_keypath = keypath
    return '\n'.join(lines)
 Return a multi-line string of pseudo-yaml from a nested dict produced by `diff()`.
    
        Output is like a yaml version of the original dicts, except that deletions are prefixed with '<'
        and additions with '>'. Note that:
            - Modified values are shown as a deletion and addition.
            - Keys present in both "left" and "right" sides (i.e. needed for changes at deeper nesting levels) are not prefixed with anything.
    
Return a multi-line string of pseudo-yaml from a nested dict produced by `diff()`.
Output is like a yaml version of the original dicts, except that deletions are prefixed with '<'
and additions with '>'. Note that:
Modified values are shown as a deletion and addition.
Keys present in both "left" and "right" sides  are not prefixed with anything.
Return a multi - line string of pseudo - yaml from a nested dict produced by ` diff () ` . Output is like a yaml version of the original dicts except that deletions are prefixed with ' < ' and additions with ' > ' . Note that : Modified values are shown as a deletion and addition . Keys present in both " left " and " right " sides are not prefixed with anything .
def changes_to_yaml(changes):
    lines = []
    nindent = 4
    curr_keypath = []
    for (keypath, action, value) in changes:
        common = [a for a, b in zip(curr_keypath, keypath) if a == b]
        new = keypath[len(common):]
        level = len(keypath) - 2
        for i, k in enumerate(new[:-1]):
            lines.append('%s%s:' % ((' ' * nindent * level), k))
        symbol = '<' if action == 'DEL' else '>'
        lines.append(symbol + (' ' * (nindent * (level+1) - 1)) + keypath[-1] + ': ' + (str(value) or repr(value)))
        curr_keypath = keypath
    return '\n'.join(lines)
def changes_to_yaml ( changes ) : lines = [ ] nindent = 4 curr_keypath = [ ] for ( keypath , action , value ) in changes : common = [ a for a , b in zip ( curr_keypath , keypath ) if a == b ] new = keypath [ len ( common ) : ] level = len ( keypath ) - 2 for i , k in enumerate ( new [ : - 1 ] ) : lines . append ( '%s%s:' % ( ( ' ' * nindent * level ) , k ) ) symbol = '<' if action == 'DEL' else '>' lines . append ( symbol + ( ' ' * ( nindent * ( level + 1 ) - 1 ) ) + keypath [ - 1 ] + ': ' + ( str ( value ) or repr ( value ) ) ) curr_keypath = keypath return '\n' . join ( lines )
Return a multi-line string of pseudo-yaml from a nested dict produced by `diff()`.
Return a multi - line string of pseudo - yaml from a nested dict produced by ` diff () ` .
""" Return a multi-line string of pseudo-yaml from a nested dict produced by `diff()`.
    
        Output is like a yaml version of the original dicts, except that deletions are prefixed with '<'
        and additions with '>'. Note that:
            - Modified values are shown as a deletion and addition.
            - Keys present in both "left" and "right" sides (i.e. needed for changes at deeper nesting levels) are not prefixed with anything.
    """ # calculate position in keys wrt previous output: # output intermediate keys (no action on these): # output actual change:
changes