MCPcopy
hub / github.com/facebookresearch/encodec / write_ecdc_header

Function write_ecdc_header

encodec/binary.py:23–29  ·  view source on GitHub ↗
(fo: tp.IO[bytes], metadata: tp.Any)

Source from the content-addressed store, hash-verified

21
22
23def write_ecdc_header(fo: tp.IO[bytes], metadata: tp.Any):
24 meta_dumped = json.dumps(metadata).encode('utf-8')
25 version = 0
26 header = _encodec_header_struct.pack(_ENCODEC_MAGIC, version, len(meta_dumped))
27 fo.write(header)
28 fo.write(meta_dumped)
29 fo.flush()
30
31
32def _read_exactly(fo: tp.IO[bytes], size: int) -> bytes:

Callers

nothing calls this directly

Calls 2

encodeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…