openmodule 16.0.2__tar.gz → 16.0.3rc1__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.
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/PKG-INFO +2 -2
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/models/base.py +2 -27
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule.egg-info/PKG-INFO +2 -2
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule.egg-info/requires.txt +1 -1
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_model.py +0 -17
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/LICENSE +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/README.md +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/__init__.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/alert.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/config.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/connection_status.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/core.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/database/__init__.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/database/custom_types.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/database/database.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/database/env.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/database/migration.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/dispatcher.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/health.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/logging.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/messaging.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/models/__init__.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/models/access_service.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/models/alert.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/models/io.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/models/kv_store.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/models/presence.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/models/privacy.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/models/rpc.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/models/settings.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/models/signals.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/models/validation.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/models/vehicle.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/rpc/__init__.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/rpc/client.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/rpc/common.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/rpc/server.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/sentry.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/threading.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/__init__.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/access_service.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/charset.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/cleanup.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/csv_export.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/databox.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/db_helper.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/eventlog.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/io.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/kv_store.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/matching.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/misc_functions.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/package_reader.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/presence.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/schedule.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/settings.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/signal_listener.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/translation.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule/utils/validation.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule.egg-info/SOURCES.txt +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule.egg-info/dependency_links.txt +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule.egg-info/not-zip-safe +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/openmodule.egg-info/top_level.txt +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/setup.cfg +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/setup.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_alembic_migrations.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_alert.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_checks.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_config.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_connection_status.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_core.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_database.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_dispatcher.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_health.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_interrupt.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_io_listen.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_logging.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_messaging.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_mockrpcclient.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_rpc.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_sentry.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_test_alert.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_test_gate.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_test_zeromq.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_utils_access_service.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_utils_charset.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_utils_cleanup.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_utils_csv_export.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_utils_databox.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_utils_eventlog.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_utils_kv_store.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_utils_kv_store_multiple.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_utils_matching.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_utils_misc_functions.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_utils_package_reader.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_utils_presence.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_utils_schedule.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_utils_settings.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_utils_signal.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_utils_validation.py +0 -0
- {openmodule-16.0.2 → openmodule-16.0.3rc1}/tests/test_utils_vehicle.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openmodule
|
|
3
|
-
Version: 16.0.
|
|
3
|
+
Version: 16.0.3rc1
|
|
4
4
|
Summary: Libraries for developing the arivo openmodule
|
|
5
5
|
Home-page: https://gitlab.com/arivo-public/device-python/openmodule.git
|
|
6
6
|
Author: ARIVO
|
|
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
14
|
Description-Content-Type: text/markdown; charset=UTF-8
|
|
15
15
|
License-File: LICENSE
|
|
16
|
-
Requires-Dist: pydantic
|
|
16
|
+
Requires-Dist: pydantic!=2.12.0,~=2.0
|
|
17
17
|
Requires-Dist: sentry-sdk~=2.19.0
|
|
18
18
|
Requires-Dist: orjson<4,>=3.4.7
|
|
19
19
|
Requires-Dist: pyzmq~=26.2
|
|
@@ -5,13 +5,13 @@ from datetime import datetime
|
|
|
5
5
|
from decimal import Decimal
|
|
6
6
|
from enum import StrEnum
|
|
7
7
|
from json.encoder import ESCAPE_ASCII
|
|
8
|
-
from typing import Annotated
|
|
8
|
+
from typing import Annotated
|
|
9
9
|
|
|
10
10
|
import orjson
|
|
11
11
|
from pydantic_core import PydanticUndefined
|
|
12
12
|
import zmq
|
|
13
13
|
from dateutil.tz import UTC
|
|
14
|
-
from pydantic import AfterValidator, ConfigDict, Field, BaseModel,
|
|
14
|
+
from pydantic import AfterValidator, ConfigDict, Field, BaseModel, RootModel
|
|
15
15
|
|
|
16
16
|
from openmodule import sentry
|
|
17
17
|
from openmodule.config import run_checks, settings
|
|
@@ -158,10 +158,7 @@ def datetime_to_timestamp(dt: datetime):
|
|
|
158
158
|
|
|
159
159
|
|
|
160
160
|
class ZMQMessage(OpenModuleModel):
|
|
161
|
-
_ALLOW_CUSTOM_TIMESTAMP: ClassVar[bool] = False # set to true for tools scripts, where you need to set the timestamp manually
|
|
162
|
-
|
|
163
161
|
timestamp: Datetime = Field(default_factory=lambda: utcnow())
|
|
164
|
-
_using_default_timestamp: bool = PrivateAttr()
|
|
165
162
|
|
|
166
163
|
name: str = Field(default_factory=lambda: settings.NAME)
|
|
167
164
|
type: str
|
|
@@ -183,28 +180,6 @@ class ZMQMessage(OpenModuleModel):
|
|
|
183
180
|
data["timestamp"] = datetime_to_timestamp(data["timestamp"])
|
|
184
181
|
return data
|
|
185
182
|
|
|
186
|
-
@classmethod
|
|
187
|
-
def model_validate(cls, obj: Any, *, context: Optional[Any] = None, **kwargs) -> Self:
|
|
188
|
-
context = {**(context or {}), "from_model_validate": True}
|
|
189
|
-
return super().model_validate(obj, context=context, **kwargs)
|
|
190
|
-
|
|
191
|
-
@model_validator(mode="before")
|
|
192
|
-
@classmethod
|
|
193
|
-
def check_default_timestamp(cls, data: dict):
|
|
194
|
-
cls._using_default_timestamp = "timestamp" not in data
|
|
195
|
-
return data
|
|
196
|
-
|
|
197
|
-
@field_validator("timestamp", mode="before")
|
|
198
|
-
@classmethod
|
|
199
|
-
def check_custom_timestamp(cls, v, info):
|
|
200
|
-
from_model_validate = (info.context or {}).get("from_model_validate", False) is True
|
|
201
|
-
using_default_timestamp = cls._using_default_timestamp is True
|
|
202
|
-
custom_constructor_timestamp_allowed = cls._ALLOW_CUSTOM_TIMESTAMP is True
|
|
203
|
-
|
|
204
|
-
if not using_default_timestamp and not custom_constructor_timestamp_allowed and not from_model_validate:
|
|
205
|
-
raise ValueError("timestamp must not be set manually")
|
|
206
|
-
return v
|
|
207
|
-
|
|
208
183
|
|
|
209
184
|
class Direction(StrEnum):
|
|
210
185
|
UNKNOWN = ""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openmodule
|
|
3
|
-
Version: 16.0.
|
|
3
|
+
Version: 16.0.3rc1
|
|
4
4
|
Summary: Libraries for developing the arivo openmodule
|
|
5
5
|
Home-page: https://gitlab.com/arivo-public/device-python/openmodule.git
|
|
6
6
|
Author: ARIVO
|
|
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
14
|
Description-Content-Type: text/markdown; charset=UTF-8
|
|
15
15
|
License-File: LICENSE
|
|
16
|
-
Requires-Dist: pydantic
|
|
16
|
+
Requires-Dist: pydantic!=2.12.0,~=2.0
|
|
17
17
|
Requires-Dist: sentry-sdk~=2.19.0
|
|
18
18
|
Requires-Dist: orjson<4,>=3.4.7
|
|
19
19
|
Requires-Dist: pyzmq~=26.2
|
|
@@ -16,12 +16,6 @@ class TestModel(OpenModuleModel):
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class ModelTestCase(TestCase):
|
|
19
|
-
def setUp(self):
|
|
20
|
-
ZMQMessage._ALLOW_CUSTOM_TIMESTAMP = True
|
|
21
|
-
|
|
22
|
-
def tearDown(self):
|
|
23
|
-
ZMQMessage._ALLOW_CUSTOM_TIMESTAMP = False
|
|
24
|
-
|
|
25
19
|
def test_json_is_forbidden(self):
|
|
26
20
|
instance = TestModel(value="Hello World")
|
|
27
21
|
with self.assertRaises(AssertionError):
|
|
@@ -148,14 +142,3 @@ class ZMQMessageTestCase(TestCase):
|
|
|
148
142
|
|
|
149
143
|
res1.pop("timestamp")
|
|
150
144
|
self.assertDictEqual(res1, {"name": "tä\nst", "type": "tö\tst"})
|
|
151
|
-
|
|
152
|
-
def test_allow_custom_timestamp(self):
|
|
153
|
-
ZMQMessage._ALLOW_CUSTOM_TIMESTAMP = False
|
|
154
|
-
with self.assertRaises(ValueError):
|
|
155
|
-
ZMQMessage(timestamp=1607586354631, name="test", type="test")
|
|
156
|
-
instance = ZMQMessage(name="test", type="test")
|
|
157
|
-
instance.type="asdf"
|
|
158
|
-
with self.assertRaises(ValueError):
|
|
159
|
-
instance.timestamp = datetime.datetime(2020, 1, 1, 0, 0, 0, 0)
|
|
160
|
-
ZMQMessage._ALLOW_CUSTOM_TIMESTAMP = True
|
|
161
|
-
instance.timestamp = datetime.datetime(2020, 1, 1, 0, 0, 0, 0)
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|