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

This commit is contained in:
Franck Nijhof authored and Pascal Vizeli committed 2019-09-03 21:14:39 +02:00
1 parent 7203027cbf
commit 445c741b30
69 files changed
+129 -149

No files matched your search

+1 -1
View File
@@ -226,7 +226,7 @@ class RachioIro:
def __str__(self) -> str:
"""Display the controller as a string."""
return 'Rachio controller "{}"'.format(self.name)
return f'Rachio controller "{self.name}"'
@property
def controller_id(self) -> str:
@@ -87,12 +87,12 @@ class RachioControllerOnlineBinarySensor(RachioControllerBinarySensor):
@property
def name(self) -> str:
"""Return the name of this sensor including the controller name."""
return "{} online".format(self._controller.name)
return f"{self._controller.name} online"
@property
def unique_id(self) -> str:
"""Return a unique id for this entity."""
return "{}-online".format(self._controller.controller_id)
return f"{self._controller.controller_id}-online"
@property
def device_class(self) -> str:
+4 -4
View File
@@ -72,7 +72,7 @@ class RachioSwitch(SwitchDevice):
@property
def name(self) -> str:
"""Get a name for this switch."""
return "Switch on {}".format(self._controller.name)
return f"Switch on {self._controller.name}"
@property
def is_on(self) -> bool:
@@ -113,12 +113,12 @@ class RachioStandbySwitch(RachioSwitch):
@property
def name(self) -> str:
"""Return the name of the standby switch."""
return "{} in standby mode".format(self._controller.name)
return f"{self._controller.name} in standby mode"
@property
def unique_id(self) -> str:
"""Return a unique id by combining controller id and purpose."""
return "{}-standby".format(self._controller.controller_id)
return f"{self._controller.controller_id}-standby"
@property
def icon(self) -> str:
@@ -183,7 +183,7 @@ class RachioZone(RachioSwitch):
@property
def unique_id(self) -> str:
"""Return a unique id by combining controller id and zone number."""
return "{}-zone-{}".format(self._controller.controller_id, self.zone_id)
return f"{self._controller.controller_id}-zone-{self.zone_id}"
@property
def icon(self) -> str: