[gedit-plugins/wip/python3: 5/19] Explicitly convert map/filter results to a list



commit ebe4640665f88f339e2921825f194d6273d2f4db
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Fri Nov 9 10:17:59 2012 +0100

    Explicitly convert map/filter results to a list

 plugins/commander/commander/commands/completion.py |    6 +++---
 plugins/commander/commander/commands/module.py     |    4 ++--
 plugins/commander/commander/entry.py               |    4 ++--
 plugins/commander/modules/find/__init__.py         |    2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/plugins/commander/commander/commands/completion.py b/plugins/commander/commander/commands/completion.py
index aed3c26..199758c 100644
--- a/plugins/commander/commander/commands/completion.py
+++ b/plugins/commander/commander/commands/completion.py
@@ -119,7 +119,7 @@ def single_command(words, idx):
     if not ret:
         return None
 
-    ret[0] = filter(lambda x: x.method, ret[0])
+    ret[0] = list(filter(lambda x: x.method, ret[0]))
 
     if not ret[0]:
         return None
@@ -209,11 +209,11 @@ def filename(words, idx, view):
 
         return ret, ret[0], after
     else:
-        return map(lambda x: _file_color(x), real), common_prefix(ret)
+        return list(map(lambda x: _file_color(x), real), common_prefix(ret))
 
 def words(ret):
     def decorator(words, idx):
-        rr = filter(lambda x: x.startswith(words[idx]), ret)
+        rr = list(filter(lambda x: x.startswith(words[idx]), ret))
         return rr, common_prefix(rr)
 
     return decorator
diff --git a/plugins/commander/commander/commands/module.py b/plugins/commander/commander/commands/module.py
index 0bd0346..63f7f43 100644
--- a/plugins/commander/commander/commands/module.py
+++ b/plugins/commander/commander/commands/module.py
@@ -70,8 +70,8 @@ class Module(method.Method):
             else:
                 root = []
 
-            root = filter(lambda x: x in dic and type(dic[x]) == types.FunctionType, root)
-            self._roots = map(lambda x: method.Method(dic[x], x, self.mod), root)
+            root = list(filter(lambda x: x in dic and type(dic[x]) == types.FunctionType, root))
+            self._roots = list(map(lambda x: method.Method(dic[x], x, self.mod), root))
 
         return self._roots
 
diff --git a/plugins/commander/commander/entry.py b/plugins/commander/commander/entry.py
index dfdd789..3639f2a 100644
--- a/plugins/commander/commander/entry.py
+++ b/plugins/commander/commander/entry.py
@@ -550,7 +550,7 @@ GtkEntry#gedit-commander-entry {
 
             # Remove system arguments
             s = ['argstr', 'args', 'entry', 'view']
-            args = filter(lambda x: not x in s, args)
+            args = list(filter(lambda x: not x in s, args))
 
             if realidx < len(args):
                 arg = args[realidx]
@@ -577,7 +577,7 @@ GtkEntry#gedit-commander-entry {
                 }
 
                 if not spec.keywords:
-                    for k in kwargs.keys():
+                    for k in list(kwargs.keys()):
                         if not k in spec.args:
                             del kwargs[k]
 
diff --git a/plugins/commander/modules/find/__init__.py b/plugins/commander/modules/find/__init__.py
index 1617c16..7c9ca8e 100644
--- a/plugins/commander/modules/find/__init__.py
+++ b/plugins/commander/modules/find/__init__.py
@@ -41,7 +41,7 @@ class TextFinder(finder.Finder):
         if self.get_find():
             buf.set_search_text(self.get_find(), self.flags)
 
-        ret = map(lambda x: x.copy(), bounds)
+        ret = list(map(lambda x: x.copy(), bounds))
 
         if buf.search_forward(bounds[0], bounds[1], ret[0], ret[1]):
             return ret



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