mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Improve typing [helpers.entity] (#70890)
This commit is contained in:
parent
385f199691
commit
283c04e424
@ -16,6 +16,7 @@ homeassistant.auth.providers.*
|
|||||||
homeassistant.helpers.area_registry
|
homeassistant.helpers.area_registry
|
||||||
homeassistant.helpers.condition
|
homeassistant.helpers.condition
|
||||||
homeassistant.helpers.discovery
|
homeassistant.helpers.discovery
|
||||||
|
homeassistant.helpers.entity
|
||||||
homeassistant.helpers.entity_values
|
homeassistant.helpers.entity_values
|
||||||
homeassistant.helpers.event
|
homeassistant.helpers.event
|
||||||
homeassistant.helpers.reload
|
homeassistant.helpers.reload
|
||||||
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from abc import ABC
|
from abc import ABC
|
||||||
import asyncio
|
import asyncio
|
||||||
from collections.abc import Awaitable, Iterable, Mapping, MutableMapping
|
from collections.abc import Coroutine, Iterable, Mapping, MutableMapping
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from enum import Enum, auto
|
from enum import Enum, auto
|
||||||
@ -621,7 +621,7 @@ class Entity(ABC):
|
|||||||
if DATA_CUSTOMIZE in self.hass.data:
|
if DATA_CUSTOMIZE in self.hass.data:
|
||||||
attr.update(self.hass.data[DATA_CUSTOMIZE].get(self.entity_id))
|
attr.update(self.hass.data[DATA_CUSTOMIZE].get(self.entity_id))
|
||||||
|
|
||||||
def _convert_temperature(state: str, attr: dict) -> str:
|
def _convert_temperature(state: str, attr: dict[str, Any]) -> str:
|
||||||
# Convert temperature if we detect one
|
# Convert temperature if we detect one
|
||||||
# pylint: disable-next=import-outside-toplevel
|
# pylint: disable-next=import-outside-toplevel
|
||||||
from homeassistant.components.sensor import SensorEntity
|
from homeassistant.components.sensor import SensorEntity
|
||||||
@ -958,7 +958,7 @@ class Entity(ABC):
|
|||||||
"""Return the representation."""
|
"""Return the representation."""
|
||||||
return f"<Entity {self.name}: {self.state}>"
|
return f"<Entity {self.name}: {self.state}>"
|
||||||
|
|
||||||
async def async_request_call(self, coro: Awaitable) -> None:
|
async def async_request_call(self, coro: Coroutine[Any, Any, Any]) -> None:
|
||||||
"""Process request batched."""
|
"""Process request batched."""
|
||||||
if self.parallel_updates:
|
if self.parallel_updates:
|
||||||
await self.parallel_updates.acquire()
|
await self.parallel_updates.acquire()
|
||||||
|
3
mypy.ini
3
mypy.ini
@ -60,6 +60,9 @@ disallow_any_generics = true
|
|||||||
[mypy-homeassistant.helpers.discovery]
|
[mypy-homeassistant.helpers.discovery]
|
||||||
disallow_any_generics = true
|
disallow_any_generics = true
|
||||||
|
|
||||||
|
[mypy-homeassistant.helpers.entity]
|
||||||
|
disallow_any_generics = true
|
||||||
|
|
||||||
[mypy-homeassistant.helpers.entity_values]
|
[mypy-homeassistant.helpers.entity_values]
|
||||||
disallow_any_generics = true
|
disallow_any_generics = true
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user