From 21efe90062d7acaa2abca0a6b6d74ed1582f667a Mon Sep 17 00:00:00 2001 From: Jip-Hop <2871973+Jip-Hop@users.noreply.github.com> Date: Sat, 29 Jun 2024 16:43:17 +0200 Subject: [PATCH] Fix Python 3.12 SyntaxWarning SyntaxWarning: invalid escape sequence --- jlmkr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jlmkr.py b/jlmkr.py index 748111a..55b8bf2 100755 --- a/jlmkr.py +++ b/jlmkr.py @@ -174,7 +174,7 @@ class KeyValueParser(configparser.ConfigParser): # Template to store comments as key value pair self._comment_template = "#{0} " + delimiter + " {1}" # Regex to match the comment prefix - self._comment_regex = re.compile(f"^#\d+\s*{re.escape(delimiter)}[^\S\n]*") + self._comment_regex = re.compile(r"^#\d+\s*" + re.escape(delimiter) + r"[^\S\n]*") # Regex to match cosmetic newlines (skips newlines in multiline values): # consecutive whitespace from start of line followed by a line not starting with whitespace self._cosmetic_newlines_regex = re.compile(r"^(\s+)(?=^\S)", re.MULTILINE) @@ -538,7 +538,7 @@ def systemd_escape_path(path): """ return "".join( map( - lambda char: "\s" if char == " " else "\\\\" if char == "\\" else char, path + lambda char: r"\s" if char == " " else "\\\\" if char == "\\" else char, path ) )