stinger-python-utils 0.1.4__tar.gz → 0.1.5__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.
- {stinger_python_utils-0.1.4 → stinger_python_utils-0.1.5}/PKG-INFO +1 -1
- {stinger_python_utils-0.1.4 → stinger_python_utils-0.1.5}/pyproject.toml +1 -1
- {stinger_python_utils-0.1.4 → stinger_python_utils-0.1.5}/src/stinger_python_utils/message_creator.py +10 -7
- {stinger_python_utils-0.1.4 → stinger_python_utils-0.1.5}/uv.lock +29 -1
- {stinger_python_utils-0.1.4 → stinger_python_utils-0.1.5}/.github/workflows/python-tests.yml +0 -0
- {stinger_python_utils-0.1.4 → stinger_python_utils-0.1.5}/.github/workflows/python37.yml +0 -0
- {stinger_python_utils-0.1.4 → stinger_python_utils-0.1.5}/.gitignore +0 -0
- {stinger_python_utils-0.1.4 → stinger_python_utils-0.1.5}/.python-version +0 -0
- {stinger_python_utils-0.1.4 → stinger_python_utils-0.1.5}/LICENSE +0 -0
- {stinger_python_utils-0.1.4 → stinger_python_utils-0.1.5}/README.md +0 -0
- {stinger_python_utils-0.1.4 → stinger_python_utils-0.1.5}/src/stinger_python_utils/__init__.py +0 -0
- {stinger_python_utils-0.1.4 → stinger_python_utils-0.1.5}/src/stinger_python_utils/return_codes.py +0 -0
- {stinger_python_utils-0.1.4 → stinger_python_utils-0.1.5}/test/__init__.py +0 -0
- {stinger_python_utils-0.1.4 → stinger_python_utils-0.1.5}/test/test_message_creator.py +0 -0
|
@@ -2,7 +2,7 @@ from pyqttier.message import Message
|
|
|
2
2
|
from pydantic import BaseModel
|
|
3
3
|
from typing import Union, Optional
|
|
4
4
|
import uuid
|
|
5
|
-
|
|
5
|
+
from .return_codes import MethodReturnCode
|
|
6
6
|
|
|
7
7
|
class MessageCreator:
|
|
8
8
|
|
|
@@ -31,13 +31,14 @@ class MessageCreator:
|
|
|
31
31
|
def error_response_message(
|
|
32
32
|
cls,
|
|
33
33
|
topic: str,
|
|
34
|
-
return_code: int,
|
|
34
|
+
return_code: Union[int, MethodReturnCode],
|
|
35
35
|
correlation_id: Union[str, bytes, None] = None,
|
|
36
36
|
debug_info: Optional[str] = None,
|
|
37
37
|
) -> Message:
|
|
38
38
|
"""
|
|
39
39
|
This could be used for a response to a request, but where there was an error fulfilling the request.
|
|
40
40
|
"""
|
|
41
|
+
rc = return_code.value if isinstance(return_code, MethodReturnCode) else return_code
|
|
41
42
|
msg_obj = Message(
|
|
42
43
|
topic=topic,
|
|
43
44
|
payload=b"{}",
|
|
@@ -48,7 +49,7 @@ class MessageCreator:
|
|
|
48
49
|
if isinstance(correlation_id, str)
|
|
49
50
|
else correlation_id
|
|
50
51
|
),
|
|
51
|
-
user_properties={"ReturnCode": str(
|
|
52
|
+
user_properties={"ReturnCode": str(rc)},
|
|
52
53
|
)
|
|
53
54
|
if (
|
|
54
55
|
debug_info is not None and msg_obj.user_properties is not None
|
|
@@ -61,7 +62,7 @@ class MessageCreator:
|
|
|
61
62
|
cls,
|
|
62
63
|
response_topic: str,
|
|
63
64
|
response_obj: Union[BaseModel, str, bytes],
|
|
64
|
-
return_code: int,
|
|
65
|
+
return_code: Union[int, MethodReturnCode],
|
|
65
66
|
correlation_id: Union[str, bytes, None] = None,
|
|
66
67
|
) -> Message:
|
|
67
68
|
"""
|
|
@@ -73,6 +74,7 @@ class MessageCreator:
|
|
|
73
74
|
payload = response_obj.encode("utf-8")
|
|
74
75
|
else:
|
|
75
76
|
payload = response_obj
|
|
77
|
+
rc = return_code.value if isinstance(return_code, MethodReturnCode) else return_code
|
|
76
78
|
msg_obj = Message(
|
|
77
79
|
topic=response_topic,
|
|
78
80
|
payload=payload,
|
|
@@ -83,7 +85,7 @@ class MessageCreator:
|
|
|
83
85
|
if isinstance(correlation_id, str)
|
|
84
86
|
else correlation_id
|
|
85
87
|
),
|
|
86
|
-
user_properties={"ReturnCode": str(
|
|
88
|
+
user_properties={"ReturnCode": str(rc)},
|
|
87
89
|
)
|
|
88
90
|
return msg_obj
|
|
89
91
|
|
|
@@ -138,13 +140,14 @@ class MessageCreator:
|
|
|
138
140
|
response_topic: str,
|
|
139
141
|
property_obj: BaseModel,
|
|
140
142
|
version: str,
|
|
141
|
-
return_code: int,
|
|
143
|
+
return_code: Union[int, MethodReturnCode],
|
|
142
144
|
correlation_id: Union[str, bytes, None] = None,
|
|
143
145
|
debug_info: Optional[str] = None,
|
|
144
146
|
) -> Message:
|
|
145
147
|
"""
|
|
146
148
|
Creates a message representing a response to a property update request.
|
|
147
149
|
"""
|
|
150
|
+
rc = return_code.value if isinstance(return_code, MethodReturnCode) else return_code
|
|
148
151
|
msg_obj = Message(
|
|
149
152
|
topic=response_topic,
|
|
150
153
|
payload=property_obj.model_dump_json(by_alias=True).encode("utf-8"),
|
|
@@ -156,7 +159,7 @@ class MessageCreator:
|
|
|
156
159
|
else correlation_id
|
|
157
160
|
),
|
|
158
161
|
user_properties={
|
|
159
|
-
"ReturnCode": str(
|
|
162
|
+
"ReturnCode": str(rc),
|
|
160
163
|
"PropertyVersion": str(version),
|
|
161
164
|
},
|
|
162
165
|
)
|
|
@@ -1270,9 +1270,35 @@ wheels = [
|
|
|
1270
1270
|
{ url = "https://files.pythonhosted.org/packages/84/25/d9db8be44e205a124f6c98bc0324b2bb149b7431c53877fc6d1038dddaf5/pytokens-0.3.0-py3-none-any.whl", hash = "sha256:95b2b5eaf832e469d141a378872480ede3f251a5a5041b8ec6e581d3ac71bbf3", size = 12195, upload-time = "2025-11-05T13:36:33.183Z" },
|
|
1271
1271
|
]
|
|
1272
1272
|
|
|
1273
|
+
[[package]]
|
|
1274
|
+
name = "ruff"
|
|
1275
|
+
version = "0.14.10"
|
|
1276
|
+
source = { registry = "https://pypi.org/simple" }
|
|
1277
|
+
sdist = { url = "https://files.pythonhosted.org/packages/57/08/52232a877978dd8f9cf2aeddce3e611b40a63287dfca29b6b8da791f5e8d/ruff-0.14.10.tar.gz", hash = "sha256:9a2e830f075d1a42cd28420d7809ace390832a490ed0966fe373ba288e77aaf4", size = 5859763, upload-time = "2025-12-18T19:28:57.98Z" }
|
|
1278
|
+
wheels = [
|
|
1279
|
+
{ url = "https://files.pythonhosted.org/packages/60/01/933704d69f3f05ee16ef11406b78881733c186fe14b6a46b05cfcaf6d3b2/ruff-0.14.10-py3-none-linux_armv6l.whl", hash = "sha256:7a3ce585f2ade3e1f29ec1b92df13e3da262178df8c8bdf876f48fa0e8316c49", size = 13527080, upload-time = "2025-12-18T19:29:25.642Z" },
|
|
1280
|
+
{ url = "https://files.pythonhosted.org/packages/df/58/a0349197a7dfa603ffb7f5b0470391efa79ddc327c1e29c4851e85b09cc5/ruff-0.14.10-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:674f9be9372907f7257c51f1d4fc902cb7cf014b9980152b802794317941f08f", size = 13797320, upload-time = "2025-12-18T19:29:02.571Z" },
|
|
1281
|
+
{ url = "https://files.pythonhosted.org/packages/7b/82/36be59f00a6082e38c23536df4e71cdbc6af8d7c707eade97fcad5c98235/ruff-0.14.10-py3-none-macosx_11_0_arm64.whl", hash = "sha256:d85713d522348837ef9df8efca33ccb8bd6fcfc86a2cde3ccb4bc9d28a18003d", size = 12918434, upload-time = "2025-12-18T19:28:51.202Z" },
|
|
1282
|
+
{ url = "https://files.pythonhosted.org/packages/a6/00/45c62a7f7e34da92a25804f813ebe05c88aa9e0c25e5cb5a7d23dd7450e3/ruff-0.14.10-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6987ebe0501ae4f4308d7d24e2d0fe3d7a98430f5adfd0f1fead050a740a3a77", size = 13371961, upload-time = "2025-12-18T19:29:04.991Z" },
|
|
1283
|
+
{ url = "https://files.pythonhosted.org/packages/40/31/a5906d60f0405f7e57045a70f2d57084a93ca7425f22e1d66904769d1628/ruff-0.14.10-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:16a01dfb7b9e4eee556fbfd5392806b1b8550c9b4a9f6acd3dbe6812b193c70a", size = 13275629, upload-time = "2025-12-18T19:29:21.381Z" },
|
|
1284
|
+
{ url = "https://files.pythonhosted.org/packages/3e/60/61c0087df21894cf9d928dc04bcd4fb10e8b2e8dca7b1a276ba2155b2002/ruff-0.14.10-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7165d31a925b7a294465fa81be8c12a0e9b60fb02bf177e79067c867e71f8b1f", size = 14029234, upload-time = "2025-12-18T19:29:00.132Z" },
|
|
1285
|
+
{ url = "https://files.pythonhosted.org/packages/44/84/77d911bee3b92348b6e5dab5a0c898d87084ea03ac5dc708f46d88407def/ruff-0.14.10-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:c561695675b972effb0c0a45db233f2c816ff3da8dcfbe7dfc7eed625f218935", size = 15449890, upload-time = "2025-12-18T19:28:53.573Z" },
|
|
1286
|
+
{ url = "https://files.pythonhosted.org/packages/e9/36/480206eaefa24a7ec321582dda580443a8f0671fdbf6b1c80e9c3e93a16a/ruff-0.14.10-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4bb98fcbbc61725968893682fd4df8966a34611239c9fd07a1f6a07e7103d08e", size = 15123172, upload-time = "2025-12-18T19:29:23.453Z" },
|
|
1287
|
+
{ url = "https://files.pythonhosted.org/packages/5c/38/68e414156015ba80cef5473d57919d27dfb62ec804b96180bafdeaf0e090/ruff-0.14.10-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f24b47993a9d8cb858429e97bdf8544c78029f09b520af615c1d261bf827001d", size = 14460260, upload-time = "2025-12-18T19:29:27.808Z" },
|
|
1288
|
+
{ url = "https://files.pythonhosted.org/packages/b3/19/9e050c0dca8aba824d67cc0db69fb459c28d8cd3f6855b1405b3f29cc91d/ruff-0.14.10-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:59aabd2e2c4fd614d2862e7939c34a532c04f1084476d6833dddef4afab87e9f", size = 14229978, upload-time = "2025-12-18T19:29:11.32Z" },
|
|
1289
|
+
{ url = "https://files.pythonhosted.org/packages/51/eb/e8dd1dd6e05b9e695aa9dd420f4577debdd0f87a5ff2fedda33c09e9be8c/ruff-0.14.10-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:213db2b2e44be8625002dbea33bb9c60c66ea2c07c084a00d55732689d697a7f", size = 14338036, upload-time = "2025-12-18T19:29:09.184Z" },
|
|
1290
|
+
{ url = "https://files.pythonhosted.org/packages/6a/12/f3e3a505db7c19303b70af370d137795fcfec136d670d5de5391e295c134/ruff-0.14.10-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:b914c40ab64865a17a9a5b67911d14df72346a634527240039eb3bd650e5979d", size = 13264051, upload-time = "2025-12-18T19:29:13.431Z" },
|
|
1291
|
+
{ url = "https://files.pythonhosted.org/packages/08/64/8c3a47eaccfef8ac20e0484e68e0772013eb85802f8a9f7603ca751eb166/ruff-0.14.10-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:1484983559f026788e3a5c07c81ef7d1e97c1c78ed03041a18f75df104c45405", size = 13283998, upload-time = "2025-12-18T19:29:06.994Z" },
|
|
1292
|
+
{ url = "https://files.pythonhosted.org/packages/12/84/534a5506f4074e5cc0529e5cd96cfc01bb480e460c7edf5af70d2bcae55e/ruff-0.14.10-py3-none-musllinux_1_2_i686.whl", hash = "sha256:c70427132db492d25f982fffc8d6c7535cc2fd2c83fc8888f05caaa248521e60", size = 13601891, upload-time = "2025-12-18T19:28:55.811Z" },
|
|
1293
|
+
{ url = "https://files.pythonhosted.org/packages/0d/1e/14c916087d8598917dbad9b2921d340f7884824ad6e9c55de948a93b106d/ruff-0.14.10-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:5bcf45b681e9f1ee6445d317ce1fa9d6cba9a6049542d1c3d5b5958986be8830", size = 14336660, upload-time = "2025-12-18T19:29:16.531Z" },
|
|
1294
|
+
{ url = "https://files.pythonhosted.org/packages/f2/1c/d7b67ab43f30013b47c12b42d1acd354c195351a3f7a1d67f59e54227ede/ruff-0.14.10-py3-none-win32.whl", hash = "sha256:104c49fc7ab73f3f3a758039adea978869a918f31b73280db175b43a2d9b51d6", size = 13196187, upload-time = "2025-12-18T19:29:19.006Z" },
|
|
1295
|
+
{ url = "https://files.pythonhosted.org/packages/fb/9c/896c862e13886fae2af961bef3e6312db9ebc6adc2b156fe95e615dee8c1/ruff-0.14.10-py3-none-win_amd64.whl", hash = "sha256:466297bd73638c6bdf06485683e812db1c00c7ac96d4ddd0294a338c62fdc154", size = 14661283, upload-time = "2025-12-18T19:29:30.16Z" },
|
|
1296
|
+
{ url = "https://files.pythonhosted.org/packages/74/31/b0e29d572670dca3674eeee78e418f20bdf97fa8aa9ea71380885e175ca0/ruff-0.14.10-py3-none-win_arm64.whl", hash = "sha256:e51d046cf6dda98a4633b8a8a771451107413b0f07183b2bef03f075599e44e6", size = 13729839, upload-time = "2025-12-18T19:28:48.636Z" },
|
|
1297
|
+
]
|
|
1298
|
+
|
|
1273
1299
|
[[package]]
|
|
1274
1300
|
name = "stinger-python-utils"
|
|
1275
|
-
version = "0.1.
|
|
1301
|
+
version = "0.1.5"
|
|
1276
1302
|
source = { editable = "." }
|
|
1277
1303
|
dependencies = [
|
|
1278
1304
|
{ name = "pydantic", version = "2.5.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.8'" },
|
|
@@ -1294,6 +1320,7 @@ dev = [
|
|
|
1294
1320
|
{ name = "pytest", version = "8.3.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.8.*'" },
|
|
1295
1321
|
{ name = "pytest", version = "8.4.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" },
|
|
1296
1322
|
{ name = "pytest", version = "9.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" },
|
|
1323
|
+
{ name = "ruff" },
|
|
1297
1324
|
]
|
|
1298
1325
|
|
|
1299
1326
|
[package.metadata]
|
|
@@ -1307,6 +1334,7 @@ dev = [
|
|
|
1307
1334
|
{ name = "black", specifier = ">=23.3.0" },
|
|
1308
1335
|
{ name = "mypy", specifier = ">=1.4.1" },
|
|
1309
1336
|
{ name = "pytest", specifier = ">=7.0.0" },
|
|
1337
|
+
{ name = "ruff", specifier = ">=0.14.10" },
|
|
1310
1338
|
]
|
|
1311
1339
|
|
|
1312
1340
|
[[package]]
|
{stinger_python_utils-0.1.4 → stinger_python_utils-0.1.5}/.github/workflows/python-tests.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stinger_python_utils-0.1.4 → stinger_python_utils-0.1.5}/src/stinger_python_utils/__init__.py
RENAMED
|
File without changes
|
{stinger_python_utils-0.1.4 → stinger_python_utils-0.1.5}/src/stinger_python_utils/return_codes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|