uiprotect 7.0.1__py3-none-any.whl → 7.0.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.
Potentially problematic release.
This version of uiprotect might be problematic. Click here for more details.
- uiprotect/data/base.py +16 -10
- uiprotect/data/bootstrap.py +3 -3
- uiprotect/utils.py +1 -1
- {uiprotect-7.0.1.dist-info → uiprotect-7.0.2.dist-info}/METADATA +1 -1
- {uiprotect-7.0.1.dist-info → uiprotect-7.0.2.dist-info}/RECORD +8 -8
- {uiprotect-7.0.1.dist-info → uiprotect-7.0.2.dist-info}/LICENSE +0 -0
- {uiprotect-7.0.1.dist-info → uiprotect-7.0.2.dist-info}/WHEEL +0 -0
- {uiprotect-7.0.1.dist-info → uiprotect-7.0.2.dist-info}/entry_points.txt +0 -0
uiprotect/data/base.py
CHANGED
|
@@ -137,10 +137,12 @@ class ProtectBaseObject(BaseModel):
|
|
|
137
137
|
data.pop("api", None)
|
|
138
138
|
return cls(api=api, **data)
|
|
139
139
|
|
|
140
|
-
return cls.
|
|
140
|
+
return cls.model_construct(**data)
|
|
141
141
|
|
|
142
142
|
@classmethod
|
|
143
|
-
def
|
|
143
|
+
def model_construct(
|
|
144
|
+
cls, _fields_set: set[str] | None = None, **values: Any
|
|
145
|
+
) -> Self:
|
|
144
146
|
api: ProtectApiClient | None = values.pop("api", None)
|
|
145
147
|
(
|
|
146
148
|
unifi_objs,
|
|
@@ -152,19 +154,21 @@ class ProtectBaseObject(BaseModel):
|
|
|
152
154
|
) = cls._get_protect_model()
|
|
153
155
|
for key, value in values.items():
|
|
154
156
|
if has_unifi_objs and key in unifi_objs and isinstance(value, dict):
|
|
155
|
-
values[key] = unifi_objs[key].
|
|
157
|
+
values[key] = unifi_objs[key].model_construct(**value)
|
|
156
158
|
elif has_unifi_lists and key in unifi_lists and isinstance(value, list):
|
|
157
159
|
values[key] = [
|
|
158
|
-
unifi_lists[key].
|
|
160
|
+
unifi_lists[key].model_construct(**v) if isinstance(v, dict) else v
|
|
159
161
|
for v in value
|
|
160
162
|
]
|
|
161
163
|
elif has_unifi_dicts and key in unifi_dicts and isinstance(value, dict):
|
|
162
164
|
values[key] = {
|
|
163
|
-
k: unifi_dicts[key].
|
|
165
|
+
k: unifi_dicts[key].model_construct(**v)
|
|
166
|
+
if isinstance(v, dict)
|
|
167
|
+
else v
|
|
164
168
|
for k, v in value.items()
|
|
165
169
|
}
|
|
166
170
|
|
|
167
|
-
obj = super().
|
|
171
|
+
obj = super().model_construct(_fields_set=_fields_set, **values)
|
|
168
172
|
if api is not None:
|
|
169
173
|
obj._api = api
|
|
170
174
|
|
|
@@ -369,7 +373,7 @@ class ProtectBaseObject(BaseModel):
|
|
|
369
373
|
if isinstance(value, ProtectBaseObject):
|
|
370
374
|
value = value.unifi_dict()
|
|
371
375
|
elif isinstance(value, dict):
|
|
372
|
-
value = klass.
|
|
376
|
+
value = klass.model_construct({}).unifi_dict(data=value) # type: ignore[arg-type]
|
|
373
377
|
|
|
374
378
|
return value
|
|
375
379
|
|
|
@@ -390,7 +394,7 @@ class ProtectBaseObject(BaseModel):
|
|
|
390
394
|
return [
|
|
391
395
|
item.unifi_dict()
|
|
392
396
|
if isinstance(item, ProtectBaseObject)
|
|
393
|
-
else klass.
|
|
397
|
+
else klass.model_construct({}).unifi_dict(data=item) # type: ignore[arg-type]
|
|
394
398
|
for item in value
|
|
395
399
|
]
|
|
396
400
|
|
|
@@ -587,9 +591,11 @@ class ProtectModelWithId(ProtectModel):
|
|
|
587
591
|
self._update_sync = update_sync or UpdateSynchronization()
|
|
588
592
|
|
|
589
593
|
@classmethod
|
|
590
|
-
def
|
|
594
|
+
def model_construct(
|
|
595
|
+
cls, _fields_set: set[str] | None = None, **values: Any
|
|
596
|
+
) -> Self:
|
|
591
597
|
update_sync = values.pop("update_sync", None)
|
|
592
|
-
obj = super().
|
|
598
|
+
obj = super().model_construct(_fields_set=_fields_set, **values)
|
|
593
599
|
obj._update_sync = update_sync or UpdateSynchronization()
|
|
594
600
|
return obj
|
|
595
601
|
|
uiprotect/data/bootstrap.py
CHANGED
|
@@ -426,7 +426,7 @@ class Bootstrap(ProtectBaseObject):
|
|
|
426
426
|
if updated_obj is None:
|
|
427
427
|
return None
|
|
428
428
|
|
|
429
|
-
old_obj = updated_obj.
|
|
429
|
+
old_obj = updated_obj.model_copy()
|
|
430
430
|
updated_data = {to_snake_case(k): v for k, v in data.items()}
|
|
431
431
|
updated_obj.update_from_dict(updated_data)
|
|
432
432
|
|
|
@@ -461,7 +461,7 @@ class Bootstrap(ProtectBaseObject):
|
|
|
461
461
|
if not (data := self.nvr.unifi_dict_to_dict(data)):
|
|
462
462
|
return None
|
|
463
463
|
|
|
464
|
-
old_nvr = self.nvr.
|
|
464
|
+
old_nvr = self.nvr.model_copy()
|
|
465
465
|
self.nvr = self.nvr.update_from_dict(data)
|
|
466
466
|
|
|
467
467
|
return WSSubscriptionMessage(
|
|
@@ -517,7 +517,7 @@ class Bootstrap(ProtectBaseObject):
|
|
|
517
517
|
# nothing left to process
|
|
518
518
|
return None
|
|
519
519
|
|
|
520
|
-
old_obj = obj.
|
|
520
|
+
old_obj = obj.model_copy()
|
|
521
521
|
obj = obj.update_from_dict(data)
|
|
522
522
|
|
|
523
523
|
if model_type is ModelType.EVENT:
|
uiprotect/utils.py
CHANGED
|
@@ -572,7 +572,7 @@ def local_datetime(dt: datetime | None = None) -> datetime:
|
|
|
572
572
|
def log_event(event: Event) -> None:
|
|
573
573
|
from uiprotect.data import EventType
|
|
574
574
|
|
|
575
|
-
_LOGGER.debug("event WS msg: %s", event.
|
|
575
|
+
_LOGGER.debug("event WS msg: %s", event.model_dump())
|
|
576
576
|
if "smart" not in event.type.value:
|
|
577
577
|
return
|
|
578
578
|
|
|
@@ -15,8 +15,8 @@ uiprotect/cli/nvr.py,sha256=TwxEg2XT8jXAbOqv6gc7KFXELKadeItEDYweSL4_-e8,4260
|
|
|
15
15
|
uiprotect/cli/sensors.py,sha256=fQtcDJCVxs4VbAqcavgBy2ABiVxAW3GXtna6_XFBp2k,8153
|
|
16
16
|
uiprotect/cli/viewers.py,sha256=2cyrp104ffIvgT0wYGIO0G35QMkEbFe7fSVqLwDXQYQ,2171
|
|
17
17
|
uiprotect/data/__init__.py,sha256=OcfuJl2qXfHcj_mdnrHhzZ5tEIZrw8auziX5IE7dn-I,2938
|
|
18
|
-
uiprotect/data/base.py,sha256=
|
|
19
|
-
uiprotect/data/bootstrap.py,sha256=
|
|
18
|
+
uiprotect/data/base.py,sha256=LRqmK60PKeDFgP2k5qpVj93AxEvdfC6kLk0Cqvt1W5k,35481
|
|
19
|
+
uiprotect/data/bootstrap.py,sha256=oWjjWsLg8f_OERG_9h__5exB3qCmwI6KX4khBGZEzoc,23251
|
|
20
20
|
uiprotect/data/convert.py,sha256=CDPkSMxSEhvDigmzmLFKpjrz0oa5FOvOdkNIHZrOZ4Q,2586
|
|
21
21
|
uiprotect/data/devices.py,sha256=Brj9bT9oJPb5jqAY5vc2JhFG6m7DJt8u58qVe-oTw6M,113803
|
|
22
22
|
uiprotect/data/nvr.py,sha256=E18DgE0nXl9VZ_ULotTPcXSi3M1u3mWQsuZbY1gIajs,47490
|
|
@@ -29,10 +29,10 @@ uiprotect/release_cache.json,sha256=NamnSFy78hOWY0DPO87J9ELFCAN6NnVquv8gQO75ZG4,
|
|
|
29
29
|
uiprotect/stream.py,sha256=MWiTRFIhUfFLPA_csSrKl5-SkUbPZ2VhDu0XW2oVr-U,4800
|
|
30
30
|
uiprotect/test_util/__init__.py,sha256=Ky8mTL61nhp5II2mxTKBAsSGvNqK8U_CfKC5AGwToAI,18704
|
|
31
31
|
uiprotect/test_util/anonymize.py,sha256=f-8ijU-_y9r-uAbhIPn0f0I6hzJpAkvJzc8UpWihObI,8478
|
|
32
|
-
uiprotect/utils.py,sha256=
|
|
32
|
+
uiprotect/utils.py,sha256=q2YYQfxr0b3QEWMSP7SdpcJZbB4huEhpo8PbtnTbEFI,20481
|
|
33
33
|
uiprotect/websocket.py,sha256=tEyenqblNXHcjWYuf4oRP1E7buNwx6zoECMwpBr-jig,8191
|
|
34
|
-
uiprotect-7.0.
|
|
35
|
-
uiprotect-7.0.
|
|
36
|
-
uiprotect-7.0.
|
|
37
|
-
uiprotect-7.0.
|
|
38
|
-
uiprotect-7.0.
|
|
34
|
+
uiprotect-7.0.2.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
|
|
35
|
+
uiprotect-7.0.2.dist-info/METADATA,sha256=rtp7lvceFYj6ZjMcu6s0RtFwTCZQ4KJrRgbfRr9aUNE,11142
|
|
36
|
+
uiprotect-7.0.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
37
|
+
uiprotect-7.0.2.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
|
|
38
|
+
uiprotect-7.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|