['', '\t\tLine 1: preceded by from:[tt] to:[ssss]', ' \t\tLine 2: preceded by from:[sstt] to:[sssst]', ' \t \tLine 3: preceded by from:[sstst] to:[s...
['', ' Line 1: preceded by from:[tt] to:[ssss]', ' \tLine 2: preceded by from:[sstt] to:[sssst]', ' Line 3: preceded by from:[sstst] to:[ss...
'' (5)
'' (5)
False (5)
5 (5)
'\n
\n
1defmake_table(self,fromlines,tolines,fromdesc='',todesc='',context=False,2numlines=5):3"""Returns HTML table of side by side comparison with change highlights45 Arguments:6 fromlines -- list of "from" lines7 tolines -- list of "to" lines8 fromdesc -- "from" file column header string9 todesc -- "to" file column header string10 context -- set to True for contextual differences (defaults to False11 which shows full differences).12 numlines -- number of context lines. When context is set True,13 controls number of lines displayed before and after the change.14 When context is False, controls the number of lines to place15 the "next" link anchors before the next change (so click of16 "next" link jumps to just before the change).17 """1819# make unique anchor prefixes so that multiple tables may exist20# on the same page without conflict.21self._make_prefix()2223# change tabs to spaces before it gets more difficult after we insert24# markup25fromlines,tolines=self._tab_newline_replace(fromlines,tolines)2627# create diffs iterator which generates side by side from/to data28ifcontext:29context_lines=numlines30else:31context_lines=None32diffs=_mdiff(fromlines,tolines,context_lines,linejunk=self._linejunk,33charjunk=self._charjunk)3435# set up iterator to wrap lines that exceed desired width36ifself._wrapcolumn:37diffs=self._line_wrapper(diffs)3839# collect up from/to lines and flags into lists (also format the lines)40fromlist,tolist,flaglist=self._collect_lines(diffs)4142# process change flags, generating middle column of next anchors/links43fromlist,tolist,flaglist,next_href,next_id=self._convert_flags(44fromlist,tolist,flaglist,context,numlines)4546s=[]47fmt=' <tr><td class="diff_next"%s>%s</td>%s'+ \48'<td class="diff_next">%s</td>%s</tr>\n'49foriinrange(len(flaglist)):50ifflaglist[i]isNone:51# mdiff yields None on separator lines skip the bogus ones52# generated for the first line53ifi>0:54s.append(' </tbody> \n <tbody>\n')55else:56s.append(fmt%(next_id[i],next_href[i],fromlist[i],57next_href[i],tolist[i]))58iffromdescortodesc:59header_row='<thead><tr>%s%s%s%s</tr></thead>'%(60'<th class="diff_next"><br /></th>',61'<th colspan="2" class="diff_header">%s</th>'%fromdesc,62'<th class="diff_next"><br /></th>',63'<th colspan="2" class="diff_header">%s</th>'%todesc)64else:65header_row=''6667table=self._table_template%dict(68data_rows=''.join(s),69header_row=header_row,70prefix=self._prefix[1])7172returntable.replace('\0+','<span class="diff_add">'). \73replace('\0-','<span class="diff_sub">'). \74replace('\0^','<span class="diff_chg">'). \75replace('\1','</span>'). \76replace('\t',' ')
Path 2: 3 calls (0.18)
['', ' 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...
'from' (3)
'to' (3)
False (3)
5 (3)
'\n
\n
1defmake_table(self,fromlines,tolines,fromdesc='',todesc='',context=False,2numlines=5):3"""Returns HTML table of side by side comparison with change highlights45 Arguments:6 fromlines -- list of "from" lines7 tolines -- list of "to" lines8 fromdesc -- "from" file column header string9 todesc -- "to" file column header string10 context -- set to True for contextual differences (defaults to False11 which shows full differences).12 numlines -- number of context lines. When context is set True,13 controls number of lines displayed before and after the change.14 When context is False, controls the number of lines to place15 the "next" link anchors before the next change (so click of16 "next" link jumps to just before the change).17 """1819# make unique anchor prefixes so that multiple tables may exist20# on the same page without conflict.21self._make_prefix()2223# change tabs to spaces before it gets more difficult after we insert24# markup25fromlines,tolines=self._tab_newline_replace(fromlines,tolines)2627# create diffs iterator which generates side by side from/to data28ifcontext:29context_lines=numlines30else:31context_lines=None32diffs=_mdiff(fromlines,tolines,context_lines,linejunk=self._linejunk,33charjunk=self._charjunk)3435# set up iterator to wrap lines that exceed desired width36ifself._wrapcolumn:37diffs=self._line_wrapper(diffs)3839# collect up from/to lines and flags into lists (also format the lines)40fromlist,tolist,flaglist=self._collect_lines(diffs)4142# process change flags, generating middle column of next anchors/links43fromlist,tolist,flaglist,next_href,next_id=self._convert_flags(44fromlist,tolist,flaglist,context,numlines)4546s=[]47fmt=' <tr><td class="diff_next"%s>%s</td>%s'+ \48'<td class="diff_next">%s</td>%s</tr>\n'49foriinrange(len(flaglist)):50ifflaglist[i]isNone:51# mdiff yields None on separator lines skip the bogus ones52# generated for the first line53ifi>0:54s.append(' </tbody> \n <tbody>\n')55else:56s.append(fmt%(next_id[i],next_href[i],fromlist[i],57next_href[i],tolist[i]))58iffromdescortodesc:59header_row='<thead><tr>%s%s%s%s</tr></thead>'%(60'<th class="diff_next"><br /></th>',61'<th colspan="2" class="diff_header">%s</th>'%fromdesc,62'<th class="diff_next"><br /></th>',63'<th colspan="2" class="diff_header">%s</th>'%todesc)64else:65header_row=''6667table=self._table_template%dict(68data_rows=''.join(s),69header_row=header_row,70prefix=self._prefix[1])7172returntable.replace('\0+','<span class="diff_add">'). \73replace('\0-','<span class="diff_sub">'). \74replace('\0^','<span class="diff_chg">'). \75replace('\1','</span>'). \76replace('\t',' ')
Path 3: 3 calls (0.18)
['', ' 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...
'from' (3)
'to' (3)
True (3)
5 (2) 0 (1)
'\n
\n
1defmake_table(self,fromlines,tolines,fromdesc='',todesc='',context=False,2numlines=5):3"""Returns HTML table of side by side comparison with change highlights45 Arguments:6 fromlines -- list of "from" lines7 tolines -- list of "to" lines8 fromdesc -- "from" file column header string9 todesc -- "to" file column header string10 context -- set to True for contextual differences (defaults to False11 which shows full differences).12 numlines -- number of context lines. When context is set True,13 controls number of lines displayed before and after the change.14 When context is False, controls the number of lines to place15 the "next" link anchors before the next change (so click of16 "next" link jumps to just before the change).17 """1819# make unique anchor prefixes so that multiple tables may exist20# on the same page without conflict.21self._make_prefix()2223# change tabs to spaces before it gets more difficult after we insert24# markup25fromlines,tolines=self._tab_newline_replace(fromlines,tolines)2627# create diffs iterator which generates side by side from/to data28ifcontext:29context_lines=numlines30else:31context_lines=None32diffs=_mdiff(fromlines,tolines,context_lines,linejunk=self._linejunk,33charjunk=self._charjunk)3435# set up iterator to wrap lines that exceed desired width36ifself._wrapcolumn:37diffs=self._line_wrapper(diffs)3839# collect up from/to lines and flags into lists (also format the lines)40fromlist,tolist,flaglist=self._collect_lines(diffs)4142# process change flags, generating middle column of next anchors/links43fromlist,tolist,flaglist,next_href,next_id=self._convert_flags(44fromlist,tolist,flaglist,context,numlines)4546s=[]47fmt=' <tr><td class="diff_next"%s>%s</td>%s'+ \48'<td class="diff_next">%s</td>%s</tr>\n'49foriinrange(len(flaglist)):50ifflaglist[i]isNone:51# mdiff yields None on separator lines skip the bogus ones52# generated for the first line53ifi>0:54s.append(' </tbody> \n <tbody>\n')55else:56s.append(fmt%(next_id[i],next_href[i],fromlist[i],57next_href[i],tolist[i]))58iffromdescortodesc:59header_row='<thead><tr>%s%s%s%s</tr></thead>'%(60'<th class="diff_next"><br /></th>',61'<th colspan="2" class="diff_header">%s</th>'%fromdesc,62'<th class="diff_next"><br /></th>',63'<th colspan="2" class="diff_header">%s</th>'%todesc)64else:65header_row=''6667table=self._table_template%dict(68data_rows=''.join(s),69header_row=header_row,70prefix=self._prefix[1])7172returntable.replace('\0+','<span class="diff_add">'). \73replace('\0-','<span class="diff_sub">'). \74replace('\0^','<span class="diff_chg">'). \75replace('\1','</span>'). \76replace('\t',' ')
Path 4: 3 calls (0.18)
['', ' 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...
'from' (3)
'to' (3)
True (3)
5 (2) 6 (1)
'\n
\n
1defmake_table(self,fromlines,tolines,fromdesc='',todesc='',context=False,2numlines=5):3"""Returns HTML table of side by side comparison with change highlights45 Arguments:6 fromlines -- list of "from" lines7 tolines -- list of "to" lines8 fromdesc -- "from" file column header string9 todesc -- "to" file column header string10 context -- set to True for contextual differences (defaults to False11 which shows full differences).12 numlines -- number of context lines. When context is set True,13 controls number of lines displayed before and after the change.14 When context is False, controls the number of lines to place15 the "next" link anchors before the next change (so click of16 "next" link jumps to just before the change).17 """1819# make unique anchor prefixes so that multiple tables may exist20# on the same page without conflict.21self._make_prefix()2223# change tabs to spaces before it gets more difficult after we insert24# markup25fromlines,tolines=self._tab_newline_replace(fromlines,tolines)2627# create diffs iterator which generates side by side from/to data28ifcontext:29context_lines=numlines30else:31context_lines=None32diffs=_mdiff(fromlines,tolines,context_lines,linejunk=self._linejunk,33charjunk=self._charjunk)3435# set up iterator to wrap lines that exceed desired width36ifself._wrapcolumn:37diffs=self._line_wrapper(diffs)3839# collect up from/to lines and flags into lists (also format the lines)40fromlist,tolist,flaglist=self._collect_lines(diffs)4142# process change flags, generating middle column of next anchors/links43fromlist,tolist,flaglist,next_href,next_id=self._convert_flags(44fromlist,tolist,flaglist,context,numlines)4546s=[]47fmt=' <tr><td class="diff_next"%s>%s</td>%s'+ \48'<td class="diff_next">%s</td>%s</tr>\n'49foriinrange(len(flaglist)):50ifflaglist[i]isNone:51# mdiff yields None on separator lines skip the bogus ones52# generated for the first line53ifi>0:54s.append(' </tbody> \n <tbody>\n')55else:56s.append(fmt%(next_id[i],next_href[i],fromlist[i],57next_href[i],tolist[i]))58iffromdescortodesc:59header_row='<thead><tr>%s%s%s%s</tr></thead>'%(60'<th class="diff_next"><br /></th>',61'<th colspan="2" class="diff_header">%s</th>'%fromdesc,62'<th class="diff_next"><br /></th>',63'<th colspan="2" class="diff_header">%s</th>'%todesc)64else:65header_row=''6667table=self._table_template%dict(68data_rows=''.join(s),69header_row=header_row,70prefix=self._prefix[1])7172returntable.replace('\0+','<span class="diff_add">'). \73replace('\0-','<span class="diff_sub">'). \74replace('\0^','<span class="diff_chg">'). \75replace('\1','</span>'). \76replace('\t',' ')
1defmake_table(self,fromlines,tolines,fromdesc='',todesc='',context=False,2numlines=5):3"""Returns HTML table of side by side comparison with change highlights45 Arguments:6 fromlines -- list of "from" lines7 tolines -- list of "to" lines8 fromdesc -- "from" file column header string9 todesc -- "to" file column header string10 context -- set to True for contextual differences (defaults to False11 which shows full differences).12 numlines -- number of context lines. When context is set True,13 controls number of lines displayed before and after the change.14 When context is False, controls the number of lines to place15 the "next" link anchors before the next change (so click of16 "next" link jumps to just before the change).17 """1819# make unique anchor prefixes so that multiple tables may exist20# on the same page without conflict.21self._make_prefix()2223# change tabs to spaces before it gets more difficult after we insert24# markup25fromlines,tolines=self._tab_newline_replace(fromlines,tolines)2627# create diffs iterator which generates side by side from/to data28ifcontext:29context_lines=numlines30else:31context_lines=None32diffs=_mdiff(fromlines,tolines,context_lines,linejunk=self._linejunk,33charjunk=self._charjunk)3435# set up iterator to wrap lines that exceed desired width36ifself._wrapcolumn:37diffs=self._line_wrapper(diffs)3839# collect up from/to lines and flags into lists (also format the lines)40fromlist,tolist,flaglist=self._collect_lines(diffs)4142# process change flags, generating middle column of next anchors/links43fromlist,tolist,flaglist,next_href,next_id=self._convert_flags(44fromlist,tolist,flaglist,context,numlines)4546s=[]47fmt=' <tr><td class="diff_next"%s>%s</td>%s'+ \48'<td class="diff_next">%s</td>%s</tr>\n'49foriinrange(len(flaglist)):50ifflaglist[i]isNone:51# mdiff yields None on separator lines skip the bogus ones52# generated for the first line53ifi>0:54s.append(' </tbody> \n <tbody>\n')55else:56s.append(fmt%(next_id[i],next_href[i],fromlist[i],57next_href[i],tolist[i]))58iffromdescortodesc:59header_row='<thead><tr>%s%s%s%s</tr></thead>'%(60'<th class="diff_next"><br /></th>',61'<th colspan="2" class="diff_header">%s</th>'%fromdesc,62'<th class="diff_next"><br /></th>',63'<th colspan="2" class="diff_header">%s</th>'%todesc)64else:65header_row=''6667table=self._table_template%dict(68data_rows=''.join(s),69header_row=header_row,70prefix=self._prefix[1])7172returntable.replace('\0+','<span class="diff_add">'). \73replace('\0-','<span class="diff_sub">'). \74replace('\0^','<span class="diff_chg">'). \75replace('\1','</span>'). \76replace('\t',' ')
1defmake_table(self,fromlines,tolines,fromdesc='',todesc='',context=False,2numlines=5):3"""Returns HTML table of side by side comparison with change highlights45 Arguments:6 fromlines -- list of "from" lines7 tolines -- list of "to" lines8 fromdesc -- "from" file column header string9 todesc -- "to" file column header string10 context -- set to True for contextual differences (defaults to False11 which shows full differences).12 numlines -- number of context lines. When context is set True,13 controls number of lines displayed before and after the change.14 When context is False, controls the number of lines to place15 the "next" link anchors before the next change (so click of16 "next" link jumps to just before the change).17 """1819# make unique anchor prefixes so that multiple tables may exist20# on the same page without conflict.21self._make_prefix()2223# change tabs to spaces before it gets more difficult after we insert24# markup25fromlines,tolines=self._tab_newline_replace(fromlines,tolines)2627# create diffs iterator which generates side by side from/to data28ifcontext:29context_lines=numlines30else:31context_lines=None32diffs=_mdiff(fromlines,tolines,context_lines,linejunk=self._linejunk,33charjunk=self._charjunk)3435# set up iterator to wrap lines that exceed desired width36ifself._wrapcolumn:37diffs=self._line_wrapper(diffs)3839# collect up from/to lines and flags into lists (also format the lines)40fromlist,tolist,flaglist=self._collect_lines(diffs)4142# process change flags, generating middle column of next anchors/links43fromlist,tolist,flaglist,next_href,next_id=self._convert_flags(44fromlist,tolist,flaglist,context,numlines)4546s=[]47fmt=' <tr><td class="diff_next"%s>%s</td>%s'+ \48'<td class="diff_next">%s</td>%s</tr>\n'49foriinrange(len(flaglist)):50ifflaglist[i]isNone:51# mdiff yields None on separator lines skip the bogus ones52# generated for the first line53ifi>0:54s.append(' </tbody> \n <tbody>\n')55else:56s.append(fmt%(next_id[i],next_href[i],fromlist[i],57next_href[i],tolist[i]))58iffromdescortodesc:59header_row='<thead><tr>%s%s%s%s</tr></thead>'%(60'<th class="diff_next"><br /></th>',61'<th colspan="2" class="diff_header">%s</th>'%fromdesc,62'<th class="diff_next"><br /></th>',63'<th colspan="2" class="diff_header">%s</th>'%todesc)64else:65header_row=''6667table=self._table_template%dict(68data_rows=''.join(s),69header_row=header_row,70prefix=self._prefix[1])7172returntable.replace('\0+','<span class="diff_add">'). \73replace('\0-','<span class="diff_sub">'). \74replace('\0^','<span class="diff_chg">'). \75replace('\1','</span>'). \76replace('\t',' ')