Skip to content

Commit c8499d1

Browse files
committed
fix E713 and E714 in schemes
1 parent 056b8d4 commit c8499d1

20 files changed

+58
-55
lines changed

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()

src/sage/schemes/elliptic_curves/ell_rational_field.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,12 +2376,12 @@ def _compute_gens(self, proof,
23762376
# progress (see trac #1949).
23772377
X = self.mwrank('-p 100 -S '+str(sat_bound))
23782378
verbose_verbose("Calling mwrank shell.")
2379-
if not 'The rank and full Mordell-Weil basis have been determined unconditionally' in X:
2379+
if 'The rank and full Mordell-Weil basis have been determined unconditionally' not in X:
23802380
msg = 'Generators not provably computed.'
23812381
if proof:
2382-
raise RuntimeError('%s\n%s'%(X,msg))
2382+
raise RuntimeError('%s\n%s' % (X, msg))
23832383
else:
2384-
verbose_verbose("Warning -- %s"%msg, level=1)
2384+
verbose_verbose("Warning -- %s" % msg, level=1)
23852385
proved = False
23862386
else:
23872387
proved = True
@@ -4714,8 +4714,9 @@ def isogenies_prime_degree(self, l=None):
47144714
if isinstance(l, list):
47154715
isogs = []
47164716
i = 0
4717-
while i<len(l):
4718-
isogenies = [f for f in self.isogenies_prime_degree(l[i]) if not f in isogs]
4717+
while i < len(l):
4718+
isogenies = [f for f in self.isogenies_prime_degree(l[i])
4719+
if f not in isogs]
47194720
isogs.extend(isogenies)
47204721
i += 1
47214722
return isogs

src/sage/schemes/elliptic_curves/isogeny_class.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ def _compute(self, verbose=False):
802802

803803
def add_tup(t):
804804
for T in [t, [t[1], t[0], t[2], 0]]:
805-
if not T in tuples:
805+
if T not in tuples:
806806
tuples.append(T)
807807
if verbose:
808808
sys.stdout.write(" -added tuple %s..." % T[:3])
@@ -818,7 +818,7 @@ def add_tup(t):
818818
sys.stdout.flush()
819819
add_tup([0,ncurves,d,phi])
820820
ncurves += 1
821-
if not d in degs:
821+
if d not in degs:
822822
degs.append(d)
823823
if verbose:
824824
sys.stdout.write("... relevant degrees: %s..." % degs)
@@ -909,8 +909,9 @@ def add_tup(t):
909909
allQs = {} # keys: discriminants d
910910
# values: lists of equivalence classes of
911911
# primitive forms of discriminant d
912-
def find_quadratic_form(d,n):
913-
if not d in allQs:
912+
913+
def find_quadratic_form(d, n):
914+
if d not in allQs:
914915
from sage.quadratic_forms.binary_qf import BinaryQF_reduced_representatives
915916

916917
allQs[d] = BinaryQF_reduced_representatives(d, primitive_only=True)

0 commit comments

Comments
 (0)