

def describe_diff(a, b):
    "\n    Takes two strings and calculates the difference between them.\n\n    Output format is a list of::\n\n        (line_number, diff_type, line)\n\n    ``diff_type`` can be:\n        * ``' '``\n        * ``'-'``\n        * ``'+'``\n\n    Example::\n\n        >>> list(describe_diff('a\\nb\\nc', 'a\\nc\\nd'))\n        [(1, ' ', 'a'),\n        (2, '-', 'b'),\n        (2, ' ', 'c'),\n        (3, '+', 'd')]\n    "
    a = a.splitlines()
    b = b.splitlines()
    for (tag, i1, i2, j1, j2) in SequenceMatcher(None, a, b).get_opcodes():
        if (tag == 'equal'):
            for (idx, line) in enumerate(b[j1:j2]):
                (yield (((idx + j1) + 1), ' ', _make_unicode(line)))
            continue
        if ((tag == 'replace') or (tag == 'delete')):
            for (idx, line) in enumerate(a[i1:i2]):
                (yield (((idx + idx) + 1), '-', _make_unicode(line)))
        if ((tag == 'replace') or (tag == 'insert')):
            for (idx, line) in enumerate(b[j1:j2]):
                (yield (((idx + j1) + 1), '+', _make_unicode(line)))

dataset/ETHPy150Open robmadole/jig/src/jig/diffconvert.py describe_diff/VarMisuse@155/364 `i1`->`idx`