Use literal string interpolation in integrations R-S (f-strings) (#26392)
This commit is contained in:
1 parent
7203027cbf
commit
445c741b30
69 files changed
+129
-149
No files matched your search
@@ -106,7 +106,7 @@ def setup(hass, config):
|
||||
slugify(event.device.id_string.lower()),
|
||||
event.device.__class__.__name__,
|
||||
event.device.subtype,
|
||||
"".join("{0:02x}".format(x) for x in event.data),
|
||||
"".join(f"{x:02x}" for x in event.data),
|
||||
)
|
||||
|
||||
# Callback to HA registered components.
|
||||
@@ -270,7 +270,7 @@ def get_new_device(event, config, device):
|
||||
if not config[ATTR_AUTOMATIC_ADD]:
|
||||
return
|
||||
|
||||
pkt_id = "".join("{0:02x}".format(x) for x in event.data)
|
||||
pkt_id = "".join(f"{x:02x}" for x in event.data)
|
||||
_LOGGER.debug(
|
||||
"Automatic add %s rfxtrx device (Class: %s Sub: %s Packet_id: %s)",
|
||||
device_id,
|
||||
|
||||
@@ -116,7 +116,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
poss_id = slugify(poss_dev.event.device.id_string.lower())
|
||||
_LOGGER.debug("Found possible matching device ID: %s", poss_id)
|
||||
|
||||
pkt_id = "".join("{0:02x}".format(x) for x in event.data)
|
||||
pkt_id = "".join(f"{x:02x}" for x in event.data)
|
||||
sensor = RfxtrxBinarySensor(event, pkt_id)
|
||||
sensor.hass = hass
|
||||
rfxtrx.RFX_DEVICES[device_id] = sensor
|
||||
|
||||
@@ -98,7 +98,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
if not config[CONF_AUTOMATIC_ADD]:
|
||||
return
|
||||
|
||||
pkt_id = "".join("{0:02x}".format(x) for x in event.data)
|
||||
pkt_id = "".join(f"{x:02x}" for x in event.data)
|
||||
_LOGGER.info("Automatic add rfxtrx.sensor: %s", pkt_id)
|
||||
|
||||
data_type = ""
|
||||
@@ -141,7 +141,7 @@ class RfxtrxSensor(Entity):
|
||||
@property
|
||||
def name(self):
|
||||
"""Get the name of the sensor."""
|
||||
return "{} {}".format(self._name, self.data_type)
|
||||
return f"{self._name} {self.data_type}"
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
|
||||
Reference in new issue
Block a user