MCPcopy Create free account
hub / github.com/apache/fory / read

Method read

python/pyfory/_serializer.py:304–321  ·  view source on GitHub ↗
(self, read_context)

Source from the content-addressed store, hash-verified

302 write_context.write_buffer(swapped)
303
304 def read(self, read_context):
305 byte_size = read_context.read_var_uint32()
306 data = read_context.read_bytes(byte_size)
307 if self.wrapper_type is BoolArray:
308 return BoolArray(bool(value) for value in data)
309 if self.reduced_precision:
310 if byte_size & 1:
311 raise ValueError(f"{self.wrapper_type.__name__} byte size mismatch")
312 raw = array.array("H")
313 raw.frombytes(data)
314 if not is_little_endian:
315 raw.byteswap()
316 return self.wrapper_type.from_buffer(raw.tobytes())
317 raw = array.array(self.typecode)
318 raw.frombytes(data)
319 if not is_little_endian and raw.itemsize > 1:
320 raw.byteswap()
321 return self.wrapper_type(raw)
322
323
324class BoolArraySerializer(_DenseArraySerializer):

Callers

nothing calls this directly

Calls 6

BoolArrayClass · 0.85
boolFunction · 0.85
from_bufferMethod · 0.80
read_var_uint32Method · 0.45
read_bytesMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected