MCPcopy Create free account
hub / github.com/dask/dask / format_blocks

Function format_blocks

dask/array/rechunk.py:792–806  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

790
791
792def 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
809def format_chunks(chunks):

Callers 1

format_chunksFunction · 0.85

Calls 2

allFunction · 0.85
_PrettyBlocksClass · 0.85

Tested by

no test coverage detected