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 -6
View File
@@ -46,15 +46,11 @@ class FileNotificationService(BaseNotificationService):
"""Send a message to a file."""
with open(self.filepath, "a") as file:
if os.stat(self.filepath).st_size == 0:
title = "{} notifications (Log started: {})\n{}\n".format(
kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT),
dt_util.utcnow().isoformat(),
"-" * 80,
)
title = f"{kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT)} notifications (Log started: {dt_util.utcnow().isoformat()})\n{'-' * 80}\n"
file.write(title)
if self.add_timestamp:
text = "{} {}\n".format(dt_util.utcnow().isoformat(), message)
text = f"{dt_util.utcnow().isoformat()} {message}\n"
else:
text = f"{message}\n"
file.write(text)