Skip to content

Commit 66aacc5

Browse files
author
Release Manager
committed
gh-36191: fix E228 and E225 in schemes/ fix pycodestyle warnings E228 and E225 in schemes this was done using `autopep8` ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. URL: #36191 Reported by: Frédéric Chapoton Reviewer(s): Kwankyu Lee
2 parents 7b8b6b6 + f495b38 commit 66aacc5

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
@@ -527,7 +527,7 @@ def _repr_(self):
527527
sage: S._repr_()
528528
'Subscheme of Projective Space of dimension 3 over Integer Ring'
529529
"""
530-
return "Subscheme of %s"%self.__A
530+
return "Subscheme of %s" % self.__A
531531

532532
def _homset(self, *args, **kwds):
533533
"""
@@ -819,11 +819,11 @@ def _check_satisfies_equations(self, v):
819819
coords = list(v)
820820
for f in self.__X.defining_polynomials():
821821
if f(coords) != 0:
822-
raise TypeError("Coordinates %s do not define a point on %s"%(v,self))
822+
raise TypeError("Coordinates %s do not define a point on %s" % (v,self))
823823
for f in self.__Y.defining_polynomials():
824824
if f(coords) != 0:
825825
return True
826-
raise TypeError("Coordinates %s do not define a point on %s"%(v,self))
826+
raise TypeError("Coordinates %s do not define a point on %s" % (v,self))
827827

828828
def rational_points(self, **kwds):
829829
"""
@@ -870,9 +870,9 @@ def rational_points(self, **kwds):
870870

871871
if bound == 0:
872872
if is_RationalField(F):
873-
raise TypeError("A positive bound (= %s) must be specified."%bound)
873+
raise TypeError("A positive bound (= %s) must be specified." % bound)
874874
if not isinstance(F, FiniteField):
875-
raise TypeError("Argument F (= %s) must be a finite field."%F)
875+
raise TypeError("Argument F (= %s) must be a finite field." % F)
876876
pts = []
877877
for P in self.ambient_space().rational_points(F):
878878
try:
@@ -984,11 +984,11 @@ def _check_satisfies_equations(self, v):
984984
for f in self.defining_polynomials():
985985
if f(coords) != 0: # it must be "!=0" instead of "if f(v)", e.g.,
986986
# because of p-adic base rings.
987-
raise TypeError("Coordinates %s do not define a point on %s"%(coords,self))
987+
raise TypeError("Coordinates %s do not define a point on %s" % (coords,self))
988988
try:
989989
return self.ambient_space()._check_satisfies_equations(coords)
990990
except TypeError:
991-
raise TypeError("Coordinates %s do not define a point on %s"%(coords,self))
991+
raise TypeError("Coordinates %s do not define a point on %s" % (coords,self))
992992

993993
def base_extend(self, R):
994994
"""
@@ -1463,10 +1463,10 @@ def union(self, other):
14631463
True
14641464
"""
14651465
if not isinstance(other, AlgebraicScheme_subscheme):
1466-
raise TypeError("other (=%s) must be a closed algebraic subscheme of an ambient space"%other)
1466+
raise TypeError("other (=%s) must be a closed algebraic subscheme of an ambient space" % other)
14671467
A = self.ambient_space()
14681468
if other.ambient_space() != A:
1469-
raise ValueError("other (=%s) must be in the same ambient space as self"%other)
1469+
raise ValueError("other (=%s) must be in the same ambient space as self" % other)
14701470
return A.subscheme(self.defining_ideal().intersection(other.defining_ideal()))
14711471

14721472
def __pow__(self, m):
@@ -1647,10 +1647,10 @@ def intersection(self, other):
16471647
y
16481648
"""
16491649
if not isinstance(other, AlgebraicScheme_subscheme):
1650-
raise TypeError("other (=%s) must be a closed algebraic subscheme of an ambient space"%other)
1650+
raise TypeError("other (=%s) must be a closed algebraic subscheme of an ambient space" % other)
16511651
A = self.ambient_space()
16521652
if other.ambient_space() != A:
1653-
raise ValueError("other (=%s) must be in the same ambient space as self"%other)
1653+
raise ValueError("other (=%s) must be in the same ambient space as self" % other)
16541654
return A.subscheme(self.defining_ideal() + other.defining_ideal())
16551655

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

17141714
def rational_points(self, **kwds):
@@ -1832,7 +1832,7 @@ def rational_points(self, **kwds):
18321832
try:
18331833
return X.points(**kwds) # checks for proper bound done in points functions
18341834
except TypeError:
1835-
raise TypeError("Unable to enumerate points over %s."%F)
1835+
raise TypeError("Unable to enumerate points over %s." % F)
18361836
elif (self.base_ring() in NumberFields() or self.base_ring() == ZZ)\
18371837
and hasattr(F, 'precision'):
18381838
#we are numerically approximating number field points
@@ -1841,7 +1841,7 @@ def rational_points(self, **kwds):
18411841
X = self.base_extend(F)(F)
18421842
return X.points()
18431843
except TypeError:
1844-
raise TypeError("Unable to enumerate points over %s."%F)
1844+
raise TypeError("Unable to enumerate points over %s." % F)
18451845

18461846
def change_ring(self, R):
18471847
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
@@ -95,9 +95,9 @@ def __init__(self, poly, ambient=None):
9595
True
9696
"""
9797
if not isinstance(poly, MPolynomial):
98-
raise TypeError("Defining polynomial (=%s) must be a multivariate polynomial."%poly)
98+
raise TypeError("Defining polynomial (=%s) must be a multivariate polynomial." % poly)
9999
if not poly.is_homogeneous():
100-
raise TypeError("Defining polynomial (=%s) must be homogeneous."%poly)
100+
raise TypeError("Defining polynomial (=%s) must be homogeneous." % poly)
101101
if ambient is None:
102102
R = poly.parent()
103103
from sage.schemes.projective.projective_space import ProjectiveSpace
@@ -120,7 +120,7 @@ def _repr_(self):
120120
sage: H._repr_()
121121
'Projective hypersurface defined by y^2 + x*z in Projective Space of dimension 2 over Integer Ring'
122122
"""
123-
return "Projective hypersurface defined by %s in %s"%(
123+
return "Projective hypersurface defined by %s in %s" % (
124124
self.defining_polynomial(), self.ambient_space())
125125

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

214214
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

@@ -996,11 +996,11 @@ def __init__(self, parent, polys, check=True):
996996
"""
997997
if check:
998998
if not isinstance(polys, (list, tuple)):
999-
raise TypeError("polys (=%s) must be a list or tuple"%polys)
999+
raise TypeError("polys (=%s) must be a list or tuple" % polys)
10001000
source_ring = parent.domain().ambient_space().coordinate_ring()
10011001
target = parent._codomain.ambient_space()
10021002
if len(polys) != target.ngens():
1003-
raise ValueError("there must be %s polynomials"%target.ngens())
1003+
raise ValueError("there must be %s polynomials" % target.ngens())
10041004
F = []
10051005
for poly in polys:
10061006
try:
@@ -1012,7 +1012,7 @@ def __init__(self, parent, polys, check=True):
10121012
try:
10131013
p = source_ring(poly.numerator()) / source_ring(poly.denominator())
10141014
except (TypeError, AttributeError):
1015-
raise TypeError("polys (=%s) must be elements of %s"%(polys, source_ring))
1015+
raise TypeError("polys (=%s) must be elements of %s" % (polys, source_ring))
10161016
F.append(p)
10171017
polys = Sequence(F)
10181018

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

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

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)