Skip to content

Commit e252233

Browse files
committed
using mute variables in combinat
1 parent aa220c4 commit e252233

18 files changed

+49
-48
lines changed

src/sage/combinat/affine_permutation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ def maximal_cyclic_factor(self, typ='decreasing', side='right', verbose=False):
706706
y = self.clone().apply_simple_reflection(i,side)
707707
T = [i]
708708
j = i
709-
for count in range(1, self.k):
709+
for _ in range(1, self.k):
710710
if (typ[0],side[0]) == ('d', 'r'):
711711
j=(j+1)%(k+1)
712712
if (typ[0],side[0]) == ('i', 'r'):

src/sage/combinat/bijectionist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2174,7 +2174,7 @@ def _preprocess_intertwining_relations(self):
21742174
A = self._A
21752175
P = self._P
21762176
images = defaultdict(set) # A^k -> A, a_1,...,a_k +-> {pi(a_1,...,a_k) for all pi}
2177-
for composition_index, pi_rho in enumerate(self._pi_rho):
2177+
for pi_rho in self._pi_rho:
21782178
for a_tuple in itertools.product(*([A]*pi_rho.numargs)):
21792179
if pi_rho.domain is not None and not pi_rho.domain(*a_tuple):
21802180
continue

src/sage/combinat/binary_recurrence_sequences.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ def __init__(self, b, c, u0=0, u1=1):
126126
self.c = c
127127
self.u0 = u0
128128
self.u1 = u1
129-
self._period_dict = {} #dictionary to cache the period of a sequence for future lookup
130-
self._PGoodness = {} #dictionary to cache primes that are "good" by some prime power
131-
self._ell = 1 #variable that keeps track of the last prime power to be used as a goodness
129+
self._period_dict = {} # dictionary to cache the period of a sequence for future lookup
130+
self._PGoodness = {} # dictionary to cache primes that are "good" by some prime power
131+
self._ell = 1 # variable that keeps track of the last prime power to be used as a goodness
132132

133133
def __repr__(self):
134134
"""
@@ -468,7 +468,7 @@ def period(self, m):
468468
#expand the list of prime factors so every factor is with multiplicity 1
469469

470470
for i0, i1 in Mfac:
471-
for j in range(i1):
471+
for _ in range(i1):
472472
C.append(i0)
473473

474474
Mfac = C
@@ -646,10 +646,10 @@ def pthpowers(self, p, Bound):
646646

647647
F = GF(ell)
648648
a0 = F(self.u0)
649-
a1 = F(self.u1) #a0 and a1 are variables for terms in sequence
649+
a1 = F(self.u1) # a0 and a1 are variables for terms in sequence
650650
bf, cf = F(self.b), F(self.c)
651651

652-
for n in range(Bound): # n is the index of the a0
652+
for n in range(Bound): # n is the index of the a0
653653

654654
#Check whether a0 is a perfect power mod ell
655655
if _is_p_power_mod(a0, p, ell):

src/sage/combinat/e_one_star.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1508,7 +1508,7 @@ def __call__(self, patch, iterations=1) -> Patch:
15081508
raise ValueError("iterations (=%s) must be >= 0" % iterations)
15091509
else:
15101510
old_faces = patch
1511-
for i in range(iterations):
1511+
for _ in range(iterations):
15121512
new_faces = []
15131513
for f in old_faces:
15141514
new_faces.extend(self._call_on_face(f, color=f.color()))

src/sage/combinat/finite_state_machine.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5754,7 +5754,7 @@ def is_deterministic(self):
57545754
state.transitions,
57555755
key=lambda t: t.word_in)
57565756

5757-
for key, transition_class in transition_classes_by_word_in:
5757+
for _, transition_class in transition_classes_by_word_in:
57585758
if len(transition_class) > 1:
57595759
return False
57605760
return True
@@ -6446,14 +6446,14 @@ def _iter_process_simple_(self, iterator):
64466446
"'simple' iterator cannot be used "
64476447
"here." %
64486448
(len(current),))
6449-
pos, states = next(iter(current.items()))
6449+
_, states = next(iter(current.items()))
64506450
if len(states) > 1:
64516451
raise RuntimeError("Process has branched "
64526452
"(visiting %s states in branch). The "
64536453
"'simple' iterator cannot be used "
64546454
"here." %
64556455
(len(states),))
6456-
state, branch = next(iter(states.items()))
6456+
_, branch = next(iter(states.items()))
64576457
if len(branch.outputs) > 1:
64586458
raise RuntimeError("Process has branched. "
64596459
"(%s different outputs in branch). The "
@@ -8216,7 +8216,7 @@ def function(transition1, transition2):
82168216
for state_result in result.iter_states():
82178217
state = state_result.label()[0]
82188218
if state.is_final:
8219-
accept, state_to, output = self.process(
8219+
accept, _, output = self.process(
82208220
state.final_word_out,
82218221
initial_state=self.state(state_result.label()[1]))
82228222
if not accept:
@@ -11809,7 +11809,7 @@ def _process_convert_output_(self, output_data, **kwargs):
1180911809
if kwargs['always_include_output']:
1181011810
return super()._process_convert_output_(
1181111811
output_data, **kwargs)
11812-
accept_input, current_state, output = output_data
11812+
accept_input, current_state, _ = output_data
1181311813
if kwargs['full_output']:
1181411814
return (accept_input, current_state)
1181511815
else:
@@ -13769,8 +13769,8 @@ def compare_to_tape(self, track_number, word):
1376913769
next(it_word)
1377013770

1377113771
# check letters not already cached
13772-
for letter_in_word in it_word:
13773-
successful, letter_on_track = self.read(track_number)
13772+
for _ in it_word:
13773+
successful, _ = self.read(track_number)
1377413774
if not successful:
1377513775
return False
1377613776
return True

src/sage/combinat/free_module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ def change_ring(self, R):
503503
return self
504504
construction = self.construction()
505505
if construction is not None:
506-
functor, arg = construction
506+
functor, _ = construction
507507
from sage.categories.pushout import VectorFunctor
508508
if isinstance(functor, VectorFunctor):
509509
return functor(R)

src/sage/combinat/fully_commutative_elements.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,13 +607,13 @@ def _still_reduced_fc_after_prepending(self, s):
607607

608608
# Find the first letter in that doesn't commute with s.
609609
try:
610-
(j, t) = next((i, x) for (i, x) in enumerate(self) if m[s, x] >= 3)
610+
j, t = next((i, x) for i, x in enumerate(self) if m[s, x] >= 3)
611611
except StopIteration:
612612
return True
613613

614614
u = self.clone()
615615
u._set_list(self[j:])
616-
x, y = u.coset_decomposition({s, t})
616+
x, _ = u.coset_decomposition({s, t})
617617
return len(x) != m[s, t] - 1
618618

619619
###########################################################################

src/sage/combinat/interval_posets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ def plot(self, **kwds):
450450
c1 = 'red' # self.latex_options()["color_decreasing"]
451451
G = self.poset().hasse_diagram()
452452
G.set_pos(self._find_node_positions())
453-
for a, b, c in G.edges(sort=False):
453+
for a, b in G.edges(sort=False, labels=False):
454454
if a < b:
455455
G.set_edge_label(a, b, 0)
456456
else:

src/sage/combinat/knutson_tao_puzzles.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ def is_completed(self):
11951195
sage: puzzle.is_completed()
11961196
True
11971197
"""
1198-
(i, j) = self.kink_coordinates()
1198+
i, _ = self.kink_coordinates()
11991199
return i == self._n + 1
12001200

