From 304426edb1a46764dda7a3f68e99eb002bf89c1a Mon Sep 17 00:00:00 2001 From: code-review-doctor <72647856+code-review-doctor@users.noreply.github.com> Date: Mon, 25 Apr 2022 08:58:17 +0100 Subject: [PATCH] Fix issue probably-meant-fstring found at https://codereview.doctor (#70574) Co-authored-by: J. Nick Koston --- homeassistant/components/aladdin_connect/cover.py | 2 +- homeassistant/components/demo/fan.py | 2 +- homeassistant/components/ezviz/switch.py | 2 +- homeassistant/components/plex/media_browser.py | 2 +- homeassistant/components/xiaomi_miio/gateway.py | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/aladdin_connect/cover.py b/homeassistant/components/aladdin_connect/cover.py index 7865a71aef9..05c24fc9a37 100644 --- a/homeassistant/components/aladdin_connect/cover.py +++ b/homeassistant/components/aladdin_connect/cover.py @@ -58,7 +58,7 @@ def setup_platform( _LOGGER.error("%s", ex) persistent_notification.create( hass, - "Error: {ex}
You will need to restart hass after fixing.", + f"Error: {ex}
You will need to restart hass after fixing.", title=NOTIFICATION_TITLE, notification_id=NOTIFICATION_ID, ) diff --git a/homeassistant/components/demo/fan.py b/homeassistant/components/demo/fan.py index 06b19e90090..66440588f17 100644 --- a/homeassistant/components/demo/fan.py +++ b/homeassistant/components/demo/fan.py @@ -254,7 +254,7 @@ class AsyncDemoPercentageFan(BaseDemoFan, FanEntity): """Set new preset mode.""" if self.preset_modes is None or preset_mode not in self.preset_modes: raise ValueError( - "{preset_mode} is not a valid preset_mode: {self.preset_modes}" + f"{preset_mode} is not a valid preset_mode: {self.preset_modes}" ) self._preset_mode = preset_mode self._percentage = None diff --git a/homeassistant/components/ezviz/switch.py b/homeassistant/components/ezviz/switch.py index c2e562f62da..55a946f858a 100644 --- a/homeassistant/components/ezviz/switch.py +++ b/homeassistant/components/ezviz/switch.py @@ -65,7 +65,7 @@ class EzvizSwitch(EzvizEntity, SwitchEntity): ) except (HTTPError, PyEzvizError) as err: - raise PyEzvizError("Failed to turn on switch {self._name}") from err + raise PyEzvizError(f"Failed to turn on switch {self._name}") from err if update_ok: await self.coordinator.async_request_refresh() diff --git a/homeassistant/components/plex/media_browser.py b/homeassistant/components/plex/media_browser.py index 1df624e265b..d65c01410c7 100644 --- a/homeassistant/components/plex/media_browser.py +++ b/homeassistant/components/plex/media_browser.py @@ -71,7 +71,7 @@ def browse_media( # noqa: C901 try: media_class = ITEM_TYPE_MEDIA_CLASS[item.type] except KeyError as err: - raise UnknownMediaType("Unknown type received: {item.type}") from err + raise UnknownMediaType(f"Unknown type received: {item.type}") from err payload = { "title": pretty_title(item, short_name), "media_class": media_class, diff --git a/homeassistant/components/xiaomi_miio/gateway.py b/homeassistant/components/xiaomi_miio/gateway.py index 27f426ff9d6..ebfb37ab8fb 100644 --- a/homeassistant/components/xiaomi_miio/gateway.py +++ b/homeassistant/components/xiaomi_miio/gateway.py @@ -81,7 +81,7 @@ class ConnectXiaomiGateway: raise AuthException(error) from error raise SetupException( - "DeviceException during setup of xiaomi gateway with host {self._host}" + f"DeviceException during setup of xiaomi gateway with host {self._host}" ) from error # get the connected sub devices @@ -115,7 +115,7 @@ class ConnectXiaomiGateway: if not miio_cloud.login(): raise SetupException( "Failed to login to Xiaomi Miio Cloud during setup of Xiaomi" - " gateway with host {self._host}", + f" gateway with host {self._host}", ) devices_raw = miio_cloud.get_devices(self._cloud_country) self._gateway_device.get_devices_from_dict(devices_raw)