diff --git a/homeassistant/components/yamaha_musiccast/config_flow.py b/homeassistant/components/yamaha_musiccast/config_flow.py index a074f34c7825d..d6ad54c4a3d80 100644 --- a/homeassistant/components/yamaha_musiccast/config_flow.py +++ b/homeassistant/components/yamaha_musiccast/config_flow.py @@ -10,9 +10,8 @@ from aiomusiccast import MusicCastConnectionException, MusicCastDevice import voluptuous as vol -from homeassistant import data_entry_flow from homeassistant.components import ssdp -from homeassistant.config_entries import ConfigFlow +from homeassistant.config_entries import ConfigFlow, ConfigFlowResult from homeassistant.const import CONF_HOST from homeassistant.helpers.aiohttp_client import async_get_clientsession @@ -33,7 +32,7 @@ class MusicCastFlowHandler(ConfigFlow, domain=DOMAIN): async def async_step_user( self, user_input: dict[str, Any] | None = None - ) -> data_entry_flow.ConfigFlowResult: + ) -> ConfigFlowResult: """Handle a flow initiated by the user.""" # Request user input, unless we are preparing discovery flow if user_input is None: @@ -73,9 +72,7 @@ async def async_step_user( return self._show_setup_form(errors) - def _show_setup_form( - self, errors: dict | None = None - ) -> data_entry_flow.ConfigFlowResult: + def _show_setup_form(self, errors: dict | None = None) -> ConfigFlowResult: """Show the setup form to the user.""" return self.async_show_form( step_id="user", @@ -85,7 +82,7 @@ def _show_setup_form( async def async_step_ssdp( self, discovery_info: ssdp.SsdpServiceInfo - ) -> data_entry_flow.ConfigFlowResult: + ) -> ConfigFlowResult: """Handle ssdp discoveries.""" if not await MusicCastDevice.check_yamaha_ssdp( discovery_info.ssdp_location, async_get_clientsession(self.hass) @@ -117,9 +114,7 @@ async def async_step_ssdp( return await self.async_step_confirm() - async def async_step_confirm( - self, user_input=None - ) -> data_entry_flow.ConfigFlowResult: + async def async_step_confirm(self, user_input=None) -> ConfigFlowResult: """Allow the user to confirm adding the device.""" if user_input is not None: return self.async_create_entry( diff --git a/homeassistant/data_entry_flow.py b/homeassistant/data_entry_flow.py index 338b5f3992f4b..6df77443e7e1e 100644 --- a/homeassistant/data_entry_flow.py +++ b/homeassistant/data_entry_flow.py @@ -10,7 +10,6 @@ import copy from dataclasses import dataclass from enum import StrEnum -from functools import partial import logging from types import MappingProxyType from typing import Any, Generic, Required, TypedDict, cast @@ -20,12 +19,6 @@ from .core import HomeAssistant, callback from .exceptions import HomeAssistantError -from .helpers.deprecation import ( - DeprecatedConstantEnum, - all_with_deprecated_constants, - check_if_deprecated_constant, - dir_with_deprecated_constants, -) from .helpers.frame import ReportBehavior, report_usage from .loader import async_suggest_report_issue from .util import uuid as uuid_util @@ -46,26 +39,6 @@ class FlowResultType(StrEnum): MENU = "menu" -# RESULT_TYPE_* is deprecated, to be removed in 2025.1 -_DEPRECATED_RESULT_TYPE_FORM = DeprecatedConstantEnum(FlowResultType.FORM, "2025.1") -_DEPRECATED_RESULT_TYPE_CREATE_ENTRY = DeprecatedConstantEnum( - FlowResultType.CREATE_ENTRY, "2025.1" -) -_DEPRECATED_RESULT_TYPE_ABORT = DeprecatedConstantEnum(FlowResultType.ABORT, "2025.1") -_DEPRECATED_RESULT_TYPE_EXTERNAL_STEP = DeprecatedConstantEnum( - FlowResultType.EXTERNAL_STEP, "2025.1" -) -_DEPRECATED_RESULT_TYPE_EXTERNAL_STEP_DONE = DeprecatedConstantEnum( - FlowResultType.EXTERNAL_STEP_DONE, "2025.1" -) -_DEPRECATED_RESULT_TYPE_SHOW_PROGRESS = DeprecatedConstantEnum( - FlowResultType.SHOW_PROGRESS, "2025.1" -) -_DEPRECATED_RESULT_TYPE_SHOW_PROGRESS_DONE = DeprecatedConstantEnum( - FlowResultType.SHOW_PROGRESS_DONE, "2025.1" -) -_DEPRECATED_RESULT_TYPE_MENU = DeprecatedConstantEnum(FlowResultType.MENU, "2025.1") - # Event that is fired when a flow is progressed via external or progress source. EVENT_DATA_ENTRY_FLOW_PROGRESSED = "data_entry_flow_progressed" @@ -126,6 +99,7 @@ def __init__( schema_errors: dict[str, Any], **kwargs: Any, ) -> None: + """Initialize an invalid data exception.""" super().__init__(message, path, error_message, **kwargs) self.schema_errors = schema_errors @@ -929,11 +903,3 @@ def __init__( def __call__(self, value: Any) -> Any: """Validate input.""" return self.schema(value) - - -# These can be removed if no deprecated constant are in this module anymore -__getattr__ = partial(check_if_deprecated_constant, module_globals=globals()) -__dir__ = partial( - dir_with_deprecated_constants, module_globals_keys=[*globals().keys()] -) -__all__ = all_with_deprecated_constants(globals()) diff --git a/tests/components/azure_data_explorer/test_config_flow.py b/tests/components/azure_data_explorer/test_config_flow.py index a700299be3316..13ff6a8bb137e 100644 --- a/tests/components/azure_data_explorer/test_config_flow.py +++ b/tests/components/azure_data_explorer/test_config_flow.py @@ -25,7 +25,7 @@ async def test_config_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> BASE_CONFIG.copy(), ) - assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY + assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY assert result2["title"] == "cluster.region.kusto.windows.net" mock_setup_entry.assert_called_once() @@ -59,12 +59,12 @@ async def test_config_flow_errors( result["flow_id"], BASE_CONFIG.copy(), ) - assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM + assert result2["type"] == data_entry_flow.FlowResultType.FORM assert result2["errors"] == {"base": expected} await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM + assert result2["type"] == data_entry_flow.FlowResultType.FORM # Retest error handling if error is corrected and connection is successful @@ -77,4 +77,4 @@ async def test_config_flow_errors( await hass.async_block_till_done() - assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY + assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY diff --git a/tests/test_data_entry_flow.py b/tests/test_data_entry_flow.py index 32020ac0d7664..74a55cb4989d7 100644 --- a/tests/test_data_entry_flow.py +++ b/tests/test_data_entry_flow.py @@ -13,11 +13,7 @@ from homeassistant.helpers import config_validation as cv from homeassistant.util.decorator import Registry -from .common import ( - async_capture_events, - help_test_all, - import_and_test_deprecated_constant_enum, -) +from .common import async_capture_events class MockFlowManager(data_entry_flow.FlowManager): @@ -985,22 +981,6 @@ async def async_step_second(self, user_input=None): assert len(manager.async_progress()) == 0 -def test_all() -> None: - """Test module.__all__ is correctly set.""" - help_test_all(data_entry_flow) - - -@pytest.mark.parametrize(("enum"), list(data_entry_flow.FlowResultType)) -def test_deprecated_constants( - caplog: pytest.LogCaptureFixture, - enum: data_entry_flow.FlowResultType, -) -> None: - """Test deprecated constants.""" - import_and_test_deprecated_constant_enum( - caplog, data_entry_flow, enum, "RESULT_TYPE_", "2025.1" - ) - - def test_section_in_serializer() -> None: """Test section with custom_serializer.""" assert cv.custom_serializer(