Improve config flow type hints in sms (#124352)

* Improve config flow type hints in sms

* Drop async_step_import
This commit is contained in:
epenet 2024-08-28 13:00:30 +02:00 committed by GitHub
parent 8ff8ed7f76
commit d4ae592a85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,11 +1,12 @@
"""Config flow for SMS integration."""
import logging
from typing import Any
import gammu
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_DEVICE
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
@ -26,7 +27,7 @@ DATA_SCHEMA = vol.Schema(
)
async def get_imei_from_config(hass: HomeAssistant, data):
async def get_imei_from_config(hass: HomeAssistant, data: dict[str, Any]) -> str:
"""Validate the user input allows us to connect.
Data has the keys from DATA_SCHEMA with values provided by the user.
@ -56,7 +57,9 @@ class SMSFlowHandler(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")
@ -79,10 +82,6 @@ class SMSFlowHandler(ConfigFlow, domain=DOMAIN):
step_id="user", data_schema=DATA_SCHEMA, errors=errors
)
async def async_step_import(self, user_input):
"""Handle import."""
return await self.async_step_user(user_input)
class CannotConnect(HomeAssistantError):
"""Error to indicate we cannot connect."""