Skip to content

Commit f495b38

Browse files
committed
fix E228 and E225 in schemes/
1 parent 6ea1fe9 commit f495b38

25 files changed

+131
-131
lines changed

src/sage/schemes/elliptic_curves/ell_rational_field.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3055,12 +3055,12 @@ def selmer_rank(self, algorithm="pari"):
30553055
try:
30563056
return self.__selmer_rank
30573057
except AttributeError:
3058-
if algorithm=="pari":
3058+
if algorithm == "pari":
30593059
ep = self.pari_curve()
30603060
lower, upper, s, pts = ep.ellrank()
30613061
tor = self.two_torsion_rank()
30623062
return upper + tor + s
3063-
elif algorithm=="mwrank":
3063+
elif algorithm == "mwrank":
30643064
C = self.mwrank_curve()
30653065
self.__selmer_rank = C.selmer_rank()
30663066
return self.__selmer_rank
@@ -3110,11 +3110,11 @@ def rank_bound(self, algorithm="pari"):
31103110
try:
31113111
return self.__rank_bound
31123112
except AttributeError:
3113-
if algorithm=="pari":
3113+
if algorithm == "pari":
31143114
ep = self.pari_curve()
31153115
lower, upper, s, pts = ep.ellrank()
31163116
return upper
3117-
elif algorithm=="mwrank":
3117+
elif algorithm == "mwrank":
31183118
C = self.mwrank_curve()
31193119
self.__rank_bound = C.rank_bound()
31203120
return self.__rank_bound

src/sage/schemes/elliptic_curves/padics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ def _multiple_to_make_good_reduction(E):
643643
li = []
644644
for p in ps:
645645
np = u.valuation(p)
646-
if Emin.discriminant() %p != 0:
646+
if Emin.discriminant() % p != 0:
647647
li.append(Emin.Np(p) * p**(np-1))
648648
elif Emin.has_additive_reduction(p):
649649
li.append(E.tamagawa_number(p) * p**np)
@@ -652,7 +652,7 @@ def _multiple_to_make_good_reduction(E):
652652
else: # non split
653653
li.append(E.tamagawa_number(p) * (p+1) * p**(np-1))
654654
otherbad = Integer(Emin.discriminant()).prime_divisors()
655-
otherbad = [p for p in otherbad if u%p != 0 ]
655+
otherbad = [p for p in otherbad if u % p != 0 ]
656656
li += [E.tamagawa_number(p) for p in otherbad]
657657
n2 = LCM(li)
658658
return n2

src/sage/schemes/generic/algebraic_scheme.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ def _repr_(self):
530530
sage: S._repr_()
531531
'Subscheme of Projective Space of dimension 3 over Integer Ring'
532532
"""
533-
return "Subscheme of %s"%self.__A
533+
return "Subscheme of %s" % self.__A
534534

535535
def _homset(self, *args, **kwds):
536536
"""
@@ -821,11 +821,11 @@ def _check_satisfies_equations(self, v):
821821
coords = list(v)
822822
for f in self.__X.defining_polynomials():
823823
if f(coords) != 0:
824-
raise TypeError("Coordinates %s do not define a point on %s"%(v,self))
824+
raise TypeError("Coordinates %s do not define a point on %s" % (v,self))
825825
for f in self.__Y.defining_polynomials():
826826
if f(coords) != 0:
827827
return True
828-
raise TypeError("Coordinates %s do not define a point on %s"%(v,self))
828+
raise TypeError("Coordinates %s do not define a point on %s" % (v,self))
829829

