(msgpack_bytes: bytes | None = None, filename: str | PathLike | None = None, **kwargs)
| 352 | |
| 353 | |
| 354 | def _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 | |
| 366 | def _to_toon(obj, filename: str | PathLike | None = None, encoding: str = "utf-8", errors: str = "strict", **kwargs): |
no test coverage detected