mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Improve type hints in weather (#78346)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
This commit is contained in:
parent
b87cd926e7
commit
dce2569389
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user