mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-04-27 17:16:24 +00:00
Fix linting
This commit is contained in:
parent
e9dfdf6cf7
commit
fd8689123f
@ -8,19 +8,22 @@ from typing import TYPE_CHECKING, Any, Optional
|
|||||||
|
|
||||||
from pydantic.v1 import BaseModel, Field, validator
|
from pydantic.v1 import BaseModel, Field, validator
|
||||||
|
|
||||||
from ...exceptions import SmartErrorCode
|
|
||||||
from ...feature import Feature
|
from ...feature import Feature
|
||||||
from ..smartmodule import SmartModule
|
|
||||||
|
|
||||||
# When support for cpython older than 3.11 is dropped
|
# When support for cpython older than 3.11 is dropped
|
||||||
# async_timeout can be replaced with asyncio.timeout
|
# async_timeout can be replaced with asyncio.timeout
|
||||||
from async_timeout import timeout as asyncio_timeout
|
from async_timeout import timeout as asyncio_timeout
|
||||||
|
|
||||||
|
from ...exceptions import SmartErrorCode
|
||||||
|
from ...feature import Feature, FeatureType
|
||||||
|
from ..smartmodule import SmartModule
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from ..smartdevice import SmartDevice
|
from ..smartdevice import SmartDevice
|
||||||
|
|
||||||
|
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class UpdateInfo(BaseModel):
|
class UpdateInfo(BaseModel):
|
||||||
"""Update info status object."""
|
"""Update info status object."""
|
||||||
|
|
||||||
@ -78,10 +81,20 @@ class Firmware(SmartModule):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
self._add_feature(
|
self._add_feature(
|
||||||
Feature(device, "Current firmware version", container=self, attribute_getter="current_firmware")
|
Feature(
|
||||||
|
device,
|
||||||
|
"Current firmware version",
|
||||||
|
container=self,
|
||||||
|
attribute_getter="current_firmware",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
self._add_feature(
|
self._add_feature(
|
||||||
Feature(device, "Available firmware version", container=self, attribute_getter="latest_firmware")
|
Feature(
|
||||||
|
device,
|
||||||
|
"Available firmware version",
|
||||||
|
container=self,
|
||||||
|
attribute_getter="latest_firmware",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
def query(self) -> dict:
|
def query(self) -> dict:
|
||||||
@ -96,7 +109,6 @@ class Firmware(SmartModule):
|
|||||||
"""Return the current firmware version."""
|
"""Return the current firmware version."""
|
||||||
return self._device.hw_info["sw_ver"]
|
return self._device.hw_info["sw_ver"]
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def latest_firmware(self) -> str:
|
def latest_firmware(self) -> str:
|
||||||
"""Return the latest firmware version."""
|
"""Return the latest firmware version."""
|
||||||
@ -126,7 +138,11 @@ class Firmware(SmartModule):
|
|||||||
async def update(self):
|
async def update(self):
|
||||||
"""Update the device firmware."""
|
"""Update the device firmware."""
|
||||||
current_fw = self.current_firmware
|
current_fw = self.current_firmware
|
||||||
_LOGGER.debug("Going to upgrade from %s to %s", current_fw, self.firmware_update_info.version)
|
_LOGGER.debug(
|
||||||
|
"Going to upgrade from %s to %s",
|
||||||
|
current_fw,
|
||||||
|
self.firmware_update_info.version,
|
||||||
|
)
|
||||||
resp = await self.call("fw_download")
|
resp = await self.call("fw_download")
|
||||||
_LOGGER.debug("Update request response: %s", resp)
|
_LOGGER.debug("Update request response: %s", resp)
|
||||||
# TODO: read timeout from get_auto_update_info or from get_fw_download_state?
|
# TODO: read timeout from get_auto_update_info or from get_fw_download_state?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user