Beispiel #1
0
 def _encode(self, obj, context):
     stream2 = BytesIO()
     self.top._pack(obj, stream2, context, Config())
     return stream2.getvalue()
Beispiel #2
0
	def _unpack(self, stream, ctx, cfg):
		size = self.getsize(ctx)
		stream2 = BytesIO(stream.read(size))
		return super()._unpack(stream2, ctx, Config())
Beispiel #3
0
 def _decode(self, obj, context):
     return self.top._unpack(BytesIO(obj), context, Config())
Beispiel #4
0
 def sizeof(self, ctx=None, cfg=None):
     return self._sizeof(ctx or {}, cfg or Config())
Beispiel #5
0
 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())
Beispiel #6
0
 def pack_to_stream(self, obj, stream):
     self._pack(obj, stream, {}, Config())
Beispiel #7
0
 def pack(self, obj):
     stream = BytesIO()
     self._pack(obj, stream, {}, Config())
     return stream.getvalue()