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

Function _format_range_context

Lib/difflib.py:1183–1192  ·  view source on GitHub ↗

Convert range to the "ed" format

(start, stop)

Source from the content-addressed store, hash-verified

1181########################################################################
1182
1183def _format_range_context(start, stop):
1184 'Convert range to the "ed" format'
1185 # Per the diff spec at http://www.unix.org/single_unix_specification/
1186 beginning = start + 1 # lines start numbering with one
1187 length = stop - start
1188 if not length:
1189 beginning -= 1 # empty ranges begin at line just before the range
1190 if length <= 1:
1191 return '{}'.format(beginning)
1192 return '{},{}'.format(beginning, beginning + length - 1)
1193
1194# See http://www.unix.org/single_unix_specification/
1195def context_diff(a, b, fromfile='', tofile='',

Callers 1

context_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…