830830
def rational_points(self, **kwds):
831831
"""
@@ -872,9 +872,9 @@ def rational_points(self, **kwds):
872872

873873
if bound == 0:
874874
if is_RationalField(F):
875-
raise TypeError("A positive bound (= %s) must be specified."%bound)
875+
raise TypeError("A positive bound (= %s) must be specified." % bound)
876876
if not isinstance(F, FiniteField):
877-
raise TypeError("Argument F (= %s) must be a finite field."%F)
877+
raise TypeError("Argument F (= %s) must be a finite field." % F)
878878
pts = []
879879
for P in self.ambient_space().rational_points(F):
880880
try:
@@ -986,11 +986,11 @@ def _check_satisfies_equations(self, v):
986986
for f in self.defining_polynomials():
987987
if f(coords) != 0: # it must be "!=0" instead of "if f(v)", e.g.,
988988
# because of p-adic base rings.
989-
raise TypeError("Coordinates %s do not define a point on %s"%(coords,self))
989+
raise TypeError("Coordinates %s do not define a point on %s" % (coords,self))
990990
try:
991991
return self.ambient_space()._check_satisfies_equations(coords)
992992
except TypeError:
993-
raise TypeError("Coordinates %s do not define a point on %s"%(coords,self))
993+
raise TypeError("Coordinates %s do not define a point on %s" % (coords,self))
994994

995995
def base_extend(self, R):
996996
"""
@@ -1465,10 +1465,10 @@ def union(self, other):
14651465
True
14661466
"""
14671467
if not isinstance(other, AlgebraicScheme_subscheme):
1468-
raise TypeError("other (=%s) must be a closed algebraic subscheme of an ambient space"%other)
1468+
raise TypeError("other (=%s) must be a closed algebraic subscheme of an ambient space" % other)
14691469
A = self.ambient_space()
14701470
if other.ambient_space() != A:
1471-
raise ValueError("other (=%s) must be in the same ambient space as self"%other)
1471+
raise ValueError("other (=%s) must be in the same ambient space as self" % other)
14721472
return A.subscheme(self.defining_ideal().intersection(other.defining_ideal()))
14731473

14741474
def __pow__(self, m):
@@ -1649,10 +1649,10 @@ def intersection(self, other):
16491649
y
16501650
"""
16511651
if not isinstance(other, AlgebraicScheme_subscheme):
1652-
raise TypeError("other (=%s) must be a closed algebraic subscheme of an ambient space"%other)
1652+
raise TypeError("other (=%s) must be a closed algebraic subscheme of an ambient space" % other)
16531653
A = self.ambient_space()
16541654
if other.ambient_space() != A:
1655-
raise ValueError("other (=%s) must be in the same ambient space as self"%other)
1655+
raise ValueError("other (=%s) must be in the same ambient space as self" % other)
16561656
return A.subscheme(self.defining_ideal() + other.defining_ideal())
16571657

16581658
def complement(self, other=None):
@@ -1708,9 +1708,9 @@ def complement(self, other=None):
17081708
if other == A:
17091709
other = A.subscheme([])
17101710
else:
1711-
raise TypeError("Argument other (=%s) must be a closed algebraic subscheme of an ambient space"%other)
1711+
raise TypeError("Argument other (=%s) must be a closed algebraic subscheme of an ambient space" % other)
17121712
if other.ambient_space() != A:
1713-
raise ValueError("other (=%s) must be in the same ambient space as self"%other)
1713+
raise ValueError("other (=%s) must be in the same ambient space as self" % other)
17141714
return AlgebraicScheme_quasi(other, self)
17151715

17161716
def rational_points(self, **kwds):
@@ -1831,7 +1831,7 @@ def rational_points(self, **kwds):
18311831
try:
18321832
return X.points(**kwds) # checks for proper bound done in points functions
18331833
except TypeError:
1834-
raise TypeError("Unable to enumerate points over %s."%F)
1834+
raise TypeError("Unable to enumerate points over %s." % F)
18351835
elif (self.base_ring() in NumberFields() or self.base_ring() == ZZ)\
18361836
and hasattr(F, 'precision'):
18371837
#we are numerically approximating number field points
@@ -1840,7 +1840,7 @@ def rational_points(self, **kwds):
18401840
X = self.base_extend(F)(F)
18411841
return X.points()
18421842
except TypeError:
1843-
raise TypeError("Unable to enumerate points over %s."%F)
1843+
raise TypeError("Unable to enumerate points over %s." % F)
18441844

