diff --git a/homeassistant/components/flick_electric/config_flow.py b/homeassistant/components/flick_electric/config_flow.py index 7f21397d5a7..5fac5cdb83a 100644 --- a/homeassistant/components/flick_electric/config_flow.py +++ b/homeassistant/components/flick_electric/config_flow.py @@ -51,8 +51,8 @@ class FlickConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): raise CannotConnect() from err except AuthException as err: raise InvalidAuth() from err - else: - return token is not None + + return token is not None async def async_step_user(self, user_input=None): """Handle gathering login info.""" diff --git a/homeassistant/components/github/coordinator.py b/homeassistant/components/github/coordinator.py index 679c3d89aeb..45ab055aa9a 100644 --- a/homeassistant/components/github/coordinator.py +++ b/homeassistant/components/github/coordinator.py @@ -136,9 +136,9 @@ class GitHubDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]): # These are unexpected and we log the trace to help with troubleshooting LOGGER.exception(exception) raise UpdateFailed(exception) from exception - else: - self._last_response = response - return response.data["data"]["repository"] + + self._last_response = response + return response.data["data"]["repository"] async def _handle_event(self, event: GitHubEventModel) -> None: """Handle an event.""" diff --git a/homeassistant/components/google/__init__.py b/homeassistant/components/google/__init__.py index fa39d3bb31b..934b34c126b 100644 --- a/homeassistant/components/google/__init__.py +++ b/homeassistant/components/google/__init__.py @@ -191,8 +191,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: raise ConfigEntryAuthFailed from err except ApiException as err: raise ConfigEntryNotReady from err - else: - hass.config_entries.async_update_entry(entry, unique_id=primary_calendar.id) + + hass.config_entries.async_update_entry(entry, unique_id=primary_calendar.id) # Only expose the add event service if we have the correct permissions if get_feature_access(hass, entry) is FeatureAccess.read_write: diff --git a/homeassistant/components/lookin/config_flow.py b/homeassistant/components/lookin/config_flow.py index 016ffbd17f5..895d071ab4e 100644 --- a/homeassistant/components/lookin/config_flow.py +++ b/homeassistant/components/lookin/config_flow.py @@ -43,9 +43,8 @@ class LookinFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): except Exception: # pylint: disable=broad-except LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") - else: - self._name = device.name + self._name = device.name self._host = host self._set_confirm_only() self.context["title_placeholders"] = {"name": self._name, "host": host} diff --git a/homeassistant/components/matter/__init__.py b/homeassistant/components/matter/__init__.py index b1470ecc422..a0e4dcf7483 100644 --- a/homeassistant/components/matter/__init__.py +++ b/homeassistant/components/matter/__init__.py @@ -69,8 +69,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: raise ConfigEntryNotReady( "Unknown error connecting to the Matter server" ) from err - else: - async_delete_issue(hass, DOMAIN, "invalid_server_version") + + async_delete_issue(hass, DOMAIN, "invalid_server_version") async def on_hass_stop(event: Event) -> None: """Handle incoming stop event from Home Assistant.""" diff --git a/homeassistant/components/ping/__init__.py b/homeassistant/components/ping/__init__.py index c3699e0fe2d..2236b8dc337 100644 --- a/homeassistant/components/ping/__init__.py +++ b/homeassistant/components/ping/__init__.py @@ -36,9 +36,9 @@ def _can_use_icmp_lib_with_privilege() -> None | bool: " socket" ) return None - else: - _LOGGER.debug("Using icmplib in privileged=False mode") - return False - else: - _LOGGER.debug("Using icmplib in privileged=True mode") - return True + + _LOGGER.debug("Using icmplib in privileged=False mode") + return False + + _LOGGER.debug("Using icmplib in privileged=True mode") + return True diff --git a/homeassistant/components/unifiprotect/media_player.py b/homeassistant/components/unifiprotect/media_player.py index 1dd1938ff49..4704c42762e 100644 --- a/homeassistant/components/unifiprotect/media_player.py +++ b/homeassistant/components/unifiprotect/media_player.py @@ -153,11 +153,11 @@ class ProtectMediaPlayer(ProtectDeviceEntity, MediaPlayerEntity): await self.device.play_audio(media_id, blocking=False) except StreamError as err: raise HomeAssistantError(err) from err - else: - # update state after starting player - self._async_updated_event(self.device) - # wait until player finishes to update state again - await self.device.wait_until_audio_completes() + + # update state after starting player + self._async_updated_event(self.device) + # wait until player finishes to update state again + await self.device.wait_until_audio_completes() self._async_updated_event(self.device) diff --git a/homeassistant/components/uptimerobot/__init__.py b/homeassistant/components/uptimerobot/__init__.py index 00ee0889c3d..359e4c6831a 100644 --- a/homeassistant/components/uptimerobot/__init__.py +++ b/homeassistant/components/uptimerobot/__init__.py @@ -84,9 +84,9 @@ class UptimeRobotDataUpdateCoordinator(DataUpdateCoordinator[list[UptimeRobotMon raise ConfigEntryAuthFailed(exception) from exception except UptimeRobotException as exception: raise UpdateFailed(exception) from exception - else: - if response.status != API_ATTR_OK: - raise UpdateFailed(response.error.message) + + if response.status != API_ATTR_OK: + raise UpdateFailed(response.error.message) monitors: list[UptimeRobotMonitor] = response.data diff --git a/homeassistant/components/vlc_telnet/config_flow.py b/homeassistant/components/vlc_telnet/config_flow.py index 35898e91b34..6995a16c3ab 100644 --- a/homeassistant/components/vlc_telnet/config_flow.py +++ b/homeassistant/components/vlc_telnet/config_flow.py @@ -180,10 +180,8 @@ class VLCTelnetConfigFlow(ConfigFlow, domain=DOMAIN): except Exception: # pylint: disable=broad-except _LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") - else: - return self.async_create_entry( - title=info["title"], data=self.hassio_discovery - ) + + return self.async_create_entry(title=info["title"], data=self.hassio_discovery) class CannotConnect(exceptions.HomeAssistantError):