[py3k] Stop using dict.iter{keys,values,items}()

Related to #296242.

authorRémi Cardona <remi.cardona@free.fr>
changeset40bd9b8b1e09
branchdefault
phasepublic
hiddenno
parent revision#388d5ab49c86 [py3k] Don't encode strings to bytes
child revision#c7494a3a871a [py3k] reduce is now in the functools module
files modified by this revision
fd.py
propagation.py
# HG changeset patch
# User Rémi Cardona <remi.cardona@free.fr>
# Date 1405925826 -7200
# Mon Jul 21 08:57:06 2014 +0200
# Node ID 40bd9b8b1e09c98152efba7f1ca2c4e398fba4be
# Parent 388d5ab49c862f289707e08f038b468dfcda6c91
[py3k] Stop using dict.iter{keys,values,items}()

Related to #296242.

diff --git a/fd.py b/fd.py
@@ -192,11 +192,11 @@
1          maybe_entailed = 1
2          ffunc = self.filterFunc
3          result_cache = self._init_result_cache()
4          for kwargs in self._assign_values(domains):
5              if maybe_entailed:
6 -                for var, val in kwargs.iteritems():
7 +                for var, val in kwargs.items():
8                      if val not in result_cache[var]:
9                          break
10                  else:
11                      continue
12              if ffunc(**kwargs):
@@ -204,11 +204,11 @@
13                      result_cache[var][val] = 1
14              else:
15                  maybe_entailed = 0
16 
17          try:
18 -            for var, keep in result_cache.iteritems():
19 +            for var, keep in result_cache.items():
20                  domain = domains[var]
21                  domain.removeValues([val for val in domain if val not in keep])
22 
23          except ConsistencyFailure:
24              raise ConsistencyFailure('Inconsistency while applying %s' % \
diff --git a/propagation.py b/propagation.py
@@ -218,11 +218,11 @@
25                          "--> Entailed constraint", constraint)
26                  self._removeConstraint(constraint)
27                  if constraint in _affected_constraints:
28                      del _affected_constraints[constraint]
29 
30 -        for domain in self._domains.itervalues():
31 +        for domain in self._domains.values():
32              if domain.size() != 1:
33                  return 0
34          return 1
35 
36  class Solver(object):