Skip to content

Commit c5a8783

Browse files
author
Release Manager
committed
Trac #32758: fix E713 and E714 in schemes
about negative comparison using "is not" URL: https://trac.sagemath.org/32758 Reported by: chapoton Ticket author(s): Frédéric Chapoton Reviewer(s): Jonathan Kliem
2 parents 50776da + c8499d1 commit c5a8783

22 files changed

+62
-59
lines changed

build/pkgs/configure/checksums.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
tarball=configure-VERSION.tar.gz
2-
sha1=8761bf411523c8980d9e404ae9c2f5dec8b6d733
3-
md5=57bc67c3d99d2fffa8688745cc101990
4-
cksum=472330691
2+
sha1=b789b0cad7547f9b699a305d5cfe6a4b67d353df
3+
md5=ad65b7da919dcff932eb34a98793504b
4+
cksum=2565222951
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
50c7af6955632686157cd8dac2d8d764f6d41fb3
1+
dc6e96cb4344704cb6779ff68e024d06063d50ee

src/sage/schemes/affine/affine_homset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def numerical_points(self, F=None, **kwds):
398398
from sage.schemes.affine.affine_space import is_AffineSpace
399399
if F is None:
400400
F = CC
401-
if not F in Fields() or not hasattr(F, 'precision'):
401+
if F not in Fields() or not hasattr(F, 'precision'):
402402
raise TypeError('F must be a numerical field')
403403
X = self.codomain()
404404
if X.base_ring() not in NumberFields():

src/sage/schemes/affine/affine_subscheme.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def is_smooth(self, point=None):
328328
False
329329
"""
330330
R = self.ambient_space().coordinate_ring()
331-
if not point is None:
331+
if point is not None:
332332
self._check_satisfies_equations(point)
333333
point_subs = dict(zip(R.gens(), point))
334334
Jac = self.Jacobian().subs(point_subs)

src/sage/schemes/curves/affine_curve.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ def tangents(self, P, factor=True):
678678
# divide T by that power of vars[1]
679679
T = self.ambient_space().coordinate_ring()(dict([((v[0],v[1] - t), h) for (v,h) in T.dict().items()]))
680680
# T is homogeneous in var[0], var[1] if nonconstant, so dehomogenize
681-
if not T in self.base_ring():
681+
if T not in self.base_ring():
682682
if T.degree(vars[0]) > 0:
683683
T = T(vars[0], 1)
684684
roots = T.univariate_polynomial().roots()
@@ -982,7 +982,7 @@ def projection(self, indices, AS=None):
982982
raise ValueError("(=%s) must be a list or tuple of length between 2 and (=%s), inclusive" % (indices, n - 1))
983983
if len(set(indices)) < len(indices):
984984
raise ValueError("(=%s) must be a list or tuple of distinct indices or variables" % indices)
985-
if not AS is None:
985+
if AS is not None:
986986
if not is_AffineSpace(AS):
987987
raise TypeError("(=%s) must be an affine space" % AS)
988988
if AS.dimension_relative() != len(indices):
@@ -2145,11 +2145,11 @@ def _nonsingular_model(self):
21452145
basis = list(gbasis)
21462146
syzygy = {}
21472147
for i in range(n):
2148-
S = k[R._first_ngens(i+1)]
2148+
S = k[R._first_ngens(i + 1)]
21492149
while basis:
21502150
f = basis.pop()
21512151
if f in S:
2152-
if not i in syzygy and f:
2152+
if i not in syzygy and f:
21532153
syzygy[i] = f
21542154
else:
21552155
basis.append(f)

src/sage/schemes/curves/curve.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,8 @@ def singular_points(self, F=None):
320320
if not self.base_ring() in Fields():
321321
raise TypeError("curve must be defined over a field")
322322
F = self.base_ring()
323-
elif not F in Fields():
324-
raise TypeError("(=%s) must be a field"%F)
323+
elif F not in Fields():
324+
raise TypeError("(=%s) must be a field" % F)
325325
X = self.singular_subscheme()
326326
return [self.point(p, check=False) for p in X.rational_points(F=F)]
327327

src/sage/schemes/curves/projective_curve.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ def projection(self, P=None, PS=None):
411411
raise TypeError("this curve is already a plane curve")
412412
if self.base_ring() not in Fields():
413413
raise TypeError("this curve must be defined over a field")
414-
if not PS is None:
414+
if PS is not None:
415415
if not is_ProjectiveSpace(PS):
416416
raise TypeError("(=%s) must be a projective space" % PS)
417417
if PS.dimension_relative() != n - 1:
@@ -455,7 +455,7 @@ def projection(self, P=None, PS=None):
455455
Q = self(P)
456456
except TypeError:
457457
pass
458-
if not Q is None:
458+
if Q is not None:
459459
raise TypeError("(=%s) must be a point not on this curve" % P)
460460
try:
461461
Q = self.ambient_space()(P)

src/sage/schemes/elliptic_curves/cm.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,9 +623,8 @@ def is_cm_j_invariant(j, method='new'):
623623
True
624624
"""
625625
# First we check that j is an algebraic number:
626-
627626
from sage.rings.all import NumberFieldElement, NumberField
628-
if not isinstance(j, NumberFieldElement) and not j in QQ:
627+
if not isinstance(j, NumberFieldElement) and j not in QQ:
629628
raise NotImplementedError("is_cm_j_invariant() is only implemented for number field elements")
630629

