MCPcopy Create free account
hub / github.com/cdgriffith/Box / _from_msgpack

Function _from_msgpack

box/converters.py:330–339  ·  view source on GitHub ↗
(msgpack_bytes: bytes | None = None, filename: str | PathLike | None = None, **kwargs)

Source from the content-addressed store, hash-verified

328
329
330def _from_msgpack(msgpack_bytes: bytes | None = None, filename: str | PathLike | None = None, **kwargs):
331 if filename:
332 _exists(filename)
333 with open(filename, "rb") as f:
334 data = msgpack.unpack(f, **kwargs)
335 elif msgpack_bytes:
336 data = msgpack.unpackb(msgpack_bytes, **kwargs)
337 else:
338 raise BoxError("from_msgpack requires a string or filename")
339 return data
340
341
342def _to_toon(obj, filename: str | PathLike | None = None, encoding: str = "utf-8", errors: str = "strict", **kwargs):

Callers 2

from_msgpackMethod · 0.90
from_msgpackMethod · 0.90

Calls 2

BoxErrorClass · 0.90
_existsFunction · 0.85

Tested by

no test coverage detected