Cleanup deprecated OptionsFlowWithConfigEntry (part 3) (#129756)

This commit is contained in:
epenet
2024-11-04 18:55:01 +01:00
committed by GitHub
parent 8870b657d1
commit d180ff417d
2 changed files with 9 additions and 8 deletions

View File

@@ -3127,6 +3127,10 @@ class OptionsFlow(ConfigEntryBaseFlow):
)
self._config_entry = value
def initialize_options(self, config_entry: ConfigEntry) -> None:
"""Initialize the options to a mutable copy of the config entry options."""
self._options = deepcopy(dict(config_entry.options))
@property
def options(self) -> dict[str, Any]:
"""Return a mutable copy of the config entry options.
@@ -3135,7 +3139,7 @@ class OptionsFlow(ConfigEntryBaseFlow):
can only be referenced after initialisation.
"""
if not hasattr(self, "_options"):
self._options = deepcopy(dict(self.config_entry.options))
self.initialize_options(self.config_entry)
return self._options
@options.setter
@@ -3161,7 +3165,7 @@ class OptionsFlowWithConfigEntry(OptionsFlow):
"inherits from OptionsFlowWithConfigEntry, which is deprecated "
"and will stop working in 2025.12",
error_if_integration=False,
error_if_core=False,
error_if_core=True,
)