Avoid rebuilding urls for every request (#715)

* Avoid rebuilding urls for every request

* more fixes

* more fixes

* make mypy happy

* reduce

* tweak

* fix tests

* fix tests

* tweak

* tweak

* lint

* fix type
This commit is contained in:
J. Nick Koston
2024-01-29 05:26:00 -10:00
committed by GitHub
parent 69dcc0d8bb
commit b479b6d84d
7 changed files with 73 additions and 62 deletions

View File

@@ -1,13 +1,13 @@
"""python-kasa exceptions."""
from asyncio import TimeoutError
from enum import IntEnum
from typing import Optional
from typing import Any, Optional
class SmartDeviceException(Exception):
"""Base exception for device errors."""
def __init__(self, *args, **kwargs):
def __init__(self, *args: Any, **kwargs: Any) -> None:
self.error_code: Optional["SmartErrorCode"] = kwargs.get("error_code", None)
super().__init__(*args)
@@ -15,7 +15,7 @@ class SmartDeviceException(Exception):
class UnsupportedDeviceException(SmartDeviceException):
"""Exception for trying to connect to unsupported devices."""
def __init__(self, *args, **kwargs):
def __init__(self, *args: Any, **kwargs: Any) -> None:
self.discovery_result = kwargs.get("discovery_result")
super().__init__(*args, **kwargs)