From b7bf1b24a858c781ee3188da589fb5d153198f3c Mon Sep 17 00:00:00 2001 From: RaHehl <7577984+RaHehl@users.noreply.github.com> Date: Sat, 7 Dec 2024 15:36:13 +0100 Subject: [PATCH] fix(data): initialize keyrings and ulp_users as empty dictionaries; update return type in dict_from_unifi_list --- src/uiprotect/data/bootstrap.py | 4 ++-- src/uiprotect/data/convert.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uiprotect/data/bootstrap.py b/src/uiprotect/data/bootstrap.py index 8b28f7e7..2113783a 100644 --- a/src/uiprotect/data/bootstrap.py +++ b/src/uiprotect/data/bootstrap.py @@ -188,8 +188,8 @@ class Bootstrap(ProtectBaseObject): # agreements # not directly from UniFi - keyrings: dict[str, Keyring] | None = None - ulp_users: dict[str, UlpUser] | None = None + keyrings: dict[str, Keyring] = {} + ulp_users: dict[str, UlpUser] = {} events: dict[str, Event] = FixSizeOrderedDict() capture_ws_stats: bool = False mac_lookup: dict[str, ProtectDeviceRef] = {} diff --git a/src/uiprotect/data/convert.py b/src/uiprotect/data/convert.py index 8f7e44d8..306b7b01 100644 --- a/src/uiprotect/data/convert.py +++ b/src/uiprotect/data/convert.py @@ -88,7 +88,7 @@ def create_from_unifi_dict( def dict_from_unifi_list( api: ProtectApiClient, unifi_list: list[dict[str, ProtectModelWithId]] ) -> dict[str, ProtectModelWithId]: - return_dict: dict[str, Any] = {} + return_dict: dict[str, ProtectModelWithId] = {} for obj_dict in unifi_list: obj = create_from_unifi_dict(obj_dict, api) return_dict[cast(ProtectModelWithId, obj).id] = obj