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:
Steven B 2024-04-16 19:21:20 +01:00 committed by GitHub
parent 87fa39dd80
commit da441bc697
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
72 changed files with 904 additions and 846 deletions

View File

@ -61,7 +61,7 @@ jobs:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.8", "pypy-3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.9", "pypy-3.10"]
os: [ubuntu-latest, macos-latest, windows-latest]
extras: [false, true]
exclude:
@ -70,7 +70,7 @@ jobs:
- os: windows-latest
extras: true
- os: ubuntu-latest
python-version: "pypy-3.8"
python-version: "pypy-3.9"
extras: true
- os: ubuntu-latest
python-version: "pypy-3.10"
@ -102,6 +102,6 @@ jobs:
run: |
poetry run pytest --cov kasa --cov-report xml
- name: "Upload coverage to Codecov"
uses: "codecov/codecov-action@v3"
uses: "codecov/codecov-action@v4"
with:
token: ${{ secrets.CODECOV_TOKEN }}

View File

@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
@ -10,14 +10,14 @@ repos:
- id: check-ast
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
rev: v0.3.7
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
rev: v1.9.0
hooks:
- id: mypy
additional_dependencies: [types-click]

View File

@ -1,6 +1,5 @@
"""Test data for benchmarks."""
import json
from .original import OriginalTPLinkSmartHomeProtocol

View File

@ -1,4 +1,5 @@
"""Original implementation of the TP-Link Smart Home protocol."""
import struct
from typing import Generator

View File

