Path 1: 14 calls (0.67)

0 (12) 3 (2)

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

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

1def _format_range_context(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 not length:
7        beginning -= 1        # empty ranges begin at line just before the range
8    if length <= 1:
9        return '{}'.format(beginning)
10    return '{},{}'.format(beginning, beginning + length - 1)
            

Path 2: 5 calls (0.24)

0 (4) 3 (1)

1 (4) 4 (1)

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

1def _format_range_context(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 not length:
7        beginning -= 1        # empty ranges begin at line just before the range
8    if length <= 1:
9        return '{}'.format(beginning)
10    return '{},{}'.format(beginning, beginning + length - 1)
            

Path 3: 2 calls (0.1)

3 (1) 0 (1)

3 (1) 0 (1)

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

1def _format_range_context(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 not length:
7        beginning -= 1        # empty ranges begin at line just before the range
8    if length <= 1:
9        return '{}'.format(beginning)
10    return '{},{}'.format(beginning, beginning + length - 1)