Path 1: 14 calls (0.52)

0 (12) 3 (2)

2 (6) 3 (4) 4 (2) 5 (1) 6 (1)

'1,2' (6) '1,3' (4) '1,4' (2) '4,2' (1) '4,3' (1)

1def _format_range_unified(start, stop):
2    'Convert range to the "ed" format'
3    # Per the diff spec at http://www.unix.org/single_unix_specification/
4    beginning = start + 1     # lines start numbering with one
5    length = stop - start
6    if length == 1:
7        return '{}'.format(beginning)
8    if not length:
9        beginning -= 1        # empty ranges begin at line just before the range
10    return '{},{}'.format(beginning, length)
            

Path 2: 11 calls (0.41)

0 (10) 3 (1)

1 (10) 4 (1)

'1' (10) '4' (1)

1def _format_range_unified(start, stop):
2    'Convert range to the "ed" format'
3    # Per the diff spec at http://www.unix.org/single_unix_specification/
4    beginning = start + 1     # lines start numbering with one
5    length = stop - start
6    if length == 1:
7        return '{}'.format(beginning)
8    if not length:
9        beginning -= 1        # empty ranges begin at line just before the range
10    return '{},{}'.format(beginning, length)
            

Path 3: 2 calls (0.07)

3 (1) 0 (1)

3 (1) 0 (1)

'3,0' (1) '0,0' (1)

1def _format_range_unified(start, stop):
2    'Convert range to the "ed" format'
3    # Per the diff spec at http://www.unix.org/single_unix_specification/
4    beginning = start + 1     # lines start numbering with one
5    length = stop - start
6    if length == 1:
7        return '{}'.format(beginning)
8    if not length:
9        beginning -= 1        # empty ranges begin at line just before the range
10    return '{},{}'.format(beginning, length)