Skip to content

Commit 197b53e

Browse files
committed
PEP8 compliance
1 parent 70e4687 commit 197b53e

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/sage/combinat/key_polynomial.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ def divided_difference(self, w):
207207
f = _divided_difference(P, wi, f)
208208
return P.from_polynomial(f)
209209

210+
210211
class KeyPolynomialBasis(CombinatorialFreeModule):
211212
r"""
212213
The key polynomial basis for a polynomial ring.
@@ -289,14 +290,14 @@ class KeyPolynomialBasis(CombinatorialFreeModule):
289290
sage: f = T.demazure_character([3,2,1])
290291
sage: k.from_polynomial(f)
291292
k[1, 0, 0, 2]
292-
293+
293294
The default behavior is to work in a polynomial ring with infinitely many
294295
variables. One can work in a specicfied number of variables::
295296
296297
sage: from sage.combinat.key_polynomial import KeyPolynomialBasis
297298
sage: k = KeyPolynomialBasis(QQ, 4)
298299
sage: k([3,0,1,2]).expand()
299-
z_0^3*z_1^2*z_2 + z_0^3*z_1*z_2^2 + z_0^3*z_1^2*z_3
300+
z_0^3*z_1^2*z_2 + z_0^3*z_1*z_2^2 + z_0^3*z_1^2*z_3
300301
+ 2*z_0^3*z_1*z_2*z_3 + z_0^3*z_2^2*z_3 + z_0^3*z_1*z_3^2 + z_0^3*z_2*z_3^2
301302
302303
sage: k([0,0,2,0]).expand()
@@ -352,10 +353,10 @@ def __classcall_private__(cls, R=None, k=None, poly_ring=None, poly_coeffs=False
352353
353354
sage: KeyPolynomialBasis(QQ['t0','t1','t2','t3'])
354355
Key polynomial basis over Rational Field
355-
356+
356357
sage: KeyPolynomialBasis(QQ['t'])
357358
Key polynomial basis over Rational Field
358-
359+
359360
sage: KeyPolynomialBasis(InfinitePolynomialRing(QQ['t'], 'z'))
360361
Key polynomial basis over Univariate Polynomial Ring in t over Rational Field
361362
@@ -366,7 +367,7 @@ def __classcall_private__(cls, R=None, k=None, poly_ring=None, poly_coeffs=False
366367
Key polynomial basis over Rational Field
367368
"""
368369

369-
poly_type = (PolynomialRing_commutative,
370+
poly_type = (PolynomialRing_commutative,
370371
MPolynomialRing_base,
371372
InfinitePolynomialRing_sparse)
372373

@@ -440,9 +441,9 @@ def build_index(m):
440441
def _coerce_map_from_(self, R):
441442
r"""
442443
EXAMPLES::
443-
444+
444445
sage: from sage.combinat.key_polynomial import KeyPolynomialBasis
445-
sage: k = KeyPolynomialBasis(QQ)
446+
sage: k = KeyPolynomialBasis(QQ)
446447
sage: m1 = k([3,2,4,0]); m1
447448
k[3, 2, 4]
448449
sage: m2 = k(Composition([3, 2, 4])); m2
@@ -460,7 +461,7 @@ def _coerce_map_from_(self, R):
460461
if R is P:
461462
return CallableConvertMap(R, self, self.from_polynomial)
462463
phi = P.coerce_map_from(R)
463-
if phi is not None:
464+
if phi is not None:
464465
return self.coerce_map_from(P) * phi
465466
return None
466467

@@ -494,7 +495,7 @@ def one_basis(self):
494495
sage: from sage.combinat.key_polynomial import KeyPolynomialBasis
495496
sage: k = KeyPolynomialBasis(QQ, 4)
496497
sage: k.one_basis()
497-
[0, 0, 0, 0]
498+
[0, 0, 0, 0]
498499
"""
499500
if self._k:
500501
return self._indices([0] * self._k)
@@ -629,10 +630,11 @@ def _divided_difference(P, i, f):
629630
R = P.polynomial_ring()
630631
z = P.poly_gens()
631632

632-
si_f = f.subs({z[i+1]:z[i], z[i]:z[i+1]})
633+
si_f = f.subs({z[i+1]: z[i], z[i]: z[i+1]})
633634

634635
return (si_f - f)//(z[i+1] - z[i])
635636

637+
636638
def _pi(P, w, f):
637639
r"""
638640
Apply the operator `\pi_w` to the polynomial `f`.
@@ -641,7 +643,7 @@ def _pi(P, w, f):
641643
642644
.. WARNING::
643645
644-
The simple transpositions should be applied from left to right.
646+
The simple transpositions should be applied from left to right.
645647
646648
EXAMPLES::
647649
@@ -667,6 +669,7 @@ def _pi(P, w, f):
667669
f = _pi_i(P, i, f)
668670
return f
669671

672+
670673
def _pi_i(P, i, f):
671674
r"""
672675
Apply `\pi_i` for a single simple transposition `s_i = (i, i+1)`.
@@ -686,10 +689,11 @@ def _pi_i(P, i, f):
686689
z = P.poly_gens()
687690
return _divided_difference(P, i, z[i] * f)
688691

692+
689693
def _sorting_word(alpha):
690694
r"""
691695
Get a reduced word for the permutation which sorts ``alpha``
692-
into a partition.
696+
into a partition.
693697
694698
The result is a list ``l = [i0, i1, i2, ...]`` where each ``ij``
695699
is a nonnegative integer such that it applies the simple

0 commit comments

Comments
 (0)