Skip to content

Commit e7abaf6

Browse files
committed
fix a few pycodestyle issues
1 parent 6689899 commit e7abaf6

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/sage/rings/polynomial/multi_polynomial.pyx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ cdef class MPolynomial(CommutativePolynomial):
259259
return min(self.support(), *args, **kwds)
260260

261261
def coefficients(self):
262-
"""
262+
r"""
263263
Return the nonzero coefficients of this polynomial in a list.
264264
265265
The returned list is decreasingly ordered by the term ordering
@@ -479,7 +479,7 @@ cdef class MPolynomial(CommutativePolynomial):
479479
for e, val in self.monomial_coefficients().items() if not e[ind]}
480480
v = [B(w)] # coefficients that don't involve var
481481
z = var
482-
for i in range(1,d+1):
482+
for i in range(1, d+1):
483483
c = <dict> self.coefficient(z).monomial_coefficients()
484484
w = {remove_from_tuple(e, ind): val for e, val in c.items()}
485485
v.append(B(w))
@@ -537,7 +537,7 @@ cdef class MPolynomial(CommutativePolynomial):
537537
elif my_vars[-1] not in vars:
538538
x = base_ring(self) if base_ring is not None else self
539539
const_ix = ETuple((0,)*len(vars))
540-
return { const_ix: x }
540+
return {const_ix: x}
541541
elif not set(my_vars).issubset(set(vars)):
542542
# we need to split it up
543543
p = self.polynomial(self._parent.gen(len(my_vars)-1))
@@ -819,7 +819,7 @@ cdef class MPolynomial(CommutativePolynomial):
819819
subclasses.
820820
"""
821821
M = self.monomials()
822-
if M==[]:
822+
if M == []:
823823
return True
824824
d = M.pop().degree()
825825
for m in M:
@@ -1149,14 +1149,14 @@ cdef class MPolynomial(CommutativePolynomial):
11491149
g = R.gen_names()
11501150
v = []
11511151
for m, c in zip(self.monomials(), self.coefficients()):
1152-
v.append('(%s)*%s'%( c._magma_init_(magma),
1153-
m._repr_with_changed_varnames(g)))
1152+
v.append('(%s)*%s' % (c._magma_init_(magma),
1153+
m._repr_with_changed_varnames(g)))
11541154
if len(v) == 0:
11551155
s = '0'
11561156
else:
11571157
s = '+'.join(v)
11581158

1159-
return '%s!(%s)'%(R.name(), s)
1159+
return '%s!(%s)' % (R.name(), s)
11601160

11611161
def _giac_init_(self):
11621162
r"""
@@ -1233,7 +1233,7 @@ cdef class MPolynomial(CommutativePolynomial):
12331233
"""
12341234
from sage.geometry.polyhedron.constructor import Polyhedron
12351235
e = self.exponents()
1236-
P = Polyhedron(vertices = e, base_ring=ZZ)
1236+
P = Polyhedron(vertices=e, base_ring=ZZ)
12371237
return P
12381238

12391239
def __iter__(self):
@@ -1449,7 +1449,7 @@ cdef class MPolynomial(CommutativePolynomial):
14491449
raise TypeError("k must be a finite field")
14501450
p = k.characteristic()
14511451
e = k.degree()
1452-
v = [self] + [self.map_coefficients(k.hom([k.gen()**(p**i)])) for i in range(1,e)]
1452+
v = [self] + [self.map_coefficients(k.hom([k.gen()**(p**i)])) for i in range(1, e)]
14531453
return prod(v).change_ring(k.prime_subfield())
14541454

14551455
def sylvester_matrix(self, right, variable=None):
@@ -1904,7 +1904,7 @@ cdef class MPolynomial(CommutativePolynomial):
19041904
for y in x:
19051905
d = d.lcm(y.denominator())
19061906
return d
1907-
except(AttributeError):
1907+
except AttributeError:
19081908
return self.base_ring().one()
19091909

19101910
def numerator(self):
@@ -2025,7 +2025,7 @@ cdef class MPolynomial(CommutativePolynomial):
20252025
ArithmeticError: element is non-invertible
20262026
"""
20272027
P = self.parent()
2028-
B = I.gens()
2028+
B = I.gens()
20292029
try:
20302030
XY = P.one().lift((self,) + tuple(B))
20312031
return P(XY[0])
@@ -2111,7 +2111,7 @@ cdef class MPolynomial(CommutativePolynomial):
21112111
#Corner case, note that the degree of zero is an Integer
21122112
return Integer(-1)
21132113

