Enable ruff check for ANN (#1139)

This commit is contained in:
Teemu R.
2024-11-10 19:55:13 +01:00
committed by GitHub
parent 6b44fe6242
commit 66eb17057e
89 changed files with 596 additions and 452 deletions

View File

@@ -1,6 +1,9 @@
"""Base class for IOT module implementations."""
from __future__ import annotations
import logging
from typing import Any
from ..exceptions import KasaException
from ..module import Module
@@ -24,16 +27,16 @@ merge = _merge_dict
class IotModule(Module):
"""Base class implemention for all IOT modules."""
def call(self, method, params=None):
async def call(self, method: str, params: dict | None = None) -> dict:
"""Call the given method with the given parameters."""
return self._device._query_helper(self._module, method, params)
return await self._device._query_helper(self._module, method, params)
def query_for_command(self, query, params=None):
def query_for_command(self, query: str, params: dict | None = None) -> dict:
"""Create a request object for the given parameters."""
return self._device._create_request(self._module, query, params)
@property
def estimated_query_response_size(self):
def estimated_query_response_size(self) -> int:
"""Estimated maximum size of query response.
The inheriting modules implement this to estimate how large a query response
@@ -42,7 +45,7 @@ class IotModule(Module):
return 256 # Estimate for modules that don't specify
@property
def data(self):
def data(self) -> dict[str, Any]:
"""Return the module specific raw data from the last update."""
dev = self._device
q = self.query()