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

Function unpack

fastnumpyio.py:32–40  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

30 return np.ndarray(shape, dtype=descr, buffer=file.read(datasize))
31
32def unpack(data):
33 dtype = str(data[:2],'utf-8')
34 dtype += str(data[2])
35 size = data[3]
36 shape = struct.unpack_from(f'<{size}I', data, 4)
37 datasize=data[2]
38 for dimension in shape:
39 datasize *= dimension
40 return np.ndarray(shape, dtype=dtype, buffer=data[4+size*4:4+size*4+datasize])
41
42
43

Callers 1

fastnumpyio.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected