mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 18:54:08 +00:00
Remove support for python <3.11 (#1273)
Python 3.11 ships with latest Debian Bookworm. pypy is not that widely used with this library based on statistics. It could be added back when pypy supports python 3.11.
This commit is contained in:
@@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
from dataclasses import asdict
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from pydantic.v1 import BaseModel, Field
|
||||
|
||||
@@ -17,22 +17,25 @@ from ..iotmodule import IotModule
|
||||
if TYPE_CHECKING:
|
||||
pass
|
||||
|
||||
# type ignore can be removed after migration mashumaro:
|
||||
# error: Signature of "__replace__" incompatible with supertype "LightState"
|
||||
|
||||
class IotLightPreset(BaseModel, LightState):
|
||||
|
||||
class IotLightPreset(BaseModel, LightState): # type: ignore[override]
|
||||
"""Light configuration preset."""
|
||||
|
||||
index: int = Field(kw_only=True)
|
||||
brightness: int = Field(kw_only=True)
|
||||
|
||||
# These are not available for effect mode presets on light strips
|
||||
hue: Optional[int] = Field(kw_only=True, default=None) # noqa: UP007
|
||||
saturation: Optional[int] = Field(kw_only=True, default=None) # noqa: UP007
|
||||
color_temp: Optional[int] = Field(kw_only=True, default=None) # noqa: UP007
|
||||
hue: int | None = Field(kw_only=True, default=None)
|
||||
saturation: int | None = Field(kw_only=True, default=None)
|
||||
color_temp: int | None = Field(kw_only=True, default=None)
|
||||
|
||||
# Variables for effect mode presets
|
||||
custom: Optional[int] = Field(kw_only=True, default=None) # noqa: UP007
|
||||
id: Optional[str] = Field(kw_only=True, default=None) # noqa: UP007
|
||||
mode: Optional[int] = Field(kw_only=True, default=None) # noqa: UP007
|
||||
custom: int | None = Field(kw_only=True, default=None)
|
||||
id: str | None = Field(kw_only=True, default=None)
|
||||
mode: int | None = Field(kw_only=True, default=None)
|
||||
|
||||
|
||||
class LightPreset(IotModule, LightPresetInterface):
|
||||
|
@@ -4,7 +4,6 @@ from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from enum import Enum
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from pydantic.v1 import BaseModel
|
||||
|
||||
@@ -35,20 +34,20 @@ class Rule(BaseModel):
|
||||
id: str
|
||||
name: str
|
||||
enable: bool
|
||||
wday: List[int] # noqa: UP006
|
||||
wday: list[int]
|
||||
repeat: bool
|
||||
|
||||
# start action
|
||||
sact: Optional[Action] # noqa: UP007
|
||||
sact: Action | None
|
||||
stime_opt: TimeOption
|
||||
smin: int
|
||||
|
||||
eact: Optional[Action] # noqa: UP007
|
||||
eact: Action | None
|
||||
etime_opt: TimeOption
|
||||
emin: int
|
||||
|
||||
# Only on bulbs
|
||||
s_light: Optional[Dict] # noqa: UP006,UP007
|
||||
s_light: dict | None
|
||||
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime, timezone, tzinfo
|
||||
from datetime import UTC, datetime, tzinfo
|
||||
|
||||
from ...exceptions import KasaException
|
||||
from ...interfaces import Time as TimeInterface
|
||||
@@ -13,7 +13,7 @@ from ..iottimezone import get_timezone, get_timezone_index
|
||||
class Time(IotModule, TimeInterface):
|
||||
"""Implements the timezone settings."""
|
||||
|
||||
_timezone: tzinfo = timezone.utc
|
||||
_timezone: tzinfo = UTC
|
||||
|
||||
def query(self) -> dict:
|
||||
"""Request time and timezone."""
|
||||
|
Reference in New Issue
Block a user