File: msgpack.py

package info (click to toggle)
django-redis 5.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 476 kB
  • sloc: python: 2,904; makefile: 6; sh: 6
file content (13 lines) | stat: -rw-r--r-- 284 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
from typing import Any

import msgpack

from .base import BaseSerializer


class MSGPackSerializer(BaseSerializer):
    def dumps(self, value: Any) -> bytes:
        return msgpack.dumps(value)

    def loads(self, value: bytes) -> Any:
        return msgpack.loads(value, raw=False)