Skip to content

Commit 76d3bfd

Browse files
committed
fix pycodestyle E713 and E714 in rings
1 parent 056b8d4 commit 76d3bfd

18 files changed

+39
-41
lines changed

src/sage/rings/complex_interval_field.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525
``+/-1``.
2626
"""
2727

28-
#*****************************************************************************
28+
# ****************************************************************************
2929
# Copyright (C) 2006 William Stein <[email protected]>
3030
#
3131
# This program is free software: you can redistribute it and/or modify
3232
# it under the terms of the GNU General Public License as published by
3333
# the Free Software Foundation, either version 2 of the License, or
3434
# (at your option) any later version.
35-
# http://www.gnu.org/licenses/
36-
#*****************************************************************************
35+
# https://www.gnu.org/licenses/
36+
# ****************************************************************************
3737

3838

3939
from sage.structure.parent import Parent
@@ -94,7 +94,7 @@ def ComplexIntervalField(prec=53, names=None):
9494
if prec in cache:
9595
X = cache[prec]
9696
C = X()
97-
if not C is None:
97+
if C is not None:
9898
return C
9999
C = ComplexIntervalField_class(prec)
100100
cache[prec] = weakref.ref(C)

src/sage/rings/derivation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def __init__(self, domain, codomain, twist=None):
247247
TypeError: the domain of the derivation must coerce to the domain of the twisting homomorphism
248248
249249
"""
250-
if not domain in Rings().Commutative():
250+
if domain not in Rings().Commutative():
251251
raise TypeError("the domain must be a commutative ring")
252252

253253
if codomain in Rings().Commutative() and codomain.has_coerce_map_from(domain):

src/sage/rings/function_field/divisor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ def multiplicity(self, place):
456456
sage: D.multiplicity(p2)
457457
-3
458458
"""
459-
if not place in self._data:
459+
if place not in self._data:
460460
return 0
461461
return self._data[place]
462462

src/sage/rings/function_field/function_field.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2893,7 +2893,7 @@ def places_above(self, p):
28932893
"""
28942894
R = self.base_field()
28952895

2896-
if not p in R.place_set():
2896+
if p not in R.place_set():
28972897
raise TypeError("not a place of the base rational function field")
28982898

28992899
if p.is_infinite_place():
@@ -3372,9 +3372,9 @@ def _weierstrass_places(self):
33723372
gaps = [1]
33733373
while M.nrows() < d:
33743374
row = vector([der._derive(basis[i], e) for i in range(d)])
3375-
if not row in M.row_space():
3375+
if row not in M.row_space():
33763376
M = matrix(M.rows() + [row])
3377-
gaps.append(e+1)
3377+
gaps.append(e + 1)
33783378
e += 1
33793379

33803380
# This is faster than M.determinant(). Note that Mx

src/sage/rings/function_field/order.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1997,7 +1997,7 @@ def decomposition(self, ideal):
19971997
row.append( V([to(e) for e in self._mtable[i][j]]) )
19981998
mtable.append(row)
19991999

2000-
if not p in self._kummer_places:
2000+
if p not in self._kummer_places:
20012001
#####################################
20022002
# Decomposition by Kummer's theorem #
20032003
#####################################

src/sage/rings/function_field/place.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ def _gaps_wronskian(self):
759759
gaps = [1]
760760
while M.nrows() < d:
761761
row = vector([to_R(der._derive(basis[i], e, sep)) for i in range(d)])
762-
if not row in M.row_space():
762+
if row not in M.row_space():
763763
M = matrix(M.rows() + [row])
764764
M.echelonize()
765765
gaps.append(e + 1)
@@ -1065,7 +1065,7 @@ def from_K(e):
10651065
alpha_powered_by_ramification_index = alpha ** prime._ramification_index
10661066

10671067
def to_K(f):
1068-
if not f in O:
1068+
if f not in O:
10691069
den = O.coordinate_vector(f).denominator()
10701070
num = den * f
10711071

