mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Update poetry locks and pre-commit hooks (#837)
Also updates CI pypy versions to be 3.9 and 3.10 which are the currently [supported versions](https://www.pypy.org/posts/2024/01/pypy-v7315-release.html). Otherwise latest cryptography doesn't ship with pypy3.8 wheels and is unable to build on windows. Also updates the `codecov-action` to v4 which fixed some intermittent uploading errors.
This commit is contained in:
@@ -11,6 +11,7 @@ For device type specific actions `SmartBulb`, `SmartPlug`, or `SmartStrip`
|
||||
Module-specific errors are raised as `KasaException` and are expected
|
||||
to be handled by the user of the library.
|
||||
"""
|
||||
|
||||
from importlib.metadata import version
|
||||
from typing import TYPE_CHECKING
|
||||
from warnings import warn
|
||||
|
@@ -3,6 +3,7 @@
|
||||
Based on the work of https://github.com/petretiandrea/plugp100
|
||||
under compatible GNU GPL3 license.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import base64
|
||||
import hashlib
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for Device base class."""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Dict, List, NamedTuple, Optional
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""python-kasa cli tool."""
|
||||
|
||||
import ast
|
||||
import asyncio
|
||||
import json
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for Device base class."""
|
||||
|
||||
import logging
|
||||
from abc import ABC, abstractmethod
|
||||
from dataclasses import dataclass
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Device creation via DeviceConfig."""
|
||||
|
||||
import logging
|
||||
import time
|
||||
from typing import Any, Dict, Optional, Tuple, Type
|
||||
|
@@ -1,6 +1,5 @@
|
||||
"""TP-Link device types."""
|
||||
|
||||
|
||||
from enum import Enum
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for holding connection parameters."""
|
||||
|
||||
import logging
|
||||
from dataclasses import asdict, dataclass, field, fields, is_dataclass
|
||||
from enum import Enum
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Discovery module for TP-Link Smart Home devices."""
|
||||
|
||||
import asyncio
|
||||
import binascii
|
||||
import ipaddress
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for emeter container."""
|
||||
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""python-kasa exceptions."""
|
||||
|
||||
from asyncio import TimeoutError as _asyncioTimeoutError
|
||||
from enum import IntEnum
|
||||
from typing import Any, Optional
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Generic interface for defining device features."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum, auto
|
||||
from typing import TYPE_CHECKING, Any, Callable, Optional, Union
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for HttpClientSession class."""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from typing import Any, Dict, Optional, Tuple, Union
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Package for supporting legacy kasa devices."""
|
||||
|
||||
from .iotbulb import IotBulb
|
||||
from .iotdevice import IotDevice
|
||||
from .iotdimmer import IotDimmer
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for bulbs (LB*, KL*, KB*)."""
|
||||
|
||||
import logging
|
||||
import re
|
||||
from enum import Enum
|
||||
@@ -233,7 +234,6 @@ class IotBulb(IotDevice, Bulb):
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@property # type: ignore
|
||||
@requires_update
|
||||
def is_color(self) -> bool:
|
||||
|
@@ -11,6 +11,7 @@ Stroetmann which is licensed under the Apache License, Version 2.0.
|
||||
You may obtain a copy of the license at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
"""
|
||||
|
||||
import collections.abc
|
||||
import functools
|
||||
import inspect
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for dimmers (currently only HS220)."""
|
||||
|
||||
from enum import Enum
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for light strips (KL430)."""
|
||||
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from ..device_type import DeviceType
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Base class for IOT module implementations."""
|
||||
|
||||
import collections
|
||||
import logging
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for smart plugs (HS100, HS110, ..)."""
|
||||
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for multi-socket devices (HS300, HS107, KP303, ..)."""
|
||||
|
||||
import logging
|
||||
from collections import defaultdict
|
||||
from datetime import datetime, timedelta
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for individual feature modules."""
|
||||
|
||||
from .ambientlight import AmbientLight
|
||||
from .antitheft import Antitheft
|
||||
from .cloud import Cloud
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of the ambient light (LAS) module found in some dimmers."""
|
||||
|
||||
from ...feature import Feature, FeatureType
|
||||
from ..iotmodule import IotModule, merge
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of the antitheft module."""
|
||||
|
||||
from .rulemodule import RuleModule
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Cloud module implementation."""
|
||||
|
||||
try:
|
||||
from pydantic.v1 import BaseModel
|
||||
except ImportError:
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation for the countdown timer."""
|
||||
|
||||
from .rulemodule import RuleModule
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of the emeter module."""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Dict, List, Optional, Union
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of the motion detection (PIR) module found in some dimmers."""
|
||||
|
||||
from enum import Enum
|
||||
from typing import Optional
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Base implementation for all rule-based modules."""
|
||||
|
||||
import logging
|
||||
from enum import Enum
|
||||
from typing import Dict, List, Optional
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Schedule module implementation."""
|
||||
|
||||
from .rulemodule import RuleModule
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Provides the current time and timezone information."""
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from ...exceptions import KasaException
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of the usage interface."""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Dict
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for the IOT legacy IOT KASA protocol."""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from typing import Dict, Optional, Union
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Base class for all module implementations."""
|
||||
|
||||
import logging
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Dict
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for a TAPO Plug."""
|
||||
|
||||
import logging
|
||||
from abc import ABC
|
||||
|
||||
|
@@ -9,6 +9,7 @@ https://github.com/softScheck/tplink-smartplug/
|
||||
which are licensed under the Apache License, Version 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
"""
|
||||
|
||||
import base64
|
||||
import errno
|
||||
import hashlib
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Package for supporting tapo-branded and newer kasa devices."""
|
||||
|
||||
from .smartbulb import SmartBulb
|
||||
from .smartchilddevice import SmartChildDevice
|
||||
from .smartdevice import SmartDevice
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Modules for SMART devices."""
|
||||
|
||||
from .alarmmodule import AlarmModule
|
||||
from .autooffmodule import AutoOffModule
|
||||
from .battery import BatterySensor
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of alarm module."""
|
||||
|
||||
from typing import TYPE_CHECKING, Dict, List, Optional
|
||||
|
||||
from ...feature import Feature, FeatureType
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of auto off module."""
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
from typing import TYPE_CHECKING, Dict, Optional
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of battery module."""
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from ...feature import Feature, FeatureType
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of brightness module."""
|
||||
|
||||
from typing import TYPE_CHECKING, Dict
|
||||
|
||||
from ...feature import Feature, FeatureType
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of cloud module."""
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from ...feature import Feature, FeatureType
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of color temp module."""
|
||||
|
||||
from typing import TYPE_CHECKING, Dict
|
||||
|
||||
from ...bulb import ColorTempRange
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of device module."""
|
||||
|
||||
from typing import Dict
|
||||
|
||||
from ..smartmodule import SmartModule
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of energy monitoring module."""
|
||||
|
||||
from typing import TYPE_CHECKING, Dict, Optional
|
||||
|
||||
from ...emeterstatus import EmeterStatus
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of firmware module."""
|
||||
|
||||
from typing import TYPE_CHECKING, Dict, Optional
|
||||
|
||||
from ...exceptions import SmartErrorCode
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of humidity module."""
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from ...feature import Feature, FeatureType
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for led controls."""
|
||||
|
||||
from typing import TYPE_CHECKING, Dict
|
||||
|
||||
from ...feature import Feature, FeatureType
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for smooth light transitions."""
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from ...exceptions import KasaException
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of report module."""
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from ...feature import Feature
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of temperature module."""
|
||||
|
||||
from typing import TYPE_CHECKING, Literal
|
||||
|
||||
from ...feature import Feature, FeatureType
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Implementation of time module."""
|
||||
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from time import mktime
|
||||
from typing import TYPE_CHECKING, cast
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for tapo-branded smart bulbs (L5**)."""
|
||||
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from ..bulb import Bulb
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Child device implementation."""
|
||||
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for a SMART device."""
|
||||
|
||||
import base64
|
||||
import logging
|
||||
from datetime import datetime, timedelta
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Base implementation for SMART modules."""
|
||||
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, Dict, Type
|
||||
|
||||
|
@@ -302,9 +302,9 @@ class FakeIotProtocol(IotProtocol):
|
||||
|
||||
def set_preferred_state(self, new_state, *args):
|
||||
"""Implement set_preferred_state."""
|
||||
self.proto["system"]["get_sysinfo"]["preferred_state"][
|
||||
new_state["index"]
|
||||
] = new_state
|
||||
self.proto["system"]["get_sysinfo"]["preferred_state"][new_state["index"]] = (
|
||||
new_state
|
||||
)
|
||||
|
||||
def light_state(self, x, *args):
|
||||
light_state = self.proto["system"]["get_sysinfo"]["light_state"]
|
||||
|
@@ -15,7 +15,7 @@ class FixtureInfo(NamedTuple):
|
||||
data: Dict
|
||||
|
||||
|
||||
FixtureInfo.__hash__ = lambda x: hash((x.name, x.protocol)) # type: ignore[attr-defined, method-assign]
|
||||
FixtureInfo.__hash__ = lambda self: hash((self.name, self.protocol)) # type: ignore[attr-defined, method-assign]
|
||||
FixtureInfo.__eq__ = lambda x, y: hash(x) == hash(y) # type: ignore[method-assign]
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Tests for all devices."""
|
||||
|
||||
import importlib
|
||||
import inspect
|
||||
import pkgutil
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Module for common iotdevice tests."""
|
||||
|
||||
import re
|
||||
from datetime import datetime
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
"""Tests for SMART devices."""
|
||||
|
||||
import logging
|
||||
from typing import Any, Dict
|
||||
|
||||
|
@@ -9,6 +9,7 @@ https://github.com/softScheck/tplink-smartplug/
|
||||
which are licensed under the Apache License, Version 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import contextlib
|
||||
import errno
|
||||
|
Reference in New Issue
Block a user