@@ -1289,7 +1289,7 @@ def _mdiff(fromlines, tolines, context=None, linejunk=None,
12891289 if None, all from/to text lines will be generated.
12901290 linejunk -- passed on to ndiff (see ndiff documentation)
12911291 charjunk -- passed on to ndiff (see ndiff documentation)
1292-
1292+
12931293 This function returns an interator which returns a tuple:
12941294 (from line tuple, to line tuple, boolean flag)
12951295
@@ -1300,7 +1300,7 @@ def _mdiff(fromlines, tolines, context=None, linejunk=None,
13001300 '\0 -' -- marks start of deleted text
13011301 '\0 ^' -- marks start of changed text
13021302 '\1 ' -- marks end of added/deleted/changed text
1303-
1303+
13041304 boolean flag -- None indicates context separation, True indicates
13051305 either "from" or "to" line contains a change, otherwise False.
13061306
@@ -1310,13 +1310,13 @@ def _mdiff(fromlines, tolines, context=None, linejunk=None,
13101310
13111311 Note, this function utilizes the ndiff function to generate the side by
13121312 side difference markup. Optional ndiff arguments may be passed to this
1313- function and they in turn will be passed to ndiff.
1313+ function and they in turn will be passed to ndiff.
13141314 """
1315- import re
1315+ import re
13161316
13171317 # regular expression for finding intraline change indices
13181318 change_re = re .compile ('(\++|\-+|\^+)' )
1319-
1319+
13201320 # create the difference iterator to generate the differences
13211321 diff_lines_iterator = ndiff (fromlines ,tolines ,linejunk ,charjunk )
13221322
@@ -1375,7 +1375,7 @@ def record_sub_info(match_object,sub_info=sub_info):
13751375 # thing (such as adding the line number) then replace the special
13761376 # marks with what the user's change markup.
13771377 return (num_lines [side ],text )
1378-
1378+
13791379 def _line_iterator ():
13801380 """Yields from/to lines of text with a change indication.
13811381
@@ -1392,7 +1392,7 @@ def _line_iterator():
13921392 """
13931393 lines = []
13941394 num_blanks_pending , num_blanks_to_yield = 0 , 0
1395- while True :
1395+ while True :
13961396 # Load up next 4 lines so we can look ahead, create strings which
13971397 # are a concatenation of the first character of each of the 4 lines
13981398 # so we can do some very readable comparisons.
@@ -1550,7 +1550,7 @@ def _line_pair_iterator():
15501550<html>
15511551
15521552<head>
1553- <meta http-equiv="Content-Type"
1553+ <meta http-equiv="Content-Type"
15541554 content="text/html; charset=ISO-8859-1" />
15551555 <title></title>
15561556 <style type="text/css">%(styles)s
@@ -1573,9 +1573,9 @@ def _line_pair_iterator():
15731573 .diff_sub {background-color:#ffaaaa}"""
15741574
15751575_table_template = """
1576- <table class="diff" id="difflib_chg_%(prefix)s_top"
1577- cellspacing="0" cellpadding="0" rules="groups" >
1578- <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
1576+ <table class="diff" id="difflib_chg_%(prefix)s_top"
1577+ cellspacing="0" cellpadding="0" rules="groups" >
1578+ <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
15791579 <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
15801580 %(header_row)s
15811581 <tbody>
@@ -1604,23 +1604,23 @@ class HtmlDiff(object):
16041604
16051605 This class can be used to create an HTML table (or a complete HTML file
16061606 containing the table) showing a side by side, line by line comparision
1607- of text with inter-line and intra-line change highlights. The table can
1607+ of text with inter-line and intra-line change highlights. The table can
16081608 be generated in either full or contextual difference mode.
1609-
1609+
16101610 The following methods are provided for HTML generation:
16111611
16121612 make_table -- generates HTML for a single side by side table
16131613 make_file -- generates complete HTML file with a single side by side table
16141614
1615- See tools/scripts/diff.py for an example usage of this class.
1615+ See tools/scripts/diff.py for an example usage of this class.
16161616 """
16171617
16181618 _file_template = _file_template
16191619 _styles = _styles
16201620 _table_template = _table_template
16211621 _legend = _legend
16221622 _default_prefix = 0
1623-
1623+
16241624 def __init__ (self ,tabsize = 8 ,wrapcolumn = None ,linejunk = None ,
16251625 charjunk = IS_CHARACTER_JUNK ):
16261626 """HtmlDiff instance initializer
@@ -1630,7 +1630,7 @@ def __init__(self,tabsize=8,wrapcolumn=None,linejunk=None,
16301630 wrapcolumn -- column number where lines are broken and wrapped,
16311631 defaults to None where lines are not wrapped.
16321632 linejunk,charjunk -- keyword arguments passed into ndiff() (used to by
1633- HtmlDiff() to generate the side by side HTML differences). See
1633+ HtmlDiff() to generate the side by side HTML differences). See
16341634 ndiff() documentation for argument default values and descriptions.
16351635 """
16361636 self ._tabsize = tabsize
@@ -1655,13 +1655,13 @@ def make_file(self,fromlines,tolines,fromdesc='',todesc='',context=False,
16551655 the "next" link anchors before the next change (so click of
16561656 "next" link jumps to just before the change).
16571657 """
1658-
1658+
16591659 return self ._file_template % dict (
16601660 styles = self ._styles ,
16611661 legend = self ._legend ,
16621662 table = self .make_table (fromlines ,tolines ,fromdesc ,todesc ,
16631663 context = context ,numlines = numlines ))
1664-
1664+
16651665 def _tab_newline_replace (self ,fromlines ,tolines ):
16661666 """Returns from/to line lists with tabs expanded and newlines removed.
16671667
@@ -1734,10 +1734,10 @@ def _split_line(self,data_list,line_num,text):
17341734 line1 = line1 + '\1 '
17351735 line2 = '\0 ' + mark + line2
17361736
1737- # tack on first line onto the output list
1737+ # tack on first line onto the output list
17381738 data_list .append ((line_num ,line1 ))
17391739
1740- # use this routine again to wrap the remaining text
1740+ # use this routine again to wrap the remaining text
17411741 self ._split_line (data_list ,'>' ,line2 )
17421742
17431743 def _line_wrapper (self ,diffs ):
@@ -1776,7 +1776,7 @@ def _collect_lines(self,diffs):
17761776 """
17771777
17781778 fromlist ,tolist ,flaglist = [],[],[]
1779- # pull from/to data and flags from mdiff style iterator
1779+ # pull from/to data and flags from mdiff style iterator
17801780 for fromdata ,todata ,flag in diffs :
17811781 try :
17821782 # store HTML markup of the lines into the lists
@@ -1788,7 +1788,7 @@ def _collect_lines(self,diffs):
17881788 tolist .append (None )
17891789 flaglist .append (flag )
17901790 return fromlist ,tolist ,flaglist
1791-
1791+
17921792 def _format_line (self ,side ,flag ,linenum ,text ):
17931793 """Returns HTML markup of "from" / "to" text lines
17941794
@@ -1802,7 +1802,7 @@ def _format_line(self,side,flag,linenum,text):
18021802 id = ' id="%s%s"' % (self ._prefix [side ],linenum )
18031803 except TypeError :
18041804 # handle blank lines where linenum is '>' or ''
1805- id = ''
1805+ id = ''
18061806 # replace those things that would get confused with HTML symbols
18071807 text = text .replace ("&" ,"&" ).replace (">" ,">" ).replace ("<" ,"<" )
18081808
@@ -1825,10 +1825,10 @@ def _make_prefix(self):
18251825
18261826 def _convert_flags (self ,fromlist ,tolist ,flaglist ,context ,numlines ):
18271827 """Makes list of "next" links"""
1828-
1828+
18291829 # all anchor names will be generated using the unique "to" prefix
18301830 toprefix = self ._prefix [1 ]
1831-
1831+
18321832 # process change flags, generating middle column of next anchors/links
18331833 next_id = ['' ]* len (flaglist )
18341834 next_href = ['' ]* len (flaglist )
@@ -1840,11 +1840,11 @@ def _convert_flags(self,fromlist,tolist,flaglist,context,numlines):
18401840 in_change = True
18411841 last = i
18421842 # at the beginning of a change, drop an anchor a few lines
1843- # (the context lines) before the change for the previous
1843+ # (the context lines) before the change for the previous
18441844 # link
18451845 i = max ([0 ,i - numlines ])
18461846 next_id [i ] = ' id="difflib_chg_%s_%d"' % (toprefix ,num_chg )
1847- # at the beginning of a change, drop a link to the next
1847+ # at the beginning of a change, drop a link to the next
18481848 # change
18491849 num_chg += 1
18501850 next_href [last ] = '<a href="#difflib_chg_%s_%d">n</a>' % (
@@ -1891,11 +1891,11 @@ def make_table(self,fromlines,tolines,fromdesc='',todesc='',context=False,
18911891 # make unique anchor prefixes so that multiple tables may exist
18921892 # on the same page without conflict.
18931893 self ._make_prefix ()
1894-
1894+
18951895 # change tabs to spaces before it gets more difficult after we insert
18961896 # markkup
18971897 fromlines ,tolines = self ._tab_newline_replace (fromlines ,tolines )
1898-
1898+
18991899 # create diffs iterator which generates side by side from/to data
19001900 if context :
19011901 context_lines = numlines
@@ -1907,7 +1907,7 @@ def make_table(self,fromlines,tolines,fromdesc='',todesc='',context=False,
19071907 # set up iterator to wrap lines that exceed desired width
19081908 if self ._wrapcolumn :
19091909 diffs = self ._line_wrapper (diffs )
1910-
1910+
19111911 # collect up from/to lines and flags into lists (also format the lines)
19121912 fromlist ,tolist ,flaglist = self ._collect_lines (diffs )
19131913
@@ -1947,7 +1947,7 @@ def make_table(self,fromlines,tolines,fromdesc='',todesc='',context=False,
19471947 replace ('\0 ^' ,'<span class="diff_chg">' ). \
19481948 replace ('\1 ' ,'</span>' ). \
19491949 replace ('\t ' ,' ' )
1950-
1950+
19511951del re
19521952
19531953def restore (delta , which ):
0 commit comments