src/sage/rings/invariants/reconstruction.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,7 @@ def _reduce_invariants(invariants, weights):
383383
for prime in gcd(invariants).factor():
384384
p = prime[0]
385385
for D in factors:
386-
if not p in D:
386+
if p not in D:
387387
D[p] = 0
388388
scalar = scalar*p**min([factors[i][p]//weights[i] for i in range(n)])
389389
return [invariants[i]*scalar**-weights[i] for i in range(n)]
390-

src/sage/rings/polynomial/infinite_polynomial_ring.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,11 +709,11 @@ def __init__(self, R, names, order):
709709
self._names = tuple(names)
710710
if not isinstance(order, str):
711711
raise TypeError("The monomial order must be given as a string")
712-
if not R in Rings().Commutative():
712+
if R not in Rings().Commutative():
713713
raise TypeError("The given 'base ring' (= %s) must be a commutative ring" % R)
714714

715715
# now, the input is accepted
716-
if hasattr(R,'_underlying_ring'):
716+
if hasattr(R, '_underlying_ring'):
717717
self._underlying_ring = R._underlying_ring
718718
else:
719719
self._underlying_ring = R.base_ring()

src/sage/rings/polynomial/multi_polynomial_ideal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2238,7 +2238,7 @@ def quotient(self, J):
22382238
if not isinstance(J, MPolynomialIdeal):
22392239
raise TypeError("J needs to be a multivariate polynomial ideal")
22402240

2241-
if not R is J.ring() and not R == J.ring():
2241+
if R is not J.ring() and not R == J.ring():
22422242
raise TypeError("base rings do not match")
22432243

22442244
from sage.libs.singular.function_factory import ff

src/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ def __init__(self, parent, x=None, check=True, is_gen=False, construct = False,
8787
#We now coerce various types into lists of coefficients. There are fast pathways for some types of polynomials
8888
if isinstance(x, Polynomial):
8989
if x.parent() is self.parent():
90-
if not absprec is infinity or not relprec is infinity:
90+
if absprec is not infinity or relprec is not infinity:
9191
x._normalize()
9292
self._poly = x._poly
9393
self._valbase = x._valbase
9494
self._valaddeds = x._valaddeds
9595
self._relprecs = x._relprecs
9696
self._normalized = x._normalized
9797
self._list = x._list
98-
if not absprec is infinity or not relprec is infinity:
98+
if absprec is not infinity or relprec is not infinity:
9999
self._adjust_prec_info(absprec, relprec)
100100
return
101101
elif x.base_ring() is ZZ:
@@ -106,7 +106,7 @@ def __init__(self, parent, x=None, check=True, is_gen=False, construct = False,
106106
self._comp_valaddeds()
107107
self._normalized = len(self._valaddeds) == 0 or (min(self._valaddeds) == 0)
108108
self._list = None
109-
if not absprec is infinity or not relprec is infinity:
109+
if absprec is not infinity or relprec is not infinity:
110110
self._adjust_prec_info(absprec, relprec)
111111
return
112112
else:
@@ -147,14 +147,14 @@ def __init__(self, parent, x=None, check=True, is_gen=False, construct = False,
147147
self._relprecs = []
148148
self._poly = PolynomialRing(ZZ, parent.variable_name())()
149149
self._normalized = True
150-
if not absprec is infinity or not relprec is infinity:
150+
if absprec is not infinity or relprec is not infinity:
151151
self._adjust_prec_info(absprec, relprec)
152152
else:
153153
self._valaddeds = [c - self._valbase for c in self._valaddeds]
154154
self._relprecs = [a.precision_absolute() - self._valbase for a in x]
155155
self._poly = PolynomialRing(ZZ, parent.variable_name())([a >> self._valbase for a in x])
156156
self._normalized = True
157-
if not absprec is infinity or not relprec is infinity:
157+
if absprec is not infinity or relprec is not infinity:
158158
self._adjust_prec_info(absprec, relprec)
159159

160160
def _new_constant_poly(self, a, P):
@@ -702,21 +702,21 @@ def _unsafe_mutate(self, n, value):
702702
self._poly._unsafe_mutate(self, n, 0)
703703
if n < len(self._relprecs):
704704
self._relprecs[n] = value.precision_absolute() - self._valbase
705-
if not self._valaddeds is None:
705+
if self._valaddeds is not None:
706706
self._valaddeds[n] = value.valuation() - self._valbase
707-
if not self._list is None:
707+
if self._list is not None:
708708
self._list[n] = value
709709
else:
710710
self._relprecs.extend([infinity] * (n - len(self._relprecs)) + [value.precision_absolute() - self._valbase])
711-
if not self._valaddeds is None:
711+
if self._valaddeds is not None:
712712
self._valaddeds.extend([infinity] * (n - len(self._relprecs)) + [value.valuation() - self._valbase])
713-
if not self._list is None:
713+
if self._list is not None:
714714
zero = self.base_ring()(0)
715715
self._list.extend([zero] * (n - len(self._relprecs)) + [value])
716716
else:
717717
basediff = self._valbase - value.valuation()
718718
self._valbase = value.valuation()
719-
if not self._valaddeds is None:
719+
if self._valaddeds is not None:
720720
self._valaddeds = [c + basediff for c in self._valaddeds]
721721
self._poly = self._poly * self.base_ring().prime_pow(basediff)
722722
if value != 0:
@@ -728,7 +728,7 @@ def _unsafe_mutate(self, n, value):
728728
else:
729729
self._relprecs.extend([infinity] * (n - len(self._relprecs)) + [value.precision_relative()])
730730
self._normalized = False
731-
if not self._list is None:
731+
if self._list is not None:
732732
if n < len(self._list):
733733
self._list[n] = value
734734
else:

0 commit comments

Comments
 (0)