Use f-strings in integrations starting with "F"and"G" (#32150)

* Use f-strings in integrations starting with F

* Use f-strings in tests for integrations starting with F

* Use f-strings in integrations starting with G

* Use f-strings in tests for integrations starting with G

* Fix pylint error

* Fix broken test
This commit is contained in:
springstan authored and GitHub committed 2020-02-24 17:54:20 -08:00
1 parent 496bd3dddf
commit ad102b3840
59 files changed
+219 -344

No files matched your search

+2 -8
View File
@@ -90,11 +90,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
device = condition[CONF_DEVICE]
sensor_type = condition[CONF_SENSOR_TYPE]
scope = condition[CONF_SCOPE]
name = "Fronius {} {} {}".format(
condition[CONF_SENSOR_TYPE].replace("_", " ").capitalize(),
device if scope == SCOPE_DEVICE else SCOPE_SYSTEM,
config[CONF_RESOURCE],
)
name = f"Fronius {condition[CONF_SENSOR_TYPE].replace('_', ' ').capitalize()} {device if scope == SCOPE_DEVICE else SCOPE_SYSTEM} {config[CONF_RESOURCE]}"
if sensor_type == TYPE_INVERTER:
if scope == SCOPE_SYSTEM:
adapter_cls = FroniusInverterSystem
@@ -258,9 +254,7 @@ class FroniusTemplateSensor(Entity):
@property
def name(self):
"""Return the name of the sensor."""
return "{} {}".format(
self._name.replace("_", " ").capitalize(), self.parent.name
)
return f"{self._name.replace('_', ' ').capitalize()} {self.parent.name}"
@property
def state(self):