2114-
if len(weights) == 1:
2114+
if len(weights) == 1:
21152115
# First unwrap it if it is given as one element argument
21162116
weights = weights[0]
21172117

@@ -2132,9 +2132,9 @@ cdef class MPolynomial(CommutativePolynomial):
21322132
for i in range(n):
21332133
l += weights[i]*m[i]
21342134
deg = l
2135-
for j in range(1,len(A)):
2135+
for j in range(1, len(A)):
21362136
l = Integer(0)
2137-
m = <tuple>A[j]
2137+
m = <tuple> A[j]
21382138
for i in range(n):
21392139
l += weights[i]*m[i]
21402140
if deg < l:
@@ -2560,27 +2560,27 @@ cdef class MPolynomial(CommutativePolynomial):
25602560
from sage.rings.real_mpfr import RealField
25612561

25622562
if self.parent().ngens() != 2:
2563-
raise ValueError("(=%s) must have two variables"%self)
2563+
raise ValueError("(=%s) must have two variables" % self)
25642564
if not self.is_homogeneous():
2565-
raise ValueError("(=%s) must be homogeneous"%self)
2565+
raise ValueError("(=%s) must be homogeneous" % self)
25662566

25672567
prec = kwds.get('prec', 300)
2568-
return_conjugation =kwds.get('return_conjugation', True)
2568+
return_conjugation = kwds.get('return_conjugation', True)
25692569
error_limit = kwds.get('error_limit', 0.000001)
25702570
emb = kwds.get('emb', None)
25712571

25722572
# getting a numerical approximation of the roots of our polynomial
25732573
CF = ComplexIntervalField(prec=prec) # keeps trac of our precision error
25742574
RF = RealField(prec=prec)
25752575
R = self.parent()
2576-
x,y = R.gens()
2576+
x, y = R.gens()
25772577

25782578
# finding quadratic Q_0, gives us our covariant, z_0
25792579
from sage.rings.polynomial.binary_form_reduce import covariant_z0
25802580
try:
25812581
z, th = covariant_z0(self, prec=prec, emb=emb, z0_cov=True)
25822582
except ValueError:# multiple roots
2583-
F = self.lc()*prod([p for p,e in self.factor()])
2583+
F = self.lc()*prod([p for p, e in self.factor()])
25842584
z, th = covariant_z0(F, prec=prec, emb=emb, z0_cov=True)
25852585
z = CF(z)
25862586
# this moves z_0 to our fundamental domain using the three steps laid
@@ -2594,11 +2594,11 @@ cdef class MPolynomial(CommutativePolynomial):
25942594
# moves z into fundamental domain by m
25952595
m = zc.real().round() # finds amount to move z's real part by
25962596
Qm = QQ(m)
2597-
M = M * matrix(QQ, [[1,Qm], [0,1]]) # move
2597+
M = M * matrix(QQ, [[1, Qm], [0, 1]]) # move
25982598
z -= m # M.inverse()*z is supposed to move z by m
25992599
elif (zc.real() <= RF(0) and zc.abs() < RF(1)) or (zc.real() > RF(0) and zc.abs() <= RF(1)): # flips z
26002600
z = -1/z
2601-
M = M * matrix(QQ, [[0,-1], [1,0]])# multiply on left because we are taking inverse matrices
2601+
M = M * matrix(QQ, [[0, -1], [1, 0]])# multiply on left because we are taking inverse matrices
26022602
zc = z.center()
26032603

26042604
smallest_coeffs = kwds.get('smallest_coeffs', True)

0 commit comments

Comments
 (0)