Skip to content

Commit b95f344

Browse files
committed
typing and details in tableaux files
1 parent dc99dc8 commit b95f344

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

src/sage/combinat/skew_tableau.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ def weight(self):
620620

621621
evaluation = weight
622622

623-
def is_standard(self):
623+
def is_standard(self) -> bool:
624624
"""
625625
Return ``True`` if ``self`` is a standard skew tableau and ``False``
626626
otherwise.
@@ -640,7 +640,7 @@ def is_standard(self):
640640
w = [i for row in self for i in row if i is not None]
641641
return sorted(w) == list(range(1, len(w) + 1)) and self.is_semistandard()
642642

643-
def is_semistandard(self):
643+
def is_semistandard(self) -> bool:
644644
"""
645645
Return ``True`` if ``self`` is a semistandard skew tableau and
646646
``False`` otherwise.
@@ -1324,7 +1324,7 @@ def shuffle(self, t2):
13241324
corner = self.cells_containing(i)[0]
13251325

13261326
# slide t2_new backwards, record i in the vacated square
1327-
(t2_new, (x, y)) = t2_new.slide(corner, True)
1327+
t2_new, (x, y) = t2_new.slide(corner, True)
13281328
t1_new[x][y] = i
13291329

13301330
t1_new = SkewTableau(t1_new)
@@ -1582,10 +1582,12 @@ def to_expr(self):
15821582
rows.reverse()
15831583
return [self.inner_shape(), rows]
15841584

1585-
def is_ribbon(self):
1585+
def is_ribbon(self) -> bool:
15861586
r"""
15871587
Return ``True`` if and only if the shape of ``self`` is a
1588-
ribbon, that is, if it has exactly one cell in each of `q`
1588+
ribbon.
1589+
1590+
This means that it has exactly one cell in each of `q`
15891591
consecutive diagonals for some nonnegative integer `q`.
15901592
15911593
EXAMPLES::
@@ -1824,7 +1826,7 @@ def cells_containing(self, i):
18241826
cell_list.append((r, c))
18251827
return cell_list
18261828

1827-
def is_k_tableau(self, k):
1829+
def is_k_tableau(self, k) -> bool:
18281830
r"""
18291831
Check whether ``self`` is a valid skew weak `k`-tableau.
18301832
@@ -1857,11 +1859,9 @@ def _label_skew(list_of_cells, sk):
18571859
sage: skew_tableau._label_skew(l, empty)
18581860
[[1, 4], [3, 2]]
18591861
"""
1860-
i = 1
18611862
skew = [list(row) for row in sk]
1862-
for row, column in list_of_cells:
1863+
for i, (row, column) in enumerate(list_of_cells, start=1):
18631864
skew[row][column] = i
1864-
i += 1
18651865
return skew
18661866

18671867

src/sage/combinat/tableau.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,7 +1694,7 @@ def weight(self):
16941694

16951695
evaluation = weight
16961696

1697-
def is_row_strict(self):
1697+
def is_row_strict(self) -> bool:
16981698
"""
16991699
Return ``True`` if ``self`` is a row strict tableau and ``False``
17001700
otherwise.
@@ -1715,7 +1715,7 @@ def is_row_strict(self):
17151715
"""
17161716
return all(row[i] < row[i+1] for row in self for i in range(len(row)-1))
17171717

1718-
def is_row_increasing(self, weak=False):
1718+
def is_row_increasing(self, weak=False) -> bool:
17191719
r"""
17201720
Return ``True`` if the entries in each row are in increasing order,
17211721
and ``False`` otherwise.
@@ -1741,7 +1741,7 @@ def test(a, b):
17411741
return a < b
17421742
return all(test(a, b) for row in self for (a, b) in zip(row, row[1:]))
17431743

1744-
def is_column_increasing(self, weak=False):
1744+
def is_column_increasing(self, weak=False) -> bool:
17451745
r"""
17461746
Return ``True`` if the entries in each column are in increasing order,
17471747
and ``False`` otherwise.
@@ -1770,7 +1770,7 @@ def tworow(a, b):
17701770
return all(test(a[i], b_i) for i, b_i in enumerate(b))
17711771
return all(tworow(self[r], self[r + 1]) for r in range(len(self) - 1))
17721772

1773-
def is_column_strict(self):
1773+
def is_column_strict(self) -> bool:
17741774
"""
17751775
Return ``True`` if ``self`` is a column strict tableau and ``False``
17761776
otherwise.
@@ -1801,7 +1801,7 @@ def tworow(a, b):
18011801
return all(a[i] < b_i for i, b_i in enumerate(b))
18021802
return all(tworow(self[r], self[r+1]) for r in range(len(self)-1))
18031803

1804-
def is_semistandard(self):
1804+
def is_semistandard(self) -> bool:
18051805
r"""
18061806
Return ``True`` if ``self`` is a semistandard tableau, and ``False``
18071807
otherwise.
@@ -1824,7 +1824,7 @@ def is_semistandard(self):
18241824
"""
18251825
return self.is_row_increasing(weak=True) and self.is_column_increasing()
18261826

