Add strict typing to efergy (#57682)

This commit is contained in:
Robert Hillis 2021-10-22 12:20:39 -04:00 committed by GitHub
parent f6ffae9e10
commit da7b67cc29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 4 deletions

View file

@ -35,6 +35,7 @@ homeassistant.components.dlna_dmr.*
homeassistant.components.dnsip.* homeassistant.components.dnsip.*
homeassistant.components.dsmr.* homeassistant.components.dsmr.*
homeassistant.components.dunehd.* homeassistant.components.dunehd.*
homeassistant.components.efergy.*
homeassistant.components.elgato.* homeassistant.components.elgato.*
homeassistant.components.esphome.* homeassistant.components.esphome.*
homeassistant.components.energy.* homeassistant.components.energy.*

View file

@ -56,7 +56,7 @@ class EfergyFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
errors=errors, errors=errors,
) )
async def async_step_import(self, import_config: ConfigType): async def async_step_import(self, import_config: ConfigType) -> FlowResult:
"""Import a config entry from configuration.yaml.""" """Import a config entry from configuration.yaml."""
for entry in self._async_current_entries(): for entry in self._async_current_entries():
if entry.data[CONF_API_KEY] == import_config[CONF_APPTOKEN]: if entry.data[CONF_API_KEY] == import_config[CONF_APPTOKEN]:

View file

@ -143,7 +143,7 @@ async def async_setup_platform(
hass: HomeAssistant, hass: HomeAssistant,
config: ConfigType, config: ConfigType,
add_entities: AddEntitiesCallback, add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType = None, discovery_info: DiscoveryInfoType | None = None,
) -> None: ) -> None:
"""Set up the Efergy sensor from yaml.""" """Set up the Efergy sensor from yaml."""
hass.async_create_task( hass.async_create_task(
@ -194,8 +194,8 @@ class EfergySensor(EfergyEntity, SensorEntity):
api: Efergy, api: Efergy,
description: SensorEntityDescription, description: SensorEntityDescription,
server_unique_id: str, server_unique_id: str,
period: str = None, period: str | None = None,
currency: str = None, currency: str | None = None,
sid: str = "", sid: str = "",
) -> None: ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""

View file

@ -396,6 +396,17 @@ no_implicit_optional = true
warn_return_any = true warn_return_any = true
warn_unreachable = true warn_unreachable = true
[mypy-homeassistant.components.efergy.*]
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
no_implicit_optional = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.elgato.*] [mypy-homeassistant.components.elgato.*]
check_untyped_defs = true check_untyped_defs = true
disallow_incomplete_defs = true disallow_incomplete_defs = true