Improve config flow type hints in tellduslive (#125299)

This commit is contained in:
epenet 2024-09-06 15:20:39 +02:00 committed by GitHub
parent 86ef7bab28
commit 3a5309e9a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -35,14 +35,15 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
_session: Session
def __init__(self) -> None: def __init__(self) -> None:
"""Init config flow.""" """Init config flow."""
self._hosts = [CLOUD_NAME] self._hosts = [CLOUD_NAME]
self._host = None self._host = None
self._session = None
self._scan_interval = SCAN_INTERVAL self._scan_interval = SCAN_INTERVAL
def _get_auth_url(self): def _get_auth_url(self) -> str | None:
self._session = Session( self._session = Session(
public_key=PUBLIC_KEY, public_key=PUBLIC_KEY,
private_key=NOT_SO_PRIVATE_KEY, private_key=NOT_SO_PRIVATE_KEY,
@ -70,7 +71,9 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
), ),
) )
async def async_step_auth(self, user_input=None): async def async_step_auth(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the submitted configuration.""" """Handle the submitted configuration."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:
@ -114,7 +117,10 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
}, },
) )
async def async_step_discovery(self, discovery_info): async def async_step_discovery(
self,
discovery_info: list[str], # type: ignore[override]
) -> ConfigFlowResult:
"""Run when a Tellstick is discovered.""" """Run when a Tellstick is discovered."""
await self._async_handle_discovery_without_unique_id() await self._async_handle_discovery_without_unique_id()