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

Function _to_msgpack

box/converters.py:345–351  ·  view source on GitHub ↗
(obj, filename: str | PathLike | None = None, **kwargs)

Source from the content-addressed store, hash-verified

343
344
345def _to_msgpack(obj, filename: str | PathLike | None = None, **kwargs):
346 if filename:
347 _exists(filename, create=True)
348 with open(filename, "wb") as f:
349 msgpack.pack(obj, f, **kwargs)
350 else:
351 return msgpack.packb(obj, **kwargs)
352
353
354def _from_msgpack(msgpack_bytes: bytes | None = None, filename: str | PathLike | None = None, **kwargs):

Callers 3

test_to_msgpackMethod · 0.90
to_msgpackMethod · 0.90
to_msgpackMethod · 0.90

Calls 1

_existsFunction · 0.85

Tested by 1

test_to_msgpackMethod · 0.72