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

Method encode

python/pyfory/format/encoder.py:31–37  ·  view source on GitHub ↗
(self, obj)

Source from the content-addressed store, hash-verified

29 self.schema_hash: bytes = pyfory.format.infer.compute_schema_hash(self.schema)
30
31 def encode(self, obj):
32 row = self.row_encoder.to_row(obj)
33 buffer = pyfory.Buffer.allocate(8 + row.size_bytes())
34 buffer.write_int64(self.schema_hash)
35 row_bytes = row.to_bytes()
36 buffer.write_bytes(row_bytes)
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))

Callers

nothing calls this directly

Calls 6

allocateMethod · 0.65
to_rowMethod · 0.45
size_bytesMethod · 0.45
write_int64Method · 0.45
to_bytesMethod · 0.45
write_bytesMethod · 0.45

Tested by

no test coverage detected