MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _format_range_context

Function _format_range_context

tools/python-3.11.9-amd64/Lib/difflib.py:1168–1177  ·  view source on GitHub ↗

Convert range to the "ed" format

(start, stop)

Source from the content-addressed store, hash-verified

1166########################################################################
1167
1168def _format_range_context(start, stop):
1169 'Convert range to the "ed" format'
1170 # Per the diff spec at http://www.unix.org/single_unix_specification/
1171 beginning = start + 1 # lines start numbering with one
1172 length = stop - start
1173 if not length:
1174 beginning -= 1 # empty ranges begin at line just before the range
1175 if length <= 1:
1176 return '{}'.format(beginning)
1177 return '{},{}'.format(beginning, beginning + length - 1)
1178
1179# See http://www.unix.org/single_unix_specification/
1180def context_diff(a, b, fromfile='', tofile='',

Callers 1

context_diffFunction · 0.85

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected