uiprotect 3.1.7__tar.gz → 3.1.8__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 (36) hide show
  1. {uiprotect-3.1.7 → uiprotect-3.1.8}/PKG-INFO +1 -1
  2. {uiprotect-3.1.7 → uiprotect-3.1.8}/pyproject.toml +1 -1
  3. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/data/base.py +22 -29
  4. {uiprotect-3.1.7 → uiprotect-3.1.8}/LICENSE +0 -0
  5. {uiprotect-3.1.7 → uiprotect-3.1.8}/README.md +0 -0
  6. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/__init__.py +0 -0
  7. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/__main__.py +0 -0
  8. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/api.py +0 -0
  9. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/cli/__init__.py +0 -0
  10. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/cli/backup.py +0 -0
  11. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/cli/base.py +0 -0
  12. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/cli/cameras.py +0 -0
  13. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/cli/chimes.py +0 -0
  14. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/cli/doorlocks.py +0 -0
  15. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/cli/events.py +0 -0
  16. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/cli/lights.py +0 -0
  17. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/cli/liveviews.py +0 -0
  18. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/cli/nvr.py +0 -0
  19. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/cli/sensors.py +0 -0
  20. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/cli/viewers.py +0 -0
  21. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/data/__init__.py +0 -0
  22. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/data/bootstrap.py +0 -0
  23. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/data/convert.py +0 -0
  24. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/data/devices.py +0 -0
  25. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/data/nvr.py +0 -0
  26. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/data/types.py +0 -0
  27. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/data/user.py +0 -0
  28. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/data/websocket.py +0 -0
  29. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/exceptions.py +0 -0
  30. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/py.typed +0 -0
  31. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/release_cache.json +0 -0
  32. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/stream.py +0 -0
  33. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/test_util/__init__.py +0 -0
  34. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/test_util/anonymize.py +0 -0
  35. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/utils.py +0 -0
  36. {uiprotect-3.1.7 → uiprotect-3.1.8}/src/uiprotect/websocket.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uiprotect
3
- Version: 3.1.7
3
+ Version: 3.1.8
4
4
  Summary: Python API for Unifi Protect (Unofficial)
5
5
  Home-page: https://github.com/uilibs/uiprotect
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "uiprotect"
3
- version = "3.1.7"
3
+ version = "3.1.8"
4
4
  description = "Python API for Unifi Protect (Unofficial)"
5
5
  authors = ["UI Protect Maintainers <ui@koston.org>"]
6
6
  license = "MIT"
@@ -582,28 +582,24 @@ class ProtectModelWithId(ProtectModel):
582
582
  setattr(self, key, data_before_changes[key])
583
583
 
584
584
  def can_create(self, user: User) -> bool:
585
- if self.model is None:
586
- return True
587
-
588
- return user.can(self.model, PermissionNode.CREATE, self)
585
+ if (model := self.model) is not None:
586
+ return user.can(model, PermissionNode.CREATE, self)
587
+ return True
589
588
 
590
589
  def can_read(self, user: User) -> bool:
591
- if self.model is None:
592
- return True
593
-
594
- return user.can(self.model, PermissionNode.READ, self)
590
+ if (model := self.model) is not None:
591
+ return user.can(model, PermissionNode.READ, self)
592
+ return True
595
593
 
596
594
  def can_write(self, user: User) -> bool:
597
- if self.model is None:
598
- return True
599
-
600
- return user.can(self.model, PermissionNode.WRITE, self)
595
+ if (model := self.model) is not None:
596
+ return user.can(model, PermissionNode.WRITE, self)
597
+ return True
601
598
 
602
599
  def can_delete(self, user: User) -> bool:
603
- if self.model is None:
604
- return True
605
-
606
- return user.can(self.model, PermissionNode.DELETE, self)
600
+ if (model := self.model) is not None:
601
+ return user.can(model, PermissionNode.DELETE, self)
602
+ return True
607
603
 
608
604
  async def queue_update(self, callback: Callable[[], None]) -> None:
609
605
  """
@@ -615,9 +611,8 @@ class ProtectModelWithId(ProtectModel):
615
611
  self._update_sync.queue.put_nowait(callback)
616
612
 
617
613
  self._update_sync.event.set()
618
- await asyncio.sleep(
619
- 0.001,
620
- ) # release execution so other `queue_update` calls can abort
614
+ # release execution so other `queue_update` calls can abort
615
+ await asyncio.sleep(0.001)
621
616
  self._update_sync.event.clear()
622
617
 
623
618
  try:
@@ -930,8 +925,8 @@ class ProtectAdoptableDeviceModel(ProtectDeviceModel):
930
925
  }
931
926
 
932
927
  async def _api_update(self, data: dict[str, Any]) -> None:
933
- if self.model is not None:
934
- return await self._api.update_device(self.model, self.id, data)
928
+ if (model := self.model) is not None:
929
+ return await self._api.update_device(model, self.id, data)
935
930
  return None
936
931
 
937
932
  def unifi_dict(
@@ -974,10 +969,9 @@ class ProtectAdoptableDeviceModel(ProtectDeviceModel):
974
969
 
975
970
  @property
976
971
  def bridge(self) -> Bridge | None:
977
- if self.bridge_id is None:
978
- return None
979
-
980
- return self._api.bootstrap.bridges[self.bridge_id]
972
+ if (bridge_id := self.bridge_id) is not None:
973
+ return self._api.bootstrap.bridges[bridge_id]
974
+ return None
981
975
 
982
976
  @property
983
977
  def protect_url(self) -> str:
@@ -1066,7 +1060,6 @@ class ProtectMotionDeviceModel(ProtectAdoptableDeviceModel):
1066
1060
 
1067
1061
  @property
1068
1062
  def last_motion_event(self) -> Event | None:
1069
- if self.last_motion_event_id is None:
1070
- return None
1071
-
1072
- return self._api.bootstrap.events.get(self.last_motion_event_id)
1063
+ if (last_motion_event_id := self.last_motion_event_id) is not None:
1064
+ return self._api.bootstrap.events.get(last_motion_event_id)
1065
+ return None
File without changes
File without changes