18451845
def change_ring(self, R):
18461846
r"""

src/sage/schemes/generic/glue.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ class GluedScheme(scheme.Scheme):
3333
def __init__(self, f, g, check=True):
3434
if check:
3535
if not morphism.is_SchemeMorphism(f):
36-
raise TypeError("f (=%s) must be a scheme morphism"%f)
36+
raise TypeError("f (=%s) must be a scheme morphism" % f)
3737
if not morphism.is_SchemeMorphism(g):
38-
raise TypeError("g (=%s) must be a scheme morphism"%g)
38+
raise TypeError("g (=%s) must be a scheme morphism" % g)
3939
if f.domain() != g.domain():
40-
raise ValueError("f (=%s) and g (=%s) must have the same domain"%(f,g))
40+
raise ValueError("f (=%s) and g (=%s) must have the same domain" % (f,g))
4141
self.__f = f
4242
self.__g = g
4343

4444
def gluing_maps(self):
4545
return self.__f, self.__g
4646

4747
def _repr_(self):
48-
return "Scheme obtained by gluing X and Y along U, where\n X: %s\n Y: %s\n U: %s"%(
48+
return "Scheme obtained by gluing X and Y along U, where\n X: %s\n Y: %s\n U: %s" % (
4949
self.__f.codomain(), self.__g.codomain(), self.__f.domain())

src/sage/schemes/generic/hypersurface.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ def __init__(self, poly, ambient=None):
9494
True
9595
"""
9696
if not isinstance(poly, MPolynomial):
97-
raise TypeError("Defining polynomial (=%s) must be a multivariate polynomial."%poly)
97+
raise TypeError("Defining polynomial (=%s) must be a multivariate polynomial." % poly)
9898
if not poly.is_homogeneous():
99-
raise TypeError("Defining polynomial (=%s) must be homogeneous."%poly)
99+
raise TypeError("Defining polynomial (=%s) must be homogeneous." % poly)
100100
if ambient is None:
101101
R = poly.parent()
102102
from sage.schemes.projective.projective_space import ProjectiveSpace
@@ -119,7 +119,7 @@ def _repr_(self):
119119
sage: H._repr_()
120120
'Projective hypersurface defined by y^2 + x*z in Projective Space of dimension 2 over Integer Ring'
121121
"""
122-
return "Projective hypersurface defined by %s in %s"%(
122+
return "Projective hypersurface defined by %s in %s" % (
123123
self.defining_polynomial(), self.ambient_space())
124124

125125
def defining_polynomial(self):
@@ -184,7 +184,7 @@ def __init__(self, poly, ambient=None):
184184
True
185185
"""
186186
if not isinstance(poly, MPolynomial):
187-
raise TypeError("Defining polynomial (= %s) must be a multivariate polynomial"%poly)
187+
raise TypeError("Defining polynomial (= %s) must be a multivariate polynomial" % poly)
188188
if ambient is None:
189189
R = poly.parent()
190190
from sage.schemes.affine.affine_space import AffineSpace
@@ -207,7 +207,7 @@ def _repr_(self):
207207
sage: H._repr_()
208208
'Affine hypersurface defined by y^2 + x*z in Affine Space of dimension 3 over Integer Ring'
209209
"""
210-
return "Affine hypersurface defined by %s in %s"%(
210+
return "Affine hypersurface defined by %s in %s" % (
211211
self.defining_polynomial(), self.ambient_space())
212212

213213
def defining_polynomial(self):

src/sage/schemes/generic/morphism.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def __init__(self, parent, codomain=None):
165165
if codomain is not None:
166166
parent = Hom(parent, codomain)
167167
if not isinstance(parent, Homset):
168-
raise TypeError("parent (=%s) must be a Homspace"%parent)
168+
raise TypeError("parent (=%s) must be a Homspace" % parent)
169169
Element.__init__(self, parent)
170170
self._codomain = parent.codomain()
171171

@@ -261,9 +261,9 @@ def __call__(self, x, *args, **kwds):
261261
try:
262262
x = D(x)
263263
except (TypeError, NotImplementedError):
264-
raise TypeError("%s fails to convert into the map's domain %s, but a `pushforward` method is not properly implemented"%(x, self.domain()))
265-
elif self.domain()!=x.codomain():
266-
raise TypeError("%s fails to convert into the map's domain %s, but a `pushforward` method is not properly implemented"%(x, self.domain()))
264+
raise TypeError("%s fails to convert into the map's domain %s, but a `pushforward` method is not properly implemented" % (x, self.domain()))
265+
elif self.domain() != x.codomain():
266+
raise TypeError("%s fails to convert into the map's domain %s, but a `pushforward` method is not properly implemented" % (x, self.domain()))
267267
else:
268268
x = converter(x)
269269
if not args and not kwds:
@@ -330,14 +330,14 @@ def _repr_(self):
330330
NotImplementedError
331331
"""
332332
if self.is_endomorphism():
333-
s = "%s endomorphism of %s"%(self._repr_type(), self.domain())
333+
s = "%s endomorphism of %s" % (self._repr_type(), self.domain())
334334
else:
335-
s = "%s morphism:"%self._repr_type()
336-
s += "\n From: %s"%self.domain()
337-
s += "\n To: %s"%self._codomain
335+
s = "%s morphism:" % self._repr_type()
336+
s += "\n From: %s" % self.domain()
337+
s += "\n To: %s" % self._codomain
338338
d = self._repr_defn()
339339
if d != '':
340-
s += "\n Defn: %s"%('\n '.join(self._repr_defn().split('\n')))
340+
s += "\n Defn: %s" % ('\n '.join(self._repr_defn().split('\n')))
341341
return s
342342

