File size: 332 Bytes
01171b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from typing import Any, Dict

import msgpack
import msgpack_numpy

# apply msgpack_numpy monkey-patch to enable automatic numpy serialization
msgpack_numpy.patch()


def serialize(data: Dict[str, Any]) -> bytes:
    return msgpack.packb(data)


def deserialize(message: bytes) -> Dict[str, Any]:
    return msgpack.unpackb(message)