uiprotect 7.0.1__tar.gz → 7.0.2__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.

Potentially problematic release.


This version of uiprotect might be problematic. Click here for more details.

Files changed (37) hide show
  1. {uiprotect-7.0.1 → uiprotect-7.0.2}/PKG-INFO +1 -1
  2. {uiprotect-7.0.1 → uiprotect-7.0.2}/pyproject.toml +1 -1
  3. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/data/base.py +16 -10
  4. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/data/bootstrap.py +3 -3
  5. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/utils.py +1 -1
  6. {uiprotect-7.0.1 → uiprotect-7.0.2}/LICENSE +0 -0
  7. {uiprotect-7.0.1 → uiprotect-7.0.2}/README.md +0 -0
  8. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/__init__.py +0 -0
  9. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/__main__.py +0 -0
  10. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/_compat.py +0 -0
  11. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/api.py +0 -0
  12. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/cli/__init__.py +0 -0
  13. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/cli/backup.py +0 -0
  14. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/cli/base.py +0 -0
  15. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/cli/cameras.py +0 -0
  16. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/cli/chimes.py +0 -0
  17. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/cli/doorlocks.py +0 -0
  18. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/cli/events.py +0 -0
  19. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/cli/lights.py +0 -0
  20. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/cli/liveviews.py +0 -0
  21. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/cli/nvr.py +0 -0
  22. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/cli/sensors.py +0 -0
  23. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/cli/viewers.py +0 -0
  24. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/data/__init__.py +0 -0
  25. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/data/convert.py +0 -0
  26. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/data/devices.py +0 -0
  27. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/data/nvr.py +0 -0
  28. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/data/types.py +0 -0
  29. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/data/user.py +0 -0
  30. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/data/websocket.py +0 -0
  31. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/exceptions.py +0 -0
  32. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/py.typed +0 -0
  33. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/release_cache.json +0 -0
  34. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/stream.py +0 -0
  35. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/test_util/__init__.py +0 -0
  36. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/test_util/anonymize.py +0 -0
  37. {uiprotect-7.0.1 → uiprotect-7.0.2}/src/uiprotect/websocket.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uiprotect
3
- Version: 7.0.1
3
+ Version: 7.0.2
4
4
  Summary: Python API for Unifi Protect (Unofficial)
5
5
  Home-page: https://github.com/uilibs/uiprotect
6
6
  Author: UI Protect Maintainers
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "uiprotect"
3
- version = "7.0.1"
3
+ version = "7.0.2"
4
4
  description = "Python API for Unifi Protect (Unofficial)"
5
5
  authors = ["UI Protect Maintainers <ui@koston.org>"]
6
6
  readme = "README.md"
@@ -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.construct(**data)
140
+ return cls.model_construct(**data)
141
141
 
142
142
  @classmethod
143
- def construct(cls, _fields_set: set[str] | None = None, **values: Any) -> Self:
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].construct(**value)
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].construct(**v) if isinstance(v, dict) else v
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].construct(**v) if isinstance(v, dict) else v
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().construct(_fields_set=_fields_set, **values)
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.construct({}).unifi_dict(data=value) # type: ignore[arg-type]
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.construct({}).unifi_dict(data=item) # type: ignore[arg-type]
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 construct(cls, _fields_set: set[str] | None = None, **values: Any) -> Self:
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().construct(_fields_set=_fields_set, **values)
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
 
@@ -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.copy()
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.copy()
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.copy()
520
+ old_obj = obj.model_copy()
521
521
  obj = obj.update_from_dict(data)
522
522
 
523
523
  if model_type is ModelType.EVENT:
@@ -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.dict())
575
+ _LOGGER.debug("event WS msg: %s", event.model_dump())
576
576
  if "smart" not in event.type.value:
577
577
  return
578
578
 
File without changes
File without changes