mirror of
https://github.com/home-assistant/core.git
synced 2026-09-26 01:11:51 -04:00
Config entry integration methods returns None (#182429)
This commit is contained in:
@@ -982,7 +982,7 @@ class ConfigEntry[_DataT = Any]:
|
||||
with async_start_setup(
|
||||
hass, integration=self.domain, group=self.entry_id, phase=setup_phase
|
||||
):
|
||||
result = await component.async_setup_entry(hass, self)
|
||||
result = await component.async_setup_entry(hass, self) # type: ignore[func-returns-value,assignment]
|
||||
|
||||
if not isinstance(result, bool):
|
||||
logger.error( # type: ignore[unreachable]
|
||||
@@ -1127,13 +1127,13 @@ class ConfigEntry[_DataT = Any]:
|
||||
if domain_is_integration:
|
||||
self._async_set_state(hass, ConfigEntryState.UNLOAD_IN_PROGRESS, None)
|
||||
try:
|
||||
result = await component.async_unload_entry(hass, self)
|
||||
result = await component.async_unload_entry(hass, self) # type: ignore[func-returns-value]
|
||||
|
||||
assert isinstance(result, bool)
|
||||
|
||||
# Only do side effects if we unloaded the integration
|
||||
if domain_is_integration:
|
||||
if result:
|
||||
if domain_is_integration: # type: ignore[unreachable]
|
||||
if result: # type: ignore[unused-ignore]
|
||||
await self._async_process_on_unload(hass)
|
||||
if hasattr(self, "runtime_data"):
|
||||
object.__delattr__(self, "runtime_data")
|
||||
@@ -1153,7 +1153,7 @@ class ConfigEntry[_DataT = Any]:
|
||||
hass, ConfigEntryState.FAILED_UNLOAD, str(exc) or "Unknown error"
|
||||
)
|
||||
return False
|
||||
return result
|
||||
return result # type: ignore[unreachable]
|
||||
|
||||
async def async_remove(self, hass: HomeAssistant) -> None:
|
||||
"""Invoke remove callback on component."""
|
||||
@@ -1281,13 +1281,13 @@ class ConfigEntry[_DataT = Any]:
|
||||
)
|
||||
return False
|
||||
|
||||
result = await component.async_migrate_entry(hass, self)
|
||||
result = await component.async_migrate_entry(hass, self) # type: ignore[func-returns-value]
|
||||
if not isinstance(result, bool):
|
||||
self.logger.error( # type: ignore[unreachable]
|
||||
self.logger.error(
|
||||
"%s.async_migrate_entry did not return boolean", self.domain
|
||||
)
|
||||
return False
|
||||
if result:
|
||||
if result: # type: ignore[unreachable]
|
||||
hass.config_entries._async_schedule_save() # noqa: SLF001
|
||||
|
||||
return result
|
||||
|
||||
@@ -384,17 +384,17 @@ class ComponentProtocol(Protocol):
|
||||
|
||||
async def async_setup_entry(
|
||||
self, hass: HomeAssistant, config_entry: ConfigEntry
|
||||
) -> bool:
|
||||
) -> None:
|
||||
"""Set up a config entry."""
|
||||
|
||||
async def async_unload_entry(
|
||||
self, hass: HomeAssistant, config_entry: ConfigEntry
|
||||
) -> bool:
|
||||
) -> None:
|
||||
"""Unload a config entry."""
|
||||
|
||||
async def async_migrate_entry(
|
||||
self, hass: HomeAssistant, config_entry: ConfigEntry
|
||||
) -> bool:
|
||||
) -> None:
|
||||
"""Migrate an old config entry."""
|
||||
|
||||
async def async_remove_entry(
|
||||
|
||||
@@ -107,7 +107,7 @@ _FUNCTION_MATCH: dict[str, list[TypeHintMatch]] = {
|
||||
0: "HomeAssistant",
|
||||
1: "ConfigEntry",
|
||||
},
|
||||
return_type="bool",
|
||||
return_type=["bool", "None"],
|
||||
mandatory=True,
|
||||
),
|
||||
TypeHintMatch(
|
||||
@@ -125,7 +125,7 @@ _FUNCTION_MATCH: dict[str, list[TypeHintMatch]] = {
|
||||
0: "HomeAssistant",
|
||||
1: "ConfigEntry",
|
||||
},
|
||||
return_type="bool",
|
||||
return_type=["bool", "None"],
|
||||
mandatory=True,
|
||||
),
|
||||
TypeHintMatch(
|
||||
@@ -134,7 +134,7 @@ _FUNCTION_MATCH: dict[str, list[TypeHintMatch]] = {
|
||||
0: "HomeAssistant",
|
||||
1: "ConfigEntry",
|
||||
},
|
||||
return_type="bool",
|
||||
return_type=["bool", "None"],
|
||||
mandatory=True,
|
||||
),
|
||||
TypeHintMatch(
|
||||
|
||||
Reference in New Issue
Block a user