Method: difflib.HtmlDiff._tab_newline_replace
Calls: 17, Exceptions: 0, Paths: 1Back
Path 1: 17 calls (1.0)
['', ' 1. Beautiful is beTTer than ugly.', ' 2. Explicit is better than implicit.', ' 3. Simple is better than complex.', ' 4. Complex is bett...
['', ' 1. Beautiful is better than ugly.', ' 3. Simple is better than complex.', ' 4. Complicated is better than complex.', ' 5. Flat is bet...
tuple (17)
1def _tab_newline_replace(self,fromlines,tolines):
2 """Returns from/to line lists with tabs expanded and newlines removed.
3
4 Instead of tab characters being replaced by the number of spaces
5 needed to fill in to the next tab stop, this function will fill
6 the space with tab characters. This is done so that the difference
7 algorithms can identify changes in a file when tabs are replaced by
8 spaces and vice versa. At the end of the HTML generation, the tab
9 characters will be replaced with a nonbreakable space.
10 """
11 def expand_tabs(line):
12 # hide real spaces
13 line = line.replace(' ','\0')
14 # expand tabs into spaces
15 line = line.expandtabs(self._tabsize)
16 # replace spaces from expanded tabs back into tab characters
17 # (we'll replace them with markup after we do differencing)
18 line = line.replace(' ','\t')
19 return line.replace('\0',' ').rstrip('\n')
20 fromlines = [expand_tabs(line) for line in fromlines]
21 tolines = [expand_tabs(line) for line in tolines]
22 return fromlines,tolines