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

Commit

Permalink
more print converted to py3 in .py files
Browse files Browse the repository at this point in the history
  • Loading branch information
Frédéric Chapoton committed Jun 12, 2016
1 parent 5ef5316 commit fd1af37
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/sage/combinat/quickref.py
Expand Up @@ -27,7 +27,7 @@
Constructions and Species::
sage: for (p, s) in cartesian_product([P,S]): print p, s # not tested
sage: for (p, s) in cartesian_product([P,S]): print((p, s)) # not tested
sage: DisjointUnionEnumeratedSets(Family(lambda n: IntegerVectors(n, 3), NonNegativeIntegers)) # not tested
Words::
Expand Down
14 changes: 9 additions & 5 deletions src/sage/combinat/root_system/reflection_group_complex.py
Expand Up @@ -61,7 +61,7 @@
Most importantly, observe that the group elements are usually represented
by permutations of the roots::
sage: for w in W: print w # optional - gap3
sage: for w in W: print(w) # optional - gap3
()
(1,3)(2,6)(5,7)
(1,5)(2,4)(6,8)
Expand Down Expand Up @@ -194,6 +194,7 @@
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
from __future__ import print_function

from sage.misc.cachefunc import cached_method, cached_in_parent_method
from sage.misc.lazy_attribute import lazy_attribute
Expand Down Expand Up @@ -1479,7 +1480,7 @@ def invariant_form(self, brute_force=False):
....: W = ReflectionGroup(ty) # optional - gap3
....: A = W.invariant_form() # optional - gap3
....: B = W.invariant_form(brute_force=True) # optional - gap3
....: print ty, A == B/B[0,0] # optional - gap3
....: print("{} {}".format(ty, A == B/B[0,0])) # optional - gap3
['A', 3] True
['B', 3] True
['F', 4] True
Expand Down Expand Up @@ -1765,7 +1766,8 @@ def length(self):
EXAMPLES::
sage: W = ReflectionGroup(4) # optional - gap3
sage: for w in W: print w.reduced_word(), w.length() # optional - gap3
sage: for w in W: # optional - gap3
....: print("{} {}".format(w.reduced_word(), w.length()))
[] 0
[1] 1
[2] 1
Expand Down Expand Up @@ -2100,7 +2102,9 @@ def to_permutation_of_roots(self):
EXAMPLES::
sage: W = ReflectionGroup((1,1,3)) # optional - gap3
sage: for w in W: perm = w.to_permutation_of_roots(); print perm, perm==w # optional - gap3
sage: for w in W: # optional - gap3
....: perm = w.to_permutation_of_roots()
....: print("{} {}".format(perm, perm == w))
() True
(1,3)(2,5)(4,6) True
(1,4)(2,3)(5,6) True
Expand Down Expand Up @@ -2672,7 +2676,7 @@ def is_regular(self, h, is_class_representative=False):
sage: W = ReflectionGroup((1,1,3)); h = W.coxeter_number() # optional - gap3
sage: for w in W: # optional - gap3
....: print w.reduced_word(), w.is_regular(h) # optional - gap3
....: print("{} {}".format(w.reduced_word(), w.is_regular(h)))
[] False
[2] False
[1] False
Expand Down
5 changes: 3 additions & 2 deletions src/sage/combinat/root_system/reflection_group_real.py
Expand Up @@ -49,6 +49,7 @@
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
from __future__ import print_function

from sage.misc.cachefunc import cached_method, cached_in_parent_method
from sage.misc.lazy_attribute import lazy_attribute
Expand Down Expand Up @@ -497,7 +498,7 @@ def reflection_to_positive_root(self, r):
EXAMPLES::
sage: W = ReflectionGroup(['A',2]) # optional - gap3
sage: for r in W.reflections(): print W.reflection_to_positive_root(r) # optional - gap3
sage: for r in W.reflections(): print(W.reflection_to_positive_root(r)) # optional - gap3
(1, 0)
(0, 1)
(1, 1)
Expand Down Expand Up @@ -538,7 +539,7 @@ def fundamental_weights(self):
sage: N = W.fundamental_weights() # optional - gap3
sage: for i in W.index_set(): # optional - gap3
....: for j in W.index_set(): # optional - gap3
....: print i, j, N[i], N[i]*S[j].to_matrix() # optional - gap3
....: print("{} {} {} {}".format(i, j, N[i], N[i]*S[j].to_matrix()))
1 1 (3/4, 1/2, 1/4) (-1/4, 1/2, 1/4)
1 2 (3/4, 1/2, 1/4) (3/4, 1/2, 1/4)
1 3 (3/4, 1/2, 1/4) (3/4, 1/2, 1/4)
Expand Down
6 changes: 4 additions & 2 deletions src/sage/databases/stein_watkins.py
Expand Up @@ -137,8 +137,10 @@
#
# http://www.gnu.org/licenses/
#*****************************************************************************
from __future__ import print_function

import bz2, os
import bz2
import os

from sage.env import SAGE_SHARE

