diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index 80c4792156a9..40f3f60abd22 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -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 diff --git a/homeassistant/loader.py b/homeassistant/loader.py index 11a326064648..d301ce871cf0 100644 --- a/homeassistant/loader.py +++ b/homeassistant/loader.py @@ -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( diff --git a/pylint/plugins/pylint_home_assistant/checkers/type_hints/const.py b/pylint/plugins/pylint_home_assistant/checkers/type_hints/const.py index 2285ef9f2e8b..6aa7bbcc3b51 100644 --- a/pylint/plugins/pylint_home_assistant/checkers/type_hints/const.py +++ b/pylint/plugins/pylint_home_assistant/checkers/type_hints/const.py @@ -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(