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

Method decode

python/pyfory/format/encoder.py:39–50  ·  view source on GitHub ↗
(self, binary: bytes)

Source from the content-addressed store, hash-verified

37 return buffer.to_bytes(0, buffer.get_writer_index())
38
39 def decode(self, binary: bytes):
40 buf = pyfory.Buffer(binary, 0, len(binary))
41 peer_hash = buf.read_int64()
42 assert self.schema_hash == peer_hash, (
43 f"Schema is not consistent, encoder schema is {self.schema}, "
44 f"clz is {self.clz}. Self/peer schema hash is "
45 f"{self.schema_hash, peer_hash}. "
46 f"Please check writer schema."
47 )
48 buf = pyfory.Buffer(binary, 8, len(binary) - 8)
49 row = pyfory.RowData(self.schema, buf)
50 return self.row_encoder.from_row(row)
51
52 def to_row(self, obj):
53 return self.row_encoder.to_row(obj)

Callers

nothing calls this directly

Calls 3

read_int64Method · 0.95
from_rowMethod · 0.80
BufferMethod · 0.45

Tested by

no test coverage detected