Skip to content

Commit d542c6a

Browse files
author
Release Manager
committed
gh-40747: fix some wrong syntax found using ` gg "^\s*\[[a-zA-Z0-9, ]*\] = " src/sage/ ` ### 📝 Checklist - [ ] The title is concise and informative. - [ ] The description explains in detail what this PR is about. URL: #40747 Reported by: Frédéric Chapoton Reviewer(s): David Coudert, Frédéric Chapoton
2 parents 89d0240 + 07ed645 commit d542c6a

File tree

12 files changed

+101
-101
lines changed

12 files changed

+101
-101
lines changed

src/sage/categories/crystals.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
sage: check_tkz_graph() # random
1212
"""
1313

14-
#*****************************************************************************
14+
# ***************************************************************************
1515
# Copyright (C) 2010 Anne Schilling <anne at math.ucdavis.edu>
1616
#
1717
# This program is free software: you can redistribute it and/or modify
1818
# it under the terms of the GNU General Public License as published by
1919
# the Free Software Foundation, either version 2 of the License, or
2020
# (at your option) any later version.
2121
# https://www.gnu.org/licenses/
22-
#*****************************************************************************
22+
# ***************************************************************************
2323

2424
import collections.abc
2525

@@ -1075,17 +1075,17 @@ def metapost(self, filename, thicklines=False, labels=True, scaling_factor=1.0,
10751075
outstring = "beginfig(-1);\n\nsx := %d;\nsy := %d;\n\nz1000=(2*sx,0);\nz1001=(-sx,sy);\nz1002=(-5,-5);\n\nz1003=(10,10);\n\n" % (int(scaling_factor*35),int(tallness*scaling_factor*35))
10761076
for i in range(size):
10771077
if self.cartan_type()[0] == 'A':
1078-
[a1,a2,a3] = string_data[i]
1078+
a1, a2, a3 = string_data[i]
10791079
else:
1080-
[a1,a2,a3,a4] = string_data[i]
1080+
a1, a2, a3, a4 = string_data[i]
10811081
shift = 0
10821082
for j in range(i):
10831083
if self.cartan_type()[0] == 'A':
1084-
[b1,b2,b3] = string_data[j]
1084+
b1, b2, b3 = string_data[j]
10851085
if b1+b3 == a1+a3 and b2 == a2:
10861086
shift += 1
10871087
else:
1088-
[b1,b2,b3,b4] = string_data[j]
1088+
b1, b2, b3, b4 = string_data[j]
10891089
if b1+b3 == a1+a3 and b2+b4 == a2+a4:
10901090
shift += 1
10911091
if self.cartan_type()[0] == 'A':
@@ -1105,10 +1105,10 @@ def metapost(self, filename, thicklines=False, labels=True, scaling_factor=1.0,
11051105
else:
11061106
col = "green; "
11071107
if self.cartan_type()[0] == 'A':
1108-
[a1,a2,a3] = string_data[i] # included to facilitate hand editing of the .mp file
1108+
a1, a2, a3 = string_data[i] # included to facilitate hand editing of the .mp file
11091109
outstring = outstring+"draw z%d--z%d withcolor %s %% %d %d %d\n" % (i,dest,col,a1,a2,a3)
11101110
else:
1111-
[a1,a2,a3,a4] = string_data[i]
1111+
a1, a2, a3, a4 = string_data[i]
11121112
outstring = outstring+"draw z%d--z%d withcolor %s %% %d %d %d %d\n" % (i,dest,col,a1,a2,a3,a4)
11131113
outstring += "\npickup pencircle scaled 3;\n\n"
11141114
for i in range(self.cardinality()):

src/sage/combinat/finite_state_machine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11258,7 +11258,7 @@ def is_equivalent(self, other):
1125811258
False
1125911259
"""
1126011260
A = self.minimization().relabeled()
11261-
[initial] = A.initial_states()
11261+
initial, = A.initial_states()
1126211262
address = {initial: ()}
1126311263
for v in A.digraph().breadth_first_search(initial.label()):
1126411264
state = A.state(v)