1827-
def is_standard(self):
1827+
def is_standard(self) -> bool:
18281828
"""
18291829
Return ``True`` if ``self`` is a standard tableau and ``False``
18301830
otherwise.
@@ -1843,7 +1843,7 @@ def is_standard(self):
18431843
entries = sorted(self.entries())
18441844
return entries == list(range(1, self.size() + 1)) and self.is_row_strict() and self.is_column_strict()
18451845

1846-
def is_increasing(self):
1846+
def is_increasing(self) -> bool:
18471847
"""
18481848
Return ``True`` if ``self`` is an increasing tableau and
18491849
``False`` otherwise.
@@ -1865,7 +1865,7 @@ def is_increasing(self):
18651865
"""
18661866
return self.is_row_strict() and self.is_column_strict()
18671867

1868-
def is_rectangular(self):
1868+
def is_rectangular(self) -> bool:
18691869
"""
18701870
Return ``True`` if the tableau ``self`` is rectangular and
18711871
``False`` otherwise.
@@ -2067,7 +2067,7 @@ def k_weight(self, k):
20672067

20682068
return res
20692069

2070-
def is_k_tableau(self, k):
2070+
def is_k_tableau(self, k) -> bool:
20712071
r"""
20722072
Check whether ``self`` is a valid weak `k`-tableau.
20732073
@@ -2518,7 +2518,7 @@ def reverse_bump(self, loc):
25182518
if not (self.is_semistandard()):
25192519
raise ValueError("reverse bumping is only defined for semistandard tableaux")
25202520
try:
2521-
(r, c) = loc
2521+
r, c = loc
25222522
if (r, c) not in self.corners():
25232523
raise ValueError("invalid corner")
25242524
except TypeError:
@@ -3177,7 +3177,7 @@ def add_entry(self, cell, m):
31773177
IndexError: (2, 2) is not an addable cell of the tableau
31783178
"""
31793179
tab = self.to_list()
3180-
(r, c) = cell
3180+
r, c = cell
31813181
try:
31823182
tab[r][c] = m # will work if we are replacing an entry
31833183
except IndexError:
@@ -3616,7 +3616,7 @@ def symmetric_group_action_on_entries(self, w):
36163616
except Exception:
36173617
return Tableau([[w[entry-1] for entry in row] for row in self])
36183618

3619-
def is_key_tableau(self):
3619+
def is_key_tableau(self) -> bool:
36203620
r"""
36213621
Return ``True`` if ``self`` is a key tableau or ``False`` otherwise.
36223622
@@ -4788,7 +4788,7 @@ def dominates(self, t):
47884788
return all(self.restrict(m).shape().dominates(t.restrict(m).shape())
47894789
for m in range(1, 1 + self.size()))
47904790

4791-
def is_standard(self):
4791+
def is_standard(self) -> bool:
47924792
"""
47934793
Return ``True`` since ``self`` is a standard tableau.
47944794

src/sage/combinat/tableau_tuple.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ def entry(self, l, r, c):
823823
"""
824824
return self[l][r][c]
825825

826-
def is_row_strict(self):
826+
def is_row_strict(self) -> bool:
827827
"""
828828
Return ``True`` if the tableau ``self`` is row strict and ``False``
829829
otherwise.
@@ -874,7 +874,7 @@ def first_row_descent(self):
874874
return (k, cell[0], cell[1])
875875
return None
876876

877-
def is_column_strict(self):
877+
def is_column_strict(self) -> bool:
878878
"""
879879
Return ``True`` if the tableau ``self`` is column strict and ``False``
880880
otherwise.
@@ -925,7 +925,7 @@ def first_column_descent(self):
925925
return (k, cell[0], cell[1])
926926
return None
927927

928-
def is_standard(self):
928+
def is_standard(self) -> bool:
929929
r"""
930930
Return ``True`` if the tableau ``self`` is a standard tableau and
931931
``False`` otherwise.
@@ -1173,7 +1173,7 @@ def add_entry(self, cell, m):
11731173
...
11741174
IndexError: (2, 1, 2) is not an addable cell of the tableau
11751175
"""
1176-
(k, r, c) = cell
1176+
k, r, c = cell
11771177
tab = self.to_list()
11781178

11791179
try:
@@ -5017,7 +5017,7 @@ def random_element(self):
50175017
while m < mu.size():
50185018
m += 1
50195019
i = randint(0, len(addables) - 1) # index for a random addable cell
5020-
(k, r, c) = addables[i] # the actual cell
5020+
k, r, c = addables[i] # the actual cell
50215021
# remove the cell we just added from the list addable nodes
50225022
addables.pop(i)
50235023
# add m into the tableau
@@ -5336,7 +5336,7 @@ def _add_entry_fast(T, cell, m):
53365336
6 8 12 14 2 11
53375337
10
53385338
"""
5339-
(k, r, c) = cell
5339+
k, r, c = cell
53405340
tab = T.to_list()
53415341

53425342
try:

0 commit comments

Comments
 (0)