From 2a0312318dd9aa3574c3a911519d848b0aeb5f1f Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 23 Aug 2024 16:16:08 +0200 Subject: [PATCH] Use single quotes in f-strings (#5267) Instead of using double quotes in f-strings use single quotes. This works with Python 3.11 too. We don't use Python 3.11 anymore, but is useful when running pytest on Debian bookworm natively, which comes with Python 3.11. --- supervisor/homeassistant/module.py | 2 +- supervisor/utils/systemd_journal.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/supervisor/homeassistant/module.py b/supervisor/homeassistant/module.py index 3eaab3ae3..cfc7acd1e 100644 --- a/supervisor/homeassistant/module.py +++ b/supervisor/homeassistant/module.py @@ -358,7 +358,7 @@ class HomeAssistant(FileConfiguration, CoreSysAttributes): if resp and not resp.get(ATTR_SUCCESS): raise HomeAssistantBackupError( - f"Preparing backup of Home Assistant Core failed due to: {resp.get(ATTR_ERROR, {}).get(ATTR_MESSAGE, "")}. Check HA Core logs.", + f"Preparing backup of Home Assistant Core failed due to: {resp.get(ATTR_ERROR, {}).get(ATTR_MESSAGE, '')}. Check HA Core logs.", _LOGGER.error, ) diff --git a/supervisor/utils/systemd_journal.py b/supervisor/utils/systemd_journal.py index 3155dc675..5a5184f5c 100644 --- a/supervisor/utils/systemd_journal.py +++ b/supervisor/utils/systemd_journal.py @@ -51,12 +51,12 @@ def journal_verbose_formatter(entries: dict[str, str]) -> str: ts = ts[: ts.index(".") + 4] # strip TZ offset identifier = ( - f"{entries.get("SYSLOG_IDENTIFIER", "_UNKNOWN_")}[{entries["_PID"]}]" + f"{entries.get('SYSLOG_IDENTIFIER', '_UNKNOWN_')}[{entries['_PID']}]" if "_PID" in entries else entries.get("SYSLOG_IDENTIFIER", "_UNKNOWN_") ) - return f"{ts} {entries.get("_HOSTNAME", "")} {identifier}: {entries.get("MESSAGE", "")}" + return f"{ts} {entries.get('_HOSTNAME', '')} {identifier}: {entries.get('MESSAGE', '')}" async def journal_logs_reader(