Path 1: 5 calls (0.29)

['', '\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
1def make_table(self,fromlines,tolines,fromdesc='',todesc='',context=False,
2                   numlines=5):
3        """Returns HTML table of side by side comparison with change highlights
4
5        Arguments:
6        fromlines -- list of "from" lines
7        tolines -- list of "to" lines
8        fromdesc -- "from" file column header string
9        todesc -- "to" file column header string
10        context -- set to True for contextual differences (defaults to False
11            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 place
15            the "next" link anchors before the next change (so click of
16            "next" link jumps to just before the change).
17        """
18
19        # make unique anchor prefixes so that multiple tables may exist
20        # on the same page without conflict.
21        self._make_prefix()
22
23        # change tabs to spaces before it gets more difficult after we insert
24        # markup
25        fromlines,tolines = self._tab_newline_replace(fromlines,tolines)
26
27        # create diffs iterator which generates side by side from/to data
28        if context:
29            context_lines = numlines
30        else:
31            context_lines = None
32        diffs = _mdiff(fromlines,tolines,context_lines,linejunk=self._linejunk,
33                      charjunk=self._charjunk)
34
35        # set up iterator to wrap lines that exceed desired width
36        if self._wrapcolumn:
37            diffs = self._line_wrapper(diffs)
38
39        # collect up from/to lines and flags into lists (also format the lines)
40        fromlist,tolist,flaglist = self._collect_lines(diffs)
41
42        # process change flags, generating middle column of next anchors/links
43        fromlist,tolist,flaglist,next_href,next_id = self._convert_flags(
44            fromlist,tolist,flaglist,context,numlines)
45
46        s = []
47        fmt = '            <tr><td class="diff_next"%s>%s</td>%s' + \
48              '<td class="diff_next">%s</td>%s</tr>\n'
49        for i in range(len(flaglist)):
50            if flaglist[i] is None:
51                # mdiff yields None on separator lines skip the bogus ones
52                # generated for the first line
53                if i > 0:
54                    s.append('        </tbody>        \n        <tbody>\n')
55            else:
56                s.append( fmt % (next_id[i],next_href[i],fromlist[i],
57                                           next_href[i],tolist[i]))
58        if fromdesc or todesc:
59            header_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)
64        else:
65            header_row = ''
66
67        table = self._table_template % dict(
68            data_rows=''.join(s),
69            header_row=header_row,
70            prefix=self._prefix[1])
71
72        return table.replace('\0+','<span class="diff_add">'). \
73                     replace('\0-','<span class="diff_sub">'). \
74                     replace('\0^','<span class="diff_chg">'). \
75                     replace('\1','</span>'). \
76                     replace('\t','&nbsp;')
            

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
1def make_table(self,fromlines,tolines,fromdesc='',todesc='',context=False,
2                   numlines=5):
3        """Returns HTML table of side by side comparison with change highlights
4
5        Arguments:
6        fromlines -- list of "from" lines
7        tolines -- list of "to" lines
8        fromdesc -- "from" file column header string
9        todesc -- "to" file column header string
10        context -- set to True for contextual differences (defaults to False
11            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 place
15            the "next" link anchors before the next change (so click of
16            "next" link jumps to just before the change).
17        """
18
19        # make unique anchor prefixes so that multiple tables may exist
20        # on the same page without conflict.
21        self._make_prefix()
22
23        # change tabs to spaces before it gets more difficult after we insert
24        # markup
25        fromlines,tolines = self._tab_newline_replace(fromlines,tolines)
26
27        # create diffs iterator which generates side by side from/to data
28        if context:
29            context_lines = numlines
30        else:
31            context_lines = None
32        diffs = _mdiff(fromlines,tolines,context_lines,linejunk=self._linejunk,
33                      charjunk=self._charjunk)
34
35        # set up iterator to wrap lines that exceed desired width
36        if self._wrapcolumn:
37            diffs = self._line_wrapper(diffs)
38
39        # collect up from/to lines and flags into lists (also format the lines)
40        fromlist,tolist,flaglist = self._collect_lines(diffs)
41
42        # process change flags, generating middle column of next anchors/links
43        fromlist,tolist,flaglist,next_href,next_id = self._convert_flags(
44            fromlist,tolist,flaglist,context,numlines)
45
46        s = []
47        fmt = '            <tr><td class="diff_next"%s>%s</td>%s' + \
48              '<td class="diff_next">%s</td>%s</tr>\n'
49        for i in range(len(flaglist)):
50            if flaglist[i] is None:
51                # mdiff yields None on separator lines skip the bogus ones
52                # generated for the first line
53                if i > 0:
54                    s.append('        </tbody>        \n        <tbody>\n')
55            else:
56                s.append( fmt % (next_id[i],next_href[i],fromlist[i],
57                                           next_href[i],tolist[i]))
58        if fromdesc or todesc:
59            header_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)
64        else:
65            header_row = ''
66
67        table = self._table_template % dict(
68            data_rows=''.join(s),
69            header_row=header_row,
70            prefix=self._prefix[1])
71
72        return table.replace('\0+','<span class="diff_add">'). \
73                     replace('\0-','<span class="diff_sub">'). \
74                     replace('\0^','<span class="diff_chg">'). \
75                     replace('\1','</span>'). \
76                     replace('\t','&nbsp;')
            

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
1def make_table(self,fromlines,tolines,fromdesc='',todesc='',context=False,
2                   numlines=5):
3        """Returns HTML table of side by side comparison with change highlights
4
5        Arguments:
6        fromlines -- list of "from" lines
7        tolines -- list of "to" lines
8        fromdesc -- "from" file column header string
9        todesc -- "to" file column header string
10        context -- set to True for contextual differences (defaults to False
11            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 place
15            the "next" link anchors before the next change (so click of
16            "next" link jumps to just before the change).
17        """
18
19        # make unique anchor prefixes so that multiple tables may exist
20        # on the same page without conflict.
21        self._make_prefix()
22
23        # change tabs to spaces before it gets more difficult after we insert
24        # markup
25        fromlines,tolines = self._tab_newline_replace(fromlines,tolines)
26
27        # create diffs iterator which generates side by side from/to data
28        if context:
29            context_lines = numlines
30        else:
31            context_lines = None
32        diffs = _mdiff(fromlines,tolines,context_lines,linejunk=self._linejunk,
33                      charjunk=self._charjunk)
34
35        # set up iterator to wrap lines that exceed desired width
36        if self._wrapcolumn:
37            diffs = self._line_wrapper(diffs)
38
39        # collect up from/to lines and flags into lists (also format the lines)
40        fromlist,tolist,flaglist = self._collect_lines(diffs)
41
42        # process change flags, generating middle column of next anchors/links
43        fromlist,tolist,flaglist,next_href,next_id = self._convert_flags(
44            fromlist,tolist,flaglist,context,numlines)
45
46        s = []
47        fmt = '            <tr><td class="diff_next"%s>%s</td>%s' + \
48              '<td class="diff_next">%s</td>%s</tr>\n'
49        for i in range(len(flaglist)):
50            if flaglist[i] is None:
51                # mdiff yields None on separator lines skip the bogus ones
52                # generated for the first line
53                if i > 0:
54                    s.append('        </tbody>        \n        <tbody>\n')
55            else:
56                s.append( fmt % (next_id[i],next_href[i],fromlist[i],
57                                           next_href[i],tolist[i]))
58        if fromdesc or todesc:
59            header_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)
64        else:
65            header_row = ''
66
67        table = self._table_template % dict(
68            data_rows=''.join(s),
69            header_row=header_row,
70            prefix=self._prefix[1])
71
72        return table.replace('\0+','<span class="diff_add">'). \
73                     replace('\0-','<span class="diff_sub">'). \
74                     replace('\0^','<span class="diff_chg">'). \
75                     replace('\1','</span>'). \
76                     replace('\t','&nbsp;')
            

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
1def make_table(self,fromlines,tolines,fromdesc='',todesc='',context=False,
2                   numlines=5):
3        """Returns HTML table of side by side comparison with change highlights
4
5        Arguments:
6        fromlines -- list of "from" lines
7        tolines -- list of "to" lines
8        fromdesc -- "from" file column header string
9        todesc -- "to" file column header string
10        context -- set to True for contextual differences (defaults to False
11            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 place
15            the "next" link anchors before the next change (so click of
16            "next" link jumps to just before the change).
17        """
18
19        # make unique anchor prefixes so that multiple tables may exist
20        # on the same page without conflict.
21        self._make_prefix()
22
23        # change tabs to spaces before it gets more difficult after we insert
24        # markup
25        fromlines,tolines = self._tab_newline_replace(fromlines,tolines)
26
27        # create diffs iterator which generates side by side from/to data
28        if context:
29            context_lines = numlines
30        else:
31            context_lines = None
32        diffs = _mdiff(fromlines,tolines,context_lines,linejunk=self._linejunk,
33                      charjunk=self._charjunk)
34
35        # set up iterator to wrap lines that exceed desired width
36        if self._wrapcolumn:
37            diffs = self._line_wrapper(diffs)
38
39        # collect up from/to lines and flags into lists (also format the lines)
40        fromlist,tolist,flaglist = self._collect_lines(diffs)
41
42        # process change flags, generating middle column of next anchors/links
43        fromlist,tolist,flaglist,next_href,next_id = self._convert_flags(
44            fromlist,tolist,flaglist,context,numlines)
45
46        s = []
47        fmt = '            <tr><td class="diff_next"%s>%s</td>%s' + \
48              '<td class="diff_next">%s</td>%s</tr>\n'
49        for i in range(len(flaglist)):
50            if flaglist[i] is None:
51                # mdiff yields None on separator lines skip the bogus ones
52                # generated for the first line
53                if i > 0:
54                    s.append('        </tbody>        \n        <tbody>\n')
55            else:
56                s.append( fmt % (next_id[i],next_href[i],fromlist[i],
57                                           next_href[i],tolist[i]))
58        if fromdesc or todesc:
59            header_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)
64        else:
65            header_row = ''
66
67        table = self._table_template % dict(
68            data_rows=''.join(s),
69            header_row=header_row,
70            prefix=self._prefix[1])
71
72        return table.replace('\0+','<span class="diff_add">'). \
73                     replace('\0-','<span class="diff_sub">'). \
74                     replace('\0^','<span class="diff_chg">'). \
75                     replace('\1','</span>'). \
76                     replace('\t','&nbsp;')
            

