Use literal string interpolation in integrations R-S (f-strings) (#26392)

This commit is contained in:
Franck Nijhof
2019-09-03 21:14:39 +02:00
committed by Pascal Vizeli
parent 7203027cbf
commit 445c741b30
69 changed files with 129 additions and 149 deletions
@@ -98,7 +98,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
return
# Note: Host part is needed, when using multiple snapservers
hpid = "{}:{}".format(host, port)
hpid = f"{host}:{port}"
groups = [SnapcastGroupDevice(group, hpid) for group in server.groups]
clients = [SnapcastClientDevice(client, hpid) for client in server.clients]
@@ -114,7 +114,7 @@ class SnapcastGroupDevice(MediaPlayerDevice):
"""Initialize the Snapcast group device."""
group.set_callback(self.schedule_update_ha_state)
self._group = group
self._uid = "{}{}_{}".format(GROUP_PREFIX, uid_part, self._group.identifier)
self._uid = f"{GROUP_PREFIX}{uid_part}_{self._group.identifier}"
@property
def state(self):
@@ -133,7 +133,7 @@ class SnapcastGroupDevice(MediaPlayerDevice):
@property
def name(self):
"""Return the name of the device."""
return "{}{}".format(GROUP_PREFIX, self._group.identifier)
return f"{GROUP_PREFIX}{self._group.identifier}"
@property
def source(self):
@@ -163,7 +163,7 @@ class SnapcastGroupDevice(MediaPlayerDevice):
@property
def device_state_attributes(self):
"""Return the state attributes."""
name = "{} {}".format(self._group.friendly_name, GROUP_SUFFIX)
name = f"{self._group.friendly_name} {GROUP_SUFFIX}"
return {"friendly_name": name}
@property
@@ -204,7 +204,7 @@ class SnapcastClientDevice(MediaPlayerDevice):
"""Initialize the Snapcast client device."""
client.set_callback(self.schedule_update_ha_state)
self._client = client
self._uid = "{}{}_{}".format(CLIENT_PREFIX, uid_part, self._client.identifier)
self._uid = f"{CLIENT_PREFIX}{uid_part}_{self._client.identifier}"
@property
def unique_id(self):
@@ -223,7 +223,7 @@ class SnapcastClientDevice(MediaPlayerDevice):
@property
def name(self):
"""Return the name of the device."""
return "{}{}".format(CLIENT_PREFIX, self._client.identifier)
return f"{CLIENT_PREFIX}{self._client.identifier}"
@property
def source(self):
@@ -260,7 +260,7 @@ class SnapcastClientDevice(MediaPlayerDevice):
@property
def device_state_attributes(self):
"""Return the state attributes."""
name = "{} {}".format(self._client.friendly_name, CLIENT_SUFFIX)
name = f"{self._client.friendly_name} {CLIENT_SUFFIX}"
return {"friendly_name": name}
@property