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

Function _format_range_unified

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

Convert range to the "ed" format

(start, stop)

Source from the content-addressed store, hash-verified

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

Callers 1

unified_diffFunction · 0.85

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected