From ff0566b11f1dd9599972eb2ebd5e007ea78bfb07 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Fri, 11 Aug 2023 23:07:06 +0200 Subject: [PATCH 1/3] Fix deque import (#98269) --- homeassistant/components/stream/recorder.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/homeassistant/components/stream/recorder.py b/homeassistant/components/stream/recorder.py index 258457a3d82a07..a334171abb8fdd 100644 --- a/homeassistant/components/stream/recorder.py +++ b/homeassistant/components/stream/recorder.py @@ -1,6 +1,7 @@ """Provide functionality to record stream.""" from __future__ import annotations +from collections import deque from io import DEFAULT_BUFFER_SIZE, BytesIO import logging import os @@ -19,8 +20,6 @@ from .fmp4utils import read_init, transform_init if TYPE_CHECKING: - import deque - from homeassistant.components.camera import DynamicStreamSettings _LOGGER = logging.getLogger(__name__) From 78ac36e3fe890ff7729ec3ff467b04ecd49ce17e Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Fri, 11 Aug 2023 23:08:21 +0200 Subject: [PATCH 2/3] Improve met_eireann generic typing (#98278) --- homeassistant/components/met_eireann/__init__.py | 5 +++-- homeassistant/components/met_eireann/weather.py | 10 ++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/met_eireann/__init__.py b/homeassistant/components/met_eireann/__init__.py index a5b096b55548c1..042eb6f458fc7d 100644 --- a/homeassistant/components/met_eireann/__init__.py +++ b/homeassistant/components/met_eireann/__init__.py @@ -1,6 +1,7 @@ """The met_eireann component.""" from datetime import timedelta import logging +from typing import Self import meteireann @@ -33,7 +34,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b weather_data = MetEireannWeatherData(hass, config_entry.data, raw_weather_data) - async def _async_update_data(): + async def _async_update_data() -> MetEireannWeatherData: """Fetch data from Met Éireann.""" try: return await weather_data.fetch_data() @@ -78,7 +79,7 @@ def __init__(self, hass, config, weather_data): self.daily_forecast = None self.hourly_forecast = None - async def fetch_data(self): + async def fetch_data(self) -> Self: """Fetch data from API - (current weather and forecast).""" await self._weather_data.fetching_data() self.current_weather_data = self._weather_data.get_current_weather() diff --git a/homeassistant/components/met_eireann/weather.py b/homeassistant/components/met_eireann/weather.py index 1356dbe0c24c38..e31951ea8a2c0b 100644 --- a/homeassistant/components/met_eireann/weather.py +++ b/homeassistant/components/met_eireann/weather.py @@ -22,9 +22,13 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.update_coordinator import CoordinatorEntity +from homeassistant.helpers.update_coordinator import ( + CoordinatorEntity, + DataUpdateCoordinator, +) from homeassistant.util import dt as dt_util +from . import MetEireannWeatherData from .const import CONDITION_MAP, DEFAULT_NAME, DOMAIN, FORECAST_MAP _LOGGER = logging.getLogger(__name__) @@ -54,7 +58,9 @@ async def async_setup_entry( ) -class MetEireannWeather(CoordinatorEntity, WeatherEntity): +class MetEireannWeather( + CoordinatorEntity[DataUpdateCoordinator[MetEireannWeatherData]], WeatherEntity +): """Implementation of a Met Éireann weather condition.""" _attr_attribution = "Data provided by Met Éireann" From 58194a5eb409cff5d37c9f7c1409bdad80ce84a5 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Fri, 11 Aug 2023 23:08:52 +0200 Subject: [PATCH 3/3] Improve wake_word generic typing (#98279) --- homeassistant/components/wake_word/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/wake_word/__init__.py b/homeassistant/components/wake_word/__init__.py index f33d06c64dab8e..895dababd54805 100644 --- a/homeassistant/components/wake_word/__init__.py +++ b/homeassistant/components/wake_word/__init__.py @@ -43,7 +43,7 @@ def async_get_wake_word_detection_entity( hass: HomeAssistant, entity_id: str ) -> WakeWordDetectionEntity | None: """Return wake word entity.""" - component: EntityComponent = hass.data[DOMAIN] + component: EntityComponent[WakeWordDetectionEntity] = hass.data[DOMAIN] return component.get_entity(entity_id)