Skip to content

Commit 281be08

Browse files
author
Release Manager
committed
gh-36857: use unicode characters to display tables This is using unicode box-drawing characters to make better-looking tables. ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. ### ⌛ Dependencies - #36861 <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> URL: #36857 Reported by: Frédéric Chapoton Reviewer(s): Kwankyu Lee
2 parents 9b73d6c + d03c94c commit 281be08

File tree

5 files changed

+260
-248
lines changed

5 files changed

+260
-248
lines changed

src/doc/en/prep/Programming.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,13 @@ when doing some of our plotting and limits. What do you think will
379379
happen if you put dollar signs around the labels in the header? ::
380380

381381
sage: table( [('i', 'det(A^i)')] + [ (i,det(A^i)) for i in [0..4] ], header_row=True)
382-
i det(A^i)
383-
+---+----------+
384-
0 1
385-
1 -2
386-
2 4
387-
3 -8
388-
4 16
382+
i det(A^i)
383+
├───┼──────────┤
384+
0 1
385+
1 -2
386+
2 4
387+
3 -8
388+
4 16
389389

390390

391391
.. _Defs:

src/sage/combinat/bijectionist.py

Lines changed: 114 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -68,54 +68,54 @@
6868
sage: bij.set_statistics((len, len), (alpha1, beta1), (alpha2, beta2))
6969
sage: a, b = bij.statistics_table()
7070
sage: table(a, header_row=True, frame=True)
71-
+-----------+--------+--------+--------+
72-
| a | α_1(a) | α_2(a) | α_3(a) |
73-
+===========+========+========+========+
74-
| [] | 0 | 0 | 0 |
75-
+-----------+--------+--------+--------+
76-
| [1] | 1 | 1 | 1 |
77-
+-----------+--------+--------+--------+
78-
| [1, 2] | 2 | 2 | 2 |
79-
+-----------+--------+--------+--------+
80-
| [2, 1] | 2 | 1 | 0 |
81-
+-----------+--------+--------+--------+
82-
| [1, 2, 3] | 3 | 3 | 3 |
83-
+-----------+--------+--------+--------+
84-
| [1, 3, 2] | 3 | 2 | 1 |
85-
+-----------+--------+--------+--------+
86-
| [2, 1, 3] | 3 | 2 | 1 |
87-
+-----------+--------+--------+--------+
88-
| [2, 3, 1] | 3 | 2 | 0 |
89-
+-----------+--------+--------+--------+
90-
| [3, 1, 2] | 3 | 1 | 0 |
91-
+-----------+--------+--------+--------+
92-
| [3, 2, 1] | 3 | 2 | 1 |
93-
+-----------+--------+--------+--------+
71+
┌───────────┬────────┬────────┬────────┐
72+
a | α_1(a) | α_2(a) | α_3(a) |
73+
╞═══════════╪════════╪════════╪════════╡
74+
[] | 0 | 0 | 0 |
75+
├───────────┼────────┼────────┼────────┤
76+
[1] | 1 | 1 | 1 |
77+
├───────────┼────────┼────────┼────────┤
78+
[1, 2] | 2 | 2 | 2 |
79+
├───────────┼────────┼────────┼────────┤
80+
[2, 1] | 2 | 1 | 0 |
81+
├───────────┼────────┼────────┼────────┤
82+
[1, 2, 3] | 3 | 3 | 3 |
83+
├───────────┼────────┼────────┼────────┤
84+
[1, 3, 2] | 3 | 2 | 1 |
85+
├───────────┼────────┼────────┼────────┤
86+
[2, 1, 3] | 3 | 2 | 1 |
87+
├───────────┼────────┼────────┼────────┤
88+
[2, 3, 1] | 3 | 2 | 0 |
89+
├───────────┼────────┼────────┼────────┤
90+
[3, 1, 2] | 3 | 1 | 0 |
91+
├───────────┼────────┼────────┼────────┤
92+
[3, 2, 1] | 3 | 2 | 1 |
93+
└───────────┴────────┴────────┴────────┘
9494
9595
sage: table(b, header_row=True, frame=True)
96-
+-----------+---+--------+--------+--------+
97-
| b | τ | β_1(b) | β_2(b) | β_3(b) |
98-
+===========+===+========+========+========+
99-
| [] | 0 | 0 | 0 | 0 |
100-
+-----------+---+--------+--------+--------+
101-
| [1] | 1 | 1 | 1 | 1 |
102-
+-----------+---+--------+--------+--------+
103-
| [1, 2] | 2 | 2 | 1 | 0 |
104-
+-----------+---+--------+--------+--------+
105-
| [2, 1] | 1 | 2 | 2 | 2 |
106-
+-----------+---+--------+--------+--------+
107-
| [1, 2, 3] | 3 | 3 | 1 | 0 |
108-
+-----------+---+--------+--------+--------+
109-
| [1, 3, 2] | 2 | 3 | 2 | 1 |
110-
+-----------+---+--------+--------+--------+
111-
| [2, 1, 3] | 2 | 3 | 2 | 1 |
112-
+-----------+---+--------+--------+--------+
113-
| [2, 3, 1] | 2 | 3 | 2 | 1 |
114-
+-----------+---+--------+--------+--------+
115-
| [3, 1, 2] | 2 | 3 | 2 | 0 |
116-
+-----------+---+--------+--------+--------+
117-
| [3, 2, 1] | 1 | 3 | 3 | 3 |
118-
+-----------+---+--------+--------+--------+
96+
┌───────────┬───┬────────┬────────┬────────┐
97+
b | τ | β_1(b) | β_2(b) | β_3(b) |
98+
╞═══════════╪═══╪════════╪════════╪════════╡
99+
[] | 0 | 0 | 0 | 0 |
100+
├───────────┼───┼────────┼────────┼────────┤
101+
[1] | 1 | 1 | 1 | 1 |
102+
├───────────┼───┼────────┼────────┼────────┤
103+
[1, 2] | 2 | 2 | 1 | 0 |
104+
├───────────┼───┼────────┼────────┼────────┤
105+
[2, 1] | 1 | 2 | 2 | 2 |
106+
├───────────┼───┼────────┼────────┼────────┤
107+
[1, 2, 3] | 3 | 3 | 1 | 0 |
108+
├───────────┼───┼────────┼────────┼────────┤
109+
[1, 3, 2] | 2 | 3 | 2 | 1 |
110+
├───────────┼───┼────────┼────────┼────────┤
111+
[2, 1, 3] | 2 | 3 | 2 | 1 |
112+
├───────────┼───┼────────┼────────┼────────┤
113+
[2, 3, 1] | 2 | 3 | 2 | 1 |
114+
├───────────┼───┼────────┼────────┼────────┤
115+
[3, 1, 2] | 2 | 3 | 2 | 0 |
116+
├───────────┼───┼────────┼────────┼────────┤
117+
[3, 2, 1] | 1 | 3 | 3 | 3 |
118+
└───────────┴───┴────────┴────────┴────────┘
119119
120120
sage: from sage.combinat.cyclic_sieving_phenomenon import orbit_decomposition
121121
sage: bij.set_constant_blocks(orbit_decomposition(A, rotate_permutation))
@@ -854,53 +854,53 @@ def statistics_table(self, header=True):
854854
sage: bij.set_statistics((wex, des), (fix, adj))
855855
sage: a, b = bij.statistics_table()
856856
sage: table(a, header_row=True, frame=True)
857-
+-----------+--------+--------+
858-
| a | α_1(a) | α_2(a) |
859-
+===========+========+========+
860-
| [] | 0 | 0 |
861-
+-----------+--------+--------+
862-
| [1] | 1 | 1 |
863-
+-----------+--------+--------+
864-
| [1, 2] | 2 | 2 |
865-
+-----------+--------+--------+
866-
| [2, 1] | 1 | 0 |
867-
+-----------+--------+--------+
868-
| [1, 2, 3] | 3 | 3 |
869-
+-----------+--------+--------+
870-
| [1, 3, 2] | 2 | 1 |
871-
+-----------+--------+--------+
872-
| [2, 1, 3] | 2 | 1 |
873-
+-----------+--------+--------+
874-
| [2, 3, 1] | 2 | 0 |
875-
+-----------+--------+--------+
876-
| [3, 1, 2] | 1 | 0 |
877-
+-----------+--------+--------+
878-
| [3, 2, 1] | 2 | 1 |
879-
+-----------+--------+--------+
857+
┌───────────┬────────┬────────┐
858+
a | α_1(a) | α_2(a) |
859+
╞═══════════╪════════╪════════╡
860+
[] | 0 | 0 |
861+
├───────────┼────────┼────────┤
862+
[1] | 1 | 1 |
863+
├───────────┼────────┼────────┤
864+
[1, 2] | 2 | 2 |
865+
├───────────┼────────┼────────┤
866+
[2, 1] | 1 | 0 |
867+
├───────────┼────────┼────────┤
868+
[1, 2, 3] | 3 | 3 |
869+
├───────────┼────────┼────────┤
870+
[1, 3, 2] | 2 | 1 |
871+
├───────────┼────────┼────────┤
872+
[2, 1, 3] | 2 | 1 |
873+
├───────────┼────────┼────────┤
874+
[2, 3, 1] | 2 | 0 |
875+
├───────────┼────────┼────────┤
876+
[3, 1, 2] | 1 | 0 |
877+
├───────────┼────────┼────────┤
878+
[3, 2, 1] | 2 | 1 |
879+
└───────────┴────────┴────────┘
880880
sage: table(b, header_row=True, frame=True)
881-
+-----------+---+--------+--------+
882-
| b | τ | β_1(b) | β_2(b) |
883-
+===========+===+========+========+
884-
| [] | 0 | 0 | 0 |
885-
+-----------+---+--------+--------+
886-
| [1] | 1 | 1 | 1 |
887-
+-----------+---+--------+--------+
888-
| [1, 2] | 2 | 1 | 0 |
889-
+-----------+---+--------+--------+
890-
| [2, 1] | 1 | 2 | 2 |
891-
+-----------+---+--------+--------+
892-
| [1, 2, 3] | 3 | 1 | 0 |
893-
+-----------+---+--------+--------+
894-
| [1, 3, 2] | 2 | 2 | 1 |
895-
+-----------+---+--------+--------+
896-
| [2, 1, 3] | 2 | 2 | 1 |
897-
+-----------+---+--------+--------+
898-
| [2, 3, 1] | 2 | 2 | 1 |
899-
+-----------+---+--------+--------+
900-
| [3, 1, 2] | 2 | 2 | 0 |
901-
+-----------+---+--------+--------+
902-
| [3, 2, 1] | 1 | 3 | 3 |
903-
+-----------+---+--------+--------+
881+
┌───────────┬───┬────────┬────────┐
882+
b | τ | β_1(b) | β_2(b) |
883+
╞═══════════╪═══╪════════╪════════╡
884+
[] | 0 | 0 | 0 |
885+
├───────────┼───┼────────┼────────┤
886+
[1] | 1 | 1 | 1 |
887+
├───────────┼───┼────────┼────────┤
888+
[1, 2] | 2 | 1 | 0 |
889+
├───────────┼───┼────────┼────────┤
890+
[2, 1] | 1 | 2 | 2 |
891+
├───────────┼───┼────────┼────────┤
892+
[1, 2, 3] | 3 | 1 | 0 |
893+
├───────────┼───┼────────┼────────┤
894+
[1, 3, 2] | 2 | 2 | 1 |
895+
├───────────┼───┼────────┼────────┤
896+
[2, 1, 3] | 2 | 2 | 1 |
897+
├───────────┼───┼────────┼────────┤
898+
[2, 3, 1] | 2 | 2 | 1 |
899+
├───────────┼───┼────────┼────────┤
900+
[3, 1, 2] | 2 | 2 | 0 |
901+
├───────────┼───┼────────┼────────┤
902+
[3, 2, 1] | 1 | 3 | 3 |
903+
└───────────┴───┴────────┴────────┘
904904
905905
TESTS:
906906
@@ -911,29 +911,29 @@ def statistics_table(self, header=True):
911911
sage: bij = Bijectionist(A, B, tau)
912912
sage: a, b = bij.statistics_table()
913913
sage: table(a, header_row=True, frame=True)
914-
+--------+
915-
| a |
916-
+========+
917-
| [] |
918-
+--------+
919-
| [1] |
920-
+--------+
921-
| [1, 2] |
922-
+--------+
923-
| [2, 1] |
924-
+--------+
914+
┌────────┐
915+
a |
916+
╞════════╡
917+
[] |
918+
├────────┤
919+
[1] |
920+
├────────┤
921+
[1, 2] |
922+
├────────┤
923+
[2, 1] |
924+
└────────┘
925925
sage: table(b, header_row=True, frame=True)
926-
+--------+---+
927-
| b | τ |
928-
+========+===+
929-
| [] | 0 |
930-
+--------+---+
931-
| [1] | 1 |
932-
+--------+---+
933-
| [1, 2] | 2 |
934-
+--------+---+
935-
| [2, 1] | 1 |
936-
+--------+---+
926+
┌────────┬───┐
927+
b | τ |
928+
╞════════╪═══╡
929+
[] | 0 |
930+
├────────┼───┤
931+
[1] | 1 |
932+
├────────┼───┤
933+
[1, 2] | 2 |
934+
├────────┼───┤
935+
[2, 1] | 1 |
936+
└────────┴───┘
937937
938938
We can omit the header::
939939

0 commit comments

Comments
 (0)