Adjust type hints in aosmith config_flow (#127160)

This commit is contained in:
epenet 2024-10-01 11:21:22 +02:00 committed by GitHub
parent 5f1470af9f
commit 2659097010
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,7 +23,7 @@ class AOSmithConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
_reauth_email: str | None = None _reauth_email: str
async def _async_validate_credentials( async def _async_validate_credentials(
self, email: str, password: str self, email: str, password: str
@ -85,13 +85,14 @@ class AOSmithConfigFlow(ConfigFlow, domain=DOMAIN):
) -> ConfigFlowResult: ) -> ConfigFlowResult:
"""Handle user's reauth credentials.""" """Handle user's reauth credentials."""
errors: dict[str, str] = {} errors: dict[str, str] = {}
if user_input is not None and self._reauth_email is not None: if user_input:
email = self._reauth_email
password = user_input[CONF_PASSWORD] password = user_input[CONF_PASSWORD]
entry_id = self.context["entry_id"] entry_id = self.context["entry_id"]
if entry := self.hass.config_entries.async_get_entry(entry_id): if entry := self.hass.config_entries.async_get_entry(entry_id):
error = await self._async_validate_credentials(email, password) error = await self._async_validate_credentials(
self._reauth_email, password
)
if error is None: if error is None:
self.hass.config_entries.async_update_entry( self.hass.config_entries.async_update_entry(
entry, entry,