Expand Down Expand Up @@ -206,7 +208,7 @@ def __iter__(self):
sage: d = SteinWatkinsAllData(0)
sage: d = d[10:20] # optional - database_stein_watkins; long time
sage: for C in d: # optional - database_stein_watkins; long time
....: print C
....: print(C)
Stein-Watkins isogeny class of conductor 11
Stein-Watkins isogeny class of conductor 14
Stein-Watkins isogeny class of conductor 15
Expand Down
2 changes: 1 addition & 1 deletion src/sage/misc/dev_tools.py
Expand Up @@ -48,7 +48,7 @@ def runsnake(command):
``command`` is first preparsed (see :func:`preparse`)::
sage: runsnake('for x in range(1,4): print x^2') # optional - runsnake
sage: runsnake('for x in range(1,4): print(x^2)') # optional - runsnake
1
4
9
Expand Down
11 changes: 7 additions & 4 deletions src/sage/misc/unknown.py
Expand Up @@ -5,9 +5,12 @@
- Florent Hivert (2010): initial version.
"""
from __future__ import print_function

from sage.structure.sage_object import SageObject
from sage.structure.unique_representation import UniqueRepresentation


class UnknownClass(UniqueRepresentation, SageObject):
"""
TESTS::
Expand All @@ -21,12 +24,12 @@ def __init__(self):
EXAMPLES::
sage: l = [False, Unknown, True]
sage: for a in l: print ([a and b for b in l])
sage: for a in l: print([a and b for b in l])
[False, False, False]
[Unknown, Unknown, Unknown]
[False, Unknown, True]
sage: for a in l: print ([a or b for b in l])
sage: for a in l: print([a or b for b in l])
[False, Unknown, True]
[False, Unknown, True]
[True, True, True]
Expand Down Expand Up @@ -136,12 +139,12 @@ def __cmp__(self, other):
EXAMPLES::
sage: l = [False, Unknown, True]
sage: for a in l: print ([a < b for b in l])
sage: for a in l: print([a < b for b in l])
[False, True, True]
[False, False, True]
[False, False, False]
sage: for a in l: print ([a <= b for b in l])
sage: for a in l: print([a <= b for b in l])
[True, True, True]
[False, True, True]
[False, False, True]
Expand Down
21 changes: 13 additions & 8 deletions src/sage/modular/etaproducts.py
Expand Up @@ -27,6 +27,7 @@
# Distributed under the terms of the GNU General Public License (GPL)
# http://www.gnu.org/licenses/
#*****************************************************************************
from __future__ import print_function

from sage.structure.sage_object import SageObject
from sage.rings.power_series_ring import PowerSeriesRing
Expand Down Expand Up @@ -918,16 +919,20 @@ def eta_poly_relations(eta_elements, degree, labels=['x1','x2'], verbose=False):

eta1, eta2 = eta_elements

if verbose: print "Trying to find a relation of degree %s" % degree
if verbose:
print("Trying to find a relation of degree %s" % degree)
inf = CuspFamily(eta1.level(), 1)
loterm = -(min([0, eta1.order_at_cusp(inf)]) + min([0,eta2.order_at_cusp(inf)]))*degree
if verbose: print "Lowest order of a term at infinity = %s" % -loterm
if verbose:
print("Lowest order of a term at infinity = %s" % -loterm)

maxdeg = sum([eta1.degree(), eta2.degree()])*degree
if verbose: print "Highest possible degree of a term = %s" % maxdeg
if verbose:
print("Highest possible degree of a term = %s" % maxdeg)
m = loterm + maxdeg + 1
oldgrob = _eta_relations_helper(eta1, eta2, degree, m, labels, verbose)
if verbose: print "Check:",
if verbose:
print("Check:", end="")
newgrob = _eta_relations_helper(eta1, eta2, degree, m+5, labels, verbose)
if oldgrob != newgrob:
if verbose:
Expand Down Expand Up @@ -968,7 +973,8 @@ def _eta_relations_helper(eta1, eta2, degree, qexp_terms, labels, verbose):
inf = CuspFamily(eta1.level(), 1)

pole_at_infinity = -(min([0, eta1.order_at_cusp(inf)]) + min([0,eta2.order_at_cusp(inf)]))*degree
if verbose: print "Trying all coefficients from q^%s to q^%s inclusive" % (-pole_at_infinity, -pole_at_infinity + qexp_terms - 1)
if verbose:
print("Trying all coefficients from q^%s to q^%s inclusive" % (-pole_at_infinity, -pole_at_infinity + qexp_terms - 1))

rows = []
for j in xrange(qexp_terms):
Expand All @@ -980,15 +986,14 @@ def _eta_relations_helper(eta1, eta2, degree, qexp_terms, labels, verbose):
M = matrix(rows)
V = M.right_kernel()
if V.dimension() == 0:
if verbose: print "No polynomial relation of order %s valid for %s terms" % (degree, qexp_terms)
if verbose:
print("No polynomial relation of order %s valid for %s terms" % (degree, qexp_terms))
return None
if V.dimension() >= 1:
#print "Found relation: "
R = PolynomialRing(QQ, 2, labels)
x,y = R.gens()
relations = []
for c in V.basis():
relations.append(sum( [ c[v] * x**indices[v][0] * y**indices[v][1] for v in xrange(len(indices))]))
#print relations[-1], " = 0"
id = R.ideal(relations)
return id.groebner_basis()
3 changes: 2 additions & 1 deletion src/sage/rings/asymptotic/growth_group_cartesian.py
Expand Up @@ -71,7 +71,7 @@
sage: cm.common_parent(A, E)
Growth Group QQ^x * x^QQ
sage: for t in cm.exception_stack(): # not tested, see #19411
....: print t
....: print(t)
::
Expand All @@ -94,6 +94,7 @@
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
from __future__ import print_function

import sage

Expand Down

0 comments on commit fd1af37

Please sign in to comment.