mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 05:47:10 +00:00
Adjust config flow type hints in withings (#72504)
This commit is contained in:
parent
30e71dd96f
commit
3d19d2d24f
@ -1,12 +1,15 @@
|
|||||||
"""Config flow for Withings."""
|
"""Config flow for Withings."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
from withings_api.common import AuthScope
|
from withings_api.common import AuthScope
|
||||||
|
|
||||||
from homeassistant.config_entries import SOURCE_REAUTH
|
from homeassistant.config_entries import SOURCE_REAUTH
|
||||||
|
from homeassistant.data_entry_flow import FlowResult
|
||||||
from homeassistant.helpers import config_entry_oauth2_flow
|
from homeassistant.helpers import config_entry_oauth2_flow
|
||||||
from homeassistant.util import slugify
|
from homeassistant.util import slugify
|
||||||
|
|
||||||
@ -29,7 +32,7 @@ class WithingsFlowHandler(
|
|||||||
return logging.getLogger(__name__)
|
return logging.getLogger(__name__)
|
||||||
|
|
||||||
@property
|
@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."""
|
"""Extra data that needs to be appended to the authorize url."""
|
||||||
return {
|
return {
|
||||||
"scope": ",".join(
|
"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."""
|
"""Override the create entry so user can select a profile."""
|
||||||
self._current_data = data
|
self._current_data = data
|
||||||
return await self.async_step_profile(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."""
|
"""Prompt the user to select a user profile."""
|
||||||
errors = {}
|
errors = {}
|
||||||
reauth_profile = (
|
reauth_profile = (
|
||||||
@ -77,7 +80,7 @@ class WithingsFlowHandler(
|
|||||||
errors=errors,
|
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."""
|
"""Prompt user to re-authenticate."""
|
||||||
if data is not None:
|
if data is not None:
|
||||||
return await self.async_step_user()
|
return await self.async_step_user()
|
||||||
@ -91,7 +94,7 @@ class WithingsFlowHandler(
|
|||||||
description_placeholders=placeholders,
|
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."""
|
"""Finish the flow."""
|
||||||
self._current_data = {}
|
self._current_data = {}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user