moat-lib-codec 0.4.21__tar.gz → 0.4.22__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.
- {moat_lib_codec-0.4.21/src/moat_lib_codec.egg-info → moat_lib_codec-0.4.22}/PKG-INFO +1 -1
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/debian/changelog +6 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/pyproject.toml +1 -1
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/_base.py +2 -2
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/_cbor.py +11 -11
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/_moat_cbor.py +1 -1
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/_moat_msgpack.py +1 -1
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/bool.py +2 -2
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/cbor.py +1 -1
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/errors.py +1 -1
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/json.py +1 -1
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/jsonvalstr.py +1 -1
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/jsonvalue.py +1 -1
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/msgpack.py +11 -11
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/noop.py +2 -2
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/utf8.py +1 -1
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/yaml.py +1 -1
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22/src/moat_lib_codec.egg-info}/PKG-INFO +1 -1
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/LICENSE.txt +0 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/Makefile +0 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/README.md +0 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/debian/.gitignore +0 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/debian/control +0 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/debian/py3dist-overrides +0 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/debian/rules +0 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/setup.cfg +0 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/__init__.py +0 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/binary.py +0 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/moat_cbor.py +0 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/moat_kv.py +0 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/moat_msgpack.py +0 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat/lib/codec/null.py +0 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat_lib_codec.egg-info/SOURCES.txt +0 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat_lib_codec.egg-info/dependency_links.txt +0 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat_lib_codec.egg-info/requires.txt +0 -0
- {moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat_lib_codec.egg-info/top_level.txt +0 -0
|
@@ -25,7 +25,7 @@ maintainers = [{email = "matthias@urlichs.de",name = "Matthias Urlichs"}]
|
|
|
25
25
|
description='A simple command/stream multiplexer'
|
|
26
26
|
readme = "README.md"
|
|
27
27
|
authors = [{email = "matthias@urlichs.de",name = "Matthias Urlichs"}]
|
|
28
|
-
version = "0.4.
|
|
28
|
+
version = "0.4.22"
|
|
29
29
|
|
|
30
30
|
[project.urls]
|
|
31
31
|
homepage = "https://m-o-a-t.org"
|
|
@@ -42,7 +42,7 @@ class Codec:
|
|
|
42
42
|
``__anext__``.
|
|
43
43
|
"""
|
|
44
44
|
|
|
45
|
-
def __init__(self, ext=None):
|
|
45
|
+
def __init__(self, ext=None) -> None:
|
|
46
46
|
if ext is None:
|
|
47
47
|
ext = Extension() # empty
|
|
48
48
|
self.ext = ext
|
|
@@ -113,7 +113,7 @@ if TYPE_CHECKING:
|
|
|
113
113
|
|
|
114
114
|
|
|
115
115
|
class Extension:
|
|
116
|
-
def __init__(self):
|
|
116
|
+
def __init__(self) -> None:
|
|
117
117
|
self.enc: dict[type, tuple[int | None, Callable]] = {}
|
|
118
118
|
self.dec: dict[int, Callable] = {}
|
|
119
119
|
|
|
@@ -42,11 +42,11 @@ CBOR_TAG_CBOR_LEADER = const(55800) # header for multiple CBOR items
|
|
|
42
42
|
class Tag:
|
|
43
43
|
"a random CBOR tag"
|
|
44
44
|
|
|
45
|
-
def __init__(self, tag: int, value: Any = None):
|
|
45
|
+
def __init__(self, tag: int, value: Any = None) -> None:
|
|
46
46
|
self.tag = tag
|
|
47
47
|
self.value = value
|
|
48
48
|
|
|
49
|
-
def __repr__(self):
|
|
49
|
+
def __repr__(self) -> str:
|
|
50
50
|
return f"Tag({self.tag!r}, {self.value!r})"
|
|
51
51
|
|
|
52
52
|
def __eq__(self, other):
|
|
@@ -107,7 +107,7 @@ def _bignum_to_bytearray(val):
|
|
|
107
107
|
class ExtraData(ValueError):
|
|
108
108
|
"buffer contains data beyond end of encoded object"
|
|
109
109
|
|
|
110
|
-
def __str__(self):
|
|
110
|
+
def __str__(self) -> str:
|
|
111
111
|
return "decoder received extra data."
|
|
112
112
|
|
|
113
113
|
|
|
@@ -119,7 +119,7 @@ class Codec(_Codec):
|
|
|
119
119
|
|
|
120
120
|
_buf_out: bytearray | None = None
|
|
121
121
|
|
|
122
|
-
def __init__(self, use_attrdict: bool = False, **kw):
|
|
122
|
+
def __init__(self, use_attrdict: bool = False, **kw) -> None:
|
|
123
123
|
super().__init__(**kw)
|
|
124
124
|
self.use_attrdict = use_attrdict
|
|
125
125
|
self.__kw = kw
|
|
@@ -247,7 +247,7 @@ class Codec(_Codec):
|
|
|
247
247
|
self._enc_type_num(CBOR_BYTES, len(outb))
|
|
248
248
|
w(outb)
|
|
249
249
|
|
|
250
|
-
def _enc_string(self, val):
|
|
250
|
+
def _enc_string(self, val) -> None:
|
|
251
251
|
if isinstance(val, str):
|
|
252
252
|
val = val.encode("utf8", "surrogateescape")
|
|
253
253
|
self._enc_type_num(CBOR_TEXT, len(val))
|
|
@@ -255,7 +255,7 @@ class Codec(_Codec):
|
|
|
255
255
|
self._enc_type_num(CBOR_BYTES, len(val))
|
|
256
256
|
self._w(val)
|
|
257
257
|
|
|
258
|
-
def _enc_array(self, arr):
|
|
258
|
+
def _enc_array(self, arr) -> None:
|
|
259
259
|
try:
|
|
260
260
|
self._enc_type_num(CBOR_ARRAY, len(arr))
|
|
261
261
|
except TypeError:
|
|
@@ -267,26 +267,26 @@ class Codec(_Codec):
|
|
|
267
267
|
for x in arr:
|
|
268
268
|
self._enc_any(x)
|
|
269
269
|
|
|
270
|
-
def _enc_dict(self, d):
|
|
270
|
+
def _enc_dict(self, d) -> None:
|
|
271
271
|
self._enc_type_num(CBOR_MAP, len(d))
|
|
272
272
|
for k, v in d.items():
|
|
273
273
|
self._enc_any(k)
|
|
274
274
|
self._enc_any(v)
|
|
275
275
|
|
|
276
|
-
def _enc_bool(self, b):
|
|
276
|
+
def _enc_bool(self, b) -> None:
|
|
277
277
|
self._w(struct.pack("B", CBOR_TRUE if b else CBOR_FALSE))
|
|
278
278
|
|
|
279
|
-
def _enc_tag(self, t, val=...):
|
|
279
|
+
def _enc_tag(self, t, val=...) -> None:
|
|
280
280
|
if val is Ellipsis:
|
|
281
281
|
t, val = t.tag, t.value
|
|
282
282
|
self._enc_type_num(CBOR_TAG, t)
|
|
283
283
|
self._enc_any(val)
|
|
284
284
|
|
|
285
|
-
def _w(self, d):
|
|
285
|
+
def _w(self, d) -> None:
|
|
286
286
|
assert self._buf_out is not None # set by encode() before calling _enc_any()
|
|
287
287
|
self._buf_out.extend(d)
|
|
288
288
|
|
|
289
|
-
def _enc_any(self, ob):
|
|
289
|
+
def _enc_any(self, ob) -> None:
|
|
290
290
|
w = self._w
|
|
291
291
|
if ob is None:
|
|
292
292
|
w(struct.pack("B", CBOR_NULL))
|
|
@@ -14,7 +14,7 @@ class Codec(_Codec):
|
|
|
14
14
|
|
|
15
15
|
null: bytes | None = None
|
|
16
16
|
|
|
17
|
-
def __init__(self, on="on", off="off", null=None, **kw):
|
|
17
|
+
def __init__(self, on="on", off="off", null=None, **kw) -> None:
|
|
18
18
|
super().__init__(**kw)
|
|
19
19
|
if on is not None:
|
|
20
20
|
self.on = on.encode("utf-8", "surrogateescape")
|
|
@@ -33,7 +33,7 @@ class Codec(_Codec):
|
|
|
33
33
|
return self.on
|
|
34
34
|
raise ValueError(obj)
|
|
35
35
|
|
|
36
|
-
def decode(self, data):
|
|
36
|
+
def decode(self, data) -> bool | None:
|
|
37
37
|
"some text > bool"
|
|
38
38
|
if data == self.on:
|
|
39
39
|
return True
|
|
@@ -28,7 +28,7 @@ class SilentRemoteError(RemoteError): # ty:ignore[unsupported-base] # RemoteEr
|
|
|
28
28
|
class NoPathError(KeyError):
|
|
29
29
|
"""An error that marks a nonexisting path"""
|
|
30
30
|
|
|
31
|
-
def __str__(self):
|
|
31
|
+
def __str__(self) -> str:
|
|
32
32
|
from moat.lib.path import Path # noqa: PLC0415
|
|
33
33
|
|
|
34
34
|
return (
|
|
@@ -10,7 +10,7 @@ from .jsonvalue import Codec as _Codec
|
|
|
10
10
|
class Codec(_Codec):
|
|
11
11
|
"JSON+Value using a stringified element"
|
|
12
12
|
|
|
13
|
-
def __init__(self, ext=None):
|
|
13
|
+
def __init__(self, ext=None) -> None:
|
|
14
14
|
if ext is not None:
|
|
15
15
|
raise ValueError("You can't extend the JSON codec")
|
|
16
16
|
super().__init__()
|
|
@@ -8,7 +8,7 @@ from .json import Codec as _Codec
|
|
|
8
8
|
class Codec(_Codec):
|
|
9
9
|
"JSON codec with 'value' element"
|
|
10
10
|
|
|
11
|
-
def __init__(self, ext=None):
|
|
11
|
+
def __init__(self, ext=None) -> None:
|
|
12
12
|
if ext is not None:
|
|
13
13
|
raise ValueError("You can't extend the JSON codec")
|
|
14
14
|
super().__init__()
|
|
@@ -39,7 +39,7 @@ __all__ = ["Codec", "ExtType"]
|
|
|
39
39
|
class Codec(_Codec):
|
|
40
40
|
"Extensible msgpack codec"
|
|
41
41
|
|
|
42
|
-
def __init__(self, use_attrdict: bool = False, **kw):
|
|
42
|
+
def __init__(self, use_attrdict: bool = False, **kw) -> None:
|
|
43
43
|
# TODO add keywords for msgpack enc/dec settings
|
|
44
44
|
super().__init__(**kw)
|
|
45
45
|
self.use_attrdict = use_attrdict
|
|
@@ -76,7 +76,7 @@ class Codec(_Codec):
|
|
|
76
76
|
except NoCodecError:
|
|
77
77
|
return ExtType(key, data)
|
|
78
78
|
|
|
79
|
-
def feed(self, data):
|
|
79
|
+
def feed(self, data) -> None:
|
|
80
80
|
"Add more bytes. Returns an iterator for the result."
|
|
81
81
|
self.stream.feed(data)
|
|
82
82
|
|
|
@@ -107,24 +107,24 @@ class FormatError(UnpackException):
|
|
|
107
107
|
class ExtraData(ValueError):
|
|
108
108
|
"too much data in buffer"
|
|
109
109
|
|
|
110
|
-
def __init__(self, unpacked, extra):
|
|
110
|
+
def __init__(self, unpacked, extra) -> None:
|
|
111
111
|
self.unpacked = unpacked
|
|
112
112
|
self.extra = extra
|
|
113
113
|
|
|
114
|
-
def __str__(self):
|
|
114
|
+
def __str__(self) -> str:
|
|
115
115
|
return "unpack(b) received extra data."
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
class ExtType:
|
|
119
119
|
"""ExtType represents extension types in msgpack."""
|
|
120
120
|
|
|
121
|
-
def __init__(self, code, data):
|
|
121
|
+
def __init__(self, code, data) -> None:
|
|
122
122
|
if isinstance(data, memoryview):
|
|
123
123
|
data = bytes(data)
|
|
124
124
|
self.code = code
|
|
125
125
|
self.data = data
|
|
126
126
|
|
|
127
|
-
def __repr__(self):
|
|
127
|
+
def __repr__(self) -> str:
|
|
128
128
|
return f"Ext({self.code}:{self.data})"
|
|
129
129
|
|
|
130
130
|
|
|
@@ -180,7 +180,7 @@ class Unpacker:
|
|
|
180
180
|
ext_hook=ExtType,
|
|
181
181
|
use_attrdict=False,
|
|
182
182
|
min_memview_len=-1,
|
|
183
|
-
):
|
|
183
|
+
) -> None:
|
|
184
184
|
#: array of bytes fed.
|
|
185
185
|
self._buffer = bytearray()
|
|
186
186
|
#: Which position we currently reads
|
|
@@ -190,7 +190,7 @@ class Unpacker:
|
|
|
190
190
|
self._min_memview_len = min_memview_len
|
|
191
191
|
self._use_attrdict = use_attrdict
|
|
192
192
|
|
|
193
|
-
def feed(self, data):
|
|
193
|
+
def feed(self, data) -> None:
|
|
194
194
|
"set the buffer"
|
|
195
195
|
if self._buffer and self._buf_pos < len(self._buffer):
|
|
196
196
|
if self._buf_pos == 0:
|
|
@@ -235,7 +235,7 @@ class Unpacker:
|
|
|
235
235
|
self._buf_pos = i + len(ret)
|
|
236
236
|
return ret
|
|
237
237
|
|
|
238
|
-
def _reserve(self, n):
|
|
238
|
+
def _reserve(self, n) -> None:
|
|
239
239
|
remain_bytes = len(self._buffer) - self._buf_pos - n
|
|
240
240
|
|
|
241
241
|
# Fast path: buffer has n bytes already
|
|
@@ -394,12 +394,12 @@ class Packer:
|
|
|
394
394
|
self,
|
|
395
395
|
# unicode_errors=None,
|
|
396
396
|
default=None,
|
|
397
|
-
):
|
|
397
|
+
) -> None:
|
|
398
398
|
self._buffer = BytesIO()
|
|
399
399
|
# self._unicode_errors = unicode_errors or "strict"
|
|
400
400
|
self._default = default
|
|
401
401
|
|
|
402
|
-
def _pack(self, obj, default=None):
|
|
402
|
+
def _pack(self, obj, default=None) -> None:
|
|
403
403
|
# Warning, does not deal with recursive data structures
|
|
404
404
|
# (except by running out of memory)
|
|
405
405
|
list_types = (list, tuple)
|
|
@@ -8,7 +8,7 @@ from ._base import Codec as _Codec
|
|
|
8
8
|
class Codec(_Codec):
|
|
9
9
|
"no-op codec"
|
|
10
10
|
|
|
11
|
-
def __init__(self, ext=None):
|
|
11
|
+
def __init__(self, ext=None) -> None:
|
|
12
12
|
if ext is not None:
|
|
13
13
|
raise ValueError("You can't extend the Null codec")
|
|
14
14
|
super().__init__()
|
|
@@ -26,7 +26,7 @@ class Codec(_Codec):
|
|
|
26
26
|
"no-op decode"
|
|
27
27
|
return data
|
|
28
28
|
|
|
29
|
-
def feed(self, data):
|
|
29
|
+
def feed(self, data) -> None:
|
|
30
30
|
"no-op feed"
|
|
31
31
|
self._buf += data
|
|
32
32
|
|
|
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
|
{moat_lib_codec-0.4.21 → moat_lib_codec-0.4.22}/src/moat_lib_codec.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|