Improve typing [helpers.entity] (#70890)

This commit is contained in:
Marc Mueller 2022-04-28 10:52:42 +02:00 committed by GitHub
parent 385f199691
commit 283c04e424
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -16,6 +16,7 @@ homeassistant.auth.providers.*
homeassistant.helpers.area_registry
homeassistant.helpers.condition
homeassistant.helpers.discovery
homeassistant.helpers.entity
homeassistant.helpers.entity_values
homeassistant.helpers.event
homeassistant.helpers.reload

View File

@ -3,7 +3,7 @@ from __future__ import annotations
from abc import ABC
import asyncio
from collections.abc import Awaitable, Iterable, Mapping, MutableMapping
from collections.abc import Coroutine, Iterable, Mapping, MutableMapping
from dataclasses import dataclass
from datetime import datetime, timedelta
from enum import Enum, auto
@ -621,7 +621,7 @@ class Entity(ABC):
if DATA_CUSTOMIZE in self.hass.data:
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
# pylint: disable-next=import-outside-toplevel
from homeassistant.components.sensor import SensorEntity
@ -958,7 +958,7 @@ class Entity(ABC):
"""Return the representation."""
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."""
if self.parallel_updates:
await self.parallel_updates.acquire()

View File

@ -60,6 +60,9 @@ disallow_any_generics = true
[mypy-homeassistant.helpers.discovery]
disallow_any_generics = true
[mypy-homeassistant.helpers.entity]
disallow_any_generics = true
[mypy-homeassistant.helpers.entity_values]
disallow_any_generics = true