Adjust type hints in alpha-vantage sensor entity (#76988)

This commit is contained in:
epenet 2022-08-18 22:48:49 +02:00 committed by GitHub
parent 7a45739104
commit 009a573324
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -128,7 +128,7 @@ class AlphaVantageSensor(SensorEntity):
self._attr_native_unit_of_measurement = symbol.get(CONF_CURRENCY, self._symbol)
self._attr_icon = ICONS.get(symbol.get(CONF_CURRENCY, "USD"))
def update(self):
def update(self) -> None:
"""Get the latest data and updates the states."""
_LOGGER.debug("Requesting new data for symbol %s", self._symbol)
all_values, _ = self._timeseries.get_intraday(self._symbol)
@ -144,7 +144,7 @@ class AlphaVantageSensor(SensorEntity):
ATTR_LOW: values["3. low"],
}
if isinstance(values, dict)
else None
else {}
)
_LOGGER.debug("Received new values for symbol %s", self._symbol)
@ -167,7 +167,7 @@ class AlphaVantageForeignExchange(SensorEntity):
self._attr_icon = ICONS.get(self._from_currency, "USD")
self._attr_native_unit_of_measurement = self._to_currency
def update(self):
def update(self) -> None:
"""Get the latest data and updates the states."""
_LOGGER.debug(
"Requesting new data for forex %s - %s",
@ -187,7 +187,7 @@ class AlphaVantageForeignExchange(SensorEntity):
CONF_TO: self._to_currency,
}
if values is not None
else None
else {}
)
_LOGGER.debug(