mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Enable strict typing for alpha_vantage (#106816)
This commit is contained in:
parent
4e0c0cf2ca
commit
0077989169
@ -58,6 +58,7 @@ homeassistant.components.aladdin_connect.*
|
|||||||
homeassistant.components.alarm_control_panel.*
|
homeassistant.components.alarm_control_panel.*
|
||||||
homeassistant.components.alert.*
|
homeassistant.components.alert.*
|
||||||
homeassistant.components.alexa.*
|
homeassistant.components.alexa.*
|
||||||
|
homeassistant.components.alpha_vantage.*
|
||||||
homeassistant.components.amazon_polly.*
|
homeassistant.components.amazon_polly.*
|
||||||
homeassistant.components.ambient_station.*
|
homeassistant.components.ambient_station.*
|
||||||
homeassistant.components.amcrest.*
|
homeassistant.components.amcrest.*
|
||||||
|
@ -74,9 +74,9 @@ def setup_platform(
|
|||||||
discovery_info: DiscoveryInfoType | None = None,
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up the Alpha Vantage sensor."""
|
"""Set up the Alpha Vantage sensor."""
|
||||||
api_key = config[CONF_API_KEY]
|
api_key: str = config[CONF_API_KEY]
|
||||||
symbols = config.get(CONF_SYMBOLS, [])
|
symbols: list[dict[str, str]] = config.get(CONF_SYMBOLS, [])
|
||||||
conversions = config.get(CONF_FOREIGN_EXCHANGE, [])
|
conversions: list[dict[str, str]] = config.get(CONF_FOREIGN_EXCHANGE, [])
|
||||||
|
|
||||||
if not symbols and not conversions:
|
if not symbols and not conversions:
|
||||||
msg = "No symbols or currencies configured."
|
msg = "No symbols or currencies configured."
|
||||||
@ -120,7 +120,7 @@ class AlphaVantageSensor(SensorEntity):
|
|||||||
|
|
||||||
_attr_attribution = ATTRIBUTION
|
_attr_attribution = ATTRIBUTION
|
||||||
|
|
||||||
def __init__(self, timeseries, symbol):
|
def __init__(self, timeseries: TimeSeries, symbol: dict[str, str]) -> None:
|
||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
self._symbol = symbol[CONF_SYMBOL]
|
self._symbol = symbol[CONF_SYMBOL]
|
||||||
self._attr_name = symbol.get(CONF_NAME, self._symbol)
|
self._attr_name = symbol.get(CONF_NAME, self._symbol)
|
||||||
@ -154,7 +154,9 @@ class AlphaVantageForeignExchange(SensorEntity):
|
|||||||
|
|
||||||
_attr_attribution = ATTRIBUTION
|
_attr_attribution = ATTRIBUTION
|
||||||
|
|
||||||
def __init__(self, foreign_exchange, config):
|
def __init__(
|
||||||
|
self, foreign_exchange: ForeignExchange, config: dict[str, str]
|
||||||
|
) -> None:
|
||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
self._foreign_exchange = foreign_exchange
|
self._foreign_exchange = foreign_exchange
|
||||||
self._from_currency = config[CONF_FROM]
|
self._from_currency = config[CONF_FROM]
|
||||||
|
10
mypy.ini
10
mypy.ini
@ -340,6 +340,16 @@ disallow_untyped_defs = true
|
|||||||
warn_return_any = true
|
warn_return_any = true
|
||||||
warn_unreachable = true
|
warn_unreachable = true
|
||||||
|
|
||||||
|
[mypy-homeassistant.components.alpha_vantage.*]
|
||||||
|
check_untyped_defs = true
|
||||||
|
disallow_incomplete_defs = true
|
||||||
|
disallow_subclassing_any = true
|
||||||
|
disallow_untyped_calls = true
|
||||||
|
disallow_untyped_decorators = true
|
||||||
|
disallow_untyped_defs = true
|
||||||
|
warn_return_any = true
|
||||||
|
warn_unreachable = true
|
||||||
|
|
||||||
[mypy-homeassistant.components.amazon_polly.*]
|
[mypy-homeassistant.components.amazon_polly.*]
|
||||||
check_untyped_defs = true
|
check_untyped_defs = true
|
||||||
disallow_incomplete_defs = true
|
disallow_incomplete_defs = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user