Adjust type hints in enphase_envoy config_flow (#127106)

This commit is contained in:
epenet 2024-09-30 15:29:25 +02:00 committed by GitHub
parent 4e157c2999
commit 454fb30759
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,7 +5,7 @@ from __future__ import annotations
from collections.abc import Mapping from collections.abc import Mapping
import logging import logging
from types import MappingProxyType from types import MappingProxyType
from typing import Any from typing import TYPE_CHECKING, Any
from awesomeversion import AwesomeVersion from awesomeversion import AwesomeVersion
from pyenphase import AUTH_TOKEN_MIN_VERSION, Envoy, EnvoyError from pyenphase import AUTH_TOKEN_MIN_VERSION, Envoy, EnvoyError
@ -311,6 +311,9 @@ class EnvoyOptionsFlowHandler(OptionsFlowWithConfigEntry):
if user_input is not None: if user_input is not None:
return self.async_create_entry(title="", data=user_input) return self.async_create_entry(title="", data=user_input)
if TYPE_CHECKING:
assert self.config_entry.unique_id is not None
return self.async_show_form( return self.async_show_form(
step_id="init", step_id="init",
data_schema=vol.Schema( data_schema=vol.Schema(
@ -326,6 +329,6 @@ class EnvoyOptionsFlowHandler(OptionsFlowWithConfigEntry):
), ),
description_placeholders={ description_placeholders={
CONF_SERIAL: self.config_entry.unique_id, CONF_SERIAL: self.config_entry.unique_id,
CONF_HOST: self.config_entry.data.get("host"), CONF_HOST: self.config_entry.data[CONF_HOST],
}, },
) )