From afb5f9421719e7c7ada1a236bb226c9f84eaf880 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Sun, 29 Aug 2004 19:33:36 +0000 Subject: [PATCH] Reverting whitespace normalization. test_difflib fails with it -- the test depends on invisible trailing whitespace in .py files. The author will have to repair that. --- Lib/difflib.py | 62 ++++++++++++++++++++-------------------- Lib/test/test_difflib.py | 32 ++++++++++----------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/Lib/difflib.py b/Lib/difflib.py index f855d46a828..aa205f7447b 100644 --- a/Lib/difflib.py +++ b/Lib/difflib.py @@ -1289,7 +1289,7 @@ def _mdiff(fromlines, tolines, context=None, linejunk=None, if None, all from/to text lines will be generated. linejunk -- passed on to ndiff (see ndiff documentation) charjunk -- passed on to ndiff (see ndiff documentation) - + This function returns an interator which returns a tuple: (from line tuple, to line tuple, boolean flag) @@ -1300,7 +1300,7 @@ def _mdiff(fromlines, tolines, context=None, linejunk=None, '\0-' -- marks start of deleted text '\0^' -- marks start of changed text '\1' -- marks end of added/deleted/changed text - + boolean flag -- None indicates context separation, True indicates either "from" or "to" line contains a change, otherwise False. @@ -1310,13 +1310,13 @@ def _mdiff(fromlines, tolines, context=None, linejunk=None, Note, this function utilizes the ndiff function to generate the side by side difference markup. Optional ndiff arguments may be passed to this - function and they in turn will be passed to ndiff. + function and they in turn will be passed to ndiff. """ - import re + import re # regular expression for finding intraline change indices change_re = re.compile('(\++|\-+|\^+)') - + # create the difference iterator to generate the differences diff_lines_iterator = ndiff(fromlines,tolines,linejunk,charjunk) @@ -1375,7 +1375,7 @@ def _mdiff(fromlines, tolines, context=None, linejunk=None, # thing (such as adding the line number) then replace the special # marks with what the user's change markup. return (num_lines[side],text) - + def _line_iterator(): """Yields from/to lines of text with a change indication. @@ -1392,7 +1392,7 @@ def _mdiff(fromlines, tolines, context=None, linejunk=None, """ lines = [] num_blanks_pending, num_blanks_to_yield = 0, 0 - while True: + while True: # Load up next 4 lines so we can look ahead, create strings which # are a concatenation of the first character of each of the 4 lines # so we can do some very readable comparisons. @@ -1550,7 +1550,7 @@ _file_template = """ -