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 E-G (f-strings) (#26379)

This commit is contained in:
Franck Nijhof
2019-09-03 17:10:56 +02:00
committed by Pascal Vizeli
parent 6a24d893c8
commit fa79ef1220
45 changed files with 87 additions and 92 deletions

View File

@@ -95,7 +95,7 @@ class FritzDectSwitch(SwitchDevice):
attrs[ATTR_CURRENT_CONSUMPTION_UNIT] = "{}".format(
ATTR_CURRENT_CONSUMPTION_UNIT_VALUE
)
attrs[ATTR_TOTAL_CONSUMPTION] = "{:.3f}".format(self.data.total_consumption)
attrs[ATTR_TOTAL_CONSUMPTION] = f"{self.data.total_consumption:.3f}"
attrs[ATTR_TOTAL_CONSUMPTION_UNIT] = "{}".format(
ATTR_TOTAL_CONSUMPTION_UNIT_VALUE
)
@@ -104,7 +104,7 @@ class FritzDectSwitch(SwitchDevice):
attrs[ATTR_TEMPERATURE] = "{}".format(
self.units.temperature(self.data.temperature, TEMP_CELSIUS)
)
attrs[ATTR_TEMPERATURE_UNIT] = "{}".format(self.units.temperature_unit)
attrs[ATTR_TEMPERATURE_UNIT] = f"{self.units.temperature_unit}"
return attrs
@property