Commit 99c88f1
committed
rf(cmdline): Simplify table2string implementation
The previous table2string implementation reimplemented Python
formatting, calculating spaces for aligning left, right or center. This
patch just translates our mini-language into the Python mini-language,
and updates the tests.
Previously, when centering required adding an odd number of spaces, we
added the extra to the left, while Python adds to the right.
This difference does not seem worth preserving.
This also avoids allocating a numpy array in order to transpose by using
the `zip(*list)` trick.1 parent 59733ff commit 99c88f1
2 files changed
+43
-43
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
39 | 40 | | |
40 | | - | |
41 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
42 | 62 | | |
43 | 63 | | |
44 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | 15 | | |
20 | 16 | | |
21 | 17 | | |
| |||
42 | 38 | | |
43 | 39 | | |
44 | 40 | | |
45 | | - | |
| 41 | + | |
46 | 42 | | |
47 | 43 | | |
48 | 44 | | |
49 | 45 | | |
50 | 46 | | |
51 | 47 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | 48 | | |
57 | 49 | | |
58 | 50 | | |
| 51 | + | |
59 | 52 | | |
60 | 53 | | |
61 | 54 | | |
62 | | - | |
63 | | - | |
64 | 55 | | |
65 | 56 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
71 | 63 | | |
72 | 64 | | |
73 | 65 | | |
| |||
77 | 69 | | |
78 | 70 | | |
79 | 71 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
| 72 | + | |
| 73 | + | |
95 | 74 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
100 | 80 | | |
101 | 81 | | |
102 | 82 | | |
| |||
0 commit comments