Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
py3: some care for .iteritems
Browse files Browse the repository at this point in the history
  • Loading branch information
Frédéric Chapoton committed Aug 13, 2018
1 parent ada43b3 commit 2c8f1e2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/sage/categories/quantum_group_representations.py
Expand Up @@ -293,8 +293,8 @@ def e(self, i):
"""
F = self.parent()
mc = self.monomial_coefficients(copy=False)
return F.linear_combination( (F.e_on_basis(i, m), c)
for m,c in mc.iteritems() )
return F.linear_combination((F.e_on_basis(i, m), c)
for m, c in mc.items())

def f(self, i):
r"""
Expand Down Expand Up @@ -325,8 +325,8 @@ def f(self, i):
"""
F = self.parent()
mc = self.monomial_coefficients(copy=False)
return F.linear_combination( (F.f_on_basis(i, m), c)
for m,c in mc.iteritems() )
return F.linear_combination((F.f_on_basis(i, m), c)
for m, c in mc.items())

def K(self, i, power=1):
r"""
Expand Down Expand Up @@ -356,8 +356,8 @@ def K(self, i, power=1):
"""
F = self.parent()
mc = self.monomial_coefficients(copy=False)
return F.linear_combination( (F.K_on_basis(i, m, power), c)
for m,c in mc.iteritems() )
return F.linear_combination((F.K_on_basis(i, m, power), c)
for m, c in mc.items())

class TensorProducts(TensorProductsCategory):
"""
Expand Down
4 changes: 2 additions & 2 deletions src/sage/modules/free_module_element.pyx
Expand Up @@ -4561,12 +4561,12 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement):
e = entries
entries = {}
try:
for k, x in e.iteritems():
for k, x in e.items():
x = coefficient_ring(x)
if x:
entries[k] = x
except TypeError:
raise TypeError("Unable to coerce value (=%s) of entries dict (=%s) to %s"%(x, entries, coefficient_ring))
raise TypeError("Unable to coerce value (=%s) of entries dict (=%s) to %s" % (x, entries, coefficient_ring))
elif copy:
entries = dict(entries) # make a copy/convert to dict
self._entries = entries
Expand Down
6 changes: 3 additions & 3 deletions src/sage/symbolic/relation.py
Expand Up @@ -1088,7 +1088,7 @@ def solve(f, *args, **kwds):
l = []
for d in ret:
r = {}
for (v,ex) in d.iteritems():
for (v, ex) in d.items():
r[v._sage_()] = ex._sage_()
l.append(r)
return l
Expand All @@ -1099,7 +1099,7 @@ def solve(f, *args, **kwds):
l = []
for sol in ret:
r = {}
for (v,ex) in sol.iteritems():
for (v, ex) in sol.items():
r[v._sage_()] = ex._sage_()
l.append(r)
return l
Expand All @@ -1116,7 +1116,7 @@ def solve(f, *args, **kwds):
s = m.to_poly_solve(variables)
except TypeError as mess: # if that gives an error, raise an error.
if "Error executing code in Maxima" in str(mess):
raise ValueError("Sage is unable to determine whether the system %s can be solved for %s"%(f,args))
raise ValueError("Sage is unable to determine whether the system %s can be solved for %s" % (f, args))
else:
raise

Expand Down

0 comments on commit 2c8f1e2

Please sign in to comment.