From c076bc72ff2bb2b409d5e7a22c721501133d4cea Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 19 Nov 2023 10:00:34 -0600 Subject: [PATCH] typing --- kasa/device_factory.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kasa/device_factory.py b/kasa/device_factory.py index 1d29312b..f18591e8 100755 --- a/kasa/device_factory.py +++ b/kasa/device_factory.py @@ -1,6 +1,6 @@ """Device creation by type.""" -from typing import Optional, Type +from typing import Any, Dict, Optional, Type from .credentials import Credentials from .device_type import DeviceType @@ -68,12 +68,12 @@ async def connect( return dev -def get_device_class_from_info(info: dict) -> Type[SmartDevice]: +def get_device_class_from_info(info: Dict[str, Any]) -> Type[SmartDevice]: """Find SmartDevice subclass for device described by passed data.""" if "system" not in info or "get_sysinfo" not in info["system"]: raise SmartDeviceException("No 'system' or 'get_sysinfo' in response") - sysinfo = info["system"]["get_sysinfo"] + sysinfo: Dict[str, Any] = info["system"]["get_sysinfo"] type_ = sysinfo.get("type", sysinfo.get("mic_type")) if type_ is None: raise SmartDeviceException("Unable to find the device type field!")