Remove options property from OptionFlow (#129890)

* Remove options property from OptionFlow

* Update test_config_entries.py

* Partial revert of "Remove deprecated property setters in option flows (#129773)"

* Partial revert "Use new helper properties in crownstone options flow (#129774)"

* Restore onewire init

* Restore onvif

* Restore roborock

* Use deepcopy in onewire

* Restore steam_online

* Restore initial options property in OptionsFlowWithConfigEntry

* re-add options property in SchemaOptionsFlowHandler

* Restore test

* Cleanup
This commit is contained in:
epenet
2024-11-06 23:28:01 +01:00
committed by GitHub
parent 53c486ccd1
commit 03d5b18974
14 changed files with 63 additions and 73 deletions

View File

@ -3060,7 +3060,6 @@ class OptionsFlowManager(
class OptionsFlow(ConfigEntryBaseFlow):
"""Base class for config options flows."""
_options: dict[str, Any]
handler: str
_config_entry: ConfigEntry
@ -3127,28 +3126,6 @@ class OptionsFlow(ConfigEntryBaseFlow):
)
self._config_entry = value
@property
def options(self) -> dict[str, Any]:
"""Return a mutable copy of the config entry options.
Please note that this is not available inside `__init__` method, and
can only be referenced after initialisation.
"""
if not hasattr(self, "_options"):
self._options = deepcopy(dict(self.config_entry.options))
return self._options
@options.setter
def options(self, value: dict[str, Any]) -> None:
"""Set the options value."""
report(
"sets option flow options explicitly, which is deprecated "
"and will stop working in 2025.12",
error_if_integration=False,
error_if_core=True,
)
self._options = value
class OptionsFlowWithConfigEntry(OptionsFlow):
"""Base class for options flows with config entry and options."""
@ -3164,6 +3141,11 @@ class OptionsFlowWithConfigEntry(OptionsFlow):
error_if_core=True,
)
@property
def options(self) -> dict[str, Any]:
"""Return a mutable copy of the config entry options."""
return self._options
class EntityRegistryDisabledHandler:
"""Handler when entities related to config entries updated disabled_by."""