OXIESEC PANEL
- Current Dir:
/
/
opt
/
alt
/
python27
/
lib64
/
python2.7
/
site-packages
/
msgpack
Server IP: 191.96.63.230
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/24/2023 02:37:57 PM
rwxr-xr-x
📄
__init__.py
1.5 KB
10/24/2023 02:37:57 PM
rw-r--r--
📄
__init__.pyc
2.41 KB
10/24/2023 02:37:57 PM
rw-r--r--
📄
_cmsgpack.so
662.79 KB
10/24/2023 02:37:57 PM
rwxr-xr-x
📄
_version.py
20 bytes
10/24/2023 02:37:57 PM
rw-r--r--
📄
_version.pyc
207 bytes
10/24/2023 02:37:57 PM
rw-r--r--
📄
exceptions.py
1.06 KB
10/24/2023 02:37:57 PM
rw-r--r--
📄
exceptions.pyc
2.35 KB
10/24/2023 02:37:57 PM
rw-r--r--
📄
fallback.py
36.58 KB
10/24/2023 02:37:57 PM
rw-r--r--
📄
fallback.pyc
32 KB
10/24/2023 02:37:57 PM
rw-r--r--
Editing: __init__.py
Close
# coding: utf-8 from ._version import version from .exceptions import * from collections import namedtuple class ExtType(namedtuple('ExtType', 'code data')): """ExtType represents ext type in msgpack.""" def __new__(cls, code, data): if not isinstance(code, int): raise TypeError("code must be int") if not isinstance(data, bytes): raise TypeError("data must be bytes") if not 0 <= code <= 127: raise ValueError("code must be 0~127") return super(ExtType, cls).__new__(cls, code, data) import os if os.environ.get('MSGPACK_PUREPYTHON'): from .fallback import Packer, unpackb, Unpacker else: try: from ._cmsgpack import Packer, unpackb, Unpacker except ImportError: from .fallback import Packer, unpackb, Unpacker def pack(o, stream, **kwargs): """ Pack object `o` and write it to `stream` See :class:`Packer` for options. """ packer = Packer(**kwargs) stream.write(packer.pack(o)) def packb(o, **kwargs): """ Pack object `o` and return packed bytes See :class:`Packer` for options. """ return Packer(**kwargs).pack(o) def unpack(stream, **kwargs): """ Unpack an object from `stream`. Raises `ExtraData` when `stream` contains extra bytes. See :class:`Unpacker` for options. """ data = stream.read() return unpackb(data, **kwargs) # alias for compatibility to simplejson/marshal/pickle. load = unpack loads = unpackb dump = pack dumps = packb