Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions homeassistant/components/anthropic/repairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
from anthropic.resources.messages.messages import DEPRECATED_MODELS
import voluptuous as vol

from homeassistant import data_entry_flow
from homeassistant.components.repairs import RepairsFlow
from homeassistant.components.repairs import RepairsFlow, RepairsFlowResult
from homeassistant.config_entries import ConfigEntryState, ConfigSubentry
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
Expand Down Expand Up @@ -41,9 +40,7 @@ def __init__(self) -> None:
self._current_subentry_id = None
self._model_list_cache = None

async def async_step_init(
self, user_input: dict[str, str]
) -> data_entry_flow.FlowResult:
async def async_step_init(self, user_input: dict[str, str]) -> RepairsFlowResult:
"""Handle the steps of a fix flow."""
if user_input.get(CONF_CHAT_MODEL):
self._async_update_current_subentry(user_input)
Expand Down
7 changes: 3 additions & 4 deletions homeassistant/components/assist_pipeline/repair_flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import voluptuous as vol

from homeassistant.components.assist_satellite import DOMAIN as ASSIST_SATELLITE_DOMAIN
from homeassistant.components.repairs import RepairsFlow
from homeassistant.data_entry_flow import FlowResult
from homeassistant.components.repairs import RepairsFlow, RepairsFlowResult
from homeassistant.helpers import entity_registry as er

REQUIRED_KEYS = ("entity_id", "entity_uuid", "integration_name")
Expand All @@ -21,14 +20,14 @@ def __init__(self, data: dict[str, str | int | float | None] | None) -> None:
raise ValueError("Missing data")
self._data = data

async def async_step_init(self, _: None = None) -> FlowResult:
async def async_step_init(self, _: None = None) -> RepairsFlowResult:
"""Handle the first step of a fix flow."""
return await self.async_step_confirm_disable_entity()

async def async_step_confirm_disable_entity(
self,
user_input: dict[str, str] | None = None,
) -> FlowResult:
) -> RepairsFlowResult:
"""Handle the confirm step of a fix flow."""
if user_input is not None:
entity_registry = er.async_get(self.hass)
Expand Down
7 changes: 3 additions & 4 deletions homeassistant/components/bthome/repairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

from typing import Any

from homeassistant import data_entry_flow
from homeassistant.components.repairs import RepairsFlow
from homeassistant.components.repairs import RepairsFlow, RepairsFlowResult
from homeassistant.core import HomeAssistant
from homeassistant.helpers import issue_registry as ir

Expand All @@ -21,13 +20,13 @@ def __init__(self, entry_id: str, entry_title: str) -> None:

async def async_step_init(
self, user_input: dict[str, Any] | None = None
) -> data_entry_flow.FlowResult:
) -> RepairsFlowResult:
"""Handle the initial step of the repair flow."""
return await self.async_step_confirm()

async def async_step_confirm(
self, user_input: dict[str, Any] | None = None
) -> data_entry_flow.FlowResult:
) -> RepairsFlowResult:
"""Handle confirmation, remove the bindkey, and reload the entry."""
if user_input is not None:
entry = self.hass.config_entries.async_get_entry(self._entry_id)
Expand Down
12 changes: 6 additions & 6 deletions homeassistant/components/cloud/repairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
from homeassistant.components.repairs import (
ConfirmRepairFlow,
RepairsFlow,
RepairsFlowResult,
repairs_flow_manager,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers import issue_registry as ir

from .const import DATA_CLOUD, DOMAIN
Expand Down Expand Up @@ -50,14 +50,14 @@ class LegacySubscriptionRepairFlow(RepairsFlow):
wait_task: asyncio.Task | None = None
_data: SubscriptionInfo | None = None

async def async_step_init(self, _: None = None) -> FlowResult:
async def async_step_init(self, _: None = None) -> RepairsFlowResult:
"""Handle the first step of a fix flow."""
return await self.async_step_confirm_change_plan()

async def async_step_confirm_change_plan(
self,
user_input: dict[str, str] | None = None,
) -> FlowResult:
) -> RepairsFlowResult:
"""Handle the confirm step of a fix flow."""
if user_input is not None:
return await self.async_step_change_plan()
Expand All @@ -66,7 +66,7 @@ async def async_step_confirm_change_plan(
step_id="confirm_change_plan", data_schema=vol.Schema({})
)

