diff --git a/homeassistant/components/weather/__init__.py b/homeassistant/components/weather/__init__.py index c55ae043622..9f8c1b9c5ce 100644 --- a/homeassistant/components/weather/__init__.py +++ b/homeassistant/components/weather/__init__.py @@ -45,8 +45,6 @@ from homeassistant.util import ( temperature as temperature_util, ) -# mypy: allow-untyped-defs, no-check-untyped-defs - _LOGGER = logging.getLogger(__name__) ATTR_CONDITION_CLASS = "condition_class" @@ -626,9 +624,9 @@ class WeatherEntity(Entity): @final @property - def state_attributes(self): + def state_attributes(self) -> dict[str, Any]: """Return the state attributes, converted from native units to user-configured units.""" - data = {} + data: dict[str, Any] = {} precision = self.precision @@ -705,9 +703,9 @@ class WeatherEntity(Entity): data[ATTR_WEATHER_PRECIPITATION_UNIT] = self._precipitation_unit if self.forecast is not None: - forecast = [] - for forecast_entry in self.forecast: - forecast_entry = dict(forecast_entry) + forecast: list[dict[str, Any]] = [] + for existing_forecast_entry in self.forecast: + forecast_entry: dict[str, Any] = dict(existing_forecast_entry) temperature = forecast_entry.pop( ATTR_FORECAST_NATIVE_TEMP, forecast_entry.get(ATTR_FORECAST_TEMP)