Various string cleanups (#30435)

* Remove some unnecessary string concatenations

* Replace some simple str.formats with f-strings

* Replace some string concatenations with f-strings
This commit is contained in:
Ville Skyttä authored and Paulus Schoutsen committed 2020-01-03 14:47:06 +01:00
1 parent 5ad209c6fd
commit fa4fa30461
105 files changed
+241 -314

No files matched your search

@@ -998,7 +998,7 @@ class WUndergroundSensor(Entity):
self.rest.request_feature(SENSOR_TYPES[condition].feature)
# This is only the suggested entity id, it might get changed by
# the entity registry later.
self.entity_id = sensor.ENTITY_ID_FORMAT.format("pws_" + condition)
self.entity_id = sensor.ENTITY_ID_FORMAT.format(f"pws_{condition}")
self._unique_id = f"{unique_id_base},{condition}"
self._device_class = self._cfg_expand("device_class")
@@ -1122,11 +1122,11 @@ class WUndergroundData:
self._api_key, "/".join(sorted(self._features)), self._lang
)
if self._pws_id:
url = url + f"pws:{self._pws_id}"
url = f"{url}pws:{self._pws_id}"
else:
url = url + f"{self._latitude},{self._longitude}"
url = f"{url}{self._latitude},{self._longitude}"
return url + ".json"
return f"{url}.json"
@Throttle(MIN_TIME_BETWEEN_UPDATES)
async def async_update(self):