Skip to content

Commit 979b368

Browse files
author
Release Manager
committed
gh-36280: fix E228 and E225 in combinat/*/*.py fix pycodestyle warning E228 and E225 in` combinat/*/*.py` done using autopep8 ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. URL: #36280 Reported by: Frédéric Chapoton Reviewer(s): Kwankyu Lee
2 parents 0fcf889 + 2d0d02c commit 979b368

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+627
-603
lines changed

src/sage/combinat/cluster_algebra_quiver/cluster_seed.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4508,13 +4508,13 @@ def get_upper_cluster_algebra_element(self,a):
45084508
sage: C.get_upper_cluster_algebra_element([1,1,1])
45094509
x0^4*x1^2*x2^3 + x0^2*x1^3*x2^4
45104510
"""
4511-
B=self.b_matrix()
4511+
B = self.b_matrix()
45124512
# Checks if the length of the
45134513
if len(a) != B.ncols():
45144514
raise ValueError('The length of the input vector must be the same as the number of columns of B.')
45154515
# Runs helper functions.
4516-
v=_vector_decomposition(a,B.nrows())
4517-
c=self._compute_compatible_vectors(v)
4516+
v = _vector_decomposition(a,B.nrows())
4517+
c = self._compute_compatible_vectors(v)
45184518
return self._produce_upper_cluster_algebra_element(v,c)
45194519

45204520
def LLM_gen_set(self, size_limit=-1):

src/sage/combinat/cluster_algebra_quiver/mutation_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def _check_special_BC_cases(dg, n, check_letter_list, check_twist_list,
311311
if conn_vert_list:
312312
conn_verts = list(set(dg).difference(conn_verts))
313313
if mut_type._letter == hope_letter and not mut_type._twist and conn_vert.issubset(conn_verts):
314-
if len(check_letter)>1:
314+
if len(check_letter) > 1:
315315
check_twist = 1
316316
if check_twist:
317317
n -= 1

src/sage/combinat/cluster_algebra_quiver/quiver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ def __init__(self, data, frozen=None, user_labels=None):
366366
elif n+m == 1:
367367
self._description = 'Quiver on 1 vertex'
368368
else:
369-
self._description = 'Quiver on %d vertices' %(n+m)
369+
self._description = 'Quiver on %d vertices' % (n+m)
370370

371371
# constructs a quiver from a digraph
372372
elif isinstance(data, DiGraph):
@@ -1512,7 +1512,7 @@ def mutation_sequence(self, sequence, show_sequence=False, fig_size=1.2 ):
15121512
raise ValueError('The quiver can only be mutated at a vertex or at a sequence of vertices')
15131513
if any(v not in V for v in sequence):
15141514
v = next(v for v in sequence if v not in V)
1515-
raise ValueError('The quiver can only be mutated at the vertex %s'%v )
1515+
raise ValueError('The quiver can only be mutated at the vertex %s' % v )
15161516

15171517
quiver = copy( self )
15181518
quiver_sequence = []

src/sage/combinat/crystals/affine_factorization.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,12 @@ def e(self, i):
250250
k = self.parent().k
251251
n = self.parent().n
252252
a = min(b[0])
253-
left = [j for j in (self.value[n-i-1]).reduced_word() if j != (a+x)%(k+1)]
254-
right = [(j-x)%(k+1) for j in (self.value[n-i]).reduced_word()]
255-
m = max([j for j in range(a) if (j+x)%(k+1) not in left])
253+
left = [j for j in (self.value[n-i-1]).reduced_word() if j != (a+x) % (k+1)]
254+
right = [(j-x) % (k+1) for j in (self.value[n-i]).reduced_word()]
255+
m = max([j for j in range(a) if (j+x) % (k+1) not in left])
256256
right += [m+1]
257257
right.sort(reverse=True)
258-
right = [(j+x)%(k+1) for j in right]
258+
right = [(j+x) % (k+1) for j in right]
259259
t = [self.value[j] for j in range(n-i-1)] + [W.from_reduced_word(left)] + [W.from_reduced_word(right)] + [self.value[j] for j in range(n-i+1,n)]
260260
return self.parent()(tuple(t))
261261

@@ -284,12 +284,12 @@ def f(self, i):
284284
k = self.parent().k
285285
n = self.parent().n
286286
a = max(b[1])
287-
right = [j for j in (self.value[n-i]).reduced_word() if j != (a+x)%(k+1)]
288-
left = [(j-x)%(k+1) for j in (self.value[n-i-1]).reduced_word()]
289-
m = min([j for j in range(a+1,k+2) if (j+x)%(k+1) not in right])
287+
right = [j for j in (self.value[n-i]).reduced_word() if j != (a+x) % (k+1)]
288+
left = [(j-x) % (k+1) for j in (self.value[n-i-1]).reduced_word()]
289+
m = min([j for j in range(a+1,k+2) if (j+x) % (k+1) not in right])
290290
left += [m-1]
291291
left.sort(reverse=True)
292-
left = [(j+x)%(k+1) for j in left]
292+
left = [(j+x) % (k+1) for j in left]
293293
t = [self.value[j] for j in range(n-i-1)] + [W.from_reduced_word(left)] + [W.from_reduced_word(right)] + [self.value[j] for j in range(n-i+1,n)]
294294
return self.parent()(tuple(t))
295295

@@ -311,13 +311,13 @@ def bracketing(self, i):
311311
k = self.parent().k
312312
right = (self.value[n-i]).reduced_word()
313313
left = (self.value[n-i-1]).reduced_word()
314-
right_n = [(j-x)%(k+1) for j in right]
315-
left_n = [(j-x)%(k+1) for j in left]
314+
right_n = [(j-x) % (k+1) for j in right]
315+
left_n = [(j-x) % (k+1) for j in left]
316316
left_unbracketed = []
317317
while left_n:
318318
m = max(left_n)
319319
left_n.remove(m)
320-
l = [j for j in right_n if j>m]
320+
l = [j for j in right_n if j > m]
321321
if l:
322322
right_n.remove(min(l))
323323
else:
@@ -428,7 +428,7 @@ def affine_factorizations(w, l, weight=None):
428428
[[1, 1, 1, s1, s2*s1, s3*s2*s1]]
429429
"""
430430
if weight is None:
431-
if l==0:
431+
if l == 0:
432432
if w.is_one():
433433
return [[]]
434434
else:
@@ -438,7 +438,7 @@ def affine_factorizations(w, l, weight=None):
438438
else:
439439
if l != len(weight):
440440
return []
441-
if l==0:
441+
if l == 0:
442442
if w.is_one():
443443
return [[]]
444444
else:

src/sage/combinat/crystals/alcove_path.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,13 @@ def vertices(self):
418418
# you to the word, it needs to be refreshed
419419

420420
#initialization
421-
lst=[]
421+
lst = []
422422
for i in range(len_lambda_chain):
423423
associated_reflection = lambda_chain[i].root.associated_reflection()
424424
if len(associated_reflection) == 1:
425425
lst.append( (prod([ s[j] for j in associated_reflection ]), [i]) )
426426

427-
l=copy(lst)
427+
l = copy(lst)
428428

429429
while True:
430430
lst2 = []
@@ -603,7 +603,7 @@ def phi(self, i):
603603
highest_weight_crystal = self.parent()._highest_weight_crystal
604604
positions, gi = self._gi(i)
605605

606-
m=max(gi)
606+
m = max(gi)
607607

608608
if not highest_weight_crystal and i == 0:
609609
raise NotImplementedError
@@ -629,7 +629,7 @@ def epsilon(self, i):
629629
temp = self
630630
temp = temp.e(i)
631631
while temp is not None:
632-
j+=1
632+
j += 1
633633
temp = temp.e(i)
634634

635635
return j
@@ -899,7 +899,7 @@ def e(self, i):
899899
else:
900900
M = Integer(m)/2 - Integer(1)/2
901901

902-
KR_test = finite_cartan_type and i==0 and m_index < len(gi) - 1
902+
KR_test = finite_cartan_type and i == 0 and m_index < len(gi) - 1
903903
KR_test = KR_test and M >= 1
904904

905905
######################################################################
@@ -909,7 +909,7 @@ def e(self, i):
909909
# If m_index == 0 then M >=1 guarantees this
910910
######################################################################
911911

912-
if ( (not finite_cartan_type or i!=0) and m_index < len(gi)-1 # alpha_i is a simple root
912+
if ( (not finite_cartan_type or i != 0) and m_index < len(gi)-1 # alpha_i is a simple root
913913
) or KR_test:
914914

915915
J.remove(positions[m_index])
@@ -1014,7 +1014,7 @@ def f(self, i):
10141014
positions, gi = self._gi(i)
10151015

10161016
m = max(gi)
1017-
m_index=gi.index(m)
1017+
m_index = gi.index(m)
10181018

10191019
if finite_cartan_type and i == 0:
10201020

@@ -1037,7 +1037,7 @@ def f(self, i):
10371037
#
10381038
# otherwise if m_index - 1 > 0 then (C2) is enough
10391039

1040-
if ( (not finite_cartan_type or i!=0) and M > 0 # alpha_i is a simple root
1040+
if ( (not finite_cartan_type or i != 0) and M > 0 # alpha_i is a simple root
10411041
) or KR_test :# KR case
10421042

10431043
J.append(positions[m_index-1])
@@ -1573,7 +1573,7 @@ def lambda_chain(self):
15731573
if not self._root_lattice.cartan_type().is_finite():
15741574
raise ValueError("Cartan type {0} is not finite".format(self._root_lattice.cartan_type()))
15751575

1576-
l=[]
1576+
l = []
15771577
for i in self._root_lattice.positive_roots():
15781578
for j in range(self._max_height(i)):
15791579
l.append(self(i,j))
@@ -1654,7 +1654,7 @@ def __init__(self, parent, root, height):
16541654
# roots
16551655

16561656
if not 0 <= height < max_height:
1657-
raise ValueError("%d out of allowed range [%d,%d)"%(height, 0, max_height))
1657+
raise ValueError("%d out of allowed range [%d,%d)" % (height, 0, max_height))
16581658

16591659
v = [height/max_height]
16601660
v.extend( [ x/max_height for x in root.associated_coroot().to_vector() ] )

src/sage/combinat/crystals/fast_crystals.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,14 @@ def __init__(self, ct, shape, format):
168168

169169
self._rootoperators.append([e1,f1,e2,f2])
170170

171-
if int(2*l1)%2 == 0:
172-
l1_str = "%d"%l1
173-
l2_str = "%d"%l2
171+
if int(2*l1) % 2 == 0:
172+
l1_str = "%d" % l1
173+
l2_str = "%d" % l2
174174
else:
175-
assert self._cartan_type[0] == 'B' and int(2*l2)%2 == 1
176-
l1_str = "%d/2"%int(2*l1)
177-
l2_str = "%d/2"%int(2*l2)
178-
self.rename("The fast crystal for %s2 with shape [%s,%s]"%(ct[0],l1_str,l2_str))
175+
assert self._cartan_type[0] == 'B' and int(2*l2) % 2 == 1
176+
l1_str = "%d/2" % int(2*l1)
177+
l2_str = "%d/2" % int(2*l2)
178+
self.rename("The fast crystal for %s2 with shape [%s,%s]" % (ct[0],l1_str,l2_str))
179179
self.module_generators = [self(0)]
180180
# self._digraph = ClassicalCrystal.digraph(self)
181181
self._digraph = super().digraph()

src/sage/combinat/crystals/fully_commutative_stable_grothendieck.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def __classcall_private__(cls, w, factors, excess):
358358
if isinstance(w.parent(), SymmetricGroup):
359359
H = HeckeMonoid(w.parent())
360360
w = H.from_reduced_word(w.reduced_word())
361-
if (not w.reduced_word()) and excess!=0:
361+
if (not w.reduced_word()) and excess != 0:
362362
raise ValueError("excess must be 0 for the empty word")
363363
return super().__classcall__(cls, w, factors, excess)
364364

@@ -504,7 +504,7 @@ def __classcall_private__(cls, w, factors, excess, shape=False):
504504
if shape:
505505
from sage.combinat.partition import _Partitions
506506
from sage.combinat.skew_partition import SkewPartition
507-
cond1 = isinstance(w, (tuple, list)) and len(w)==2 and w[0] in _Partitions and w[1] in _Partitions
507+
cond1 = isinstance(w, (tuple, list)) and len(w) == 2 and w[0] in _Partitions and w[1] in _Partitions
508508
cond2 = isinstance(w, SkewPartition)
509509
if cond1 or cond2:
510510
sh = SkewPartition([w[0], w[1]])
@@ -520,7 +520,7 @@ def __classcall_private__(cls, w, factors, excess, shape=False):
520520
if isinstance(w.parent(), SymmetricGroup):
521521
H = HeckeMonoid(w.parent())
522522
w = H.from_reduced_word(w.reduced_word())
523-
if (not w.reduced_word()) and excess!=0:
523+
if (not w.reduced_word()) and excess != 0:
524524
raise ValueError("excess must be 0 for the empty word")
525525
return super().__classcall__(cls, w, factors, excess)
526526

@@ -733,7 +733,7 @@ def bracketing(self, i):
733733
while left_n:
734734
m = max(left_n)
735735
left_n.remove(m)
736-
l = [j for j in right_n if j>=m]
736+
l = [j for j in right_n if j >= m]
737737
if l:
738738
right_n.remove(min(l))
739739
else:
@@ -882,7 +882,7 @@ def _generate_decreasing_hecke_factorizations(w, factors, ex, weight=None, paren
882882
for word in L:
883883
F = _list_all_decreasing_runs(word, factors)
884884
for f in F:
885-
t = [[word[j] for j in range(len(word)) if f[j]==i] for i in range(factors, 0, -1)]
885+
t = [[word[j] for j in range(len(word)) if f[j] == i] for i in range(factors, 0, -1)]
886886
if weight is None or weight == wt(t):
887887
Factors.append(parent.element_class(parent, t))
888888
return sorted(Factors, reverse=True)
@@ -1020,7 +1020,7 @@ def _jumps(w):
10201020
sage: _jumps(w)
10211021
[2, 4, 8, 10]
10221022
"""
1023-
return [i+1 for i in range(len(w)-1) if w[i]<=w[i+1]]
1023+
return [i+1 for i in range(len(w)-1) if w[i] <= w[i+1]]
10241024

10251025

10261026
def _is_valid_column_word(w, m=None):

src/sage/combinat/crystals/generalized_young_walls.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,9 @@ def number_of_parts(self):
392392
r = new[i]
393393
if r == [] or r in new[i+1:]:
394394
new.pop(i)
395-
elif r[0] == n and len(r)%(n+1) == 0:
395+
elif r[0] == n and len(r) % (n+1) == 0:
396396
for j in range(n+1):
397-
temp = [k%(n+1) for k in range(j+len(r)/(n+1)-1,j-1,-1)]
397+
temp = [k % (n+1) for k in range(j+len(r)/(n+1)-1,j-1,-1)]
398398
if temp not in new:
399399
new.insert(i+1, temp)
400400
new.pop(i)
@@ -425,7 +425,7 @@ def sum_of_weighted_row_lengths(self):
425425
15
426426
"""
427427
n = self.parent().cartan_type().rank() - 1
428-
m = lambda i: len([1 for r in self.data if r and r[0] == (i-1)%(n+1)])
428+
m = lambda i: len([1 for r in self.data if r and r[0] == (i-1) % (n+1)])
429429
for r in self.data:
430430
if r and r[0] == n:
431431
raise ValueError('Statistic only valid for generalized Young walls in Y_0')

0 commit comments

Comments
 (0)