metta-websocket 0.9.2__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.
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: metta-websocket
|
|
3
|
+
Version: 0.9.2
|
|
4
|
+
Summary: websocket-client's own timeouts, so an absent MeTTa backend reads as absent
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Classifier: Development Status :: 3 - Alpha
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Intended Audience :: Science/Research
|
|
9
|
+
Requires-Python: >=3.12
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: pymetta==0.9.2
|
|
12
|
+
Requires-Dist: websocket-client
|
|
13
|
+
|
|
14
|
+
# metta-websocket
|
|
15
|
+
|
|
16
|
+
websocket-client's own timeouts, so an absent MeTTa backend reads as absent.
|
|
17
|
+
|
|
18
|
+
`pymetta` names no third-party library. This package is one row against the `transport-error` point, and the seat
|
|
19
|
+
finds it exactly as it finds a package written by somebody else: through the
|
|
20
|
+
`metta.extensions` entry point, loaded at the first dispatch that has no answer
|
|
21
|
+
without it, or through `import metta_websocket`, whose module body registers the same
|
|
22
|
+
rows.
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
pip install metta-websocket # or: pip install 'pymetta[das]'
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Its tests are in `tests/`, and they run in the workspace suite:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
sh extensions/python/test.sh ext/metta-websocket
|
|
32
|
+
```
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
metta_websocket.py,sha256=DmkyTHXjGNvZIy-3naSJWISevF0ax6HcPXHeEmU-BMI,1682
|
|
2
|
+
metta_websocket-0.9.2.dist-info/METADATA,sha256=50u0iJKVNW3qawxjwiPZKkWfu7r3NeCV_DHhu8w_w9M,1103
|
|
3
|
+
metta_websocket-0.9.2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
4
|
+
metta_websocket-0.9.2.dist-info/entry_points.txt,sha256=ElQEr2w7DAQyZU_jrE3YYU7GZ6hp3hnDMscto0WAPEw,53
|
|
5
|
+
metta_websocket-0.9.2.dist-info/top_level.txt,sha256=DWf1SB0H8zq9pjxaoQ5IVjYDt12MRWxwrXKC80Ec2Kc,16
|
|
6
|
+
metta_websocket-0.9.2.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
metta_websocket
|
metta_websocket.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Purpose: websocket-client's own timeouts, so an absent backend reads as absent.
|
|
2
|
+
|
|
3
|
+
`metta._errors.errors.is_transport_failure` asks whether a failure means the backend is
|
|
4
|
+
ABSENT rather than wrong, which decides whether a client retries or reports.
|
|
5
|
+
The obvious test does not separate them: a socket timeout raises OSError, but
|
|
6
|
+
websocket-client's own timeout does NOT subclass it, so "is the cause an
|
|
7
|
+
OSError" misses exactly the shape a broken event stream takes under load. One
|
|
8
|
+
row against the seat's `transport-error` point says which classes those are.
|
|
9
|
+
|
|
10
|
+
Installed beside pymetta, or through `pip install 'pymetta[das]'`. The row
|
|
11
|
+
holds the module NAME and imports nothing; the classes are read only when a
|
|
12
|
+
failure is actually classified, and only if websocket-client is imported.
|
|
13
|
+
|
|
14
|
+
Assumes:
|
|
15
|
+
- the two exception classes keep their names, which is the only thing this
|
|
16
|
+
row knows about the library
|
|
17
|
+
Guarantees:
|
|
18
|
+
- a websocket timeout and a closed stream both read as transport failures,
|
|
19
|
+
and an ordinary application error does not [tested: tests/test_websocket.py;
|
|
20
|
+
commit=94057a0f073c0fab0a35c42beff2c324d8a0addd]
|
|
21
|
+
Open Obligations:
|
|
22
|
+
To Do: None
|
|
23
|
+
Hacks: None
|
|
24
|
+
Future Enhancements: None
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
from __future__ import annotations
|
|
28
|
+
|
|
29
|
+
from metta import seam
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _classes(module) -> tuple[type[BaseException], ...]:
|
|
33
|
+
"""websocket-client's own timeout and closed-stream exceptions."""
|
|
34
|
+
return (module.WebSocketTimeoutException, module.WebSocketConnectionClosedException)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def register() -> None:
|
|
38
|
+
"""This package's one row, against the seat's `transport-error` point."""
|
|
39
|
+
seam.transport_error.register("websocket", module="websocket", classes=_classes)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
register()
|