tmsgpack 0.3.9__tar.gz → 0.3.14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tmsgpack-0.3.9/tmsgpack.egg-info → tmsgpack-0.3.14}/PKG-INFO +1 -1
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/pyproject.toml +1 -1
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tests/test_codec.py +4 -4
- tmsgpack-0.3.14/tests/test_codec_custom.py +240 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack/codec.py +12 -8
- tmsgpack-0.3.14/tmsgpack/codec_custom.py +125 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack/core.c +15 -15
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack/core.pyx +1 -1
- {tmsgpack-0.3.9 → tmsgpack-0.3.14/tmsgpack.egg-info}/PKG-INFO +1 -1
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack.egg-info/SOURCES.txt +2 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/MANIFEST.in +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/README.md +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/build_pyx.py +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/setup.cfg +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/setup.py +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tests/test_build_pyx.py +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tests/test_round_trip.py +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack/__init__.py +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack/api.py +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack/src-parts/01-imports +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack/src-parts/02-constants +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack/src-parts/03-encode-fn +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack/src-parts/04-decode-fn +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack/src-parts/05-encode-buffer +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack/src-parts/06-decode-buffer +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack/src-parts/07-encode-buffer-slow +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack/src-parts/08-decode-buffer-slow +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack/src-parts/09-exceptions +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack.egg-info/dependency_links.txt +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack.egg-info/requires.txt +0 -0
- {tmsgpack-0.3.9 → tmsgpack-0.3.14}/tmsgpack.egg-info/top_level.txt +0 -0
|
@@ -154,13 +154,13 @@ def test_with_seed_data_round_trip(codec):
|
|
|
154
154
|
assert decoded.dbh is other_dbh
|
|
155
155
|
|
|
156
156
|
|
|
157
|
-
# ---
|
|
157
|
+
# --- with_seed_data produces independent caches ---
|
|
158
158
|
|
|
159
|
-
def
|
|
159
|
+
def test_with_seed_data_has_independent_caches(codec):
|
|
160
160
|
codec, t = codec
|
|
161
161
|
codec2 = codec.with_seed_data({t.Dbh: t.Dbh()})
|
|
162
|
-
assert codec2.encoder_cache is codec.encoder_cache
|
|
163
|
-
assert codec2.decoder_cache is codec.decoder_cache
|
|
162
|
+
assert codec2.encoder_cache is not codec.encoder_cache
|
|
163
|
+
assert codec2.decoder_cache is not codec.decoder_cache
|
|
164
164
|
|
|
165
165
|
|
|
166
166
|
# --- Inject[T] without a DependencyInjector ---
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
"""Tests for TmsgpackCustom: custom encode/decode for non-dataclass types."""
|
|
2
|
+
|
|
3
|
+
import struct
|
|
4
|
+
import textwrap
|
|
5
|
+
import pytest
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
pytest.importorskip("semifun.di")
|
|
9
|
+
pytest.importorskip("semifun.plugins")
|
|
10
|
+
|
|
11
|
+
from tmsgpack.codec import NoDependencyInjector, TmsgpackCodec
|
|
12
|
+
from semifun.di.injector import DependencyInjector
|
|
13
|
+
from semifun.plugins.testing import create_registry_from_paths
|
|
14
|
+
from semifun.plugins.registry import _feature_map_from_registry
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# --- Write test packages with custom codec types ---
|
|
18
|
+
|
|
19
|
+
def _write_custom_types_package(tmp_path: Path) -> Path:
|
|
20
|
+
pkg = tmp_path / "test_custom_types"
|
|
21
|
+
pkg.mkdir()
|
|
22
|
+
(pkg / "__init__.py").write_text("")
|
|
23
|
+
(pkg / "types.py").write_text(textwrap.dedent("""\
|
|
24
|
+
import struct
|
|
25
|
+
from tmsgpack.codec_custom import TmsgpackCustom
|
|
26
|
+
|
|
27
|
+
# --- Target types (not dataclasses) ---
|
|
28
|
+
|
|
29
|
+
class Pair:
|
|
30
|
+
def __init__(self, x, y):
|
|
31
|
+
self.x = x
|
|
32
|
+
self.y = y
|
|
33
|
+
def __eq__(self, other):
|
|
34
|
+
return type(other) is Pair and self.x == other.x and self.y == other.y
|
|
35
|
+
|
|
36
|
+
class Point:
|
|
37
|
+
def __init__(self, x, y):
|
|
38
|
+
self.x = x
|
|
39
|
+
self.y = y
|
|
40
|
+
def __eq__(self, other):
|
|
41
|
+
return type(other) is Point and self.x == other.x and self.y == other.y
|
|
42
|
+
|
|
43
|
+
# --- Dict mode ---
|
|
44
|
+
|
|
45
|
+
#::testing_custom_codec:Pair=CodecPairDict
|
|
46
|
+
class CodecPairDict(TmsgpackCustom):
|
|
47
|
+
def encode_dict(obj):
|
|
48
|
+
return {'x': obj.x, 'y': obj.y}
|
|
49
|
+
def decode_dict(*, x, y):
|
|
50
|
+
return Pair(x=x, y=y)
|
|
51
|
+
|
|
52
|
+
# --- List mode ---
|
|
53
|
+
|
|
54
|
+
#::testing_custom_codec:Point=CodecPointList
|
|
55
|
+
class CodecPointList(TmsgpackCustom):
|
|
56
|
+
def encode_list(obj):
|
|
57
|
+
return [obj.x, obj.y]
|
|
58
|
+
def decode_list(x, y):
|
|
59
|
+
return Point(x, y)
|
|
60
|
+
"""))
|
|
61
|
+
(pkg / "types_bytes.py").write_text(textwrap.dedent("""\
|
|
62
|
+
import struct
|
|
63
|
+
from tmsgpack.codec_custom import TmsgpackCustom
|
|
64
|
+
|
|
65
|
+
class FloatPair:
|
|
66
|
+
def __init__(self, x, y):
|
|
67
|
+
self.x = x
|
|
68
|
+
self.y = y
|
|
69
|
+
def __eq__(self, other):
|
|
70
|
+
return (type(other) is FloatPair
|
|
71
|
+
and self.x == other.x and self.y == other.y)
|
|
72
|
+
|
|
73
|
+
#::testing_custom_codec:FloatPair=CodecFloatPairBytes
|
|
74
|
+
class CodecFloatPairBytes(TmsgpackCustom):
|
|
75
|
+
def encode_bytes(obj):
|
|
76
|
+
return struct.pack('<ff', obj.x, obj.y)
|
|
77
|
+
def decode_bytes(data):
|
|
78
|
+
x, y = struct.unpack('<ff', data)
|
|
79
|
+
return FloatPair(x, y)
|
|
80
|
+
"""))
|
|
81
|
+
return pkg
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@pytest.fixture
|
|
85
|
+
def test_types(tmp_path):
|
|
86
|
+
pkg = _write_custom_types_package(tmp_path)
|
|
87
|
+
registry = create_registry_from_paths(
|
|
88
|
+
packages=[("test_custom_types", pkg)],
|
|
89
|
+
)
|
|
90
|
+
feature_map = _feature_map_from_registry(registry, "testing_custom_codec")
|
|
91
|
+
import test_custom_types.types as t
|
|
92
|
+
import test_custom_types.types_bytes as tb
|
|
93
|
+
return t, tb, feature_map
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
@pytest.fixture
|
|
97
|
+
def codec(test_types):
|
|
98
|
+
t, tb, feature_map = test_types
|
|
99
|
+
return TmsgpackCodec(sort_keys=False, di=NoDependencyInjector(),
|
|
100
|
+
plugin_feature_type=feature_map), t, tb
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
# --- Dict mode round-trip ---
|
|
104
|
+
|
|
105
|
+
def test_dict_mode_round_trip(codec):
|
|
106
|
+
codec, t, tb = codec
|
|
107
|
+
pair = t.Pair(x='hello', y=42)
|
|
108
|
+
data = codec.encode(pair)
|
|
109
|
+
restored = codec.decode(data)
|
|
110
|
+
assert restored == pair
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
# --- List mode round-trip ---
|
|
114
|
+
|
|
115
|
+
def test_list_mode_round_trip(codec):
|
|
116
|
+
codec, t, tb = codec
|
|
117
|
+
point = t.Point(x=10, y=20)
|
|
118
|
+
data = codec.encode(point)
|
|
119
|
+
restored = codec.decode(data)
|
|
120
|
+
assert restored == point
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# --- Bytes mode round-trip ---
|
|
124
|
+
|
|
125
|
+
def test_bytes_mode_round_trip(codec):
|
|
126
|
+
codec, t, tb = codec
|
|
127
|
+
fp = tb.FloatPair(x=1.5, y=2.5)
|
|
128
|
+
data = codec.encode(fp)
|
|
129
|
+
restored = codec.decode(data)
|
|
130
|
+
assert restored == fp
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
# --- Content hashing works with custom types ---
|
|
134
|
+
|
|
135
|
+
def test_content_hash_dict_mode(codec):
|
|
136
|
+
codec, t, tb = codec
|
|
137
|
+
codec_sorted = TmsgpackCodec(sort_keys=True, di=NoDependencyInjector(),
|
|
138
|
+
plugin_feature_type=codec.plugin_feature_type)
|
|
139
|
+
pair = t.Pair(x='a', y=1)
|
|
140
|
+
h = codec_sorted.hash_to_str(pair)
|
|
141
|
+
assert isinstance(h, str)
|
|
142
|
+
assert len(h) == 22
|
|
143
|
+
# Same value, same hash
|
|
144
|
+
assert codec_sorted.hash_to_str(t.Pair(x='a', y=1)) == h
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
# --- Nested values in custom types ---
|
|
148
|
+
|
|
149
|
+
def test_dict_mode_nested_values(codec):
|
|
150
|
+
codec, t, tb = codec
|
|
151
|
+
pair = t.Pair(x=[1, 2, 3], y={'a': True})
|
|
152
|
+
data = codec.encode(pair)
|
|
153
|
+
restored = codec.decode(data)
|
|
154
|
+
assert restored == pair
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
# --- Validation: mismatched modes ---
|
|
158
|
+
|
|
159
|
+
def test_mismatched_modes_raises():
|
|
160
|
+
from tmsgpack.codec_custom import TmsgpackCustom
|
|
161
|
+
with pytest.raises(TypeError, match="mode mismatch"):
|
|
162
|
+
class Bad(TmsgpackCustom):
|
|
163
|
+
def encode_dict(obj): return {}
|
|
164
|
+
def decode_list(x): return None
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def test_no_encode_raises():
|
|
168
|
+
from tmsgpack.codec_custom import TmsgpackCustom
|
|
169
|
+
with pytest.raises(TypeError, match="encode_dict, encode_list, encode_bytes"):
|
|
170
|
+
class Bad(TmsgpackCustom):
|
|
171
|
+
def decode_dict(*, x): return None
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def test_no_decode_raises():
|
|
175
|
+
from tmsgpack.codec_custom import TmsgpackCustom
|
|
176
|
+
with pytest.raises(TypeError, match="decode_dict, decode_list, decode_bytes"):
|
|
177
|
+
class Bad(TmsgpackCustom):
|
|
178
|
+
def encode_dict(obj): return {}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
# --- DI on decode ---
|
|
182
|
+
|
|
183
|
+
def _write_di_types_package(tmp_path: Path) -> Path:
|
|
184
|
+
pkg = tmp_path / "test_custom_di_types"
|
|
185
|
+
pkg.mkdir()
|
|
186
|
+
(pkg / "__init__.py").write_text("")
|
|
187
|
+
(pkg / "types.py").write_text(textwrap.dedent("""\
|
|
188
|
+
from tmsgpack.codec_custom import TmsgpackCustom
|
|
189
|
+
from semifun.di.model import Inject
|
|
190
|
+
|
|
191
|
+
class Cache:
|
|
192
|
+
def __init__(self):
|
|
193
|
+
self.store = {}
|
|
194
|
+
def get(self, key):
|
|
195
|
+
return self.store[key]
|
|
196
|
+
def put(self, key, value):
|
|
197
|
+
self.store[key] = value
|
|
198
|
+
|
|
199
|
+
class Widget:
|
|
200
|
+
def __init__(self, name, data):
|
|
201
|
+
self.name = name
|
|
202
|
+
self.data = data
|
|
203
|
+
def __eq__(self, other):
|
|
204
|
+
return (type(other) is Widget
|
|
205
|
+
and self.name == other.name
|
|
206
|
+
and self.data == other.data)
|
|
207
|
+
|
|
208
|
+
#::testing_custom_di_codec:Widget=CodecWidget
|
|
209
|
+
class CodecWidget(TmsgpackCustom):
|
|
210
|
+
def encode_dict(obj, cache: Inject[Cache]):
|
|
211
|
+
cache.put(obj.name, obj.data)
|
|
212
|
+
return {'name': obj.name}
|
|
213
|
+
def decode_dict(*, name, cache: Inject[Cache]):
|
|
214
|
+
data = cache.get(name)
|
|
215
|
+
return Widget(name=name, data=data)
|
|
216
|
+
"""))
|
|
217
|
+
return pkg
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def test_di_on_encode_and_decode(tmp_path):
|
|
221
|
+
pkg = _write_di_types_package(tmp_path)
|
|
222
|
+
registry = create_registry_from_paths(
|
|
223
|
+
packages=[("test_custom_di_types", pkg)],
|
|
224
|
+
)
|
|
225
|
+
feature_map = _feature_map_from_registry(registry, "testing_custom_di_codec")
|
|
226
|
+
import test_custom_di_types.types as t
|
|
227
|
+
|
|
228
|
+
cache = t.Cache()
|
|
229
|
+
injectors_map = lambda name, default=None: default
|
|
230
|
+
di = DependencyInjector(injectors_map=injectors_map, seed_data={t.Cache: cache})
|
|
231
|
+
codec = TmsgpackCodec(sort_keys=False, di=di, plugin_feature_type=feature_map)
|
|
232
|
+
|
|
233
|
+
widget = t.Widget(name='gizmo', data=[1, 2, 3])
|
|
234
|
+
data = codec.encode(widget)
|
|
235
|
+
|
|
236
|
+
# The cache was populated during encode
|
|
237
|
+
assert cache.store == {'gizmo': [1, 2, 3]}
|
|
238
|
+
|
|
239
|
+
restored = codec.decode(data)
|
|
240
|
+
assert restored == widget
|
|
@@ -5,6 +5,7 @@ from semifun.caching.cached_property import cached_property
|
|
|
5
5
|
|
|
6
6
|
import enum
|
|
7
7
|
from .api import EncodeDecode
|
|
8
|
+
from .codec_custom import TmsgpackCustom, make_codec_handler_custom
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class DependencyInjectorProtocol(Protocol):
|
|
@@ -30,18 +31,13 @@ class TmsgpackCodec(EncodeDecode):
|
|
|
30
31
|
sort_keys: bool
|
|
31
32
|
di: DependencyInjectorProtocol
|
|
32
33
|
# Memoization only: init=False keeps them out of the constructor.
|
|
33
|
-
# `replace()`
|
|
34
|
-
# So with_seed_data re-attaches them explicitly --
|
|
35
|
-
# the same pattern as DependencyInjector._call_with_args_sig_cache.
|
|
34
|
+
# `replace()` re-runs default_factory, giving each derived codec fresh caches.
|
|
36
35
|
encoder_cache: dict = field(default_factory=dict, init=False, repr=False)
|
|
37
36
|
decoder_cache: dict = field(default_factory=dict, init=False, repr=False)
|
|
38
37
|
plugin_feature_type: str
|
|
39
38
|
|
|
40
39
|
def with_seed_data(self, seed_data):
|
|
41
|
-
|
|
42
|
-
object.__setattr__(new, 'encoder_cache', self.encoder_cache)
|
|
43
|
-
object.__setattr__(new, 'decoder_cache', self.decoder_cache)
|
|
44
|
-
return new
|
|
40
|
+
return replace(self, di=self.di.with_seed_data(seed_data))
|
|
45
41
|
|
|
46
42
|
def prep_encode(self, value, target): return [None, self, value]
|
|
47
43
|
|
|
@@ -69,7 +65,13 @@ class TmsgpackCodec(EncodeDecode):
|
|
|
69
65
|
return codec_handler.decode_dctx(dctx=dctx)
|
|
70
66
|
|
|
71
67
|
def decode_from_bytes(self, dctx):
|
|
72
|
-
|
|
68
|
+
type_name = dctx._type
|
|
69
|
+
if type_name not in self.decoder_cache:
|
|
70
|
+
codec_spec = self.type_name_to_codec_spec(type_name=type_name)
|
|
71
|
+
codec_handler = self.codec_spec_to_codec_handler(codec_spec=codec_spec, type_name=type_name)
|
|
72
|
+
self.decoder_cache[type_name] = codec_handler
|
|
73
|
+
codec_handler = self.decoder_cache[type_name]
|
|
74
|
+
return codec_handler.decode_dctx(dctx=dctx)
|
|
73
75
|
|
|
74
76
|
@cached_property
|
|
75
77
|
def feature_map(self):
|
|
@@ -85,6 +87,8 @@ class TmsgpackCodec(EncodeDecode):
|
|
|
85
87
|
def codec_spec_to_codec_handler(self, codec_spec, type_name):
|
|
86
88
|
if isinstance(codec_spec, enum.EnumType):
|
|
87
89
|
return CodecHandler(type_name=type_name, attributes=('value',), constructor=codec_spec)
|
|
90
|
+
if isinstance(codec_spec, type) and issubclass(codec_spec, TmsgpackCustom):
|
|
91
|
+
return make_codec_handler_custom(codec_spec=codec_spec, type_name=type_name, di=self.di)
|
|
88
92
|
if is_dataclass(codec_spec):
|
|
89
93
|
all_fields = fields(codec_spec)
|
|
90
94
|
injected_type = self.di.injected_type
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import inspect
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
|
|
4
|
+
_MODES = ('dict', 'list', 'bytes')
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TmsgpackCustom:
|
|
8
|
+
"""Base class for custom tmsgpack codec handlers.
|
|
9
|
+
|
|
10
|
+
Subclass and define exactly one encode/decode pair:
|
|
11
|
+
encode_dict / decode_dict — wire format is key-value pairs
|
|
12
|
+
encode_list / decode_list — wire format is ordered sequence
|
|
13
|
+
encode_bytes / decode_bytes — wire format is raw bytes
|
|
14
|
+
|
|
15
|
+
Example (dict mode):
|
|
16
|
+
class CodecBar(TmsgpackCustom):
|
|
17
|
+
def encode_dict(obj):
|
|
18
|
+
return {'x': obj.x, 'y': obj.y}
|
|
19
|
+
def decode_dict(*, x, y):
|
|
20
|
+
return Bar(x=x, y=y)
|
|
21
|
+
|
|
22
|
+
Example (bytes mode):
|
|
23
|
+
class CodecPoint(TmsgpackCustom):
|
|
24
|
+
def encode_bytes(obj):
|
|
25
|
+
return struct.pack('ff', obj.x, obj.y)
|
|
26
|
+
def decode_bytes(data):
|
|
27
|
+
x, y = struct.unpack('ff', data)
|
|
28
|
+
return Point(x, y)
|
|
29
|
+
|
|
30
|
+
Dependency injection on encode or decode:
|
|
31
|
+
class CodecBig(TmsgpackCustom):
|
|
32
|
+
def encode_dict(obj, store: Inject[BlobStore]):
|
|
33
|
+
blob_id = store.put(obj.data)
|
|
34
|
+
return {'id': blob_id, 'name': obj.name}
|
|
35
|
+
def decode_dict(*, id, name, store: Inject[BlobStore]):
|
|
36
|
+
data = store.get(id)
|
|
37
|
+
return Big(name=name, data=data)
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
def __init_subclass__(cls, **kwargs):
|
|
41
|
+
super().__init_subclass__(**kwargs)
|
|
42
|
+
encode_modes = [m for m in _MODES if hasattr(cls, f'encode_{m}')]
|
|
43
|
+
decode_modes = [m for m in _MODES if hasattr(cls, f'decode_{m}')]
|
|
44
|
+
if len(encode_modes) != 1:
|
|
45
|
+
raise TypeError(
|
|
46
|
+
f'{cls.__name__}: define exactly one of encode_dict, encode_list, encode_bytes'
|
|
47
|
+
f' (found: {", ".join(f"encode_{m}" for m in encode_modes) or "none"})'
|
|
48
|
+
)
|
|
49
|
+
if len(decode_modes) != 1:
|
|
50
|
+
raise TypeError(
|
|
51
|
+
f'{cls.__name__}: define exactly one of decode_dict, decode_list, decode_bytes'
|
|
52
|
+
f' (found: {", ".join(f"decode_{m}" for m in decode_modes) or "none"})'
|
|
53
|
+
)
|
|
54
|
+
if encode_modes[0] != decode_modes[0]:
|
|
55
|
+
raise TypeError(
|
|
56
|
+
f'{cls.__name__}: mode mismatch — encode_{encode_modes[0]} vs decode_{decode_modes[0]}'
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _has_injected(fn, di):
|
|
61
|
+
"""Check whether any parameter of fn has an Inject[T] annotation."""
|
|
62
|
+
sig = inspect.signature(fn)
|
|
63
|
+
for param in sig.parameters.values():
|
|
64
|
+
if param.annotation is not inspect.Parameter.empty:
|
|
65
|
+
if di.injected_type(param.annotation):
|
|
66
|
+
return True
|
|
67
|
+
return False
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@dataclass(frozen=True)
|
|
71
|
+
class CodecHandlerCustom:
|
|
72
|
+
type_name: str
|
|
73
|
+
encode_fn: object
|
|
74
|
+
decode_fn: object
|
|
75
|
+
mode: str # 'dict' | 'list' | 'bytes'
|
|
76
|
+
encode_has_di: bool
|
|
77
|
+
decode_has_di: bool
|
|
78
|
+
di: object # DependencyInjectorProtocol
|
|
79
|
+
|
|
80
|
+
def encode_ectx(self, ectx):
|
|
81
|
+
value = ectx.value
|
|
82
|
+
if self.encode_has_di:
|
|
83
|
+
data = self.di.sync_call_with_args(fn=self.encode_fn, args=(value,), kwargs={})
|
|
84
|
+
else:
|
|
85
|
+
data = self.encode_fn(value)
|
|
86
|
+
mode = self.mode
|
|
87
|
+
if mode == 'dict': ectx.put_dict(self.type_name, data)
|
|
88
|
+
elif mode == 'list': ectx.put_sequence(self.type_name, data)
|
|
89
|
+
else: ectx.put_bytes(self.type_name, data)
|
|
90
|
+
|
|
91
|
+
def decode_dctx(self, dctx):
|
|
92
|
+
mode = self.mode
|
|
93
|
+
if mode == 'dict':
|
|
94
|
+
data = dctx.take_dict()
|
|
95
|
+
if self.decode_has_di:
|
|
96
|
+
return self.di.sync_call_with_args(fn=self.decode_fn, args=(), kwargs=data)
|
|
97
|
+
return self.decode_fn(**data)
|
|
98
|
+
elif mode == 'list':
|
|
99
|
+
data = dctx.take_list()
|
|
100
|
+
if self.decode_has_di:
|
|
101
|
+
return self.di.sync_call_with_args(fn=self.decode_fn, args=tuple(data), kwargs={})
|
|
102
|
+
return self.decode_fn(*data)
|
|
103
|
+
else:
|
|
104
|
+
data = dctx.take_bytes()
|
|
105
|
+
if self.decode_has_di:
|
|
106
|
+
return self.di.sync_call_with_args(fn=self.decode_fn, args=(data,), kwargs={})
|
|
107
|
+
return self.decode_fn(data)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def make_codec_handler_custom(codec_spec, type_name, di):
|
|
111
|
+
"""Create a CodecHandlerCustom from a TmsgpackCustom subclass."""
|
|
112
|
+
for mode in _MODES:
|
|
113
|
+
if hasattr(codec_spec, f'encode_{mode}'):
|
|
114
|
+
break
|
|
115
|
+
encode_fn = getattr(codec_spec, f'encode_{mode}')
|
|
116
|
+
decode_fn = getattr(codec_spec, f'decode_{mode}')
|
|
117
|
+
return CodecHandlerCustom(
|
|
118
|
+
type_name=type_name,
|
|
119
|
+
encode_fn=encode_fn,
|
|
120
|
+
decode_fn=decode_fn,
|
|
121
|
+
mode=mode,
|
|
122
|
+
encode_has_di=_has_injected(encode_fn, di),
|
|
123
|
+
decode_has_di=_has_injected(decode_fn, di),
|
|
124
|
+
di=di,
|
|
125
|
+
)
|
|
@@ -3065,7 +3065,7 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati
|
|
|
3065
3065
|
#endif
|
|
3066
3066
|
/* #### Code section: constant_name_defines ### */
|
|
3067
3067
|
#define __pyx_kp_u_ __pyx_string_tab[0]
|
|
3068
|
-
#define
|
|
3068
|
+
#define __pyx_kp_u_0_3_14 __pyx_string_tab[1]
|
|
3069
3069
|
#define __pyx_kp_u_B __pyx_string_tab[2]
|
|
3070
3070
|
#define __pyx_kp_u_H __pyx_string_tab[3]
|
|
3071
3071
|
#define __pyx_kp_u_I __pyx_string_tab[4]
|
|
@@ -24659,11 +24659,11 @@ __Pyx_RefNannySetupContext("PyInit_core", 0);
|
|
|
24659
24659
|
/* "tmsgpack/core.pyx":4
|
|
24660
24660
|
* # DON'T EDIT THIS FILE. EDIT THE SOURCES, INSTEAD: tmsgpack/src-parts/[inserted by cython to avoid comment start]*
|
|
24661
24661
|
*
|
|
24662
|
-
* __version__ = "0.3.
|
|
24662
|
+
* __version__ = "0.3.14" # <<<<<<<<<<<<<<
|
|
24663
24663
|
*
|
|
24664
24664
|
* from libc.stdint cimport int8_t, int16_t, int32_t, int64_t
|
|
24665
24665
|
*/
|
|
24666
|
-
if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_version, __pyx_mstate_global->
|
|
24666
|
+
if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_version, __pyx_mstate_global->__pyx_kp_u_0_3_14) < (0)) __PYX_ERR(0, 4, __pyx_L1_error)
|
|
24667
24667
|
|
|
24668
24668
|
/* "tmsgpack/core.pyx":13
|
|
24669
24669
|
* ctypedef double float64_t
|
|
@@ -26242,33 +26242,33 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) {
|
|
|
26242
26242
|
static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
|
|
26243
26243
|
CYTHON_UNUSED_VAR(__pyx_mstate);
|
|
26244
26244
|
{
|
|
26245
|
-
const struct { const unsigned int length: 9; } index[] = {{1},{
|
|
26246
|
-
#if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (
|
|
26247
|
-
const char* const cstring = "(\265/\375
|
|
26248
|
-
PyObject *data = __Pyx_DecompressString(cstring,
|
|
26245
|
+
const struct { const unsigned int length: 9; } index[] = {{1},{6},{2},{2},{2},{23},{21},{179},{27},{2},{18},{8},{2},{2},{16},{18},{7},{16},{18},{6},{2},{2},{2},{9},{50},{11},{2},{14},{26},{26},{26},{24},{17},{16},{34},{36},{25},{26},{24},{24},{24},{24},{23},{25},{25},{25},{25},{16},{34},{36},{25},{25},{26},{24},{24},{24},{24},{23},{25},{25},{25},{25},{12},{9},{27},{29},{20},{19},{19},{18},{20},{12},{9},{27},{29},{19},{18},{22},{17},{19},{8},{20},{16},{34},{36},{26},{24},{24},{24},{24},{25},{25},{25},{25},{16},{34},{36},{26},{24},{24},{24},{24},{25},{25},{25},{25},{13},{12},{8},{18},{9},{18},{5},{4},{15},{17},{16},{8},{5},{7},{4},{14},{12},{3},{6},{8},{12},{13},{5},{6},{8},{13},{10},{15},{3},{1},{8},{7},{4},{3},{11},{9},{8},{12},{7},{9},{14},{12},{11},{10},{31},{31},{31},{31},{14},{12},{8},{9},{7},{7},{7},{7},{6},{8},{8},{8},{8},{10},{17},{13},{4},{12},{10},{12},{19},{4},{9},{5},{5},{6},{3},{10},{9},{9},{8},{10},{8},{13},{5},{6},{6},{12},{5},{6},{11},{8},{9},{7},{7},{7},{7},{6},{8},{8},{8},{8},{21},{17},{24},{43},{43},{80},{61},{24},{19},{24},{24},{24},{24},{264},{33},{30},{57},{11},{19},{21},{24},{19},{19},{13},{25},{9},{97},{105},{15},{11},{58},{96}};
|
|
26246
|
+
#if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (1738 bytes) */
|
|
26247
|
+
const char* const cstring = "(\265/\375`#\021\0056\000\372E\240\016E\360\222\250\r\314\300\354\004[\0237;6]\326\235B\243\301t\246H\232\270{\264\010\373\233+\233D\226\337FkI\261\235\\\245\204\2124Q\247a2\014 \323\246%S\023\330\211F\244\253\200\236'\010x\221\241&\002\306\000\300\000\335\0004\364\022\232\247\352\356\276\225$\246\232\007b\311\362\370\244,\234!\314OM\013\225B5j\232\204*\266R\223k\325e\024\202*(('&\033\240\237\252\274\237-t\315N\256\205\307\361&Y|E/\325`\311\251\322X-}\371\266VY\002\3371\254\376\362Xr\320>\324\334+\314\266\203\246\026\350\301\316u\017+\375\215\346\0224Y\210\035c\271\315R\306\020\377\364\033~\241V%\004\245\200L\\\254\270\200\365\372Oz\037\303n\363\227\327Kts\rb\n\253}\371\256\004|\371\362\320\345K\r~\346*\205/\247l\253\303\267,\240\212\347M\256`\225\276Y[\202\233<\371\266\265\264\204P\204H\204@\037\017\007\317\206\021\001[\326\254|\217\261R\231\332\376\351\206S\3764bz\212\263fS\214\232G\217qZ-\306\224\275\246\030M\271\244\315\222Oy?n\363\272v-\366J?\333k\247\307\322Y;,c\274\366\336\225\025$\223\204a\362\027\017\343,\242\t\230\316E\214\316u$\257\226\305}\237\325\263\3523\267q\371a\276\304eaYW@'\031t\362\371JS^\332\315\244\335\177\3071N\317u\223)\223p\023\216%\t\230\216\363\370\265S\003jJ\356\204S?\251\366\230n\360Z\323\266\311\t\243\243\344\213\360y\263\305\367qH\205\375\273R\214O+\235\233\244+z\337\244\332\2325\030\243\317\254\371\215\021\376\226%\264U\3034$\317\202\205]@E\262\ttV6H\346i<\224\375\021\313\\\032\227\n\370\371:\237\007\3177K\264\037hdT\257\020\217\017\305KQY\320\231\3164!\032\001HL\344\211x\035\366\223\350\025\215\2003#\372>_j\017\330\235\310\333x\252\355!\275\n^\346\021\330(*-u\212\026\010'\246q\251>\023\217e\177\000\265>\262'=\326\226\033\204\376V\010'\366\331\01681Q\214\350\223\341\211\274\017\273\263G\264>63\232\230\216\313\303w\302\373x\027v\266E\264@\004\000\340\354\320\304P|}\3458k\\\256\331\343\037#\356\360\317|q\347\250\370\327\342h\332`|\223YU\222\277\362\r5)W3\327\375o\031\373Me\214\232\3762\257\344\374r\226\213\221\3455%\253\323\373\325\243""\275\036Y\211\010\272\003\214\357\344K\360\241\262\257C\204\327\210\r\354\023s!\301\252\014\013\007X\307u\342A\347H\361(\210\300D6\261\027#\030J\006\304\353\303\265\001\302T[\302\312\363Rq\375'?\222\t\033\230\312\363\030y#\n4:<t\330x\235\\#\327\210\353\023\002[\260@'\030\331+ZFk\025\343\261\211I/\303f\321\037}\242\005\262\211e\232\324:0\322\030Z\00561M\314\310%r\211t\036H\206^e\233\244E:\317\217\325\331\r>\005\237&\206\352\305\207\321\267:\260\027\314\224l\215\004{5\002|]\347\313\276\022\317\245\300ViP\2665[E\006\2013\243G\272e\264W\n:\020b\231\016\034\032\035\335K\276h\270TZ\364\204\031\232B\002\0031\006\036i\237t\005\355\3222\300\231\031m\321\026\3318N\350\021\031)\003\341\245y\205\370bx'\017\255\232\311\276\201\205\250\241\241q\206fDD$\005I\n\031\016\241\014Q\2329\307\324\003\222i\260\244@\014\021\302\010!\220P\005\222\nR\036\205\264\006\244\r\224\264\353\356\320T\tRAo\260z\247\225\230\312hs\020Xl'}>\031\r\355\352\276Q\322v7\362D\027x\013<\257\234/pa\026\303\341\325\005\273\3737\335\244\323\205\034\274\275l*\310_\206\365\314U\357\323\204\260\224\004\244\236\353\035Bt\264\t\000\224\352\340\263\001\346\354\244I\023\304]\314PI\246\030\262\005\374x\301\232\211\377\365\253\031\366\200\035Tj3h\264\237:\016l\000u\207\236\002\240\271\275@D\034\336\304\223\320\315\345x\213\327I\014\347~\335$\360\004$\203\256#\006\006{\020\311\312\210%8m\265\341\366C\320\330\326\350!\333[\026\237\343\206\\%#a\350\333\006\350\211OL\236YM\016\203\337\033\000\221\177: \223(\355\326lR\236'78\323\005#\0034V(;\205\t\266C\336\346\255:}\233\274b}\361\r\310@\204\367Q=\"\220l\206\224\210P\251\n\325h\241k\031\300\026&^\003\334\211Q\004(\261q\326\312Y\361\007\365\306-\331\321LVN\305\371\324f\250\302\030R\275\247\276QLG\340\316\034\362y\341-\tC\252k%SS\264\027\350\243d7\355\203\000\324\244\267\212s\221\357\212\340\213\021\254wQ\241\030 \251\203\224\\P\351\007\325jD\255px\214\216\r\021\260\362\374\257\263;\007\213P\026\273@\345mqs\302qwO\017\375\366H\371\204\030\313\177fH\340\313\004\217u\360\032\347LJ""\270H\366\350U\266\177\016\234\230R\300=\254\224\356Ro\336\320R\375\214\276P\212\214$[z\377\367\212}\242\031\331\t<\016T'N/\340\215\202,\223\205\302\313\267\235\177f^\3764\362,\t\243E\271\330\020\345\376Ph\351\354\257\n\225E\332\300S\221\355V\306\213\202sVbteo\227\030<\367\377\262S4nfM\\\003\222\323\032NxV^\301-V{R\321\356\005\024\r\033\001h\221\200\370\034\010\233\212\244zq\014\004\342\020\345hYr\316\314p;}ZI=n\026\322E\313\034x\315\000\007}\237\200e\361\323\370x5*.\260T=\233\236J\0373=\326\016.\201\354`@\246\273!\217\222\337\026\360\347\353Q\345\213\003uWp\342SIOe\277\016\361Q\242\333\243P\037\000*\212\266\371X\266{\2301\025\201\263\261\311\206\361\375L\314\2310\357\330\217V(\311\002#\017\300\020\322\016G\023\345\321\362uh\247tM\177K\215\032\350\324\r\236\306\373\361s\353\221\216\373HC\207\253\375G\274\306\306\367\203:o\235\374\354\300\016\231\2442\334\274`:\005\346\030\236\275\224\300\234f\224\213\001\351\306\000\316\203\300\323\245\252J\213\251\324,\302`fPy\027v$\262\367\202\022UF\350O\364\031j";
|
|
26248
|
+
PyObject *data = __Pyx_DecompressString(cstring, 1738, 3);
|
|
26249
26249
|
if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
26250
26250
|
const char* const bytes = __Pyx_PyBytes_AsString(data);
|
|
26251
26251
|
#if !CYTHON_ASSUME_SAFE_MACROS
|
|
26252
26252
|
if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
|
|
26253
26253
|
#endif
|
|
26254
|
-
#elif (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (
|
|
26255
|
-
const char* const cstring = "BZh91AY&
|
|
26256
|
-
PyObject *data = __Pyx_DecompressString(cstring,
|
|
26254
|
+
#elif (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (1853 bytes) */
|
|
26255
|
+
const char* const cstring = "BZh91AY&SYtC\034\233\000\001[\177\377\357\377\377\277\376\257\377\377\277\367\377\370\277\377\377\364@@@@@@@@@@@@@\000@\000`\007n\371\311*+7wv\326-\232Z\322\250\340 I(\232\232\203\324\310\017Q\3454{\324\230L\321@\320d\365<\246\203C\010hi\240\365=F\215\0324hz\236\240\366\202i\004\222\002\r\023D\332\022\237\223Tc(=C@\003 \032\000\000\000\000\000\320=M\2246PA\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\032\237\352\250\0215\000\320\323@\000\000\000\032\032\000\000\000\000\000\000\000\000\020`\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\004\246\210)\241\220\010a!\223&\232#\023A\243C@4\000\000\000\006@\001\243@\010\353]\006\013\267Z+\302\277\004E\3621\2029\004\003\314\243\356\245\211\223by\240F:\220q)25Y\177\004\377S\nS\002\004)\nR\022\"\"P\010!2C\025\255\347w\3062\213\246\306i\204\304190<\212Z\020\0012\2561\244\266\211\347\020ZE\"N\016IZ\352\246\246\010\262\264\256\032\310\204\001\345d&\360{\234\016\212E\203\325\031fb5\375\345\276a\311\305\323\177\027\361\027\365\037\325\207\030\307#\235[\374n\306\037\250~\364\250\376\253\255NxB\327\325\3132\271\324\367\022R\345\"9\305\355\001\263^\275\215\325\206\032J\026\241\321\2517M1QJ\367k\255\004\305\377#\316\354\343\231\237\322\236\215\2438\201\t\277}2\334Jl<\301\207a\003\031\251\213\335[\372\201\266\364\0308< \305\330\214\007\2530N\325_\007\271/b`\253E)\354\373O. E\300\347\261wkP\202$\"\016\236\275%K\262\220\270l\370\376\235\025u\270\370a\327\244\263u\033l7\0301f\010\311/\000\020\232Hf\224\334\3707\272&\326\315z\367\"\222\224\271u\232*V\265\254R\020\204%\231!\006|\316@\240\312\310\226l-:<3\022S\2319\302g\005\213)\232\327\034\343\221\031\363\024\354Nb`\230~\027a\257o\231\330\211\234Xvp\253q\356\273@]!\263\257\277F\003V\356\356\354DGw:\"\224\245\"\"\"V\276=\033f;Y\214WJ6\321(&\351\2624\262\206\020k\020\220e\330\355\010I\201t\200H\035\203\205\366\300\034\322l[S\346\323\350\2765U.nX\234\260qh5\2726\212\375\221\234\005k\337G\332J\351`\212F\027\234\247~\265\220\005 N\347M\353T\222rJ!$\222@\000+\266""\311}]+Z\246A)&\022\310\244\226\253\252\333\325[+\252\273\256\230,\227\225]p\000\000\026IzZ]Z\271+\032W\256\335\210\344\342\020\256zK\257\340\347\017\023\253\314\005\313\274\315L\231|\\/\3355G\277I(,)2%\212W\001\"C<\304\261\305\t\251'$\370\237\034\274\017\220\311\226s*\204\251\\'\313\264\350a\013\221\257<\202\226\031\347\200c\003\330'\t\202\2427\212\356\026\\\004IH\222\220\000\tD\241\033\037&{\003\005)&k]\203\331\242%\231\310\255\220\326\240\"\302W\323W:4\303>d\002-\317f\253^\327\304\315\027\353\010b/j5\355\335\203\225\242\354\206(\245$\354\303\004\362\244\204\220\010\000\001@\002\000g\352\251e\331&\021\235\367\324X\317~\261J\023\322\325\232I$\222I;>\002\310l\t\213\352\023\225\273\220\311\372!\003\212\271\261\321`\\\373\203,&!\242\363\216\265\002\021\2240(\373+,\213i\275\365\341P\374\022\022\336\2460\211\213\205\262\347`\300Z\32241\245\200\252\023i\337\326\246\256y\254\357\261\325h\341\266\210M\212BL\220\223\355\026\220es\305\350O G!\213{\200\317\312\316\332\320\006\254\234F\340m\266\3625\241Y\216\315\254\367\366\244`\277\222\304\275\204\000\000\000\000\"\"\210\317\317:JN\331h\261\322\351\332\373\002\364\225nK\035\370\017Y5\206\033m\206\313\202\0035\n\250\262\263f\240ll\342k\226\343\200\255\364+\202\330\235\220\226b2}Oz\023\255Hu\"\270\325\370:\235\350\314\017b\355\253\326\031\021r\242\021\246X\021\244{\330Q4\002v\254\262b\033\270\n\315\010\004s\250d\221\320\261\204\2539\375\206\272\267B\254(\032\313k`f\324\317\252e\333\253\031Y.Ih\260$\014\343z\250o\271\250\332Z\326\272n\2309:\346w\\\336{\357.'b\033\236\363\220uE/<s}6\203\03203\003TAJ\222j\251JR\274Z\361\030xi\230M\252c&2c,LT\265-D\3559\253\202\370\032K\271q\2149\234\005\326\0229\331b\026\027#\014\017\031\\\004\207\220\034\273g\244\226tR,H\275\31025\353\222\367R\034\027\024\r\372'\271\225&U0&0\357\273MU\244G\002\262\274\247\311\227\213\016hW\234\341\006\n\244\231$\201$\212Qu\020\352\333\010\2603_vk:1\371\354\256'q;\273\253\331d\330\220\206\233\025\202\245\371\3622EL\242\314n\003\222X`BW\315\246\237DA\262\257!1,X""\230\022xJ\345R\361 \355\000D#\234\303p1\316\315\343\330t\206.m\301@c\272\017\r!)\272\320\024\263\326\315\320\315\020\336\320W\014\241\276\366HFS\220\322\274\305\r\247K\271)\240+\242\267\214\006\355\210\304\2164q\243\215\034jH\324\211\242h\235\247@k\260\014\033\310W&\004k\361n\307\341\324)-\200\034\236P\315\252\304\301\266]wJ\021\247\254vV\225\353\357v\216\025'zyR\224\224\336q\273J\320\366\330\365\331KY\230\003\330k\346\032\244\346C\014\224\266xkFC\013\035\325\206k~\344\216\354\037\322\202\336a\031\305\362Q\263\367.i\355\016\344\376VTI@m\203\317\237\244r\347\\an&\216\3172(^\3156\t\270\316\321\207zq\370\266|\232\357CH\243\260\\\245\231K\24606\334P\267\363\254\361D\2501H\334\302\275\010\252?\030j\227\305v\320\337\342\235J\304j\221|\361\205\rF\017\010=^\032t\352\375H\023\302\035D\245_\257L\275\204\320\325\032\275\274\272\231\357\2059\231tk\223\303\276\330\006t\354O#>m\206\3629\316\264\374\371\265\265\260\244<\375\01436\207\320jXyO\323U\362\202\265\234\234\353:[#\246\0275\001\331\245\326\311\026@K\310\320\347\303\306\347\004K\306\033\274\035\030\335\020\304\273\236)+/_\257\341K\3767\021\351\233\014Zp\206\326\036\036\217\326\361\204\323g\215\271\320\353\312\264\tA4Aj\224\344\356A%bHx$\024\036PLv\"\035\210T!\351\t\232\034\240\356\362\240\322C\311\277\361w$S\205\t\007D1\311\260";
|
|
26256
|
+
PyObject *data = __Pyx_DecompressString(cstring, 1853, 2);
|
|
26257
26257
|
if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
26258
26258
|
const char* const bytes = __Pyx_PyBytes_AsString(data);
|
|
26259
26259
|
#if !CYTHON_ASSUME_SAFE_MACROS
|
|
26260
26260
|
if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
|
|
26261
26261
|
#endif
|
|
26262
|
-
#elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (
|
|
26263
|
-
const char* const cstring = "x\332\
|
|
26264
|
-
PyObject *data = __Pyx_DecompressString(cstring,
|
|
26262
|
+
#elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (1749 bytes) */
|
|
26263
|
+
const char* const cstring = "x\332\245WKs\033\305\026F\205\300&6\004\305y\024\217p\333@*EADd\344<\214 \245\004'\327\024\204(8\204\307\242\2535\323\222\007\217{\244\231n\331\242Xx\251\345,{9\313Yj\251\245\227Yz\251\245\177\302\375\t\367t\317C\257\031\010E\252F\356\376\316\351\363>\247;\367n\226\277(W\252\265\373\265\377\326vvl\233\266\211\215\232\216cS\302P\217\330\202n\241\307\016G\2249\242\275\207,\326\021\034\231\204\023\000)\342{\204\243\007}\276\3470dy\310\244\266\325\244.\341\324\356#\217\273\226\301\251\253\230\030z\262\375\344F\365N\025\021f\"\227\376N\r\356!O4\r\233x\036\365\220\323BMa\331\334b\210\367;\324+\243\235\026\352;\0021JM\304\035\324\001\276\351\003|\2172\344Q\256\026\350:a\314\341\204[\016\303p\334b\355\353\310\264\\Pb\365\250:\375\220\330\036-\377\3201\034\223\"\007<\000}.am\212n\336\330\330\334\334B\265\3063f\322\226\305@\233\243\331\266\0201M\014bi\255Y3M\203\037!\341)[\016-\203\226\365\376\220x\010\0304^6-\2174mJ\347\030\351\002#e\212\257m\324\366j\226\345E;\2239\020\274\026\0216G\030\273\324\024\006\305\030\231B[\317\034v\003\202\331\263 5\030\033\026\2638V\226\241f\237S\017\214\357\326T\260Y\333s\204k\320\2579\331\247X\323\220A \245&j9.\262-\217k\212\ti\231&hNMQ,\331\024\220\277 \353\300kw\210\261\377\271\341\270\264\334\351\037\335'\036\375\206\252\330\335\027\255\026u\347\367\345\3243CW\014\306\031\034\220R\320\310\377\202\3075#\337\262\010-\333!\374N\026\305b\274\222\203o\344\340\325\034<S>\004(\013\026yzE\236b\221\247Y$\252\267\331l\214\247\367\3311\236\343\310\214\361\014\017\361&1\236!\034\272\371\204I\360\347)I\0202\360\215\034\274\232\203g\312\217\203?\017\213<\275\"O\261\310\323\254\203?\235\221h\375\200\037\245\213\305\320O\223\026b>!N\332u\016S\215:\007\251\306\233\203\300\3719\204\213\216=\343A\264\006z\272X4v\232\264`\354\204\010\343?\262u\026R\246\316\"\036\355\n\312\014:\207rw\026\320W\314c\207\321]\030\373\030?\351\037\301\367\rH\303\217\351\021\177J[?\222\326L+\314\357\027=\311\340Xph\201'\035\036Y\024UG9\370F\016^\315\3013\345\213<\005\"O\203\310S!""\022\035\323\371\237\337g\307\354\357\246\304\002O\332\363Y\224\304\245\254\236\317\301\2539x\246|\221\247@\344i\020y*t\314v\277\217\256\263m\327u\\\214\343\027\005\224d2\013\211\327g\206\345\224\341\272\203\027\004\274\024<\005;\256I]\303\206-X\212\271K\014\332\004)J\201a6EK}Xw\245\256tS\247\013\267\\\347 \222:\r\250\346\306\272\225p\362\307t\014\214)\310P\037N\033\206j\017\222\265\t\235\002\277\030\267\004\003v\214\333I\3520\266<\234\032lqz\340\331\026\3476P\016\010\330\013\377\016('\372Q\2457\216)\024\021V\256\203)\203W\005\005\002\334\364\300\313\310\201&1z\210\261\nU\307\351\300\302\245\035\342\002!\235\014\311<\230\236\002q\357\247\016\000;t\272\261G\215}O\034D;\227z\360\376\211\326\261\371j\311\365`P+\301:\226\261\017\366\315_\217\031\344\351\034\317\221\347\333&\203\274x\272\307\325;M\271\337\025\304\216B\221\274D\322\331\021\217\212x2\304\203 \356\373\350\215\2204{\322\333I+'\235;y\374-\264h\n\320#\325\234vK\267h\234\025X\305\357\307\251\306\305\031M\3549.W\037\336\247}\017HnD\007\323\004<\311\373\336\3442J\257\240\364\342I\256\233\311%\203\261b\204\337\370-\250\232\203\352\214A8a/:\360_\005\n\317\336\324\020\235}\375\003u\325\243\256\247\336\3548yV\244\023%\036 \361\274\210\307C<\r\242\013?\031\001I\307'\r\236\364\363q\341\177\313\257\274\266:\370Z\226\344'A%x\024\336\036\256\037\027\316\212+\203{r]\336\r\352\301\363\260~\\\037/\277'+\343\345\363\003\356\177)\211<\014H \"|eP\005\360\256|\030\334\010\273\303\302xyu\360\255O\374n\304\274)\337\010J\301\307\001y\031\326%\331\r\212A*\265/_\227\007a%\254\247\214g\313o\373\372\330\266\177\t\366\\\336\n\326\202\372x\365m\377<\034-L-J~\311\277\026I\356\376\003yw\202\315p\tl;?\352\236\024\322\303\357\313z\246\353\221\224CI\203\333\341zXQ\020\002\007\276\033\026\206\2451\210^\221\233A!(-\340\253r\033\202\262\276\200\277!/\201\202\356\002~N^S^)\374Z\260\033\226\316&\201S~u\375%0\242\035\374\024~5*\214\256\236\220\023p\354\242\377(J\330\037rM\326e\343l\371\315\3013\377c\277-w\203w\224\265\3437/\374\253\355G\376\317/""\277\375\320\337\211\267[\303_Fd\324\177Q\310\202\377xQ\032_]\237\005\316\226/\203\253=\331P\361\336\361\033>\224\322\331\362U8WR\310w\262 KQv\252~W\236Kj\355\252|\026\\\017K\341\372$s\375\360U\225\375\210\372k\340i\343&\245p\td\233\362\272\022\033k<\323\225qE\276\005)\357\205\ru0\246\034\307\005q\027B\373T\227Dw\032\372\t\312\250\020^\0165\370\256\\\317\254\236i\3500\324^M C\231\036q\t\277\356\357\312R\264\351\371\317\265\374j\320\207\352X\033\326\207\215\343\302\270xn\360\251\337\210z\371\255\301\256_\032\027W\007\217\374\212\377P~\026\220qq\351\2707x\356o\313\213*\212\027|\260\347\212\362\370\212\256x\250]\305\241z\345\364|exq\330\030\266G\277\275Xz\001\0343Ha\242\340\262\356\275\213A\343\345\025m\006KA\367%\025\235\026?\204\344]\nI\310\207[#\355a\0316=\345\354Y\361?\262{\212n\016WF_\236\354\2376\236\216\213k\247k\037\005wtg\203\374?\375\333*\342\033\303\365\323/\036\236\260\323\335gc\230f\225\323\342\275\021\250\376\000\272\365VXR\213\375\360B\270\021\376\030u\331\312\340\226\377\201\352\262\251\346\312\256\210\007*#\343UH+\204\240\224.\376\017\303V\031\r";
|
|
26264
|
+
PyObject *data = __Pyx_DecompressString(cstring, 1749, 1);
|
|
26265
26265
|
if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
26266
26266
|
const char* const bytes = __Pyx_PyBytes_AsString(data);
|
|
26267
26267
|
#if !CYTHON_ASSUME_SAFE_MACROS
|
|
26268
26268
|
if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
|
|
26269
26269
|
#endif
|
|
26270
|
-
#else /* compression: none (
|
|
26271
|
-
const char* const bytes = "?0.3.
|
|
26270
|
+
#else /* compression: none (4643 bytes) */
|
|
26271
|
+
const char* const bytes = "?0.3.14<B<H<IIllegal boolean value: Not enough input dataNote that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.Opcode out of range 0-255: <QUndefined opcode: add_note<b<ddctx used twice.dctx was not used.disableectx used twice.ectx was not used.enablegc<h<iisenabledno default __reduce__ due to non-trivial __cinit__not bytes: <q<stringsource>take_bytes called for listtake_dict called for bytestake_list called for bytestake_str called for listtmsgpack/core.pyxBaseDecodeBufferBaseDecodeBuffer.__reduce_cython__BaseDecodeBuffer.__setstate_cython__BaseDecodeBuffer.rd_bytesBaseDecodeBuffer.rd_float8BaseDecodeBuffer.rd_int1BaseDecodeBuffer.rd_int2BaseDecodeBuffer.rd_int4BaseDecodeBuffer.rd_int8BaseDecodeBuffer.rd_strBaseDecodeBuffer.rd_uint1BaseDecodeBuffer.rd_uint2BaseDecodeBuffer.rd_uint4BaseDecodeBuffer.rd_uint8BaseEncodeBufferBaseEncodeBuffer.__reduce_cython__BaseEncodeBuffer.__setstate_cython__BaseEncodeBuffer.as_bytesBaseEncodeBuffer.wr_bytesBaseEncodeBuffer.wr_float8BaseEncodeBuffer.wr_int1BaseEncodeBuffer.wr_int2BaseEncodeBuffer.wr_int4BaseEncodeBuffer.wr_int8BaseEncodeBuffer.wr_strBaseEncodeBuffer.wr_uint1BaseEncodeBuffer.wr_uint2BaseEncodeBuffer.wr_uint4BaseEncodeBuffer.wr_uint8DecodeBufferDecodeCtxDecodeCtx.__reduce_cython__DecodeCtx.__setstate_cython__DecodeCtx.take_bytesDecodeCtx.take_dictDecodeCtx.take_listDecodeCtx.take_strDecodeCtx.take_tupleEncodeBufferEncodeCtxEncodeCtx.__reduce_cython__EncodeCtx.__setstate_cython__EncodeCtx.put_bytesEncodeCtx.put_dictEncodeCtx.put_sequenceEncodeCtx.put_strEncodeCtx.put_valueNoneType__Pyx_PyDict_NextRefSafeDecodeBufferSafeDecodeBuffer.__reduce_cython__SafeDecodeBuffer.__setstate_cython__SafeDecodeBuffer.rd_float8SafeDecodeBuffer.rd_int1SafeDecodeBuffer.rd_int2SafeDecodeBuffer.rd_int4SafeDecodeBuffer.rd_int8SafeDecodeBuffer.rd_uint1SafeDecodeBuffer.rd_uint2SafeDecodeBuffer.rd_uint4SafeDecodeBuffer.rd_""uint8SafeEncodeBufferSafeEncodeBuffer.__reduce_cython__SafeEncodeBuffer.__setstate_cython__SafeEncodeBuffer.wr_float8SafeEncodeBuffer.wr_int1SafeEncodeBuffer.wr_int2SafeEncodeBuffer.wr_int4SafeEncodeBuffer.wr_int8SafeEncodeBuffer.wr_uint1SafeEncodeBuffer.wr_uint2SafeEncodeBuffer.wr_uint4SafeEncodeBuffer.wr_uint8TMsgpackError__annotate__as_bytesasyncio.coroutinesbyteordercline_in_tracebackcodecdbufdbuf_take_valuedecode_from_bytesdecode_from_list__dict___dict__doc__ebufebuf_put_valueencode_valueendextend__func____getstate___is_coroutineitemslittle__main____metaclass____module____mro_entries__msgn__name____new__packpop__prepare__put_bytesput_dictput_sequenceput_strput_value__pyx_checksum__pyx_result__pyx_state__pyx_type__pyx_unpickle_BaseDecodeBuffer__pyx_unpickle_BaseEncodeBuffer__pyx_unpickle_SafeDecodeBuffer__pyx_unpickle_SafeEncodeBuffer__pyx_vtable____qualname__rd_bytesrd_float8rd_int1rd_int2rd_int4rd_int8rd_strrd_uint1rd_uint2rd_uint4rd_uint8__reduce____reduce_cython____reduce_ex__self__set_name__setdefault__setstate____setstate_cython__sortsort_keysstartstatestructsystake_bytestake_dicttake_listtake_strtake_tuple__test__tmsgpack.core_typeunpackupdateuse_setstatevaluevalues__version__wr_byteswr_float8wr_int1wr_int2wr_int4wr_int8wr_strwr_uint1wr_uint2wr_uint4wr_uint8\200\001\360\010\000\005\014\210>\230\021\230)\2401\240G\2507\260!\200\001\340\004\013\210?\230!\2309\240A\240W\250A\200A\330\010\033\2301\330\010\017\210t\220;\230a\230w\240a\240u\250A\200A\330\010\013\2104\210t\2209\230F\240-\250q\260\001\330\010\014\210J\220a\220q\330\010\017\210t\2205\230\t\240\021\240$\240a\200A\330\010\013\2104\210t\2209\230F\240-\250q\260\001\330\010\014\210J\220a\220q\330\010\017\210t\2205\230\007\230q\240\004\240A\200A\330\010\013\2104\210y\230\006\230m\2501\250A\330\010\014\210J\220a\220q\340\010\020\220\001\330\010\014\210E\220\025\220a\220t\2306\240\023\240A\330\014\020\220\017\230q\240\001\330\014\020\220\017\230q\240\001\330\014\021\220\021\220%\220q\330\010\017\210q\200A""\330\010\013\2104\210y\230\006\230m\2501\250A\330\010\014\210J\220a\220q\340\010\020\220\001\330\010\014\210E\220\025\220a\220t\2308\2405\250\007\250q\260\017\270q\300\001\330\010\017\210q\200A\330\010\034\230A\330\010\017\210t\220;\230a\230w\240a\240u\250A\200A\330\010\014\210J\220a\220w\230e\2407\250!\2501\200A\330\010 \240\004\240L\260\001\260\021\330\010\020\220\013\2305\240\001\240\021\200A\330\010 \240\004\240L\260\001\260\021\330\010\020\220\014\230E\240\021\240!\200A\330\010 \240\004\240L\260\001\260\021\330\010\020\220\t\230\025\230a\230q\200A\330\010 \240\004\240L\260\001\260\021\330\010\020\220\n\230%\230q\240\001\200A\330\010%\240T\250\021\340\010\014\210J\220a\220q\330\010\013\2104\210q\220\007\220w\230g\240V\250=\270\001\270\035\300a\300q\340\010\024\220G\2301\330\010\017\210z\230\023\230A\230Q\340\010\r\210U\220$\220g\230T\240\031\250!\2501\330\r\022\220$\220g\230T\240\031\250!\2501\330\r\022\220$\220g\230T\240\031\250!\2501\330\r\022\220$\220g\230T\240\031\250!\2501\330\r\022\220$\220g\230T\240\031\250!\2501\330\r\022\220#\220X\230T\240\031\250!\2501\330\r\022\220#\220X\230T\240\031\250!\2501\330\r\022\220#\220X\230T\240\031\250!\2501\330\r\022\220\"\220I\230T\240\031\250!\250:\260Y\270a\270y\310\001\330\r\022\220\"\220I\230T\240\031\250!\250:\260Y\270a\270z\310\021\330\035!\240\031\250!\250:\260Y\270a\270z\310\021\340\010\026\220a\220v\230Q\330\010\014\210I\220Q\220a\200A\340\010\035\230T\240\021\330\010\014\210L\230\001\230\021\330\010\017\210t\2204\220q\230\n\240$\240a\200A\330\010\035\230U\240'\250\021\250!\330\010\017\210t\220;\230a\230y\250\003\2501\250A\200A\330\010\035\230Z\240s\250!\2501\330\010\014\210J\220a\220q\340\010\025\220Q\220d\230'\240\021\330\010\026\220a\220v\230Q\340\010\014\210E\220\027\230\016\240a\240v\250Q\200A\330\010\026\220a\220v\230Q\200A\330\010\017\210t\2209\230A\230R\230w\240a\240q\200A\330\010\017\210t\2209\230A\230V\2405\250\001\250\026\250q\200A\330\010\032\230!\330\010\017\210t\220;\230a\230w\240a\240u\250A\200A""\330\010\017\210t\220;\230a\230w\240a\240w\250a\200A\340\010\017\210t\220;\230a\230w\240c\250\021\250!\200A\330\010\017\210u\220A\220T\230\021\200A\330\010\017\210v\220W\230A\230V\2404\240y\260\001\260\023\260A\260Q\200\001\330\004\n\210+\220Q\200\001\360\010\000\005\016\210T\220\021\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220E\230\024\230Q\330\010\022\220!\330\010\027\220q\340\010\027\220t\2308\2407\250!\330\004\007\200q\330\010\017\320\0171\260\024\260Q\260g\270[\310\007\310q\340\010\017\320\0171\260\024\260Q\260g\270[\310\001\200\001\360\010\000\005\016\210T\220\026\220t\2306\240\024\240Q\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220E\230\024\230Q\330\010\022\220!\330\010\027\220q\340\010\027\220t\2305\240\007\240q\330\004\007\200q\330\010\017\320\0171\260\024\260Q\260g\270[\310\007\310q\340\010\017\320\0171\260\024\260Q\260g\270[\310\001\320\004\"\240'\250\025\250a\250t\260:\270Q\200\001\330\004.\250a\250v\260Q\200\001\340\004\037\230q\320 0\260\013\270;\300k\320QR\330\004\023\320\023#\2408\2501\250A\330\004\007\200|\2207\230!\330\0102\260!\3203F\300n\320TU\330\004\013\2101\320\004?\270q\330\010\036\230e\2406\250\021\330\010\036\230k\250\022\2502\250S\260\001\260\021\330\010\013\2106\220\036\230q\240\001\340\010\014\210J\220a\220q\330\010\025\220Q\220d\230'\240\021\330\010\026\220a\220v\230Q\340\010\014\210C\210u\220A\330\014\032\230!\2306\240\021\330\014\032\230!\2306\240\021";
|
|
26272
26272
|
PyObject *data = NULL;
|
|
26273
26273
|
CYTHON_UNUSED_VAR(__Pyx_DecompressString);
|
|
26274
26274
|
#endif
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# THIS FILE IS AUTOMATICALLY CREATED BY build_pyx.py
|
|
2
2
|
# DON'T EDIT THIS FILE. EDIT THE SOURCES, INSTEAD: tmsgpack/src-parts/*
|
|
3
3
|
|
|
4
|
-
__version__ = "0.3.
|
|
4
|
+
__version__ = "0.3.14"
|
|
5
5
|
|
|
6
6
|
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t
|
|
7
7
|
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t
|
|
@@ -5,10 +5,12 @@ pyproject.toml
|
|
|
5
5
|
setup.py
|
|
6
6
|
tests/test_build_pyx.py
|
|
7
7
|
tests/test_codec.py
|
|
8
|
+
tests/test_codec_custom.py
|
|
8
9
|
tests/test_round_trip.py
|
|
9
10
|
tmsgpack/__init__.py
|
|
10
11
|
tmsgpack/api.py
|
|
11
12
|
tmsgpack/codec.py
|
|
13
|
+
tmsgpack/codec_custom.py
|
|
12
14
|
tmsgpack/core.c
|
|
13
15
|
tmsgpack/core.pyx
|
|
14
16
|
tmsgpack.egg-info/PKG-INFO
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|