uiprotect 7.5.2__py3-none-any.whl → 7.5.3__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 CHANGED
@@ -8,7 +8,7 @@ from collections.abc import Callable
8
8
  from datetime import datetime, timedelta
9
9
  from functools import cache
10
10
  from ipaddress import IPv4Address
11
- from typing import TYPE_CHECKING, Any, NamedTuple, TypeVar
11
+ from typing import TYPE_CHECKING, Any, NamedTuple
12
12
  from uuid import UUID
13
13
 
14
14
  from convertertools import pop_dict_set_if_none, pop_dict_tuple
@@ -53,7 +53,6 @@ if TYPE_CHECKING:
53
53
  from ..data.user import User
54
54
 
55
55
 
56
- ProtectObject = TypeVar("ProtectObject", bound="ProtectBaseObject")
57
56
  RECENT_EVENT_MAX = timedelta(seconds=30)
58
57
  EVENT_PING_INTERVAL = timedelta(seconds=3)
59
58
  EVENT_PING_INTERVAL_SECONDS = EVENT_PING_INTERVAL.total_seconds()
@@ -478,7 +477,7 @@ class ProtectBaseObject(BaseModel):
478
477
 
479
478
  return new_data
480
479
 
481
- def update_from_dict(cls: ProtectObject, data: dict[str, Any]) -> ProtectObject:
480
+ def update_from_dict(self, data: dict[str, Any]) -> Self:
482
481
  """
483
482
  Updates current object from a cleaned UFP JSON dict.
484
483
 
@@ -492,15 +491,15 @@ class ProtectBaseObject(BaseModel):
492
491
  has_unifi_lists,
493
492
  unifi_dicts,
494
493
  has_unifi_dicts,
495
- ) = cls._get_protect_model()
496
- api = cls._api
497
- _fields = cls.model_fields
494
+ ) = self._get_protect_model()
495
+ api = self._api
496
+ _fields = self.__class__.model_fields
498
497
  unifi_obj: ProtectBaseObject | None
499
498
  value: Any
500
499
 
501
500
  for key, item in data.items():
502
501
  if has_unifi_objs and key in unifi_objs and isinstance(item, dict):
503
- if (unifi_obj := getattr(cls, key)) is not None:
502
+ if (unifi_obj := getattr(self, key)) is not None:
504
503
  value = unifi_obj.update_from_dict(item)
505
504
  else:
506
505
  value = unifi_objs[key](**item, api=api)
@@ -514,9 +513,9 @@ class ProtectBaseObject(BaseModel):
514
513
  else:
515
514
  value = convert_unifi_data(item, _fields[key])
516
515
 
517
- setattr(cls, key, value)
516
+ setattr(self, key, value)
518
517
 
519
- return cls
518
+ return self
520
519
 
521
520
  def dict_with_excludes(self) -> dict[str, Any]:
522
521
  """Returns a dict of the current object without any UFP objects converted to dicts."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: uiprotect
3
- Version: 7.5.2
3
+ Version: 7.5.3
4
4
  Summary: Python API for Unifi Protect (Unofficial)
5
5
  Author: UI Protect Maintainers
6
6
  Author-email: ui@koston.org
@@ -16,7 +16,7 @@ uiprotect/cli/nvr.py,sha256=TwxEg2XT8jXAbOqv6gc7KFXELKadeItEDYweSL4_-e8,4260
16
16
  uiprotect/cli/sensors.py,sha256=fQtcDJCVxs4VbAqcavgBy2ABiVxAW3GXtna6_XFBp2k,8153
17
17
  uiprotect/cli/viewers.py,sha256=2cyrp104ffIvgT0wYGIO0G35QMkEbFe7fSVqLwDXQYQ,2171
18
18
  uiprotect/data/__init__.py,sha256=audwJBjxRiYdNPeYlP6iofFIOq3gyQzh6VpDsOCM2dQ,2964
19
- uiprotect/data/base.py,sha256=rXm08mA4W7VErgsjS_lqM9HBhFK5-he1L2N6zFMl5yY,35481
19
+ uiprotect/data/base.py,sha256=5DHHot9uHLBg2quXhf0Q2SdiIuQBnR7tLw_8PgODH6s,35397
20
20
  uiprotect/data/bootstrap.py,sha256=ddNaKrTprN7Zq0ZE3O_F5whepUh6z9GqyrUWxLyZ0HE,23570
21
21
  uiprotect/data/convert.py,sha256=xEN878_hm0HZZCVYGwJSxcSp2as9zpkvsemVIibReOA,2628
22
22
  uiprotect/data/devices.py,sha256=AuQK0vfs5J370TW7GDa6M8ylhaFZoxlAL-_SGyCOAUk,114391
@@ -32,8 +32,8 @@ uiprotect/test_util/__init__.py,sha256=HlQBgIgdtrvT-gQ5OWP92LbgVr_YzsD5NFImLRonU
32
32
  uiprotect/test_util/anonymize.py,sha256=f-8ijU-_y9r-uAbhIPn0f0I6hzJpAkvJzc8UpWihObI,8478
33
33
  uiprotect/utils.py,sha256=5Z30chqnQhQdtD1vabRtZXjBpeiJagL5KDuALQlWxk8,20559
34
34
  uiprotect/websocket.py,sha256=tEyenqblNXHcjWYuf4oRP1E7buNwx6zoECMwpBr-jig,8191
35
- uiprotect-7.5.2.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
36
- uiprotect-7.5.2.dist-info/METADATA,sha256=ZCmDSknaWeoGOM0GWjiX0T7ge_DL2137w-wB0-TQ-Zs,11095
37
- uiprotect-7.5.2.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
38
- uiprotect-7.5.2.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
39
- uiprotect-7.5.2.dist-info/RECORD,,
35
+ uiprotect-7.5.3.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
36
+ uiprotect-7.5.3.dist-info/METADATA,sha256=S2b2APeP61Vf8K-pm3fiyaljfJsxXIUZu4enkt9pnQk,11095
37
+ uiprotect-7.5.3.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
38
+ uiprotect-7.5.3.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
39
+ uiprotect-7.5.3.dist-info/RECORD,,