src/orion/core/utils/diff.py
def colored_diff(string_a, string_b):
    """Return a multi-line colored diff of given strings `a` and `b`"""
    string_a = string_a.splitlines(keepends=True)
    string_b = string_b.splitlines(keepends=True)
    result = list(Differ().compare(string_a, string_b))

    colored_result = []
    for i, line in enumerate(result):
        line = line.strip("\n")
        if line[0] == "-" or (line[0] == "?" and result[i - 1][0] == "-"):
            line = red(line)
        elif line[0] == "+" or (line[0] == "?" and result[i - 1][0] == "+"):
            line = green(line)

        colored_result.append(line)

    return "\n".join(colored_result)
Return a multi-line colored diff of given strings `a` and `b`
Return a multi-line colored diff of given strings `a` and `b`
Return a multi - line colored diff of given strings ` a ` and ` b `
def colored_diff(string_a, string_b):
    string_a = string_a.splitlines(keepends=True)
    string_b = string_b.splitlines(keepends=True)
    result = list(Differ().compare(string_a, string_b))
    colored_result = []
    for i, line in enumerate(result):
        line = line.strip("\n")
        if line[0] == "-" or (line[0] == "?" and result[i - 1][0] == "-"):
            line = red(line)
        elif line[0] == "+" or (line[0] == "?" and result[i - 1][0] == "+"):
            line = green(line)
        colored_result.append(line)
    return "\n".join(colored_result)
def colored_diff ( string_a , string_b ) : string_a = string_a . splitlines ( keepends = True ) string_b = string_b . splitlines ( keepends = True ) result = list ( Differ ( ) . compare ( string_a , string_b ) ) colored_result = [ ] for i , line in enumerate ( result ) : line = line . strip ( "\n" ) if line [ 0 ] == "-" or ( line [ 0 ] == "?" and result [ i - 1 ] [ 0 ] == "-" ) : line = red ( line ) elif line [ 0 ] == "+" or ( line [ 0 ] == "?" and result [ i - 1 ] [ 0 ] == "+" ) : line = green ( line ) colored_result . append ( line ) return "\n" . join ( colored_result )
Return a multi-line colored diff of given strings `a` and `b`
Return a multi - line colored diff of given strings ` a ` and ` b `
"""Return a multi-line colored diff of given strings `a` and `b`"""
string_a
string_b