[extensions-web] review: Clean up



commit 87c275832642cca44e5a2e91df534036fc6843a0
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Jun 26 13:39:08 2012 -0400

    review: Clean up
    
    Cosmetic and basic cleanup fixes

 sweettooth/review/diffutils.py |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/sweettooth/review/diffutils.py b/sweettooth/review/diffutils.py
index 7e47950..831d4f1 100644
--- a/sweettooth/review/diffutils.py
+++ b/sweettooth/review/diffutils.py
@@ -44,6 +44,8 @@ class MyersDiffer:
         self.max_lines = 0
         self.fdiag = None
         self.bdiag = None
+        self.downoff = 0
+        self.upoff = 0
 
     def ratio(self):
         self._gen_diff_data()
@@ -145,8 +147,8 @@ class MyersDiffer:
         if self.a_data and self.b_data:
             return
 
-        self.a_data = self.DiffData(self._gen_diff_codes(self.a, False))
-        self.b_data = self.DiffData(self._gen_diff_codes(self.b, True))
+        self.a_data = self.DiffData(self._gen_diff_codes(self.a))
+        self.b_data = self.DiffData(self._gen_diff_codes(self.b))
 
         self._discard_confusing_lines()
 
@@ -165,20 +167,17 @@ class MyersDiffer:
         self._shift_chunks(self.a_data, self.b_data)
         self._shift_chunks(self.b_data, self.a_data)
 
-    def _gen_diff_codes(self, lines, is_modified_file):
+    def _gen_diff_codes(self, lines):
         """
         Converts all unique lines of text into unique numbers. Comparing
         lists of numbers is faster than comparing lists of strings.
         """
         codes = []
 
-        linenum = 0
-
         for line in lines:
             # TODO: Handle ignoring/triming spaces, ignoring casing, and
             #       special hooks
 
-            raw_line = line
             stripped_line = line.lstrip()
 
             if self.ignore_space:
@@ -196,8 +195,6 @@ class MyersDiffer:
 
             codes.append(code)
 
-            linenum += 1
-
         return codes
 
     def _find_sms(self, a_lower, a_upper, b_lower, b_upper, find_minimal):
@@ -438,7 +435,7 @@ class MyersDiffer:
                     j += 1
 
             if i == i_end:
-                return;
+                return
 
             start = i
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]