Path 5: 2 calls (0.12)

['line 0', '1234567890123456789012345689012345', 'line 1', 'line 2', 'line 3', 'line 4 changed', 'line 5 changed', 'line 6 changed', 'line 7', '...

['line 0', '1234567890123456789012345689012345', 'line 1', 'line 2 added', 'line 3', 'line 4 chanGEd', 'line 5a chanGed', 'line 6a changEd', 'l...

'' (2)

'' (2)

False (2)

5 (2)

'\n

\n
1def make_table(self,fromlines,tolines,fromdesc='',todesc='',context=False,
2                   numlines=5):
3        """Returns HTML table of side by side comparison with change highlights
4
5        Arguments:
6        fromlines -- list of "from" lines
7        tolines -- list of "to" lines
8        fromdesc -- "from" file column header string
9        todesc -- "to" file column header string
10        context -- set to True for contextual differences (defaults to False
11            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 place
15            the "next" link anchors before the next change (so click of
16            "next" link jumps to just before the change).
17        """
18
19        # make unique anchor prefixes so that multiple tables may exist
20        # on the same page without conflict.
21        self._make_prefix()
22
23        # change tabs to spaces before it gets more difficult after we insert
24        # markup
25        fromlines,tolines = self._tab_newline_replace(fromlines,tolines)
26
27        # create diffs iterator which generates side by side from/to data
28        if context:
29            context_lines = numlines
30        else:
31            context_lines = None
32        diffs = _mdiff(fromlines,tolines,context_lines,linejunk=self._linejunk,
33                      charjunk=self._charjunk)
34
35        # set up iterator to wrap lines that exceed desired width
36        if self._wrapcolumn:
37            diffs = self._line_wrapper(diffs)
38
39        # collect up from/to lines and flags into lists (also format the lines)
40        fromlist,tolist,flaglist = self._collect_lines(diffs)
41
42        # process change flags, generating middle column of next anchors/links
43        fromlist,tolist,flaglist,next_href,next_id = self._convert_flags(
44            fromlist,tolist,flaglist,context,numlines)
45
46        s = []
47        fmt = '            <tr><td class="diff_next"%s>%s</td>%s' + \
48              '<td class="diff_next">%s</td>%s</tr>\n'
49        for i in range(len(flaglist)):
50            if flaglist[i] is None:
51                # mdiff yields None on separator lines skip the bogus ones
52                # generated for the first line
53                if i > 0:
54                    s.append('        </tbody>        \n        <tbody>\n')
55            else:
56                s.append( fmt % (next_id[i],next_href[i],fromlist[i],
57                                           next_href[i],tolist[i]))
58        if fromdesc or todesc:
59            header_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)
64        else:
65            header_row = ''
66
67        table = self._table_template % dict(
68            data_rows=''.join(s),
69            header_row=header_row,
70            prefix=self._prefix[1])
71
72        return table.replace('\0+','<span class="diff_add">'). \
73                     replace('\0-','<span class="diff_sub">'). \
74                     replace('\0^','<span class="diff_chg">'). \
75                     replace('\1','</span>'). \
76                     replace('\t','&nbsp;')
            

Path 6: 1 calls (0.06)

['line 0', '1234567890123456789012345689012345', 'line 1', 'line 2', 'line 3', 'line 4 changed', 'line 5 changed', 'line 6 changed', 'line 7', '...

['line 0', '1234567890123456789012345689012345', 'line 1', 'line 2 added', 'line 3', 'line 4 chanGEd', 'line 5a chanGed', 'line 6a changEd', 'l...

'' (1)

'' (1)

True (1)

0 (1)

'\n

\n
1def make_table(self,fromlines,tolines,fromdesc='',todesc='',context=False,
2                   numlines=5):
3        """Returns HTML table of side by side comparison with change highlights
4
5        Arguments:
6        fromlines -- list of "from" lines
7        tolines -- list of "to" lines
8        fromdesc -- "from" file column header string
9        todesc -- "to" file column header string
10        context -- set to True for contextual differences (defaults to False
11            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 place
15            the "next" link anchors before the next change (so click of
16            "next" link jumps to just before the change).
17        """
18
19        # make unique anchor prefixes so that multiple tables may exist
20        # on the same page without conflict.
21        self._make_prefix()
22
23        # change tabs to spaces before it gets more difficult after we insert
24        # markup
25        fromlines,tolines = self._tab_newline_replace(fromlines,tolines)
26
27        # create diffs iterator which generates side by side from/to data
28        if context:
29            context_lines = numlines
30        else:
31            context_lines = None
32        diffs = _mdiff(fromlines,tolines,context_lines,linejunk=self._linejunk,
33                      charjunk=self._charjunk)
34
35        # set up iterator to wrap lines that exceed desired width
36        if self._wrapcolumn:
37            diffs = self._line_wrapper(diffs)
38
39        # collect up from/to lines and flags into lists (also format the lines)
40        fromlist,tolist,flaglist = self._collect_lines(diffs)
41
42        # process change flags, generating middle column of next anchors/links
43        fromlist,tolist,flaglist,next_href,next_id = self._convert_flags(
44            fromlist,tolist,flaglist,context,numlines)
45
46        s = []
47        fmt = '            <tr><td class="diff_next"%s>%s</td>%s' + \
48              '<td class="diff_next">%s</td>%s</tr>\n'
49        for i in range(len(flaglist)):
50            if flaglist[i] is None:
51                # mdiff yields None on separator lines skip the bogus ones
52                # generated for the first line
53                if i > 0:
54                    s.append('        </tbody>        \n        <tbody>\n')
55            else:
56                s.append( fmt % (next_id[i],next_href[i],fromlist[i],
57                                           next_href[i],tolist[i]))
58        if fromdesc or todesc:
59            header_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)
64        else:
65            header_row = ''
66
67        table = self._table_template % dict(
68            data_rows=''.join(s),
69            header_row=header_row,
70            prefix=self._prefix[1])
71
72        return table.replace('\0+','<span class="diff_add">'). \
73                     replace('\0-','<span class="diff_sub">'). \
74                     replace('\0^','<span class="diff_chg">'). \
75                     replace('\1','</span>'). \
76                     replace('\t','&nbsp;')