async def async_step_change_plan(self, _: None = None) -> FlowResult:
async def async_step_change_plan(self, _: None = None) -> RepairsFlowResult:
"""Wait for the user to authorize the app installation."""

cloud = self.hass.data[DATA_CLOUD]
Expand Down Expand Up @@ -107,11 +107,11 @@ async def _async_wait_for_plan_change() -> None:

return self.async_external_step_done(next_step_id="complete")

async def async_step_complete(self, _: None = None) -> FlowResult:
async def async_step_complete(self, _: None = None) -> RepairsFlowResult:
"""Handle the final step of a fix flow."""
return self.async_create_entry(data={})

async def async_step_timeout(self, _: None = None) -> FlowResult:
async def async_step_timeout(self, _: None = None) -> RepairsFlowResult:
"""Handle the final step of a fix flow."""
return self.async_abort(reason="operation_took_too_long")

Expand Down
7 changes: 3 additions & 4 deletions homeassistant/components/doorbird/repairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import voluptuous as vol

from homeassistant import data_entry_flow
from homeassistant.components.repairs import RepairsFlow
from homeassistant.components.repairs import RepairsFlow, RepairsFlowResult
from homeassistant.core import HomeAssistant
from homeassistant.helpers import issue_registry as ir

Expand All @@ -17,13 +16,13 @@ def __init__(self, entry_id: str) -> None:

async def async_step_init(
self, user_input: dict[str, str] | None = None
) -> data_entry_flow.FlowResult:
) -> RepairsFlowResult:
"""Handle the first step of a fix flow."""
return await self.async_step_confirm()

async def async_step_confirm(
self, user_input: dict[str, str] | None = None
) -> data_entry_flow.FlowResult:
) -> RepairsFlowResult:
"""Handle the confirm step of a fix flow."""
if user_input is not None:
self.hass.config_entries.async_schedule_reload(self.entry_id)
Expand Down
9 changes: 4 additions & 5 deletions homeassistant/components/esphome/repairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

import voluptuous as vol

from homeassistant import data_entry_flow
from homeassistant.components.repairs import RepairsFlow
from homeassistant.components.repairs import RepairsFlow, RepairsFlowResult
from homeassistant.core import HomeAssistant

from .manager import async_replace_device
Expand Down Expand Up @@ -43,7 +42,7 @@ def stored_mac(self) -> str:

