[py3k] dict.iter*() no longer exist
authorRémi Cardona <remi.cardona@free.fr>
Fri, 25 Jul 2014 09:20:43 +0200
changeset 751 1e454af7ac93
parent 750 e554893cccb6
child 752 156221f61760
[py3k] dict.iter*() no longer exist
analyze.py
stcheck.py
stmts.py
test/unittest_analyze.py
--- a/analyze.py	Fri Jul 25 00:28:03 2014 +0200
+++ b/analyze.py	Fri Jul 25 09:20:43 2014 +0200
@@ -372,7 +372,7 @@
     def _init_stmt(self, node):
         pb = CSPProblem()
         # set domain for all the variables
-        for var in node.defined_vars.itervalues():
+        for var in node.defined_vars.values():
             pb.add_var( var.name, self._base_domain )
         # no variable short cut
         return pb
@@ -448,7 +448,7 @@
         for subquery in node.with_: # resolve subqueries first
             self.visit_union(subquery.query)
         constraints = self._init_stmt(node)
-        for ca in node.aliases.itervalues():
+        for ca in node.aliases.values():
             etypes = set(stmt.selection[ca.colnum].get_type(sol, self.kwargs)
                          for stmt in ca.query.children for sol in stmt.solutions)
             constraints.add_var( ca.name, etypes )
--- a/stcheck.py	Fri Jul 25 00:28:03 2014 +0200
+++ b/stcheck.py	Fri Jul 25 09:20:43 2014 +0200
@@ -147,7 +147,7 @@
                 self._check_selected(term, 'selection', state)
                 for vref in term.iget_nodes(VariableRef):
                     state.add_var_info(vref.variable, VAR_SELECTED)
-        for var in node.defined_vars.itervalues():
+        for var in node.defined_vars.values():
             vinfo = state.var_info.get(var, 0)
             if not (vinfo & VAR_HAS_REL) and (vinfo & VAR_HAS_TYPE_REL) \
                    and not (vinfo & VAR_SELECTED):
@@ -194,7 +194,7 @@
                 rtype = graph[(var, fromvar)]
                 cardidx = 1
             rschema = self.schema.rschema(rtype)
-            for rdef in rschema.rdefs.itervalues():
+            for rdef in rschema.rdefs.values():
                 # XXX aggregats handling needs much probably some enhancements...
                 if not (var in select.aggregated
                         or (rdef.cardinality[cardidx] in '?1' and
@@ -250,7 +250,7 @@
                     # XXX ok for MIN, MAX, but what about COUNT, AVG...
                     trmap[subvref.children[0].name] = vref.name
                     node.parent.aggregated.add(vref.name)
-            for key, val in select.vargraph.iteritems():
+            for key, val in select.vargraph.items():
                 if isinstance(key, tuple):
                     key = (_var_graphid(key[0], trmap, select),
                            _var_graphid(key[1], trmap, select))
@@ -490,7 +490,7 @@
         node.annotated = True
 
     def _visit_stmt(self, node):
-        for var in node.defined_vars.itervalues():
+        for var in node.defined_vars.values():
             var.prepare_annotation()
         for i, term in enumerate(node.selection):
             for func in term.iget_nodes(Function):
@@ -511,7 +511,7 @@
             self.visit_select(select)
 
     def visit_select(self, node):
-        for var in node.aliases.itervalues():
+        for var in node.aliases.values():
             var.prepare_annotation()
         if node.with_ is not None:
             for subquery in node.with_:
--- a/stmts.py	Fri Jul 25 00:28:03 2014 +0200
+++ b/stmts.py	Fri Jul 25 09:20:43 2014 +0200
@@ -134,7 +134,7 @@
         if key == 'possibletypes':
             self.solutions = solutions
         defined = self.defined_vars
-        for var in defined.itervalues():
+        for var in defined.values():
             var.stinfo[key] = set()
             for solution in solutions:
                 var.stinfo[key].add(solution[var.name])
@@ -306,7 +306,7 @@
             for descr in select.get_selection_solutions():
                 for i, etype in enumerate(descr):
                     values.setdefault(i, set()).add(etype)
-        for idx, etypes in values.iteritems():
+        for idx, etypes in values.items():
             if len(etypes) > 1:
                 change.add(idx)
         return change
@@ -526,7 +526,7 @@
 
     def set_possible_types(self, solutions, kwargs=_MARKER, key='possibletypes'):
         super(Select, self).set_possible_types(solutions, kwargs, key)
-        for ca in self.aliases.itervalues():
+        for ca in self.aliases.values():
             ca.stinfo[key] = capt = set()
             for solution in solutions:
                 capt.add(solution[ca.name])
--- a/test/unittest_analyze.py	Fri Jul 25 00:28:03 2014 +0200
+++ b/test/unittest_analyze.py	Fri Jul 25 09:20:43 2014 +0200
@@ -162,7 +162,7 @@
                                       )
                                     ),
             }
-        for rtype, rschema in self._relations.iteritems():
+        for rtype, rschema in self._relations.items():
             rschema.type = rtype
 
     def entities(self):