Improve media_player typing (#78666)

This commit is contained in:
Marc Mueller 2022-09-18 03:08:17 +02:00 committed by GitHub
parent e9eb5dc338
commit dbc02707a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 5 deletions

View File

@ -19,6 +19,7 @@ from aiohttp import web
from aiohttp.hdrs import CACHE_CONTROL, CONTENT_TYPE
from aiohttp.typedefs import LooseHeaders
import async_timeout
from typing_extensions import Required
import voluptuous as vol
from yarl import URL
@ -219,7 +220,7 @@ ATTR_TO_PROPERTY = [
class _CacheImage(TypedDict, total=False):
"""Class to hold a cached image."""
lock: asyncio.Lock
lock: Required[asyncio.Lock]
content: tuple[bytes | None, str | None]

View File

@ -46,7 +46,7 @@ async def async_get_conditions(
) -> list[dict[str, str]]:
"""List device conditions for Media player devices."""
registry = entity_registry.async_get(hass)
conditions = []
conditions: list[dict[str, str]] = []
# Get all the integrations entities for this device
for entry in entity_registry.async_entries_for_device(registry, device_id):

View File

@ -37,8 +37,6 @@ from .const import (
MediaPlayerEntityFeature,
)
# mypy: allow-untyped-defs
async def _async_reproduce_states(
hass: HomeAssistant,
@ -51,7 +49,7 @@ async def _async_reproduce_states(
cur_state = hass.states.get(state.entity_id)
features = cur_state.attributes[ATTR_SUPPORTED_FEATURES] if cur_state else 0
async def call_service(service: str, keys: Iterable) -> None:
async def call_service(service: str, keys: Iterable[str]) -> None:
"""Call service with set of attributes given."""
data = {"entity_id": state.entity_id}
for key in keys: