[py3k] dict.keys/values/items() are now iterators/memoryviews
authorRémi Cardona <remi.cardona@free.fr>
Fri, 25 Jul 2014 22:41:55 +0200
changeset 752 156221f61760
parent 751 1e454af7ac93
child 753 72827f7fd743
[py3k] dict.keys/values/items() are now iterators/memoryviews
__init__.py
analyze.py
test/unittest_analyze.py
--- a/__init__.py	Fri Jul 25 09:20:43 2014 +0200
+++ b/__init__.py	Fri Jul 25 22:41:55 2014 +0200
@@ -140,7 +140,7 @@
             for subselect in subquery.query.children:
                 self._simplify(subselect)
         rewritten = False
-        for var in select.defined_vars.values():
+        for var in list(select.defined_vars.values()):
             stinfo = var.stinfo
             if stinfo['constnode'] and not stinfo.get('blocsimplification'):
                 uidrel = stinfo['uidrel']
--- a/analyze.py	Fri Jul 25 09:20:43 2014 +0200
+++ b/analyze.py	Fri Jul 25 22:41:55 2014 +0200
@@ -316,7 +316,7 @@
             self.uid_func = None
         else:
             self.uid_func_mapping = uid_func_mapping
-            self.uid_func = uid_func_mapping.values()[0]
+            self.uid_func = next(iter(uid_func_mapping.values()))
 
     def set_schema(self, schema):
         self.schema = schema
@@ -394,7 +394,7 @@
         if uid_func_mapping is not None:
             assert len(uid_func_mapping) <= 1
             self.uid_func_mapping = uid_func_mapping
-            self.uid_func = uid_func_mapping.values()[0]
+            self.uid_func = next(iter(uid_func_mapping.values()))
         self.kwargs = kwargs
         self.deambiguifiers = set()
         self._visit(node)
--- a/test/unittest_analyze.py	Fri Jul 25 09:20:43 2014 +0200
+++ b/test/unittest_analyze.py	Fri Jul 25 22:41:55 2014 +0200
@@ -44,7 +44,7 @@
         for e_type, dest_types in assoc_types:
             for e_type in dest_types:
                 d[e_type] = 1
-        self.obj_types = d.keys()
+        self.obj_types = list(d.keys())
         self.symmetric = symmetric
         self.inlined = False
         if card is None: