mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-04-10 13:30:17 +00:00
Add support for bypassing pre-packed data
This commit is contained in:
parent
f9806368ae
commit
e4ec35b7d3
4 changed files with 21 additions and 3 deletions
|
|
@ -16,6 +16,19 @@ class ExtType(namedtuple("ExtType", "code data")):
|
|||
return super().__new__(cls, code, data)
|
||||
|
||||
|
||||
class Bypass:
|
||||
"""Bypass is a placeholder class to skip serialization and pass the bytes value as is."""
|
||||
|
||||
__slots__ = ["data"]
|
||||
|
||||
def __init__(self, data):
|
||||
if isinstance(data, bytes):
|
||||
self.data = data
|
||||
|
||||
else:
|
||||
self.data = memoryview(data).tobytes()
|
||||
|
||||
|
||||
class Timestamp:
|
||||
"""Timestamp represents the Timestamp extension type in msgpack.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue