Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/sage/categories/crystals.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
sage: check_tkz_graph() # random
"""

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

import collections.abc

Expand Down Expand Up @@ -1075,17 +1075,17 @@ def metapost(self, filename, thicklines=False, labels=True, scaling_factor=1.0,
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))
for i in range(size):
if self.cartan_type()[0] == 'A':
[a1,a2,a3] = string_data[i]
a1, a2, a3 = string_data[i]
else:
[a1,a2,a3,a4] = string_data[i]
a1, a2, a3, a4 = string_data[i]
shift = 0
for j in range(i):
if self.cartan_type()[0] == 'A':
[b1,b2,b3] = string_data[j]
b1, b2, b3 = string_data[j]
if b1+b3 == a1+a3 and b2 == a2:
shift += 1
else:
[b1,b2,b3,b4] = string_data[j]
b1, b2, b3, b4 = string_data[j]
if b1+b3 == a1+a3 and b2+b4 == a2+a4:
shift += 1
if self.cartan_type()[0] == 'A':
Expand All @@ -1105,10 +1105,10 @@ def metapost(self, filename, thicklines=False, labels=True, scaling_factor=1.0,
else:
col = "green; "
if self.cartan_type()[0] == 'A':
[a1,a2,a3] = string_data[i] # included to facilitate hand editing of the .mp file
a1, a2, a3 = string_data[i] # included to facilitate hand editing of the .mp file
outstring = outstring+"draw z%d--z%d withcolor %s %% %d %d %d\n" % (i,dest,col,a1,a2,a3)
else:
[a1,a2,a3,a4] = string_data[i]
a1, a2, a3, a4 = string_data[i]
outstring = outstring+"draw z%d--z%d withcolor %s %% %d %d %d %d\n" % (i,dest,col,a1,a2,a3,a4)
outstring += "\npickup pencircle scaled 3;\n\n"
for i in range(self.cardinality()):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/finite_state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -11258,7 +11258,7 @@ def is_equivalent(self, other):
False
"""
A = self.minimization().relabeled()
[initial] = A.initial_states()
initial, = A.initial_states()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure it's the correct syntax ?

sage: a, = [2, 3]
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[1], line 1
----> 1 a, = [Integer(2), Integer(3)]

ValueError: too many values to unpack (expected 1)
sage: a, *_ = [2, 3]
sage: a
2
sage: a, *_ = [2, 3, 4]
sage: a
2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it works to unpack a list or tuple with one element
sage: moulinsart, = [421]

