From 3d19d2d24fe4a54e2032f2758bbefac9fcff52ff Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 30 May 2022 16:29:47 +0200 Subject: [PATCH] Adjust config flow type hints in withings (#72504) --- homeassistant/components/withings/config_flow.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/withings/config_flow.py b/homeassistant/components/withings/config_flow.py index b447973af97..a4ac6597248 100644 --- a/homeassistant/components/withings/config_flow.py +++ b/homeassistant/components/withings/config_flow.py @@ -1,12 +1,15 @@ """Config flow for Withings.""" from __future__ import annotations +from collections.abc import Mapping import logging +from typing import Any import voluptuous as vol from withings_api.common import AuthScope from homeassistant.config_entries import SOURCE_REAUTH +from homeassistant.data_entry_flow import FlowResult from homeassistant.helpers import config_entry_oauth2_flow from homeassistant.util import slugify @@ -29,7 +32,7 @@ class WithingsFlowHandler( return logging.getLogger(__name__) @property - def extra_authorize_data(self) -> dict: + def extra_authorize_data(self) -> dict[str, str]: """Extra data that needs to be appended to the authorize url.""" return { "scope": ",".join( @@ -42,12 +45,12 @@ class WithingsFlowHandler( ) } - async def async_oauth_create_entry(self, data: dict) -> dict: + async def async_oauth_create_entry(self, data: dict[str, Any]) -> FlowResult: """Override the create entry so user can select a profile.""" self._current_data = data return await self.async_step_profile(data) - async def async_step_profile(self, data: dict) -> dict: + async def async_step_profile(self, data: dict[str, Any]) -> FlowResult: """Prompt the user to select a user profile.""" errors = {} reauth_profile = ( @@ -77,7 +80,7 @@ class WithingsFlowHandler( errors=errors, ) - async def async_step_reauth(self, data: dict = None) -> dict: + async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult: """Prompt user to re-authenticate.""" if data is not None: return await self.async_step_user() @@ -91,7 +94,7 @@ class WithingsFlowHandler( description_placeholders=placeholders, ) - async def async_step_finish(self, data: dict) -> dict: + async def async_step_finish(self, data: dict[str, Any]) -> FlowResult: """Finish the flow.""" self._current_data = {}