12011201
def south_labels(self):
@@ -1225,7 +1225,7 @@ def add_piece(self, piece):
12251225
sage: P.add_piece(piece); P
12261226
{(1, 4): 1/0\0}
12271227
"""
1228-
(i, j) = self.kink_coordinates()
1228+
i, j = self.kink_coordinates()
12291229
self._squares[i, j] = piece
12301230
if isinstance(piece, DeltaPiece):
12311231
i += 1
@@ -1253,7 +1253,7 @@ def add_pieces(self, pieces):
12531253
sage: P
12541254
{(1, 4): 1/0\0, (2, 4): 1/0\0}
12551255
"""
1256-
(i, j) = self.kink_coordinates()
1256+
i, j = self.kink_coordinates()
12571257
for piece in pieces:
12581258
self._squares[i, j] = piece
12591259
if isinstance(piece, DeltaPiece):
@@ -2178,7 +2178,7 @@ def _fill_puzzle_by_strips(self, lamda, mu):
21782178
queue = [PuzzleFilling(lamda, mu)]
21792179
while queue:
21802180
PP = queue.pop()
2181-
(i, j) = PP.kink_coordinates()
2181+
i, _ = PP.kink_coordinates()
21822182

21832183
# grab nw labels
21842184
if i == 1:

src/sage/combinat/partition_kleshchev.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ def e(self, i):
994994
cell = self.good_cells(i)
995995
if cell is None:
996996
return None
997-
r,c = cell
997+
r, _ = cell
998998
mu = list(self)
999999
mu[r] -= 1
10001000
return type(self)(P, mu)
@@ -1055,7 +1055,7 @@ def e(self, i):
10551055
cell = self.good_cells(i)
10561056
if cell is None:
10571057
return None
1058-
k,r,c = cell
1058+
k, r, _ = cell
10591059
mu = self.to_list()
10601060
mu[k][r] -= 1
10611061
return type(self)(P, mu)
@@ -1938,7 +1938,7 @@ def _is_regular(kpt, multicharge, convention):
19381938
convention = convention[0] + 'G'
19391939
cell = _a_good_cell(kpt, multicharge, convention)
19401940
while cell is not None:
1941-
k,r,c = cell
1941+
k, r, _ = cell
19421942
if kpt[k][r] == 1:
19431943
kpt[k].pop()
19441944
else:
@@ -1964,15 +1964,15 @@ def _is_restricted(kpt, multicharge, convention):
19641964
sage: _is_restricted([[], []], [I3(0),I3(2)], 'RG')
19651965
True
19661966
"""
1967-
if all(part == [] for part in kpt):
1967+
if all(not part for part in kpt):
19681968
return True
19691969
convention = convention[0] + 'S'
19701970
cell = _a_good_cell(kpt, multicharge, convention)
19711971
while cell is not None:
1972-
k,r,c = cell
1972+
k, r, _ = cell
19731973
if kpt[k][r] == 1:
19741974
kpt[k].pop()
19751975
else:
19761976
kpt[k][r] -= 1
19771977
cell = _a_good_cell(kpt, multicharge, convention)
1978-
return all(part == [] for part in kpt)
1978+
return all(not part for part in kpt)

0 commit comments

Comments
 (0)