src/sage/combinat/root_system/branching_rules.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,7 @@ def rule(x):
15251525
return BranchingRule(Rtype, Stype, lambda x: [(x[4]-3*x[5])/2,(x[0]+x[1]+x[2]+x[3])/2,(-x[0]-x[1]+x[2]+x[3])/2,(-x[0]+x[1]-x[2]+x[3])/2], "symmetric")
15261526
elif Rtype == CartanType("E6") and Stype == CartanType("C4"):
15271527
def f(x):
1528-
[x0, x1, x2, x3, x4, x5] = x[:6]
1528+
x0, x1, x2, x3, x4, x5 = x[:6]
15291529
return [(x0+x1+x2+x3+x4-3*x5)/2,
15301530
(-x0-x1-x2-x3+x4-3*x5)/2,
15311531
-x0 + x3, -x1 + x2]
@@ -1712,12 +1712,12 @@ def br(x):
17121712
return BranchingRule(Rtype, Stype, lambda x: x, "isomorphic")
17131713
elif Rtype == CartanType("B2") and Stype == CartanType("C2"):
17141714
def rule(x):
1715-
[x1, x2] = x
1715+
x1, x2 = x
17161716
return [x1 + x2, x1 - x2]
17171717
return BranchingRule(Rtype, Stype, rule, "isomorphic")
17181718
elif Rtype == CartanType("C2") and Stype == CartanType("B2"):
17191719
def rule(x):
1720-
[x1, x2] = x
1720+
x1, x2 = x
17211721
return [(x1 + x2) / 2, (x1 - x2) / 2]
17221722
return BranchingRule(Rtype, Stype, rule, "isomorphic")
17231723
elif Rtype == CartanType("B1") and Stype == CartanType("A1"):
@@ -1730,18 +1730,18 @@ def rule(x):
17301730
return BranchingRule(Rtype, Stype, lambda x: [x[0]-x[1]], "isomorphic")
17311731
elif Rtype == CartanType("A3") and Stype == CartanType("D3"):
17321732
def rule(x):
1733-
[x1, x2, x3, x4] = x
1733+
x1, x2, x3, x4 = x
17341734
return [(x1+x2-x3-x4)/2, (x1-x2+x3-x4)/2, (x1-x2-x3+x4)/2]
17351735
return BranchingRule(Rtype, Stype, rule, "isomorphic")
17361736
elif Rtype == CartanType("D3") and Stype == CartanType("A3"):
17371737
def rule(x):
1738-
[t1, t2, t3] = x
1738+
t1, t2, t3 = x
17391739
return [(t1+t2+t3)/2, (t1-t2-t3)/2,
17401740
(-t1+t2-t3)/2, (-t1-t2+t3)/2]
17411741
return BranchingRule(Rtype, Stype, rule, "isomorphic")
17421742
elif Rtype == CartanType("D2") and Stype == CartanType("A1xA1"):
17431743
def rule(x):
1744-
[t1, t2] = x
1744+
t1, t2 = x
17451745
return [(t1-t2)/2, -(t1-t2)/2, (t1+t2)/2, -(t1+t2)/2]
17461746
return BranchingRule(Rtype, Stype, rule, "isomorphic")
17471747
else:
@@ -1759,7 +1759,7 @@ def rule(x):
17591759
nr = 2*Rtype[1]
17601760
else:
17611761
raise ValueError("Rule not found")
1762-
[s1, s2] = [stypes[i][1] for i in range(2)]
1762+
s1, s2 = [stypes[i][1] for i in range(2)]
17631763
ns = [s1, s2]
17641764
for i in range(2):
17651765
if stypes[i][0] == 'A':
@@ -1860,14 +1860,14 @@ def rule(x):
18601860
return BranchingRule(Rtype, Stype, lambda x: [x[1]+x[3],x[2]-x[3],-x[1]-x[2],-2*x[6],x[4]+x[5],-x[4]+x[5]], "miscellaneous")
18611861
elif stypes == [CartanType("F4"), CartanType("A1")]:
18621862
def f(x):
1863-
[x0, x1, x2, x3, x4, x5, x6] = x[:7]
1863+
x0, x1, x2, x3, x4, x5, x6 = x[:7]
18641864
return [(x4-x5)/2-x6, (x0+x1+x2+x3)/2,
18651865
(-x0-x1+x2+x3)/2, (-x0+x1-x2+x3)/2,
18661866
x5-x6, x6-x5]
18671867
return BranchingRule(Rtype, Stype, f, "miscellaneous")
18681868
elif stypes == [CartanType("A1"), CartanType("F4")]:
18691869
def f(x):
1870-
[x0, x1, x2, x3, x4, x5, x6] = x[:7]
1870+
x0, x1, x2, x3, x4, x5, x6 = x[:7]
18711871
return [x5-x6, x6-x5, (x4-x5)/2-x6,
18721872
(x0+x1+x2+x3)/2,
18731873
(-x0-x1+x2+x3)/2,
@@ -2289,7 +2289,7 @@ def maximal_subgroups(ct, mode='print_rules'):
22892289
elif mode == "get_rule":
22902290
d = {}
22912291
for line in rul:
2292-
[k, br] = line.split(":")
2292+
k, br = line.split(":")
22932293
br = eval(br)
22942294
if k in d:
22952295
if not isinstance(d[k], list):

src/sage/combinat/root_system/dynkin_diagram.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,8 @@ def __getitem__(self, i):
770770
[[2], [1, 3], [2, 4], [3]]
771771
"""
772772
if not isinstance(i, tuple):
773-
return DiGraph.__getitem__(self,i)
774-
[i,j] = i
773+
return DiGraph.__getitem__(self, i)
774+
i, j = i
775775
if i == j:
776776
if i in self._odd_isotropic_roots:
777777
return 0

src/sage/combinat/root_system/pieri_factors.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -699,12 +699,12 @@ def __contains__(self, w):
699699
return False
700700

701701
if not (self._min_length <= len(support) and
702-
len(support) <= self._max_length and
703-
self._min_support.issubset(support) and
704-
support.issubset(self._max_support)):
702+
len(support) <= self._max_length and
703+
self._min_support.issubset(support) and
704+
support.issubset(self._max_support)):
705705
return False
706706

707-
[rank, unrank] = sage.combinat.ranker.from_list(red)
707+
rank, unrank = sage.combinat.ranker.from_list(red)
708708
for i in red:
709709
j = (i + 1) % (n + 1)
710710
if j in support:

src/sage/combinat/root_system/weyl_characters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ def _product_helper(self, d1, b):
535535
"""
536536
d = {}
537537
for k in d1:
538-
[epsilon, g] = self.dot_reduce(b + k)
538+
epsilon, g = self.dot_reduce(b + k)
539539
if epsilon == 1:
540540
d[g] = d.get(g, 0) + d1[k]
541541
elif epsilon == -1:
@@ -566,7 +566,7 @@ def dot_reduce(self, a):
566566
"""
567567
alphacheck = self._space.simple_coroots()
568568
alpha = self._space.simple_roots()
569-
[epsilon, ret] = [1, a]
569+
epsilon, ret = [1, a]
570570
done = False
571571
while not done:
572572
done = True

src/sage/combinat/symmetric_group_representations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ def representation_matrix_for_simple_transposition(self, i):
680680
M = matrix(self._ring, digraph.num_verts())
681681
for g in digraph.connected_components_subgraphs():
682682
if g.num_verts() == 1:
683-
[v] = g.vertices(sort=True)
683+
v, = g.vertices(sort=True)
684684
w = self._word_dict[v]
685685
trivial = None
686686
for j, a in enumerate(w):
@@ -693,7 +693,7 @@ def representation_matrix_for_simple_transposition(self, i):
693693
j = index_lookup[v]
694694
M[j, j] = 1 if trivial is True else -1
695695
else:
696-
[(u, v, (j, beta))] = g.edges(sort=True)
696+
(u, v, (j, beta)), = g.edges(sort=True)
697697
iu = index_lookup[u]
698698
iv = index_lookup[v]
699699
M[iu, iu], M[iu, iv], M[iv, iu], M[iv, iv] = \

src/sage/graphs/connectivity.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,7 @@ def edge_connectivity(G,
15851585
if implementation == "boost":
15861586
from sage.graphs.base.boost_graph import edge_connectivity
15871587

1588-
[obj, edges] = edge_connectivity(g)
1588+
obj, edges = edge_connectivity(g)
15891589

15901590
if value_only:
15911591
return obj
@@ -2460,7 +2460,7 @@ def bridges(G, labels=True):
24602460
if len(b) == 2 and not tuple(b) in ME:
24612461
if labels:
24622462
if multiple_edges:
2463-
[label] = G.edge_label(b[0], b[1])
2463+
label, = G.edge_label(b[0], b[1])
24642464
else:
24652465
label = G.edge_label(b[0], b[1])
24662466
yield (b[0], b[1], label)

src/sage/graphs/generators/families.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4017,7 +4017,7 @@ def MuzychukS6Graph(n, d, Phi='fixed', Sigma='fixed', verbose=False):
40174017
if Sigma == 'random':
40184018
for x in range(m):
40194019
for line in L_i[x]:
4020-
[i, j] = line
4020+
i, j = line
40214021
temp = phi[(j, line)][:]
40224022
for hyp in phi[(i, line)]:
40234023
rand = randrange(0, len(temp))
@@ -4027,7 +4027,7 @@ def MuzychukS6Graph(n, d, Phi='fixed', Sigma='fixed', verbose=False):
40274027
elif Sigma == 'fixed':
40284028
for x in range(m):
40294029
for line in L_i[x]:
4030-
[i, j] = line
4030+
i, j = line
40314031
temp = phi[(j, line)][:]
40324032
for hyp in phi[(i, line)]:
40334033
val = temp.pop()

src/sage/graphs/graph_decompositions/tree_decomposition.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,7 @@ cdef class TreelengthConnected:
15481548
cdef frozenset reduced_cut
15491549

15501550
if len(cc) == 1:
1551-
[v] = cc
1551+
v, = cc
15521552
# We identify the neighbors of v in cut
15531553
reduced_cut = cut.intersection(g.neighbor_iterator(v))
15541554
# We can form a new bag with its closed neighborhood, and this

0 commit comments

Comments
 (0)