Skip to content

Commit

Permalink
Update poetry locks and pre-commit hooks (#837)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sdb9696 committed Apr 16, 2024
1 parent 87fa39d commit da441bc
Show file tree
Hide file tree
Showing 72 changed files with 904 additions and 846 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
Expand Down Expand Up @@ -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 }}
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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]
Expand Down
1 change: 0 additions & 1 deletion devtools/bench/utils/data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Test data for benchmarks."""


import json

from .original import OriginalTPLinkSmartHomeProtocol
Expand Down
1 change: 1 addition & 0 deletions devtools/bench/utils/original.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Original implementation of the TP-Link Smart Home protocol."""

import struct
from typing import Generator

Expand Down
1 change: 1 addition & 0 deletions devtools/dump_devinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
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
Expand Down
1 change: 1 addition & 0 deletions devtools/generate_supported.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions devtools/perftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Script for testing update performance on devices."""

import asyncio
import time

Expand Down
1 change: 1 addition & 0 deletions kasa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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
Expand Down
1 change: 1 addition & 0 deletions kasa/aestransport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions kasa/bulb.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for Device base class."""

from abc import ABC, abstractmethod
from typing import Dict, List, NamedTuple, Optional

Expand Down
1 change: 1 addition & 0 deletions kasa/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""python-kasa cli tool."""

import ast
import asyncio
import json
Expand Down
1 change: 1 addition & 0 deletions kasa/device.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for Device base class."""

import logging
from abc import ABC, abstractmethod
from dataclasses import dataclass
Expand Down
1 change: 1 addition & 0 deletions kasa/device_factory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Device creation via DeviceConfig."""

import logging
import time
from typing import Any, Dict, Optional, Tuple, Type
Expand Down
1 change: 0 additions & 1 deletion kasa/device_type.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""TP-Link device types."""


from enum import Enum


Expand Down
1 change: 1 addition & 0 deletions kasa/deviceconfig.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for holding connection parameters."""

import logging
from dataclasses import asdict, dataclass, field, fields, is_dataclass
from enum import Enum
Expand Down
1 change: 1 addition & 0 deletions kasa/discover.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Discovery module for TP-Link Smart Home devices."""

import asyncio
import binascii
import ipaddress
Expand Down
1 change: 1 addition & 0 deletions kasa/emeterstatus.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for emeter container."""

import logging
from typing import Optional

Expand Down
1 change: 1 addition & 0 deletions kasa/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""python-kasa exceptions."""

from asyncio import TimeoutError as _asyncioTimeoutError
from enum import IntEnum
from typing import Any, Optional
Expand Down
1 change: 1 addition & 0 deletions kasa/feature.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions kasa/httpclient.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for HttpClientSession class."""

import asyncio
import logging
from typing import Any, Dict, Optional, Tuple, Union
Expand Down
1 change: 1 addition & 0 deletions kasa/iot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Package for supporting legacy kasa devices."""

from .iotbulb import IotBulb
from .iotdevice import IotDevice
from .iotdimmer import IotDimmer
Expand Down
2 changes: 1 addition & 1 deletion kasa/iot/iotbulb.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for bulbs (LB*, KL*, KB*)."""

import logging
import re
from enum import Enum
Expand Down Expand Up @@ -233,7 +234,6 @@ async def _initialize_features(self):
)
)


@property # type: ignore
@requires_update
def is_color(self) -> bool:
Expand Down
1 change: 1 addition & 0 deletions kasa/iot/iotdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
You may obtain a copy of the license at
http://www.apache.org/licenses/LICENSE-2.0
"""

import collections.abc
import functools
import inspect
Expand Down
1 change: 1 addition & 0 deletions kasa/iot/iotdimmer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for dimmers (currently only HS220)."""

from enum import Enum
from typing import Any, Dict, Optional

Expand Down
1 change: 1 addition & 0 deletions kasa/iot/iotlightstrip.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for light strips (KL430)."""

from typing import Dict, List, Optional

from ..device_type import DeviceType
Expand Down
1 change: 1 addition & 0 deletions kasa/iot/iotmodule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base class for IOT module implementations."""

import collections
import logging

Expand Down
1 change: 1 addition & 0 deletions kasa/iot/iotplug.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for smart plugs (HS100, HS110, ..)."""

import logging
from typing import Optional

Expand Down
1 change: 1 addition & 0 deletions kasa/iot/iotstrip.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for multi-socket devices (HS300, HS107, KP303, ..)."""

import logging
from collections import defaultdict
from datetime import datetime, timedelta
Expand Down
1 change: 1 addition & 0 deletions kasa/iot/modules/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for individual feature modules."""

