mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 14:27:07 +00:00
Improve media_player typing (#78666)
This commit is contained in:
parent
e9eb5dc338
commit
dbc02707a9
@ -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]
|
||||
|
||||
|
||||
|
@ -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):
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user