Enable Ruff RUF010 (#115371)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Sid 2024-05-08 23:54:49 +02:00 committed by GitHub
parent 589104f63d
commit ac54cdcdb4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 88 additions and 95 deletions

View file

@ -35,5 +35,5 @@ class SwitchBeeButton(SwitchBeeEntity, ButtonEntity):
await self.coordinator.api.set_state(self._device.id, ApiStateCommand.ON)
except SwitchBeeError as exp:
raise HomeAssistantError(
f"Failed to fire scenario {self.name}, {str(exp)}"
f"Failed to fire scenario {self.name}, {exp!s}"
) from exp

View file

@ -181,7 +181,7 @@ class SwitchBeeClimateEntity(SwitchBeeDeviceEntity[SwitchBeeThermostat], Climate
await self.coordinator.api.set_state(self._device.id, state)
except (SwitchBeeError, SwitchBeeDeviceOfflineError) as exp:
raise HomeAssistantError(
f"Failed to set {self.name} state {state}, error: {str(exp)}"
f"Failed to set {self.name} state {state}, error: {exp!s}"
) from exp
await self.coordinator.async_refresh()

View file

@ -55,7 +55,7 @@ class SwitchBeeSomfyEntity(SwitchBeeDeviceEntity[SwitchBeeSomfy], CoverEntity):
await self.coordinator.api.set_state(self._device.id, command)
except (SwitchBeeError, SwitchBeeTokenError) as exp:
raise HomeAssistantError(
f"Failed to fire {command} for {self.name}, {str(exp)}"
f"Failed to fire {command} for {self.name}, {exp!s}"
) from exp
async def async_open_cover(self, **kwargs: Any) -> None:
@ -145,7 +145,7 @@ class SwitchBeeCoverEntity(SwitchBeeDeviceEntity[SwitchBeeShutter], CoverEntity)
except (SwitchBeeError, SwitchBeeTokenError) as exp:
raise HomeAssistantError(
f"Failed to set {self.name} position to {kwargs[ATTR_POSITION]}, error:"
f" {str(exp)}"
f" {exp!s}"
) from exp
self._get_coordinator_device().position = kwargs[ATTR_POSITION]

View file

@ -100,7 +100,7 @@ class SwitchBeeLightEntity(SwitchBeeDeviceEntity[SwitchBeeDimmer], LightEntity):
await self.coordinator.api.set_state(self._device.id, state)
except (SwitchBeeError, SwitchBeeDeviceOfflineError) as exp:
raise HomeAssistantError(
f"Failed to set {self.name} state {state}, {str(exp)}"
f"Failed to set {self.name} state {state}, {exp!s}"
) from exp
if not isinstance(state, int):
@ -120,7 +120,7 @@ class SwitchBeeLightEntity(SwitchBeeDeviceEntity[SwitchBeeDimmer], LightEntity):
await self.coordinator.api.set_state(self._device.id, ApiStateCommand.OFF)
except (SwitchBeeError, SwitchBeeDeviceOfflineError) as exp:
raise HomeAssistantError(
f"Failed to turn off {self._attr_name}, {str(exp)}"
f"Failed to turn off {self._attr_name}, {exp!s}"
) from exp
# update the coordinator manually

View file

@ -102,7 +102,7 @@ class SwitchBeeSwitchEntity(SwitchBeeDeviceEntity[_DeviceTypeT], SwitchEntity):
except (SwitchBeeError, SwitchBeeDeviceOfflineError) as exp:
await self.coordinator.async_refresh()
raise HomeAssistantError(
f"Failed to set {self._attr_name} state {state}, {str(exp)}"
f"Failed to set {self._attr_name} state {state}, {exp!s}"
) from exp
await self.coordinator.async_refresh()