MCPcopy Index your code
hub / github.com/apache/fory / read

Method read

python/pyfory/serializer.py:880–892  ·  view source on GitHub ↗
(self, buffer)

Source from the content-addressed store, hash-verified

878 buffer.write_bytes(value.astype(value.dtype.newbyteorder("<")).tobytes())
879
880 def read(self, buffer):
881 type_id = buffer.read_uint8()
882 dtype = _np_typeid_to_dtype.get(type_id)
883 if dtype is None:
884 raise NotImplementedError(f"Unsupported ndarray type id: {type_id}")
885 data = buffer.read_bytes_and_size()
886 arr = np.frombuffer(data, dtype=dtype.newbyteorder("<"))
887 if dtype.itemsize > 1:
888 if is_little_endian:
889 arr = arr.view(dtype)
890 else:
891 arr = arr.astype(dtype)
892 return arr
893
894
895class PythonNDArraySerializer(NDArraySerializer):

Callers

nothing calls this directly

Calls 2

getMethod · 0.65
read_uint8Method · 0.45

Tested by

no test coverage detected