Pretty-format *blocks*. >>> format_blocks((10, 10, 10)) 3*[10] >>> format_blocks((2, 3, 4)) [2, 3, 4] >>> format_blocks((10, 10, 5, 6, 2, 2, 2, 7)) 2*[10] | [5, 6] | 3*[2] | [7]
(blocks)
| 790 | |
| 791 | |
| 792 | def format_blocks(blocks): |
| 793 | """ |
| 794 | Pretty-format *blocks*. |
| 795 | |
| 796 | >>> format_blocks((10, 10, 10)) |
| 797 | 3*[10] |
| 798 | >>> format_blocks((2, 3, 4)) |
| 799 | [2, 3, 4] |
| 800 | >>> format_blocks((10, 10, 5, 6, 2, 2, 2, 7)) |
| 801 | 2*[10] | [5, 6] | 3*[2] | [7] |
| 802 | """ |
| 803 | assert isinstance(blocks, tuple) and all( |
| 804 | isinstance(x, int) or math.isnan(x) for x in blocks |
| 805 | ) |
| 806 | return _PrettyBlocks(blocks) |
| 807 | |
| 808 | |
| 809 | def format_chunks(chunks): |
no test coverage detected