343343
def __mul__(self, right):
@@ -396,7 +396,7 @@ def __mul__(self, right):
396396
if not isinstance(right, SchemeMorphism):
397397
return coercion_model.bin_op(self, right, operator.mul)
398398
if right.codomain() != self.domain():
399-
raise TypeError("self (=%s) domain must equal right (=%s) codomain"%(self, right))
399+
raise TypeError("self (=%s) domain must equal right (=%s) codomain" % (self, right))
400400
if isinstance(self, SchemeMorphism_id):
401401
return right
402402
if isinstance(right, SchemeMorphism_id):
@@ -428,7 +428,7 @@ def __pow__(self, n, dummy=None):
428428
"""
429429
if not self.is_endomorphism():
430430
raise TypeError("self must be an endomorphism.")
431-
if n==0:
431+
if n == 0:
432432
return self.domain().identity_morphism()
433433
return generic_power(self, n)
434434

@@ -995,11 +995,11 @@ def __init__(self, parent, polys, check=True):
995995
"""
996996
if check:
997997
if not isinstance(polys, (list, tuple)):
998-
raise TypeError("polys (=%s) must be a list or tuple"%polys)
998+
raise TypeError("polys (=%s) must be a list or tuple" % polys)
999999
source_ring = parent.domain().ambient_space().coordinate_ring()
10001000
target = parent._codomain.ambient_space()
10011001
if len(polys) != target.ngens():
1002-
raise ValueError("there must be %s polynomials"%target.ngens())
1002+
raise ValueError("there must be %s polynomials" % target.ngens())
10031003
F = []
10041004
for poly in polys:
10051005
try:
@@ -1011,7 +1011,7 @@ def __init__(self, parent, polys, check=True):
10111011
try:
10121012
p = source_ring(poly.numerator()) / source_ring(poly.denominator())
10131013
except (TypeError, AttributeError):
1014-
raise TypeError("polys (=%s) must be elements of %s"%(polys, source_ring))
1014+
raise TypeError("polys (=%s) must be elements of %s" % (polys, source_ring))
10151015
F.append(p)
10161016
polys = Sequence(F)
10171017

@@ -1244,7 +1244,7 @@ def _repr_defn(self):
12441244
"""
12451245
i = self.domain().ambient_space()._repr_generic_point()
12461246
o = self._codomain.ambient_space()._repr_generic_point(self.defining_polynomials())
1247-
return "Defined on coordinates by sending %s to\n%s"%(i,o)
1247+
return "Defined on coordinates by sending %s to\n%s" % (i,o)
12481248

12491249
def __getitem__(self, i):
12501250
"""

src/sage/schemes/generic/point.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def _repr_(self):
6666
sage: P._repr_()
6767
'Point on Spectrum of Integer Ring'
6868
"""
69-
return "Point on %s"%self.__S
69+
return "Point on %s" % self.__S
7070

7171
########################################################
7272
# Topological points on a scheme
@@ -179,7 +179,7 @@ def __init__(self, S, P, check=False):
179179
# unfortunately is_prime() is only implemented in a small
180180
# number of cases
181181
if check and not P.is_prime():
182-
raise ValueError("The argument %s must be a prime ideal of %s"%(P, R))
182+
raise ValueError("The argument %s must be a prime ideal of %s" % (P, R))
183183
SchemeTopologicalPoint.__init__(self, S)
184184
self.__P = P
185185

@@ -197,7 +197,7 @@ def _repr_(self):
197197
sage: pt._repr_()
198198
'Point on Projective Space of dimension 2 over Rational Field defined by the Ideal (-x^2 + y*z) of Multivariate Polynomial Ring in x, y, z over Rational Field'
199199
"""
200-
return "Point on %s defined by the %s"%(self.scheme(),
200+
return "Point on %s defined by the %s" % (self.scheme(),
201201
self.prime_ideal())
202202

203203
def prime_ideal(self):
@@ -247,7 +247,7 @@ def __init__(self, f):
247247
self.__f = f
248248

249249
def _repr_(self):
250-
return "Point on %s defined by the morphism %s"%(self.scheme(),
250+
return "Point on %s defined by the morphism %s" % (self.scheme(),
251251
self.morphism())
252252

253253
def morphism(self):

0 commit comments

Comments
 (0)