async def async_step_init(
self, user_input: dict[str, str] | None = None
) -> data_entry_flow.FlowResult:
) -> RepairsFlowResult:
"""Handle the first step of a fix flow."""
return self.async_show_menu(
step_id="init",
Expand All @@ -52,7 +51,7 @@ async def async_step_init(

async def async_step_migrate(
self, user_input: dict[str, str] | None = None
) -> data_entry_flow.FlowResult:
) -> RepairsFlowResult:
"""Handle the migrate step of a fix flow."""
if user_input is None:
return self.async_show_form(
Expand All @@ -66,7 +65,7 @@ async def async_step_migrate(

async def async_step_manual(
self, user_input: dict[str, str] | None = None
) -> data_entry_flow.FlowResult:
) -> RepairsFlowResult:
"""Handle the manual step of a fix flow."""
if user_input is None:
return self.async_show_form(
Expand Down
15 changes: 7 additions & 8 deletions homeassistant/components/hassio/repairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
from aiohasupervisor.models import ContextType
import voluptuous as vol

from homeassistant.components.repairs import RepairsFlow
from homeassistant.components.repairs import RepairsFlow, RepairsFlowResult
from homeassistant.const import ATTR_NAME
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResult

from . import get_addons_list
from .const import (
Expand Down Expand Up @@ -77,7 +76,7 @@ def description_placeholders(self) -> dict[str, str] | None:

return placeholders or None

def _async_form_for_suggestion(self, suggestion: Suggestion) -> FlowResult:
def _async_form_for_suggestion(self, suggestion: Suggestion) -> RepairsFlowResult:
"""Return form for suggestion."""
return self.async_show_form(
step_id=suggestion.key,
Expand All @@ -86,7 +85,7 @@ def _async_form_for_suggestion(self, suggestion: Suggestion) -> FlowResult:
last_step=True,
)

async def async_step_init(self, _: None = None) -> FlowResult:
async def async_step_init(self, _: None = None) -> RepairsFlowResult:
"""Handle the first step of a fix flow."""
# Out of sync with supervisor, issue is resolved or not fixable. Remove it
if not self.issue or not self.issue.suggestions:
Expand All @@ -108,7 +107,7 @@ async def async_step_init(self, _: None = None) -> FlowResult:
# Always show a form for one suggestion to explain to user what's happening
return self._async_form_for_suggestion(self.issue.suggestions[0])

async def async_step_fix_menu(self, _: None = None) -> FlowResult:
async def async_step_fix_menu(self, _: None = None) -> RepairsFlowResult:
"""Show the fix menu."""
assert self.issue

Expand All @@ -120,7 +119,7 @@ async def async_step_fix_menu(self, _: None = None) -> FlowResult:

async def _async_step_apply_suggestion(
self, suggestion: Suggestion, confirmed: bool = False
) -> FlowResult:
) -> RepairsFlowResult:
"""Handle applying a suggestion as a flow step. Optionally request confirmation."""
if not confirmed and suggestion.key in SUGGESTION_CONFIRMATION_REQUIRED:
return self._async_form_for_suggestion(suggestion)
Expand All @@ -137,13 +136,13 @@ def _async_step(
suggestion: Suggestion,
) -> Callable[
[SupervisorIssueRepairFlow, dict[str, str] | None],
Coroutine[Any, Any, FlowResult],
Coroutine[Any, Any, RepairsFlowResult],
]:
"""Generate a step handler for a suggestion."""

async def _async_step(
self: SupervisorIssueRepairFlow, user_input: dict[str, str] | None = None
) -> FlowResult:
) -> RepairsFlowResult:
"""Handle a flow step for a suggestion."""
return await self._async_step_apply_suggestion(
suggestion, confirmed=user_input is not None
Expand Down
19 changes: 11 additions & 8 deletions homeassistant/components/homeassistant/repairs.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
"""Repairs for Home Assistant."""

from homeassistant.components.repairs import ConfirmRepairFlow, RepairsFlow
from homeassistant.components.repairs import (
ConfirmRepairFlow,
RepairsFlow,
RepairsFlowResult,
)
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers import issue_registry as ir

from .const import DOMAIN
Expand All @@ -18,7 +21,7 @@ def __init__(self, data: dict[str, str]) -> None:

async def async_step_init(
self, user_input: dict[str, str] | None = None
) -> FlowResult:
) -> RepairsFlowResult:
"""Handle the first step of a fix flow."""
return self.async_show_menu(
step_id="init",
Expand All @@ -28,7 +31,7 @@ async def async_step_init(

async def async_step_confirm(
self, user_input: dict[str, str] | None = None
) -> FlowResult:
) -> RepairsFlowResult:
"""Handle the confirm step of a fix flow."""
entries = self.hass.config_entries.async_entries(self.domain)
for entry in entries:
Expand All @@ -37,7 +40,7 @@ async def async_step_confirm(

async def async_step_ignore(
self, user_input: dict[str, str] | None = None
) -> FlowResult:
) -> RepairsFlowResult:
"""Handle the ignore step of a fix flow."""
ir.async_get(self.hass).async_ignore(
DOMAIN, f"integration_not_found.{self.domain}", True
Expand All @@ -58,7 +61,7 @@ def __init__(self, data: dict[str, str]) -> None:

async def async_step_init(
self, user_input: dict[str, str] | None = None
) -> FlowResult:
) -> RepairsFlowResult:
"""Handle the first step of a fix flow."""
return self.async_show_menu(
step_id="init",
Expand All @@ -68,14 +71,14 @@ async def async_step_init(

async def async_step_confirm(
self, user_input: dict[str, str] | None = None
) -> FlowResult:
) -> RepairsFlowResult:
"""Handle the confirm step of a fix flow."""
await self.hass.config_entries.async_remove(self.entry_id)
return self.async_create_entry(data={})

async def async_step_ignore(
self, user_input: dict[str, str] | None = None
) -> FlowResult:
) -> RepairsFlowResult:
"""Handle the ignore step of a fix flow."""
ir.async_get(self.hass).async_ignore(
DOMAIN, f"orphaned_ignored_entry.{self.entry_id}", True
Expand Down
10 changes: 4 additions & 6 deletions homeassistant/components/homewizard/repairs.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
"""Repairs for HomeWizard integration."""

from homeassistant import data_entry_flow
from homeassistant.components.repairs import RepairsFlow
from homeassistant.components.repairs import RepairsFlow, RepairsFlowResult
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_IP_ADDRESS, CONF_TOKEN
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResult

from .config_flow import async_request_token

Expand All @@ -19,14 +17,14 @@ def __init__(self, entry: ConfigEntry) -> None:

async def async_step_init(
self, user_input: dict[str, str] | None = None
) -> data_entry_flow.FlowResult:
) -> RepairsFlowResult:
"""Handle the first step of a fix flow."""

return await self.async_step_confirm()

async def async_step_confirm(
self, user_input: dict[str, str] | None = None
) -> FlowResult:
) -> RepairsFlowResult:
"""Handle the confirm step of a fix flow."""

if user_input is not None:
Expand All @@ -38,7 +36,7 @@ async def async_step_confirm(

async def async_step_authorize(
self, user_input: dict[str, str] | None = None
) -> FlowResult:
) -> RepairsFlowResult:
"""Handle the authorize step of a fix flow."""

ip_address = self.entry.data[CONF_IP_ADDRESS]
Expand Down
13 changes: 8 additions & 5 deletions homeassistant/components/kitchen_sink/repairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import voluptuous as vol

from homeassistant import data_entry_flow
from homeassistant.components.repairs import ConfirmRepairFlow, RepairsFlow
from homeassistant.components.repairs import (
ConfirmRepairFlow,
RepairsFlow,
RepairsFlowResult,
)
from homeassistant.core import HomeAssistant


Expand All @@ -12,14 +15,14 @@ class DemoFixFlow(RepairsFlow):

async def async_step_init(
self, user_input: dict[str, str] | None = None
) -> data_entry_flow.FlowResult:
) -> RepairsFlowResult:
"""Handle the first step of a fix flow."""

return await self.async_step_confirm()

async def async_step_confirm(
self, user_input: dict[str, str] | None = None
) -> data_entry_flow.FlowResult:
) -> RepairsFlowResult:
"""Handle the confirm step of a fix flow."""
if user_input is not None:
return self.async_create_entry(data={})
Expand All @@ -32,7 +35,7 @@ class DemoColdTeaFixFlow(RepairsFlow):

async def async_step_init(
self, user_input: dict[str, str] | None = None
) -> data_entry_flow.FlowResult:
) -> RepairsFlowResult:
"""Handle the first step of a fix flow."""
return self.async_abort(reason="not_tea_time")

Expand Down
Loading
Loading