MCPcopy Create free account
hub / github.com/divideconcept/fastnumpyio / pack

Function pack

fastnumpyio.py:15–17  ·  view source on GitHub ↗
(array)

Source from the content-addressed store, hash-verified

13 file.write(array.data)
14
15def pack(array):
16 size=len(array.shape)
17 return bytes(array.dtype.byteorder.replace('=','<' if sys.byteorder == 'little' else '>')+array.dtype.kind,'utf-8')+array.dtype.itemsize.to_bytes(1,byteorder='little')+struct.pack(f'<B{size}I',size,*array.shape)+array.data
18
19def load(file):
20 if type(file) == str:

Callers 1

fastnumpyio.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected