[gobject-introspection] giscanner: Convert map() results to list



commit d9a9f70ef6e3b1ef0f4baccf94780d286e51bbb0
Author: Simon Feltman <sfeltman src gnome org>
Date:   Mon Apr 28 23:33:59 2014 -0700

    giscanner: Convert map() results to list
    
    Convert the results map() calls to a list for Python 3 compatibility.
    In Python 3, map() returns an iterable "map object" which does not
    allow indexing or iteration more than once.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679438

 giscanner/gdumpparser.py |    4 ++--
 giscanner/girparser.py   |    6 +++---
 giscanner/transformer.py |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py
index 179bbd8..ebd33f9 100644
--- a/giscanner/gdumpparser.py
+++ b/giscanner/gdumpparser.py
@@ -438,8 +438,8 @@ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.ide
     def _parse_parents(self, xmlnode, node):
         parents_str = xmlnode.attrib.get('parents', '')
         if parents_str != '':
-            parent_types = map(lambda s: ast.Type.create_from_gtype_name(s),
-                               parents_str.split(','))
+            parent_types = list(map(lambda s: ast.Type.create_from_gtype_name(s),
+                                    parents_str.split(',')))
         else:
             parent_types = []
         node.parent_chain = parent_types
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index 76dc5af..248e223 100644
--- a/giscanner/girparser.py
+++ b/giscanner/girparser.py
@@ -455,8 +455,8 @@ class GIRParser(object):
                 return ast.Type(ctype=ctype)
             elif name in ['GLib.List', 'GLib.SList']:
                 subchild = self._find_first_child(typenode,
-                                                  map(_corens, ('callback', 'array',
-                                                                'varargs', 'type')))
+                                                  list(map(_corens, ('callback', 'array',
+                                                                '    varargs', 'type'))))
                 if subchild is not None:
                     element_type = self._parse_type(typenode)
                 else:
@@ -464,7 +464,7 @@ class GIRParser(object):
                 return ast.List(name, element_type, ctype=ctype)
             elif name == 'GLib.HashTable':
                 subchildren = self._find_children(typenode, _corens('type'))
-                subchildren_types = map(self._parse_type_simple, subchildren)
+                subchildren_types = list(map(self._parse_type_simple, subchildren))
                 while len(subchildren_types) < 2:
                     subchildren_types.append(ast.TYPE_ANY)
                 return ast.Map(subchildren_types[0], subchildren_types[1], ctype=ctype)
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index 6cd7dc2..2d5c04d 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -278,7 +278,7 @@ currently-scanned namespace is first."""
                 unprefixed_namespaces.append(ns)
         if matches:
             matches.sort(self._sort_matches)
-            return map(lambda x: (x[0], x[1]), matches)
+            return list(map(lambda x: (x[0], x[1]), matches))
         elif self._accept_unprefixed:
             return [(self._namespace, name)]
         elif unprefixed_namespaces:


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