631630
# for j in ZZ we have a lookup-table:

src/sage/schemes/elliptic_curves/ell_egros.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,10 +447,10 @@ def egros_get_j(S=[], proof=None, verbose=False):
447447
P = urst(P)
448448
x = P[0]
449449
y = P[1]
450-
j = x**3 /w
451-
assert j-1728 == y**2 /w
450+
j = x**3 / w
451+
assert j - 1728 == y**2 / w
452452
if is_possible_j(j, S):
453-
if not j in jlist:
453+
if j not in jlist:
454454
if verbose:
455455
print("Adding possible j = ", j)
456456
sys.stdout.flush()

src/sage/schemes/elliptic_curves/ell_modular_symbols.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def modular_symbol_space(E, sign, base_ring, bound=None):
129129
Modular Symbols space of dimension 1 for Gamma_0(11) of weight 2 with sign -1 over Finite Field of size 37
130130
131131
"""
132-
if not sign in [-1,0,1]:
132+
if sign not in [-1, 0, 1]:
133133
raise TypeError('sign must -1, 0 or 1')
134134
N = E.conductor()
135135
M = ModularSymbols(N, sign=sign, base_ring=base_ring)
@@ -323,12 +323,12 @@ def __init__(self, E, sign, nap=1000):
323323
"""
324324
from sage.libs.eclib.newforms import ECModularSymbol
325325

326-
if not sign in [-1,1]:
326+
if sign not in [-1, 1]:
327327
raise TypeError('sign must -1 or 1')
328328
self._sign = ZZ(sign)
329329
self._E = E
330330
self._scaling = 1 if E.discriminant()>0 else ZZ(1)/2
331-
self._implementation="eclib"
331+
self._implementation = "eclib"
332332
self._base_ring = QQ
333333
# The ECModularSymbol class must be initialized with sign=0 to compute minus symbols
334334
self._modsym = ECModularSymbol(E, int(sign==1), nap)
@@ -436,11 +436,11 @@ def __init__(self, E, sign, normalize="L_ratio"):
436436
[1, 1, 1, 1, 1, 1, 1, 1]
437437
438438
"""
439-
if not sign in [-1,1]:
439+
if sign not in [-1, 1]:
440440
raise TypeError('sign must -1 or 1')
441441
self._sign = ZZ(sign)
442442
self._E = E
443-
self._implementation="sage"
443+
self._implementation = "sage"
444444
self._normalize = normalize
445445
self._modsym = E.modular_symbol_space(sign=self._sign)
446446
self._base_ring = self._modsym.base_ring()

0 commit comments

Comments
 (0)