address = {initial: ()}
for v in A.digraph().breadth_first_search(initial.label()):
state = A.state(v)
Expand Down
20 changes: 10 additions & 10 deletions src/sage/combinat/root_system/branching_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ def rule(x):
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")
elif Rtype == CartanType("E6") and Stype == CartanType("C4"):
def f(x):
[x0, x1, x2, x3, x4, x5] = x[:6]
x0, x1, x2, x3, x4, x5 = x[:6]
return [(x0+x1+x2+x3+x4-3*x5)/2,
(-x0-x1-x2-x3+x4-3*x5)/2,
-x0 + x3, -x1 + x2]
Expand Down Expand Up @@ -1712,12 +1712,12 @@ def br(x):
return BranchingRule(Rtype, Stype, lambda x: x, "isomorphic")
elif Rtype == CartanType("B2") and Stype == CartanType("C2"):
def rule(x):
[x1, x2] = x
x1, x2 = x
return [x1 + x2, x1 - x2]
return BranchingRule(Rtype, Stype, rule, "isomorphic")
elif Rtype == CartanType("C2") and Stype == CartanType("B2"):
def rule(x):
[x1, x2] = x
x1, x2 = x
return [(x1 + x2) / 2, (x1 - x2) / 2]
return BranchingRule(Rtype, Stype, rule, "isomorphic")
elif Rtype == CartanType("B1") and Stype == CartanType("A1"):
Expand All @@ -1730,18 +1730,18 @@ def rule(x):
return BranchingRule(Rtype, Stype, lambda x: [x[0]-x[1]], "isomorphic")
elif Rtype == CartanType("A3") and Stype == CartanType("D3"):
def rule(x):
[x1, x2, x3, x4] = x
x1, x2, x3, x4 = x
return [(x1+x2-x3-x4)/2, (x1-x2+x3-x4)/2, (x1-x2-x3+x4)/2]
return BranchingRule(Rtype, Stype, rule, "isomorphic")
elif Rtype == CartanType("D3") and Stype == CartanType("A3"):
def rule(x):
[t1, t2, t3] = x
t1, t2, t3 = x
return [(t1+t2+t3)/2, (t1-t2-t3)/2,
(-t1+t2-t3)/2, (-t1-t2+t3)/2]
return BranchingRule(Rtype, Stype, rule, "isomorphic")
elif Rtype == CartanType("D2") and Stype == CartanType("A1xA1"):
def rule(x):
[t1, t2] = x
t1, t2 = x
return [(t1-t2)/2, -(t1-t2)/2, (t1+t2)/2, -(t1+t2)/2]
return BranchingRule(Rtype, Stype, rule, "isomorphic")
else:
Expand All @@ -1759,7 +1759,7 @@ def rule(x):
nr = 2*Rtype[1]
else:
raise ValueError("Rule not found")
[s1, s2] = [stypes[i][1] for i in range(2)]
s1, s2 = [stypes[i][1] for i in range(2)]
ns = [s1, s2]
for i in range(2):
if stypes[i][0] == 'A':
Expand Down Expand Up @@ -1860,14 +1860,14 @@ def rule(x):
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")
elif stypes == [CartanType("F4"), CartanType("A1")]:
def f(x):
[x0, x1, x2, x3, x4, x5, x6] = x[:7]
x0, x1, x2, x3, x4, x5, x6 = x[:7]
return [(x4-x5)/2-x6, (x0+x1+x2+x3)/2,
(-x0-x1+x2+x3)/2, (-x0+x1-x2+x3)/2,
x5-x6, x6-x5]
return BranchingRule(Rtype, Stype, f, "miscellaneous")
elif stypes == [CartanType("A1"), CartanType("F4")]:
def f(x):
[x0, x1, x2, x3, x4, x5, x6] = x[:7]
x0, x1, x2, x3, x4, x5, x6 = x[:7]
return [x5-x6, x6-x5, (x4-x5)/2-x6,
(x0+x1+x2+x3)/2,
(-x0-x1+x2+x3)/2,
Expand Down Expand Up @@ -2289,7 +2289,7 @@ def maximal_subgroups(ct, mode='print_rules'):
elif mode == "get_rule":
d = {}
for line in rul:
[k, br] = line.split(":")
k, br = line.split(":")
br = eval(br)
if k in d:
if not isinstance(d[k], list):
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/root_system/dynkin_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,8 @@ def __getitem__(self, i):
[[2], [1, 3], [2, 4], [3]]
"""
if not isinstance(i, tuple):
return DiGraph.__getitem__(self,i)
[i,j] = i
return DiGraph.__getitem__(self, i)
i, j = i
if i == j:
if i in self._odd_isotropic_roots:
return 0
Expand Down
8 changes: 4 additions & 4 deletions src/sage/combinat/root_system/pieri_factors.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,12 +699,12 @@ def __contains__(self, w):
return False

if not (self._min_length <= len(support) and
len(support) <= self._max_length and
self._min_support.issubset(support) and
support.issubset(self._max_support)):
len(support) <= self._max_length and
self._min_support.issubset(support) and
support.issubset(self._max_support)):
return False

[rank, unrank] = sage.combinat.ranker.from_list(red)
rank, unrank = sage.combinat.ranker.from_list(red)
for i in red:
j = (i + 1) % (n + 1)
if j in support:
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/root_system/weyl_characters.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ def _product_helper(self, d1, b):
"""
d = {}
for k in d1:
[epsilon, g] = self.dot_reduce(b + k)
epsilon, g = self.dot_reduce(b + k)
if epsilon == 1:
d[g] = d.get(g, 0) + d1[k]
elif epsilon == -1:
Expand Down Expand Up @@ -566,7 +566,7 @@ def dot_reduce(self, a):
"""
alphacheck = self._space.simple_coroots()
alpha = self._space.simple_roots()
[epsilon, ret] = [1, a]
epsilon, ret = [1, a]
done = False
while not done:
done = True
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/symmetric_group_representations.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ def representation_matrix_for_simple_transposition(self, i):
M = matrix(self._ring, digraph.num_verts())
for g in digraph.connected_components_subgraphs():
if g.num_verts() == 1:
[v] = g.vertices(sort=True)
v, = g.vertices(sort=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question here. may be you can use v = g.vertices(sort=True)[0]

w = self._word_dict[v]
trivial = None
for j, a in enumerate(w):
Expand All @@ -693,7 +693,7 @@ def representation_matrix_for_simple_transposition(self, i):
j = index_lookup[v]
M[j, j] = 1 if trivial is True else -1
else:
[(u, v, (j, beta))] = g.edges(sort=True)
(u, v, (j, beta)), = g.edges(sort=True)
iu = index_lookup[u]
iv = index_lookup[v]
M[iu, iu], M[iu, iv], M[iv, iu], M[iv, iv] = \
Expand Down
4 changes: 2 additions & 2 deletions src/sage/graphs/connectivity.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1585,7 +1585,7 @@ def edge_connectivity(G,
if implementation == "boost":
from sage.graphs.base.boost_graph import edge_connectivity

[obj, edges] = edge_connectivity(g)
obj, edges = edge_connectivity(g)

if value_only:
return obj
Expand Down Expand Up @@ -2460,7 +2460,7 @@ def bridges(G, labels=True):
if len(b) == 2 and not tuple(b) in ME:
if labels:
if multiple_edges:
[label] = G.edge_label(b[0], b[1])
label, = G.edge_label(b[0], b[1])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here again

else:
label = G.edge_label(b[0], b[1])
yield (b[0], b[1], label)
Expand Down
4 changes: 2 additions & 2 deletions src/sage/graphs/generators/families.py
Original file line number Diff line number Diff line change
Expand Up @@ -4352,7 +4352,7 @@ def MuzychukS6Graph(n, d, Phi='fixed', Sigma='fixed', verbose=False):
if Sigma == 'random':
for x in range(m):
for line in L_i[x]:
[i, j] = line
i, j = line
temp = phi[(j, line)][:]
for hyp in phi[(i, line)]:
rand = randrange(0, len(temp))
Expand All @@ -4362,7 +4362,7 @@ def MuzychukS6Graph(n, d, Phi='fixed', Sigma='fixed', verbose=False):
elif Sigma == 'fixed':
for x in range(m):
for line in L_i[x]:
[i, j] = line
i, j = line
temp = phi[(j, line)][:]
for hyp in phi[(i, line)]:
val = temp.pop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1548,7 +1548,7 @@ cdef class TreelengthConnected:
cdef frozenset reduced_cut

if len(cc) == 1:
[v] = cc
v, = cc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v = cc[0] ?

# We identify the neighbors of v in cut
reduced_cut = cut.intersection(g.neighbor_iterator(v))
# We can form a new bag with its closed neighborhood, and this
Expand Down
Loading
Loading