[meld] Replace iteritems/itervalues with items/values for Python 3 compat



commit db086665852630698ab5bde9c46e524d512bdec5
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Oct 27 08:30:20 2012 +1000

    Replace iteritems/itervalues with items/values for Python 3 compat
    
    While in theory these changes could cause worse performance under
    Python 2, the areas in which these calls occurred are very unlikely to
    have any performance impact.

 meld/diffmap.py      |    2 +-
 meld/dirdiff.py      |    2 +-
 meld/vc/bzr.py       |    2 +-
 meld/vc/fossil.py    |    4 ++--
 meld/vc/git.py       |    2 +-
 meld/vc/mercurial.py |    2 +-
 meld/vc/monotone.py  |    2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/meld/diffmap.py b/meld/diffmap.py
index 5c8292c..f9111c9 100644
--- a/meld/diffmap.py
+++ b/meld/diffmap.py
@@ -110,7 +110,7 @@ class DiffMap(gtk.DrawingArea):
         for c, y0, y1 in self._difffunc():
             tagged_diffs[c].append((y0, y1))
 
-        for tag, diffs in tagged_diffs.iteritems():
+        for tag, diffs in tagged_diffs.items():
             context.set_source_color(self.fill_colors[tag])
             for y0, y1 in diffs:
                 y0, y1 = round(y0 * height) - 0.5, round(y1 * height) - 0.5
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 40b3040..847415b 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -194,7 +194,7 @@ class CanonicalListing(object):
     def get(self):
         first = lambda seq: next(s for s in seq if s)
         filled = lambda seq: tuple([s or first(seq) for s in seq])
-        return sorted([filled(v) for v in self.items.itervalues()])
+        return sorted(filled(v) for v in self.items.values())
 
 
 ################################################################################
diff --git a/meld/vc/bzr.py b/meld/vc/bzr.py
index a5cbdeb..7b63db6 100644
--- a/meld/vc/bzr.py
+++ b/meld/vc/bzr.py
@@ -113,7 +113,7 @@ class Vc(_vc.CachedVc):
         retfiles = []
         retdirs = []
         bzrfiles = {}
-        for path,state in tree.iteritems():
+        for path, state in tree.items():
             mydir, name = os.path.split(path)
             if path.endswith('/'):
                 mydir, name = os.path.split(mydir)
diff --git a/meld/vc/fossil.py b/meld/vc/fossil.py
index fd2c6ed..9cc1ef6 100644
--- a/meld/vc/fossil.py
+++ b/meld/vc/fossil.py
@@ -123,7 +123,7 @@ class Vc(_vc.CachedVc):
         retdirs = []
         vcfiles = {}
 
-        for path, state in tree.iteritems():
+        for path, state in tree.items():
             mydir, name = os.path.split(path)
             if path.endswith('/'):
                 mydir, name = os.path.split(mydir)
@@ -164,7 +164,7 @@ class Vc(_vc.CachedVc):
                                   'manifest.uuid']
 
                     if f not in ignorelist:
-                        print "WARNING: '%s' was not listed by 'ls -l'" % f
+                        print("WARNING: '%s' was not listed by 'ls -l'" % f)
 
                 # If it ain't listed by the inventory it's not under version
                 # control
diff --git a/meld/vc/git.py b/meld/vc/git.py
index 7ba3412..7ea55df 100644
--- a/meld/vc/git.py
+++ b/meld/vc/git.py
@@ -187,7 +187,7 @@ class Vc(_vc.CachedVc):
         for name,path in dirs:
             # git does not operate on dirs, just files
             retdirs.append( _vc.Dir(path, name, _vc.STATE_NORMAL))
-        for path, state in tree.iteritems():
+        for path, state in tree.items():
             # removed files are not in the filesystem, so must be added here
             if state is _vc.STATE_REMOVED:
                 folder, name = os.path.split(path)
diff --git a/meld/vc/mercurial.py b/meld/vc/mercurial.py
index 7c012ec..7b952d2 100644
--- a/meld/vc/mercurial.py
+++ b/meld/vc/mercurial.py
@@ -129,7 +129,7 @@ class Vc(_vc.CachedVc):
         for name, path in dirs:
             # mercurial does not operate on dirs, just files
             retdirs.append(_vc.Dir(path, name, _vc.STATE_NORMAL))
-        for path, state in tree.iteritems():
+        for path, state in tree.items():
             # removed files are not in the filesystem, so must be added here
             if state is _vc.STATE_REMOVED:
                 folder, name = os.path.split(path)
diff --git a/meld/vc/monotone.py b/meld/vc/monotone.py
index 804d525..36edf05 100644
--- a/meld/vc/monotone.py
+++ b/meld/vc/monotone.py
@@ -234,7 +234,7 @@ class Vc(_vc.CachedVc):
         retdirs = []
         vcfiles = {}
 
-        for path,state in tree.iteritems():
+        for path, state in tree.items():
             mydir, name = os.path.split(path)
             if path.endswith('/'):
                 mydir, name = os.path.split(mydir)



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