Use literal string interpolation in integrations A (f-strings) (#26377)

* Use literal string interpolation in integrations A (f-strings)

* Black
This commit is contained in:
Franck Nijhof
2019-09-03 16:11:36 +02:00
committed by Andrew Sayre
parent 3534b8a977
commit ad51615718
37 changed files with 74 additions and 95 deletions

View File

@@ -194,7 +194,7 @@ class AirVisualSensor(Entity):
@property
def unique_id(self):
"""Return a unique, HASS-friendly identifier for this entity."""
return "{0}_{1}_{2}".format(self._location_id, self._locale, self._type)
return f"{self._location_id}_{self._locale}_{self._type}"
@property
def unit_of_measurement(self):
@@ -210,7 +210,7 @@ class AirVisualSensor(Entity):
return
if self._type == SENSOR_TYPE_LEVEL:
aqi = data["aqi{0}".format(self._locale)]
aqi = data[f"aqi{self._locale}"]
[level] = [
i
for i in POLLUTANT_LEVEL_MAPPING
@@ -219,9 +219,9 @@ class AirVisualSensor(Entity):
self._state = level["label"]
self._icon = level["icon"]
elif self._type == SENSOR_TYPE_AQI:
self._state = data["aqi{0}".format(self._locale)]
self._state = data[f"aqi{self._locale}"]
elif self._type == SENSOR_TYPE_POLLUTANT:
symbol = data["main{0}".format(self._locale)]
symbol = data[f"main{self._locale}"]
self._state = POLLUTANT_MAPPING[symbol]["label"]
self._attrs.update(
{