mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 02: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,
|
temperature as temperature_util,
|
||||||
)
|
)
|
||||||
|
|
||||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
ATTR_CONDITION_CLASS = "condition_class"
|
ATTR_CONDITION_CLASS = "condition_class"
|
||||||
@ -626,9 +624,9 @@ class WeatherEntity(Entity):
|
|||||||
|
|
||||||
@final
|
@final
|
||||||
@property
|
@property
|
||||||
def state_attributes(self):
|
def state_attributes(self) -> dict[str, Any]:
|
||||||
"""Return the state attributes, converted from native units to user-configured units."""
|
"""Return the state attributes, converted from native units to user-configured units."""
|
||||||
data = {}
|
data: dict[str, Any] = {}
|
||||||
|
|
||||||
precision = self.precision
|
precision = self.precision
|
||||||
|
|
||||||
@ -705,9 +703,9 @@ class WeatherEntity(Entity):
|
|||||||
data[ATTR_WEATHER_PRECIPITATION_UNIT] = self._precipitation_unit
|
data[ATTR_WEATHER_PRECIPITATION_UNIT] = self._precipitation_unit
|
||||||
|
|
||||||
if self.forecast is not None:
|
if self.forecast is not None:
|
||||||
forecast = []
|
forecast: list[dict[str, Any]] = []
|
||||||
for forecast_entry in self.forecast:
|
for existing_forecast_entry in self.forecast:
|
||||||
forecast_entry = dict(forecast_entry)
|
forecast_entry: dict[str, Any] = dict(existing_forecast_entry)
|
||||||
|
|
||||||
temperature = forecast_entry.pop(
|
temperature = forecast_entry.pop(
|
||||||
ATTR_FORECAST_NATIVE_TEMP, forecast_entry.get(ATTR_FORECAST_TEMP)
|
ATTR_FORECAST_NATIVE_TEMP, forecast_entry.get(ATTR_FORECAST_TEMP)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user