Improve string formatting v6 (#33698)

This commit is contained in:
springstan authored and GitHub committed 2020-04-07 23:14:28 +02:00
1 parent d7e3b0b755
commit eae21be5b9
43 files changed
+81 -87

No files matched your search

+2 -4
View File
@@ -254,9 +254,7 @@ class NotionEntity(Entity):
@property
def name(self):
"""Return the name of the sensor."""
return "{}: {}".format(
self._notion.sensors[self._sensor_id]["name"], self._name
)
return f"{self._notion.sensors[self._sensor_id]['name']}: {self._name}"
@property
def should_poll(self):
@@ -267,7 +265,7 @@ class NotionEntity(Entity):
def unique_id(self):
"""Return a unique, unchanging string that represents this sensor."""
task = self._notion.tasks[self._task_id]
return "{}_{}".format(self._sensor_id, task["task_type"])
return f"{self._sensor_id}_{task['task_type']}"
async def _update_bridge_id(self):
"""Update the entity's bridge ID if it has changed.