[meld] Move to next() builtin



commit 177a2d330925e7fbd02bc3233210614cb6faec59
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Oct 26 07:01:51 2012 +1000

    Move to next() builtin

 meld/diffutil.py  |    2 +-
 meld/dirdiff.py   |    2 +-
 meld/filediff.py  |   28 ++++++++++++++--------------
 meld/filemerge.py |    2 +-
 meld/merge.py     |    2 +-
 5 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/meld/diffutil.py b/meld/diffutil.py
index 28fae69..e3f10b4 100644
--- a/meld/diffutil.py
+++ b/meld/diffutil.py
@@ -456,7 +456,7 @@ class Differ(gobject.GObject):
         for i in range(self.num_sequences - 1):
             matcher = self._matcher(None, sequences[1], sequences[i*2])
             work = matcher.initialise()
-            while work.next() is None:
+            while next(work) is None:
                 yield None
             self.diffs[i] = matcher.get_difference_opcodes()
         self._initialised = True
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index f5ff4c1..08d784e 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -1127,7 +1127,7 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
                 if treeview.row_expanded(rowiter.path):
                     for row in rowiter.iterchildren():
                         recurse_tree_states(row)
-            recurse_tree_states(iter(self.model).next())
+            recurse_tree_states(next(iter(self.model)))
             row_states.append(None)
 
             numlines = float(len(row_states) - 1)
diff --git a/meld/filediff.py b/meld/filediff.py
index d82b29e..ec3f01c 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -376,19 +376,19 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         self.status_info_labels[1].set_text(line_column)
 
         if line != self.cursor.line or force:
-            chunk, prev, next = self.linediffer.locate_chunk(pane, line)
+            chunk, prev, next_ = self.linediffer.locate_chunk(pane, line)
             if chunk != self.cursor.chunk or force:
                 self.cursor.chunk = chunk
                 self.emit("current-diff-changed")
-            if prev != self.cursor.prev or next != self.cursor.next or force:
+            if prev != self.cursor.prev or next_ != self.cursor.next or force:
                 self.emit("next-diff-changed", prev is not None,
-                          next is not None)
+                          next_ is not None)
 
             prev_conflict, next_conflict = None, None
             for conflict in self.linediffer.conflicts:
                 if prev is not None and conflict <= prev:
                     prev_conflict = conflict
-                if next is not None and conflict >= next:
+                if next_ is not None and conflict >= next_:
                     next_conflict = conflict
                     break
             if prev_conflict != self.cursor.prev_conflict or \
@@ -396,7 +396,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
                 self.emit("next-conflict-changed", prev_conflict is not None,
                           next_conflict is not None)
 
-            self.cursor.prev, self.cursor.next = prev, next
+            self.cursor.prev, self.cursor.next = prev, next_
             self.cursor.prev_conflict = prev_conflict
             self.cursor.next_conflict = next_conflict
         self.cursor.line, self.cursor.offset = line, offset
@@ -562,7 +562,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         # This hack is required when pane0's prev/next chunk doesn't exist
         # (i.e., is Same) between pane0 and pane1.
         prev_chunk0, prev_chunk1, next_chunk0, next_chunk1 = (None,) * 4
-        _, prev, next = self.linediffer.locate_chunk(pane0, line)
+        _, prev, next_ = self.linediffer.locate_chunk(pane0, line)
         if prev is not None:
             while prev >= 0:
                 prev_chunk0 = self.linediffer.get_chunk(prev, pane0, pane1)
@@ -573,15 +573,15 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
                     break
                 prev -= 1
 
-        if next is not None:
-            while next < self.linediffer.diff_count():
-                next_chunk0 = self.linediffer.get_chunk(next, pane0, pane1)
-                next_chunk1 = self.linediffer.get_chunk(next, pane1, pane0)
+        if next_ is not None:
+            while next_ < self.linediffer.diff_count():
+                next_chunk0 = self.linediffer.get_chunk(next_, pane0, pane1)
+                next_chunk1 = self.linediffer.get_chunk(next_, pane1, pane0)
                 if None not in (next_chunk0, next_chunk1):
                     end0 = next_chunk0[1]
                     end1 = next_chunk1[1]
                     break
-                next += 1
+                next_ += 1
 
         return "Same", start0, end0, start1, end1
 
@@ -1057,13 +1057,13 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         yield _("[%s] Computing differences") % self.label_text
         texts = self.buffer_filtered[:self.num_panes]
         step = self.linediffer.set_sequences_iter(texts)
-        while step.next() is None:
+        while next(step) is None:
             yield 1
 
-        chunk, prev, next = self.linediffer.locate_chunk(1, 0)
+        chunk, prev, next_ = self.linediffer.locate_chunk(1, 0)
         self.cursor.next = chunk
         if self.cursor.next is None:
-            self.cursor.next = next
+            self.cursor.next = next_
         for buf in self.textbuffer:
             buf.place_cursor(buf.get_start_iter())
         self.scheduler.add_task(lambda: self.next_diff(gtk.gdk.SCROLL_DOWN), True)
diff --git a/meld/filemerge.py b/meld/filemerge.py
index 4077a6c..7e5947e 100644
--- a/meld/filemerge.py
+++ b/meld/filemerge.py
@@ -48,7 +48,7 @@ class FileMerge(filediff.FileDiff):
         yield _("[%s] Merging files") % self.label_text
         merger = merge.Merger()
         step = merger.initialize(self.buffer_filtered, self.buffer_texts)
-        while step.next() is None:
+        while next(step) is None:
             yield 1
         for merged_text in merger.merge_3_files():
             yield 1
diff --git a/meld/merge.py b/meld/merge.py
index a2bb533..528b0a8 100644
--- a/meld/merge.py
+++ b/meld/merge.py
@@ -170,7 +170,7 @@ class Merger(diffutil.Differ):
 
     def initialize(self, sequences, texts):
         step = self.differ.set_sequences_iter(sequences)
-        while step.next() == None:
+        while next(step) is None:
             yield None
         self.texts = texts
         yield 1



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