MCPcopy Index your code
hub / github.com/python/cpython / _format_range_unified

Function _format_range_unified

Lib/difflib.py:1090–1099  ·  view source on GitHub ↗

Convert range to the "ed" format

(start, stop)

Source from the content-addressed store, hash-verified

1088########################################################################
1089
1090def _format_range_unified(start, stop):
1091 'Convert range to the "ed" format'
1092 # Per the diff spec at http://www.unix.org/single_unix_specification/
1093 beginning = start + 1 # lines start numbering with one
1094 length = stop - start
1095 if length == 1:
1096 return '{}'.format(beginning)
1097 if not length:
1098 beginning -= 1 # empty ranges begin at line just before the range
1099 return '{},{}'.format(beginning, length)
1100
1101def unified_diff(a, b, fromfile='', tofile='', fromfiledate='',
1102 tofiledate='', n=3, lineterm='\n', *, color=False):

Callers 1

unified_diffFunction · 0.85

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…