Lines Matching refs:line
731 Each line of a Differ delta begins with a two-letter code:
733 '- ' line unique to sequence 1
734 '+ ' line unique to sequence 2
735 ' ' line common to both sequences
736 '? ' line not present in either input sequence
750 First we set up the texts, sequences of individual single-line strings
774 filter out line and character 'junk'. See Differ.__init__ for details.
795 As a single multi-line string it looks like this:
837 Each sequence must contain individual single-line strings ending with
1008 >>> for line in results: print(repr(line))
1045 def IS_LINE_JUNK(line, pat=re.compile(r"\s*(?:#\s*)?$").match):
1047 Return True for ignorable line: iff `line` is blank or contains a single '#'.
1059 return pat(line) is not None
1092 beginning -= 1 # empty ranges begin at line just before the range
1100 Unified diffs are a compact way of showing line changes and a few
1120 >>> for line in unified_diff('one two three four'.split(),
1124 ... print(line) # doctest: +NORMALIZE_WHITESPACE
1153 for line in a[i1:i2]:
1154 yield ' ' + line
1157 for line in a[i1:i2]:
1158 yield '-' + line
1160 for line in b[j1:j2]:
1161 yield '+' + line
1174 beginning -= 1 # empty ranges begin at line just before the range
1185 Context diffs are a compact way of showing line changes and a few
1244 for line in a[i1:i2]:
1245 yield prefix[tag] + line
1253 for line in b[j1:j2]:
1254 yield prefix[tag] + line
1300 for line in lines:
1301 yield line.encode('ascii', 'surrogateescape')
1321 Tools/scripts/ndiff.py is a command-line front-end to this function.
1353 (from line tuple, to line tuple, boolean flag)
1355 from/to line tuple -- (line num, line text)
1356 line num -- integer or None (to indicate a context separation)
1357 line text -- original line text with following markers inserted:
1364 either "from" or "to" line contains a change, otherwise False.
1383 """Returns line of text with user's change markup and line formatting.
1385 lines -- list of lines from the ndiff generator to produce a line of
1386 text from. When producing the line of text to return, the
1388 format_key -- '+' return first line in list with "add" markup around
1389 the entire line.
1390 '-' return first line in list with "delete" markup around
1391 the entire line.
1392 '?' return first line in list with add/delete/change
1393 intraline markup (indices obtained from second line)
1394 None return first line in list with no markup
1396 num_lines -- from/to current line number. This is NOT intended to be a
1398 maintain memory of the current line numbers between calls
1406 # Handle case where no user markup is to be added, just return line of
1407 # text with user's line format to allow for usage of the line number.
1424 # Handle case of add/delete entire line
1427 # if line of text is just a newline, insert a space so there is
1433 # Return line of text, first allow user's line formatter to do its
1434 # thing (such as adding the line number) then replace the special
1443 it yields both a "from" and a "to" line, otherwise it will yield one
1445 boolean flag is yielded to indicate if the text line(s) have
1460 s = ''.join([line[0] for line in lines])
1463 # corresponding add/delete lines get a matching blank line so
1464 # all line pairs get yielded at the next level.
1472 # caught up on blank lines yet, just process the delete line
1477 # in delete block and see an intraline change or unchanged line
1478 # coming: yield the delete line and then blanks
1490 # delete FROM line
1496 # caught up on blank lines yet, just process the add line
1501 # will be leaving an add block: yield blanks then add line
1505 # inside an add block, yield the add line
1529 This function is an iterator. It itself pulls lines from the line
1670 containing the table) showing a side by side, line by line comparison
1671 of text with inter-line and intra-line change highlights. The table can
1733 """Returns from/to line lists with tabs expanded and newlines removed.
1742 def expand_tabs(line):
1744 line = line.replace(' ','\0')
1746 line = line.expandtabs(self._tabsize)
1749 line = line.replace(' ','\t')
1750 return line.replace('\0',' ').rstrip('\n')
1751 fromlines = [expand_tabs(line) for line in fromlines]
1752 tolines = [expand_tabs(line) for line in tolines]
1758 This function will determine if the input text line needs to be
1760 will be determined and the first line appended to the output
1761 text line list. This function is used recursively to handle
1762 the second part of the split line to further split it.
1764 # if blank line or context separator, just add it to the output list
1769 # if line text doesn't need wrapping, just add it to the output list
1798 # line and start marker at beginning of second line because each
1799 # line will have its own table tag markup around it.
1804 # tack on first line onto the output list
1820 # for each from/to line split it at the wrap column to form
1825 # yield from/to line in pairs inserting blank lines as
1842 into a single line of text with HTML markup.
1863 flag -- indicates if difference on line
1864 linenum -- line number (used for line number column)
1865 text -- line text to be marked up
1876 # make space non-breakable so they don't get compressed or line wrapped
1890 # store prefixes so line format method has access
1932 # if not a change on first line, drop a link
1991 # generated for the first line
2024 lines originating from file 1 or 2 (parameter `which`), stripping off line
2047 for line in delta:
2048 if line[:2] in prefixes:
2049 yield line[2:]