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

Function _from_msgpack

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

Source from the content-addressed store, hash-verified

352
353
354def _from_msgpack(msgpack_bytes: bytes | None = None, filename: str | PathLike | None = None, **kwargs):
355 if filename:
356 _exists(filename)
357 with open(filename, "rb") as f:
358 data = msgpack.unpack(f, **kwargs)
359 elif msgpack_bytes:
360 data = msgpack.unpackb(msgpack_bytes, **kwargs)
361 else:
362 raise BoxError("from_msgpack requires a string or filename")
363 return data
364
365
366def _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