@ -7,6 +7,7 @@ If you have new, yet unsupported device or a device with no devinfo file under
Executing this script will several modules and methods one by one,
and finally execute a query to query all of them at once.
"""
import base64
import collections.abc
import json

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python
"""Script that checks supported devices and updates README.md and SUPPORTED.md."""
import json
import os
import sys

View File

@ -1,4 +1,5 @@
"""Script for testing update performance on devices."""
import asyncio
import time

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,5 @@
"""Module for Device base class."""
from abc import ABC, abstractmethod
from typing import Dict, List, NamedTuple, Optional

View File

@ -1,4 +1,5 @@
"""python-kasa cli tool."""
import ast
import asyncio
import json

View File

@ -1,4 +1,5 @@
"""Module for Device base class."""
import logging
from abc import ABC, abstractmethod
from dataclasses import dataclass

View File

@ -1,4 +1,5 @@
"""Device creation via DeviceConfig."""
import logging
import time
from typing import Any, Dict, Optional, Tuple, Type

View File

@ -1,6 +1,5 @@
"""TP-Link device types."""
from enum import Enum

View File

@ -1,4 +1,5 @@
"""Module for holding connection parameters."""
import logging
from dataclasses import asdict, dataclass, field, fields, is_dataclass
from enum import Enum

View File

@ -1,4 +1,5 @@
"""Discovery module for TP-Link Smart Home devices."""
import asyncio
import binascii
import ipaddress

View File

@ -1,4 +1,5 @@
"""Module for emeter container."""
import logging
from typing import Optional

View File

@ -1,4 +1,5 @@
"""python-kasa exceptions."""
from asyncio import TimeoutError as _asyncioTimeoutError
from enum import IntEnum
from typing import Any, Optional

View File

@ -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

View File

@ -1,4 +1,5 @@
"""Module for HttpClientSession class."""
import asyncio
import logging
from typing import Any, Dict, Optional, Tuple, Union

View File

@ -1,4 +1,5 @@
"""Package for supporting legacy kasa devices."""
from .iotbulb import IotBulb
from .iotdevice import IotDevice
from .iotdimmer import IotDimmer

View File

@ -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:

View File

@ -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

View File

@ -1,4 +1,5 @@
"""Module for dimmers (currently only HS220)."""
from enum import Enum
from typing import Any, Dict, Optional

View File

@ -1,4 +1,5 @@
"""Module for light strips (KL430)."""
from typing import Dict, List, Optional
from ..device_type import DeviceType

View File

@ -1,4 +1,5 @@
"""Base class for IOT module implementations."""
import collections
import logging

View File

@ -1,4 +1,5 @@
"""Module for smart plugs (HS100, HS110, ..)."""
import logging
from typing import Optional

View File

@ -1,4 +1,5 @@
"""Module for multi-socket devices (HS300, HS107, KP303, ..)."""
import logging
from collections import defaultdict
from datetime import datetime, timedelta

View File

@ -1,4 +1,5 @@
"""Module for individual feature modules."""
from .ambientlight import AmbientLight
from .antitheft import Antitheft
from .cloud import Cloud

View File

@ -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

View File

@ -1,4 +1,5 @@
"""Implementation of the antitheft module."""
from .rulemodule import RuleModule

View File

@ -1,4 +1,5 @@
"""Cloud module implementation."""
try:
from pydantic.v1 import BaseModel
except ImportError:

View File

@ -1,4 +1,5 @@
"""Implementation for the countdown timer."""
from .rulemodule import RuleModule

View File

@ -1,4 +1,5 @@
"""Implementation of the emeter module."""
from datetime import datetime
from typing import Dict, List, Optional, Union

View File

@ -1,4 +1,5 @@
"""Implementation of the motion detection (PIR) module found in some dimmers."""
from enum import Enum
from typing import Optional

View File

@ -1,4 +1,5 @@
"""Base implementation for all rule-based modules."""
import logging
from enum import Enum
from typing import Dict, List, Optional

View File

@ -1,4 +1,5 @@
"""Schedule module implementation."""
from .rulemodule import RuleModule

View File

@ -1,4 +1,5 @@
"""Provides the current time and timezone information."""
from datetime import datetime
from ...exceptions import KasaException

View File

@ -1,4 +1,5 @@
"""Implementation of the usage interface."""
from datetime import datetime
from typing import Dict

View File

@ -1,4 +1,5 @@
"""Module for the IOT legacy IOT KASA protocol."""
import asyncio
import logging
from typing import Dict, Optional, Union

View File

@ -1,4 +1,5 @@
"""Base class for all module implementations."""
import logging
from abc import ABC, abstractmethod
from typing import Dict

View File

@ -1,4 +1,5 @@
"""Module for a TAPO Plug."""
import logging
from abc import ABC

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,5 @@
"""Modules for SMART devices."""
from .alarmmodule import AlarmModule
from .autooffmodule import AutoOffModule
from .battery import BatterySensor

View File

@ -1,4 +1,5 @@
"""Implementation of alarm module."""
from typing import TYPE_CHECKING, Dict, List, Optional
from ...feature import Feature, FeatureType

View File

@ -1,4 +1,5 @@
"""Implementation of auto off module."""
from datetime import datetime, timedelta
from typing import TYPE_CHECKING, Dict, Optional

View File

@ -1,4 +1,5 @@
"""Implementation of battery module."""
from typing import TYPE_CHECKING
from ...feature import Feature, FeatureType

View File

@ -1,4 +1,5 @@
"""Implementation of brightness module."""
from typing import TYPE_CHECKING, Dict
from ...feature import Feature, FeatureType

View File

@ -1,4 +1,5 @@
"""Implementation of cloud module."""
from typing import TYPE_CHECKING
from ...feature import Feature, FeatureType

View File

@ -1,4 +1,5 @@
"""Implementation of color temp module."""
from typing import TYPE_CHECKING, Dict
from ...bulb import ColorTempRange

View File

@ -1,4 +1,5 @@
"""Implementation of device module."""
from typing import Dict
from ..smartmodule import SmartModule

View File

@ -1,4 +1,5 @@
"""Implementation of energy monitoring module."""
from typing import TYPE_CHECKING, Dict, Optional
from ...emeterstatus import EmeterStatus

View File

@ -1,4 +1,5 @@
"""Implementation of firmware module."""
from typing import TYPE_CHECKING, Dict, Optional
from ...exceptions import SmartErrorCode

View File

@ -1,4 +1,5 @@
"""Implementation of humidity module."""
from typing import TYPE_CHECKING
from ...feature import Feature, FeatureType

View File

@ -1,4 +1,5 @@
"""Module for led controls."""
from typing import TYPE_CHECKING, Dict
from ...feature import Feature, FeatureType

View File

@ -1,4 +1,5 @@
"""Module for smooth light transitions."""
from typing import TYPE_CHECKING
from ...exceptions import KasaException

View File

@ -1,4 +1,5 @@
"""Implementation of report module."""
from typing import TYPE_CHECKING
from ...feature import Feature

View File

@ -1,4 +1,5 @@
"""Implementation of temperature module."""
from typing import TYPE_CHECKING, Literal
from ...feature import Feature, FeatureType

View File

@ -1,4 +1,5 @@
"""Implementation of time module."""
from datetime import datetime, timedelta, timezone
from time import mktime
from typing import TYPE_CHECKING, cast

View File

@ -1,4 +1,5 @@
"""Module for tapo-branded smart bulbs (L5**)."""
from typing import Dict, List, Optional
from ..bulb import Bulb

View File

@ -1,4 +1,5 @@
"""Child device implementation."""
import logging
from typing import Optional

View File

@ -1,4 +1,5 @@
"""Module for a SMART device."""
import base64
import logging
from datetime import datetime, timedelta

View File

@ -1,4 +1,5 @@
"""Base implementation for SMART modules."""
import logging
from typing import TYPE_CHECKING, Dict, Type

View File

@ -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"]

View File

@ -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]

View File

@ -1,4 +1,5 @@
"""Tests for all devices."""
import importlib
import inspect
import pkgutil

View File

@ -1,4 +1,5 @@
"""Module for common iotdevice tests."""
import re
from datetime import datetime

View File

@ -1,4 +1,5 @@
"""Tests for SMART devices."""
import logging
from typing import Any, Dict

View File

@ -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

1657
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -101,6 +101,8 @@ build-backend = "poetry.core.masonry.api"
[tool.ruff]
target-version = "py38"
[tool.ruff.lint]
select = [
"E", # pycodestyle
"D", # pydocstyle
@ -116,10 +118,10 @@ ignore = [
"D107", # Missing docstring in `__init__`
]
[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "pep257"
[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"kasa/tests/*.py" = [
"D100",
"D101",