1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Use literal string interpolation in integrations H-J (f-strings) (#26380)

This commit is contained in:
Franck Nijhof
2019-09-03 17:27:14 +02:00
committed by Pascal Vizeli
parent 13bb2ea35a
commit f9edec19ad
59 changed files with 128 additions and 139 deletions

View File

@@ -67,7 +67,7 @@ class IOSSensor(Entity):
def unique_id(self):
"""Return the unique ID of this sensor."""
device_id = self._device[ios.ATTR_DEVICE_ID]
return "{}_{}".format(self.type, device_id)
return f"{self.type}_{device_id}"
@property
def unit_of_measurement(self):
@@ -100,11 +100,11 @@ class IOSSensor(Entity):
ios.ATTR_BATTERY_STATE_UNPLUGGED,
):
charging = False
icon_state = "{}-off".format(DEFAULT_ICON_STATE)
icon_state = f"{DEFAULT_ICON_STATE}-off"
elif battery_state == ios.ATTR_BATTERY_STATE_UNKNOWN:
battery_level = None
charging = False
icon_state = "{}-unknown".format(DEFAULT_ICON_LEVEL)
icon_state = f"{DEFAULT_ICON_LEVEL}-unknown"
if self.type == "state":
return icon_state