from .ambientlight import AmbientLight
from .antitheft import Antitheft
from .cloud import Cloud
Expand Down
1 change: 1 addition & 0 deletions kasa/iot/modules/ambientlight.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 1 addition & 0 deletions kasa/iot/modules/antitheft.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of the antitheft module."""

from .rulemodule import RuleModule


Expand Down
1 change: 1 addition & 0 deletions kasa/iot/modules/cloud.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Cloud module implementation."""

try:
from pydantic.v1 import BaseModel
except ImportError:
Expand Down
1 change: 1 addition & 0 deletions kasa/iot/modules/countdown.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation for the countdown timer."""

from .rulemodule import RuleModule


Expand Down
1 change: 1 addition & 0 deletions kasa/iot/modules/emeter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of the emeter module."""

from datetime import datetime
from typing import Dict, List, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions kasa/iot/modules/motion.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of the motion detection (PIR) module found in some dimmers."""

from enum import Enum
from typing import Optional

Expand Down
1 change: 1 addition & 0 deletions kasa/iot/modules/rulemodule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base implementation for all rule-based modules."""

import logging
from enum import Enum
from typing import Dict, List, Optional
Expand Down
1 change: 1 addition & 0 deletions kasa/iot/modules/schedule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Schedule module implementation."""

from .rulemodule import RuleModule


Expand Down
1 change: 1 addition & 0 deletions kasa/iot/modules/time.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides the current time and timezone information."""

from datetime import datetime

from ...exceptions import KasaException
Expand Down
1 change: 1 addition & 0 deletions kasa/iot/modules/usage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of the usage interface."""

from datetime import datetime
from typing import Dict

Expand Down
1 change: 1 addition & 0 deletions kasa/iotprotocol.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for the IOT legacy IOT KASA protocol."""

import asyncio
import logging
from typing import Dict, Optional, Union
Expand Down
1 change: 1 addition & 0 deletions kasa/module.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base class for all module implementations."""

import logging
from abc import ABC, abstractmethod
from typing import Dict
Expand Down
1 change: 1 addition & 0 deletions kasa/plug.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for a TAPO Plug."""

import logging
from abc import ABC

Expand Down
1 change: 1 addition & 0 deletions kasa/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
which are licensed under the Apache License, Version 2.0
http://www.apache.org/licenses/LICENSE-2.0
"""

import base64
import errno
import hashlib
Expand Down
1 change: 1 addition & 0 deletions kasa/smart/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions kasa/smart/modules/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Modules for SMART devices."""

from .alarmmodule import AlarmModule
from .autooffmodule import AutoOffModule
from .battery import BatterySensor
Expand Down
1 change: 1 addition & 0 deletions kasa/smart/modules/alarmmodule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of alarm module."""

from typing import TYPE_CHECKING, Dict, List, Optional

from ...feature import Feature, FeatureType
Expand Down
1 change: 1 addition & 0 deletions kasa/smart/modules/autooffmodule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of auto off module."""

from datetime import datetime, timedelta
from typing import TYPE_CHECKING, Dict, Optional

Expand Down
1 change: 1 addition & 0 deletions kasa/smart/modules/battery.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of battery module."""

from typing import TYPE_CHECKING

from ...feature import Feature, FeatureType
Expand Down
1 change: 1 addition & 0 deletions kasa/smart/modules/brightness.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of brightness module."""

from typing import TYPE_CHECKING, Dict

from ...feature import Feature, FeatureType
Expand Down
1 change: 1 addition & 0 deletions kasa/smart/modules/cloudmodule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of cloud module."""

from typing import TYPE_CHECKING

from ...feature import Feature, FeatureType
Expand Down
1 change: 1 addition & 0 deletions kasa/smart/modules/colortemp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of color temp module."""

from typing import TYPE_CHECKING, Dict

from ...bulb import ColorTempRange
Expand Down
1 change: 1 addition & 0 deletions kasa/smart/modules/devicemodule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of device module."""

from typing import Dict

from ..smartmodule import SmartModule
Expand Down
1 change: 1 addition & 0 deletions kasa/smart/modules/energymodule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of energy monitoring module."""

from typing import TYPE_CHECKING, Dict, Optional

from ...emeterstatus import EmeterStatus
Expand Down
1 change: 1 addition & 0 deletions kasa/smart/modules/firmware.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of firmware module."""

from typing import TYPE_CHECKING, Dict, Optional

from ...exceptions import SmartErrorCode
Expand Down
1 change: 1 addition & 0 deletions kasa/smart/modules/humidity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of humidity module."""

from typing import TYPE_CHECKING

from ...feature import Feature, FeatureType
Expand Down
1 change: 1 addition & 0 deletions kasa/smart/modules/ledmodule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for led controls."""

from typing import TYPE_CHECKING, Dict

from ...feature import Feature, FeatureType
Expand Down

0 comments on commit da441bc

Please sign in to comment.