rocket-welder-sdk 1.1.42__py3-none-any.whl → 1.1.44__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.
- rocket_welder_sdk/__init__.py +18 -22
- rocket_welder_sdk/binary_frame_reader.py +222 -0
- rocket_welder_sdk/binary_frame_writer.py +213 -0
- rocket_welder_sdk/confidence.py +206 -0
- rocket_welder_sdk/delta_frame.py +150 -0
- rocket_welder_sdk/high_level/__init__.py +8 -1
- rocket_welder_sdk/high_level/client.py +114 -3
- rocket_welder_sdk/high_level/connection_strings.py +3 -15
- rocket_welder_sdk/high_level/frame_sink_factory.py +2 -15
- rocket_welder_sdk/high_level/transport_protocol.py +4 -130
- rocket_welder_sdk/keypoints_protocol.py +520 -55
- rocket_welder_sdk/rocket_welder_client.py +0 -77
- rocket_welder_sdk/segmentation_result.py +387 -2
- rocket_welder_sdk/session_id.py +6 -182
- rocket_welder_sdk/transport/__init__.py +10 -3
- rocket_welder_sdk/transport/frame_sink.py +3 -3
- rocket_welder_sdk/transport/frame_source.py +2 -2
- rocket_welder_sdk/transport/websocket_transport.py +316 -0
- rocket_welder_sdk/varint.py +213 -0
- {rocket_welder_sdk-1.1.42.dist-info → rocket_welder_sdk-1.1.44.dist-info}/METADATA +1 -4
- {rocket_welder_sdk-1.1.42.dist-info → rocket_welder_sdk-1.1.44.dist-info}/RECORD +23 -18
- rocket_welder_sdk/transport/nng_transport.py +0 -197
- {rocket_welder_sdk-1.1.42.dist-info → rocket_welder_sdk-1.1.44.dist-info}/WHEEL +0 -0
- {rocket_welder_sdk-1.1.42.dist-info → rocket_welder_sdk-1.1.44.dist-info}/top_level.txt +0 -0
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Unified transport protocol as a value type.
|
|
3
3
|
|
|
4
|
-
Supports: file://, socket
|
|
4
|
+
Supports: file://, socket://
|
|
5
5
|
|
|
6
6
|
Examples:
|
|
7
7
|
file:///home/user/output.bin - absolute file path
|
|
8
8
|
socket:///tmp/my.sock - Unix domain socket
|
|
9
|
-
nng+push+ipc://tmp/keypoints - NNG Push over IPC
|
|
10
|
-
nng+push+tcp://host:5555 - NNG Push over TCP
|
|
11
9
|
"""
|
|
12
10
|
|
|
13
11
|
from __future__ import annotations
|
|
@@ -25,61 +23,21 @@ class TransportKind(Enum):
|
|
|
25
23
|
SOCKET = auto()
|
|
26
24
|
"""Unix domain socket (direct, no messaging library)."""
|
|
27
25
|
|
|
28
|
-
NNG_PUSH_IPC = auto()
|
|
29
|
-
"""NNG Push over IPC."""
|
|
30
|
-
|
|
31
|
-
NNG_PUSH_TCP = auto()
|
|
32
|
-
"""NNG Push over TCP."""
|
|
33
|
-
|
|
34
|
-
NNG_PULL_IPC = auto()
|
|
35
|
-
"""NNG Pull over IPC."""
|
|
36
|
-
|
|
37
|
-
NNG_PULL_TCP = auto()
|
|
38
|
-
"""NNG Pull over TCP."""
|
|
39
|
-
|
|
40
|
-
NNG_PUB_IPC = auto()
|
|
41
|
-
"""NNG Pub over IPC."""
|
|
42
|
-
|
|
43
|
-
NNG_PUB_TCP = auto()
|
|
44
|
-
"""NNG Pub over TCP."""
|
|
45
|
-
|
|
46
|
-
NNG_SUB_IPC = auto()
|
|
47
|
-
"""NNG Sub over IPC."""
|
|
48
|
-
|
|
49
|
-
NNG_SUB_TCP = auto()
|
|
50
|
-
"""NNG Sub over TCP."""
|
|
51
|
-
|
|
52
26
|
|
|
53
27
|
class TransportProtocol:
|
|
54
28
|
"""
|
|
55
29
|
Unified transport protocol specification as a value type.
|
|
56
30
|
|
|
57
|
-
Supports: file://, socket
|
|
31
|
+
Supports: file://, socket://
|
|
58
32
|
"""
|
|
59
33
|
|
|
60
34
|
# Predefined protocols
|
|
61
35
|
File: TransportProtocol
|
|
62
36
|
Socket: TransportProtocol
|
|
63
|
-
NngPushIpc: TransportProtocol
|
|
64
|
-
NngPushTcp: TransportProtocol
|
|
65
|
-
NngPullIpc: TransportProtocol
|
|
66
|
-
NngPullTcp: TransportProtocol
|
|
67
|
-
NngPubIpc: TransportProtocol
|
|
68
|
-
NngPubTcp: TransportProtocol
|
|
69
|
-
NngSubIpc: TransportProtocol
|
|
70
|
-
NngSubTcp: TransportProtocol
|
|
71
37
|
|
|
72
38
|
_SCHEMA_MAP: ClassVar[Dict[str, TransportKind]] = {
|
|
73
39
|
"file": TransportKind.FILE,
|
|
74
40
|
"socket": TransportKind.SOCKET,
|
|
75
|
-
"nng+push+ipc": TransportKind.NNG_PUSH_IPC,
|
|
76
|
-
"nng+push+tcp": TransportKind.NNG_PUSH_TCP,
|
|
77
|
-
"nng+pull+ipc": TransportKind.NNG_PULL_IPC,
|
|
78
|
-
"nng+pull+tcp": TransportKind.NNG_PULL_TCP,
|
|
79
|
-
"nng+pub+ipc": TransportKind.NNG_PUB_IPC,
|
|
80
|
-
"nng+pub+tcp": TransportKind.NNG_PUB_TCP,
|
|
81
|
-
"nng+sub+ipc": TransportKind.NNG_SUB_IPC,
|
|
82
|
-
"nng+sub+tcp": TransportKind.NNG_SUB_TCP,
|
|
83
41
|
}
|
|
84
42
|
|
|
85
43
|
_KIND_TO_SCHEMA: ClassVar[Dict[TransportKind, str]] = {}
|
|
@@ -95,7 +53,7 @@ class TransportProtocol:
|
|
|
95
53
|
|
|
96
54
|
@property
|
|
97
55
|
def schema(self) -> str:
|
|
98
|
-
"""The schema string (e.g., 'file', 'socket'
|
|
56
|
+
"""The schema string (e.g., 'file', 'socket')."""
|
|
99
57
|
return self._schema
|
|
100
58
|
|
|
101
59
|
# Classification properties
|
|
@@ -110,82 +68,6 @@ class TransportProtocol:
|
|
|
110
68
|
"""True if this is a Unix socket transport."""
|
|
111
69
|
return self._kind == TransportKind.SOCKET
|
|
112
70
|
|
|
113
|
-
@property
|
|
114
|
-
def is_nng(self) -> bool:
|
|
115
|
-
"""True if this is any NNG-based transport."""
|
|
116
|
-
return self._kind in {
|
|
117
|
-
TransportKind.NNG_PUSH_IPC,
|
|
118
|
-
TransportKind.NNG_PUSH_TCP,
|
|
119
|
-
TransportKind.NNG_PULL_IPC,
|
|
120
|
-
TransportKind.NNG_PULL_TCP,
|
|
121
|
-
TransportKind.NNG_PUB_IPC,
|
|
122
|
-
TransportKind.NNG_PUB_TCP,
|
|
123
|
-
TransportKind.NNG_SUB_IPC,
|
|
124
|
-
TransportKind.NNG_SUB_TCP,
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
@property
|
|
128
|
-
def is_push(self) -> bool:
|
|
129
|
-
"""True if this is a Push pattern."""
|
|
130
|
-
return self._kind in {TransportKind.NNG_PUSH_IPC, TransportKind.NNG_PUSH_TCP}
|
|
131
|
-
|
|
132
|
-
@property
|
|
133
|
-
def is_pull(self) -> bool:
|
|
134
|
-
"""True if this is a Pull pattern."""
|
|
135
|
-
return self._kind in {TransportKind.NNG_PULL_IPC, TransportKind.NNG_PULL_TCP}
|
|
136
|
-
|
|
137
|
-
@property
|
|
138
|
-
def is_pub(self) -> bool:
|
|
139
|
-
"""True if this is a Pub pattern."""
|
|
140
|
-
return self._kind in {TransportKind.NNG_PUB_IPC, TransportKind.NNG_PUB_TCP}
|
|
141
|
-
|
|
142
|
-
@property
|
|
143
|
-
def is_sub(self) -> bool:
|
|
144
|
-
"""True if this is a Sub pattern."""
|
|
145
|
-
return self._kind in {TransportKind.NNG_SUB_IPC, TransportKind.NNG_SUB_TCP}
|
|
146
|
-
|
|
147
|
-
@property
|
|
148
|
-
def is_ipc(self) -> bool:
|
|
149
|
-
"""True if this uses IPC layer."""
|
|
150
|
-
return self._kind in {
|
|
151
|
-
TransportKind.NNG_PUSH_IPC,
|
|
152
|
-
TransportKind.NNG_PULL_IPC,
|
|
153
|
-
TransportKind.NNG_PUB_IPC,
|
|
154
|
-
TransportKind.NNG_SUB_IPC,
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
@property
|
|
158
|
-
def is_tcp(self) -> bool:
|
|
159
|
-
"""True if this uses TCP layer."""
|
|
160
|
-
return self._kind in {
|
|
161
|
-
TransportKind.NNG_PUSH_TCP,
|
|
162
|
-
TransportKind.NNG_PULL_TCP,
|
|
163
|
-
TransportKind.NNG_PUB_TCP,
|
|
164
|
-
TransportKind.NNG_SUB_TCP,
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
def create_nng_address(self, path_or_host: str) -> str:
|
|
168
|
-
"""
|
|
169
|
-
Create the NNG address from a path/host.
|
|
170
|
-
|
|
171
|
-
For IPC: ipc:///path
|
|
172
|
-
For TCP: tcp://host:port
|
|
173
|
-
|
|
174
|
-
Raises:
|
|
175
|
-
ValueError: If this is not an NNG protocol.
|
|
176
|
-
"""
|
|
177
|
-
if not self.is_nng:
|
|
178
|
-
raise ValueError(f"Cannot create NNG address for {self._kind} transport")
|
|
179
|
-
|
|
180
|
-
if self.is_ipc:
|
|
181
|
-
# IPC paths need leading "/" for absolute paths
|
|
182
|
-
if not path_or_host.startswith("/"):
|
|
183
|
-
return f"ipc:///{path_or_host}"
|
|
184
|
-
return f"ipc://{path_or_host}"
|
|
185
|
-
|
|
186
|
-
# TCP
|
|
187
|
-
return f"tcp://{path_or_host}"
|
|
188
|
-
|
|
189
71
|
def __str__(self) -> str:
|
|
190
72
|
return self._schema
|
|
191
73
|
|
|
@@ -202,7 +84,7 @@ class TransportProtocol:
|
|
|
202
84
|
|
|
203
85
|
@classmethod
|
|
204
86
|
def parse(cls, s: str) -> TransportProtocol:
|
|
205
|
-
"""Parse a protocol string (e.g., '
|
|
87
|
+
"""Parse a protocol string (e.g., 'file', 'socket')."""
|
|
206
88
|
result = cls.try_parse(s)
|
|
207
89
|
if result is None:
|
|
208
90
|
raise ValueError(f"Invalid transport protocol: {s}")
|
|
@@ -225,14 +107,6 @@ class TransportProtocol:
|
|
|
225
107
|
# Initialize predefined protocols
|
|
226
108
|
TransportProtocol.File = TransportProtocol(TransportKind.FILE, "file")
|
|
227
109
|
TransportProtocol.Socket = TransportProtocol(TransportKind.SOCKET, "socket")
|
|
228
|
-
TransportProtocol.NngPushIpc = TransportProtocol(TransportKind.NNG_PUSH_IPC, "nng+push+ipc")
|
|
229
|
-
TransportProtocol.NngPushTcp = TransportProtocol(TransportKind.NNG_PUSH_TCP, "nng+push+tcp")
|
|
230
|
-
TransportProtocol.NngPullIpc = TransportProtocol(TransportKind.NNG_PULL_IPC, "nng+pull+ipc")
|
|
231
|
-
TransportProtocol.NngPullTcp = TransportProtocol(TransportKind.NNG_PULL_TCP, "nng+pull+tcp")
|
|
232
|
-
TransportProtocol.NngPubIpc = TransportProtocol(TransportKind.NNG_PUB_IPC, "nng+pub+ipc")
|
|
233
|
-
TransportProtocol.NngPubTcp = TransportProtocol(TransportKind.NNG_PUB_TCP, "nng+pub+tcp")
|
|
234
|
-
TransportProtocol.NngSubIpc = TransportProtocol(TransportKind.NNG_SUB_IPC, "nng+sub+ipc")
|
|
235
|
-
TransportProtocol.NngSubTcp = TransportProtocol(TransportKind.NNG_SUB_TCP, "nng+sub+tcp")
|
|
236
110
|
|
|
237
111
|
# Initialize reverse lookup map
|
|
238
112
|
TransportProtocol._KIND_TO_SCHEMA = {v: k for k, v in TransportProtocol._SCHEMA_MAP.items()}
|