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