mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 10:44:04 +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,13 +4,11 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from collections.abc import Coroutine
|
||||
from asyncio import timeout as asyncio_timeout
|
||||
from collections.abc import Callable, Coroutine
|
||||
from datetime import date
|
||||
from typing import TYPE_CHECKING, Callable, Optional
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
# When support for cpython older than 3.11 is dropped
|
||||
# async_timeout can be replaced with asyncio.timeout
|
||||
from async_timeout import timeout as asyncio_timeout
|
||||
from pydantic.v1 import BaseModel, Field, validator
|
||||
|
||||
from ...exceptions import KasaException
|
||||
@@ -41,11 +39,11 @@ class UpdateInfo(BaseModel):
|
||||
"""Update info status object."""
|
||||
|
||||
status: int = Field(alias="type")
|
||||
version: Optional[str] = Field(alias="fw_ver", default=None) # noqa: UP007
|
||||
release_date: Optional[date] = None # noqa: UP007
|
||||
release_notes: Optional[str] = Field(alias="release_note", default=None) # noqa: UP007
|
||||
fw_size: Optional[int] = None # noqa: UP007
|
||||
oem_id: Optional[str] = None # noqa: UP007
|
||||
version: str | None = Field(alias="fw_ver", default=None)
|
||||
release_date: date | None = None
|
||||
release_notes: str | None = Field(alias="release_note", default=None)
|
||||
fw_size: int | None = None
|
||||
oem_id: str | None = None
|
||||
needs_upgrade: bool = Field(alias="need_to_upgrade")
|
||||
|
||||
@validator("release_date", pre=True)
|
||||
@@ -58,9 +56,7 @@ class UpdateInfo(BaseModel):
|
||||
@property
|
||||
def update_available(self) -> bool:
|
||||
"""Return True if update available."""
|
||||
if self.status != 0:
|
||||
return True
|
||||
return False
|
||||
return self.status != 0
|
||||
|
||||
|
||||
class Firmware(SmartModule):
|
||||
|
@@ -2,9 +2,8 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime, timedelta, timezone, tzinfo
|
||||
from datetime import UTC, datetime, timedelta, timezone, tzinfo
|
||||
from typing import cast
|
||||
|
||||
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
||||
|
||||
from ...cachedzoneinfo import CachedZoneInfo
|
||||
@@ -19,7 +18,7 @@ class Time(SmartModule, TimeInterface):
|
||||
REQUIRED_COMPONENT = "time"
|
||||
QUERY_GETTER_NAME = "get_device_time"
|
||||
|
||||
_timezone: tzinfo = timezone.utc
|
||||
_timezone: tzinfo = UTC
|
||||
|
||||
def _initialize_features(self) -> None:
|
||||
"""Initialize features after the initial update."""
|
||||
|
Reference in New Issue
Block a user