def _encode(self, obj, context): stream2 = BytesIO() self.top._pack(obj, stream2, context, Config()) return stream2.getvalue()
def _unpack(self, stream, ctx, cfg): size = self.getsize(ctx) stream2 = BytesIO(stream.read(size)) return super()._unpack(stream2, ctx, Config())
def _decode(self, obj, context): return self.top._unpack(BytesIO(obj), context, Config())
def sizeof(self, ctx=None, cfg=None): return self._sizeof(ctx or {}, cfg or Config())
def unpack(self, buf_or_stream): if not hasattr(buf_or_stream, "read"): buf_or_stream = BytesIO(buf_or_stream) return self._unpack(buf_or_stream, {}, Config())
def pack_to_stream(self, obj, stream): self._pack(obj, stream, {}, Config())
def pack(self, obj): stream = BytesIO() self._pack(obj, stream, {}, Config()) return stream.getvalue()