diff options
| author | Inada Naoki <songofacandy@gmail.com> | 2019-12-05 18:29:15 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-05 18:29:15 +0900 |
| commit | 641406902efaa8f22f4a7973d04c921a2a35a6be (patch) | |
| tree | 386d7f59b87ce5b798b4a21ac55a3aabb77ddd68 /msgpack/__init__.py | |
| parent | 2c6668941f72e3bcb797d096437683eca4e3caf5 (diff) | |
| download | msgpack-python-641406902efaa8f22f4a7973d04c921a2a35a6be.tar.gz | |
Add Timestamp support (#382)
Diffstat (limited to 'msgpack/__init__.py')
| -rw-r--r-- | msgpack/__init__.py | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/msgpack/__init__.py b/msgpack/__init__.py index 4112a16..ff66f46 100644 --- a/msgpack/__init__.py +++ b/msgpack/__init__.py @@ -1,22 +1,10 @@ # coding: utf-8 from ._version import version from .exceptions import * +from .ext import ExtType, Timestamp import os import sys -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) if os.environ.get('MSGPACK_PUREPYTHON') or sys.version_info[0] == 2: |
