Convert range to the "ed" format
(start, stop)
| 1088 | ######################################################################## |
| 1089 | |
| 1090 | def _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 | |
| 1101 | def unified_diff(a, b, fromfile='', tofile='', fromfiledate='', |
| 1102 | tofiledate='', n=3, lineterm='\n', *, color=False): |
no test coverage detected
searching dependent graphs…