runtimepy 5.11.1__py3-none-any.whl → 5.11.3__py3-none-any.whl
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.
- runtimepy/__init__.py +2 -2
- runtimepy/codec/protocol/base.py +1 -0
- runtimepy/codec/protocol/json.py +7 -1
- runtimepy/codec/system/__init__.py +25 -13
- runtimepy/enum/registry.py +11 -1
- runtimepy/primitives/byte_order.py +33 -2
- runtimepy/util.py +3 -3
- {runtimepy-5.11.1.dist-info → runtimepy-5.11.3.dist-info}/METADATA +6 -6
- {runtimepy-5.11.1.dist-info → runtimepy-5.11.3.dist-info}/RECORD +13 -13
- {runtimepy-5.11.1.dist-info → runtimepy-5.11.3.dist-info}/WHEEL +0 -0
- {runtimepy-5.11.1.dist-info → runtimepy-5.11.3.dist-info}/entry_points.txt +0 -0
- {runtimepy-5.11.1.dist-info → runtimepy-5.11.3.dist-info}/licenses/LICENSE +0 -0
- {runtimepy-5.11.1.dist-info → runtimepy-5.11.3.dist-info}/top_level.txt +0 -0
runtimepy/__init__.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# =====================================
|
|
2
2
|
# generator=datazen
|
|
3
3
|
# version=3.1.4
|
|
4
|
-
# hash=
|
|
4
|
+
# hash=f45f335bfb519a5a33f13603258a4d33
|
|
5
5
|
# =====================================
|
|
6
6
|
|
|
7
7
|
"""
|
|
@@ -10,7 +10,7 @@ Useful defaults and other package metadata.
|
|
|
10
10
|
|
|
11
11
|
DESCRIPTION = "A framework for implementing Python services."
|
|
12
12
|
PKG_NAME = "runtimepy"
|
|
13
|
-
VERSION = "5.11.
|
|
13
|
+
VERSION = "5.11.3"
|
|
14
14
|
|
|
15
15
|
# runtimepy-specific content.
|
|
16
16
|
METRICS_NAME = "metrics"
|
runtimepy/codec/protocol/base.py
CHANGED
runtimepy/codec/protocol/json.py
CHANGED
|
@@ -25,6 +25,7 @@ from runtimepy.primitives.field.manager import (
|
|
|
25
25
|
VALUES_KEY,
|
|
26
26
|
BitFieldsManager,
|
|
27
27
|
)
|
|
28
|
+
from runtimepy.primitives.serializable import SerializableMap
|
|
28
29
|
|
|
29
30
|
BUILD_KEY = "build"
|
|
30
31
|
META_KEY = "meta"
|
|
@@ -96,7 +97,11 @@ class JsonProtocol(ProtocolBase):
|
|
|
96
97
|
return data
|
|
97
98
|
|
|
98
99
|
@classmethod
|
|
99
|
-
def import_json(
|
|
100
|
+
def import_json(
|
|
101
|
+
cls: type[T],
|
|
102
|
+
data: dict[str, _JsonObject],
|
|
103
|
+
serializables: SerializableMap = None,
|
|
104
|
+
) -> T:
|
|
100
105
|
"""Create a bit-fields manager from JSON data."""
|
|
101
106
|
|
|
102
107
|
# Only set values once (at the end).
|
|
@@ -126,6 +131,7 @@ class JsonProtocol(ProtocolBase):
|
|
|
126
131
|
identifier=_cast(int, data[META_KEY]["id"]),
|
|
127
132
|
byte_order=_cast(str, data[META_KEY]["byte_order"]),
|
|
128
133
|
alias=data[META_KEY]["alias"], # type: ignore
|
|
134
|
+
serializables=serializables,
|
|
129
135
|
)
|
|
130
136
|
|
|
131
137
|
# Set values.
|
|
@@ -3,23 +3,24 @@ A basic type-system implementation.
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
# built-in
|
|
6
|
-
from typing import Iterable, Optional
|
|
6
|
+
from typing import Iterable, Optional, Union
|
|
7
7
|
|
|
8
8
|
# third-party
|
|
9
9
|
from vcorelib.logging import LoggerMixin
|
|
10
10
|
from vcorelib.namespace import CPP_DELIM, Namespace
|
|
11
11
|
|
|
12
12
|
# internal
|
|
13
|
-
from runtimepy import PKG_NAME
|
|
14
13
|
from runtimepy.codec.protocol import Protocol
|
|
15
14
|
from runtimepy.enum import RuntimeEnum
|
|
16
|
-
from runtimepy.enum.registry import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
from runtimepy.enum.registry import DEFAULT_ENUM_PRIMITIVE, RuntimeIntEnum
|
|
16
|
+
from runtimepy.primitives.byte_order import (
|
|
17
|
+
DEFAULT_BYTE_ORDER,
|
|
18
|
+
ByteOrder,
|
|
19
|
+
enum_registry,
|
|
20
20
|
)
|
|
21
|
-
from runtimepy.primitives.byte_order import ByteOrder
|
|
22
21
|
from runtimepy.primitives.types import AnyPrimitiveType, PrimitiveTypes
|
|
22
|
+
from runtimepy.registry.name import RegistryKey
|
|
23
|
+
from runtimepy.util import Identifier
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
def resolve_name(matches: Iterable[str]) -> str:
|
|
@@ -50,7 +51,9 @@ class TypeSystem(LoggerMixin):
|
|
|
50
51
|
|
|
51
52
|
self.primitives: dict[str, AnyPrimitiveType] = {}
|
|
52
53
|
self.custom: dict[str, Protocol] = {}
|
|
53
|
-
self.
|
|
54
|
+
self.custom_ids = Identifier(scale=1)
|
|
55
|
+
|
|
56
|
+
self._enums = enum_registry(register_byte_order=False)
|
|
54
57
|
|
|
55
58
|
global_namespace = Namespace(delim=CPP_DELIM)
|
|
56
59
|
|
|
@@ -61,9 +64,8 @@ class TypeSystem(LoggerMixin):
|
|
|
61
64
|
self.root_namespace = global_namespace
|
|
62
65
|
|
|
63
66
|
# Register enums.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
self.runtime_int_enum(enum)
|
|
67
|
+
for enum in [ByteOrder]:
|
|
68
|
+
self.runtime_int_enum(enum)
|
|
67
69
|
|
|
68
70
|
self.root_namespace = global_namespace.child(*namespace)
|
|
69
71
|
|
|
@@ -98,11 +100,21 @@ class TypeSystem(LoggerMixin):
|
|
|
98
100
|
assert enum is not None
|
|
99
101
|
self._register_primitive(name, enum.primitive)
|
|
100
102
|
|
|
101
|
-
def register(
|
|
103
|
+
def register(
|
|
104
|
+
self,
|
|
105
|
+
name: str,
|
|
106
|
+
*namespace: str,
|
|
107
|
+
byte_order: Union[ByteOrder, RegistryKey] = DEFAULT_BYTE_ORDER,
|
|
108
|
+
) -> Protocol:
|
|
102
109
|
"""Register a custom type."""
|
|
103
110
|
|
|
104
111
|
resolved = self._name(name, *namespace, check_available=True)
|
|
105
|
-
new_type = Protocol(
|
|
112
|
+
new_type = Protocol(
|
|
113
|
+
self._enums,
|
|
114
|
+
alias=resolved,
|
|
115
|
+
identifier=self.custom_ids(),
|
|
116
|
+
byte_order=byte_order,
|
|
117
|
+
)
|
|
106
118
|
self.custom[resolved] = new_type
|
|
107
119
|
return new_type
|
|
108
120
|
|
runtimepy/enum/registry.py
CHANGED
|
@@ -63,6 +63,11 @@ class RuntimeIntEnum(_IntEnum):
|
|
|
63
63
|
|
|
64
64
|
return data
|
|
65
65
|
|
|
66
|
+
@classmethod
|
|
67
|
+
def id(cls) -> _Optional[int]:
|
|
68
|
+
"""Override in sub-class to coerce enum id."""
|
|
69
|
+
return None
|
|
70
|
+
|
|
66
71
|
@classmethod
|
|
67
72
|
def primitive(cls) -> str:
|
|
68
73
|
"""The underlying primitive type for this runtime enumeration."""
|
|
@@ -89,6 +94,11 @@ class RuntimeIntEnum(_IntEnum):
|
|
|
89
94
|
|
|
90
95
|
data = _RuntimeEnum.data_from_enum(cls)
|
|
91
96
|
data["primitive"] = cls.primitive()
|
|
97
|
+
|
|
98
|
+
ident = cls.id()
|
|
99
|
+
if ident is not None:
|
|
100
|
+
data["id"] = ident
|
|
101
|
+
|
|
92
102
|
result = registry.register_dict(name, data)
|
|
93
|
-
assert result is not None
|
|
103
|
+
assert result is not None, (name, data)
|
|
94
104
|
return result
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
A module implementing an enumeration for byte ordering options.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
+
# built-in
|
|
6
|
+
from typing import Optional
|
|
7
|
+
|
|
5
8
|
# internal
|
|
6
|
-
from runtimepy.enum.registry import RuntimeIntEnum
|
|
9
|
+
from runtimepy.enum.registry import EnumRegistry, RuntimeIntEnum
|
|
7
10
|
|
|
8
11
|
|
|
9
|
-
class ByteOrder(
|
|
12
|
+
class ByteOrder(RuntimeIntEnum):
|
|
10
13
|
"""An enumeration for viable byte orders."""
|
|
11
14
|
|
|
12
15
|
NATIVE = 1
|
|
@@ -30,5 +33,33 @@ class ByteOrder(_RuntimeIntEnum):
|
|
|
30
33
|
"""Get this byte order as a string."""
|
|
31
34
|
return self.fmt
|
|
32
35
|
|
|
36
|
+
@classmethod
|
|
37
|
+
def id(cls) -> Optional[int]:
|
|
38
|
+
"""Override in sub-class to coerce enum id."""
|
|
39
|
+
return 1
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# https://en.cppreference.com/w/cpp/types/endian
|
|
43
|
+
STD_ENDIAN = {
|
|
44
|
+
"little": ByteOrder.LITTLE_ENDIAN,
|
|
45
|
+
"big": ByteOrder.BIG_ENDIAN,
|
|
46
|
+
"native": ByteOrder.NATIVE,
|
|
47
|
+
}
|
|
48
|
+
|
|
33
49
|
|
|
34
50
|
DEFAULT_BYTE_ORDER = ByteOrder.NETWORK
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def enum_registry(
|
|
54
|
+
*kinds: type[RuntimeIntEnum], register_byte_order: bool = True
|
|
55
|
+
) -> EnumRegistry:
|
|
56
|
+
"""Create an enum registry with the provided custom types registered."""
|
|
57
|
+
|
|
58
|
+
result = EnumRegistry()
|
|
59
|
+
|
|
60
|
+
if register_byte_order:
|
|
61
|
+
ByteOrder.register_enum(result)
|
|
62
|
+
|
|
63
|
+
for kind in kinds:
|
|
64
|
+
kind.register_enum(result)
|
|
65
|
+
return result
|
runtimepy/util.py
CHANGED
|
@@ -34,10 +34,10 @@ def normalize_root(*src_parts: Union[str, Path]) -> Path:
|
|
|
34
34
|
class Identifier:
|
|
35
35
|
"""A simple message indentifier interface."""
|
|
36
36
|
|
|
37
|
-
def __init__(self) -> None:
|
|
37
|
+
def __init__(self, start: int = 1, scale: int = 2) -> None:
|
|
38
38
|
"""Initialize this instance."""
|
|
39
|
-
self.curr_id
|
|
40
|
-
self.scale =
|
|
39
|
+
self.curr_id = start
|
|
40
|
+
self.scale = scale
|
|
41
41
|
|
|
42
42
|
def __call__(self) -> int:
|
|
43
43
|
"""Get the next identifier."""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: runtimepy
|
|
3
|
-
Version: 5.11.
|
|
3
|
+
Version: 5.11.3
|
|
4
4
|
Summary: A framework for implementing Python services.
|
|
5
5
|
Home-page: https://github.com/vkottler/runtimepy
|
|
6
6
|
Author: Vaughn Kottler
|
|
@@ -17,11 +17,11 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
17
17
|
Requires-Python: >=3.12
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
|
-
Requires-Dist:
|
|
20
|
+
Requires-Dist: websockets
|
|
21
21
|
Requires-Dist: vcorelib>=3.5.1
|
|
22
|
-
Requires-Dist:
|
|
22
|
+
Requires-Dist: psutil
|
|
23
23
|
Requires-Dist: svgen>=0.7.4
|
|
24
|
-
Requires-Dist:
|
|
24
|
+
Requires-Dist: aiofiles
|
|
25
25
|
Provides-Extra: test
|
|
26
26
|
Requires-Dist: pylint; extra == "test"
|
|
27
27
|
Requires-Dist: flake8; extra == "test"
|
|
@@ -50,11 +50,11 @@ Dynamic: requires-python
|
|
|
50
50
|
=====================================
|
|
51
51
|
generator=datazen
|
|
52
52
|
version=3.1.4
|
|
53
|
-
hash=
|
|
53
|
+
hash=8e8d3499d8579ca086dc80c977f6fd7f
|
|
54
54
|
=====================================
|
|
55
55
|
-->
|
|
56
56
|
|
|
57
|
-
# runtimepy ([5.11.
|
|
57
|
+
# runtimepy ([5.11.3](https://pypi.org/project/runtimepy/))
|
|
58
58
|
|
|
59
59
|
[](https://pypi.org/project/runtimepy/)
|
|
60
60
|

|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
runtimepy/__init__.py,sha256=
|
|
1
|
+
runtimepy/__init__.py,sha256=RJTUf2wSfvc8jMmH7nL4hTPvTdBOQNL3-pYVsf-5Dp8,391
|
|
2
2
|
runtimepy/__main__.py,sha256=OPAed6hggoQdw-6QAR62mqLC-rCkdDhOq0wyeS2vDRI,332
|
|
3
3
|
runtimepy/app.py,sha256=sTvatbsGZ2Hdel36Si_WUbNMtg9CzsJyExr5xjIcxDE,970
|
|
4
4
|
runtimepy/dev_requirements.txt,sha256=j0dh11ztJAzfaUL0iFheGjaZj9ppDzmTkclTT8YKO8c,230
|
|
@@ -7,7 +7,7 @@ runtimepy/mapping.py,sha256=VQK1vzmQVvYYKI85_II37-hIEbvgL3PzNy-WI6TTo80,5091
|
|
|
7
7
|
runtimepy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
runtimepy/requirements.txt,sha256=PdID4t7w3qsEoNwrMR-SJoH5OQ9oIUcpesKJC4AiU64,124
|
|
9
9
|
runtimepy/schemas.py,sha256=zTgxPm9DHZ0R_bmmOjNQMTXdtM_Hb1bE-Fog40jDCgg,839
|
|
10
|
-
runtimepy/util.py,sha256=
|
|
10
|
+
runtimepy/util.py,sha256=ZHSucNi-gbrcajoCv2dNjQs48dJPC3mTM_wZHx7AW1U,1719
|
|
11
11
|
runtimepy/channel/__init__.py,sha256=pf0RJ5g37_FVV8xoUNgzFGuIfbZEYSBA_cQlJSDTPDo,4774
|
|
12
12
|
runtimepy/channel/registry.py,sha256=nk36qM_Bf6qK6AFR0plaZHR1PU7b4LZqbQ0feJqk4lc,4784
|
|
13
13
|
runtimepy/channel/environment/__init__.py,sha256=0Jj8g7Y4bdDvmWtzpegB9D4milGPhsZokoYxmps5zgU,1612
|
|
@@ -25,9 +25,9 @@ runtimepy/channel/event/__init__.py,sha256=9LCSNa1Iiwr6Q6JkwQGELDQ7rWfU_xjAMh6qM
|
|
|
25
25
|
runtimepy/channel/event/header.py,sha256=eDRZgzzM5HZQ8QtV4DjyAsrAhEZyM7IfwqK6WB5ACEw,868
|
|
26
26
|
runtimepy/codec/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
27
|
runtimepy/codec/protocol/__init__.py,sha256=Rg7RSKGn2UBpGMpwq1aCLUBA5h4pORdh53NfR7Cjw0U,1530
|
|
28
|
-
runtimepy/codec/protocol/base.py,sha256=
|
|
29
|
-
runtimepy/codec/protocol/json.py,sha256=
|
|
30
|
-
runtimepy/codec/system/__init__.py,sha256=
|
|
28
|
+
runtimepy/codec/protocol/base.py,sha256=aIQCuUYPhe7-jgaYaoNzq3UU57lnBzrLqIr0H7fnHFc,10464
|
|
29
|
+
runtimepy/codec/protocol/json.py,sha256=gYGB_OEfZYySKQ_n3eDxYNs6Ku80FdawY5zDqjx9ctc,4315
|
|
30
|
+
runtimepy/codec/system/__init__.py,sha256=MLmczvxKnZoPnaPb_22EVC4TdVEj6P0IClejv5WCZ18,7245
|
|
31
31
|
runtimepy/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
32
|
runtimepy/commands/all.py,sha256=jH2dsmkqyBFe_2ZlPFpko0UCMW3fFfJsuGIbeJFbDoQ,1619
|
|
33
33
|
runtimepy/commands/arbiter.py,sha256=CtTMRYpqCAN3vWHkkr9jqWpoF7JGNXafKIBFmkarAfc,1567
|
|
@@ -118,7 +118,7 @@ runtimepy/data/static/woff2/CascadiaMono-Italic.woff2,sha256=S31PimDgq0GV7XMRV-Y
|
|
|
118
118
|
runtimepy/data/static/woff2/CascadiaMono-Regular.woff2,sha256=hHPAFO0U10TCKBw-UofHN2BLjax9qNClzN9oWGKkQx0,143936
|
|
119
119
|
runtimepy/data/static/woff2/README.md,sha256=flHwSRmDxd6OnWhzxmnXzwio1Mong5tB4d8VgieWCOs,289
|
|
120
120
|
runtimepy/enum/__init__.py,sha256=WIBMOaogauR1u7mK-I4Z5BZUoWANU7alIlrz82QdCmY,5820
|
|
121
|
-
runtimepy/enum/registry.py,sha256=
|
|
121
|
+
runtimepy/enum/registry.py,sha256=b_oW8l-yNXvrVGfwQ2kKs2bqBk5pT48WBc2vXUTkJks,2861
|
|
122
122
|
runtimepy/enum/types.py,sha256=uQYGvaAJVm5tUdwxn_SLHkTZHJpEf7364rTSL27necA,1027
|
|
123
123
|
runtimepy/message/__init__.py,sha256=X5PZqSPGhNT4MruaiQjN4MwJHhy8gV9W32QXyxgS9-E,3004
|
|
124
124
|
runtimepy/message/handlers.py,sha256=He9NC7MCkaV2clKc8dTSZ_T8N2l3ATjaTFzBr9n1T34,3775
|
|
@@ -233,7 +233,7 @@ runtimepy/noise/__init__.py,sha256=EJM7h3t_z74wwrn6FAFQwYE2yUcOZQ1K1IQqOb8Z0AI,3
|
|
|
233
233
|
runtimepy/primitives/__init__.py,sha256=nwWJH1e0KN2NsVwQ3wvRtUpl9s9Ap8Q32NNZLGol0wU,2323
|
|
234
234
|
runtimepy/primitives/base.py,sha256=BaGPUTeVMnLnTPcpjqnS2lzPN74Pe5C0XaQdgrTfW7A,9185
|
|
235
235
|
runtimepy/primitives/bool.py,sha256=lATPgb1e62rjLn5XlJX8lP3tVYR3DlxV8RT9HpOMdT0,1640
|
|
236
|
-
runtimepy/primitives/byte_order.py,sha256=
|
|
236
|
+
runtimepy/primitives/byte_order.py,sha256=J2Pg3gXg8Lmu_uU2mduNJt3mnP_enwDI4Y-X8kWAUP0,1456
|
|
237
237
|
runtimepy/primitives/evaluation.py,sha256=0N7mT8uoiJaY-coF2PeEXU2WO-FmbyN2Io9_EaghO9Q,4657
|
|
238
238
|
runtimepy/primitives/float.py,sha256=6vzNKnnLzzM4vP10V4E0PHZQH6vTvIl34pId1oFtlqc,2146
|
|
239
239
|
runtimepy/primitives/int.py,sha256=Ia2vtzXXfBb8fj1mgwu_PFpblrL2qzsN4Qwjvk5NhT4,3618
|
|
@@ -285,9 +285,9 @@ runtimepy/tui/task.py,sha256=nUZo9fuOC-k1Wpqdzkv9v1tQirCI28fZVgcC13Ijvus,1093
|
|
|
285
285
|
runtimepy/tui/channels/__init__.py,sha256=evDaiIn-YS9uGhdo8ZGtP9VK1ek6sr_P1nJ9JuSET0o,4536
|
|
286
286
|
runtimepy/ui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
287
287
|
runtimepy/ui/controls.py,sha256=yvT7h3thbYaitsakcIAJ90EwKzJ4b-jnc6p3UuVf_XE,1241
|
|
288
|
-
runtimepy-5.11.
|
|
289
|
-
runtimepy-5.11.
|
|
290
|
-
runtimepy-5.11.
|
|
291
|
-
runtimepy-5.11.
|
|
292
|
-
runtimepy-5.11.
|
|
293
|
-
runtimepy-5.11.
|
|
288
|
+
runtimepy-5.11.3.dist-info/licenses/LICENSE,sha256=yKBRwbO-cOPBrlpsZmJkkSa33DfY31aE8t7lZ0DwlUo,1071
|
|
289
|
+
runtimepy-5.11.3.dist-info/METADATA,sha256=jorcstJRpdgXA-aUoZoyvC_cECYSEZSHA6XP0UWWxyU,9395
|
|
290
|
+
runtimepy-5.11.3.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
291
|
+
runtimepy-5.11.3.dist-info/entry_points.txt,sha256=-btVBkYv7ybcopqZ_pRky-bEzu3vhbaG3W3Z7ERBiFE,51
|
|
292
|
+
runtimepy-5.11.3.dist-info/top_level.txt,sha256=0jPmh6yqHyyJJDwEID-LpQly-9kQ3WRMjH7Lix8peLg,10
|
|
293
|
+
runtimepy-5.11.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|