Skip to content

Commit

Permalink
Fix Python 3.12 SyntaxWarning
Browse files Browse the repository at this point in the history
SyntaxWarning: invalid escape sequence
  • Loading branch information
Jip-Hop committed Jun 29, 2024
1 parent 01e1156 commit 21efe90
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jlmkr.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def __init__(self, *args, **kwargs):
# 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)
Expand Down Expand Up @@ -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
)
)

Expand Down

0 comments on commit 21efe90

Please sign in to comment.