mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
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:
committed by
Andrew Sayre
parent
3534b8a977
commit
ad51615718
@@ -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(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user