diff options
author | Brian Norris <computersforpeace@gmail.com> | 2024-07-26 12:02:33 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2024-09-01 11:05:43 -0600 |
commit | 7b8f0bfa6e1a0390bea8e2b24d7d7fa33d654db3 (patch) | |
tree | 4f139a9b07642826d00c73d0c78e6ee807d2809a /tools/patman/commit.py | |
parent | 57949a99b7bd0aa21abbde1ffa7e50e5d9e10a4e (diff) |
patman: Resolve python string vs. regex escaping syntax
Python strings have their own notion of backslash-escaping, and that can
conflict with the intentions for strings passed to the 're' module. In
particular, I get warnings like this:
tools/patman/../patman/commit.py:9: SyntaxWarning: invalid escape sequence '\s'
re_subject_tag = re.compile('([^:\s]*):\s*(.*)')
We should use a raw string (r'...') so that all escaping is passed into
the regex module, not interpreted within the string itself.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/patman/commit.py')
-rw-r--r-- | tools/patman/commit.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/patman/commit.py b/tools/patman/commit.py index 684225c0e60..ce37a3d95eb 100644 --- a/tools/patman/commit.py +++ b/tools/patman/commit.py @@ -6,7 +6,7 @@ import collections import re # Separates a tag: at the beginning of the subject from the rest of it -re_subject_tag = re.compile('([^:\s]*):\s*(.*)') +re_subject_tag = re.compile(r'([^:\s]*):\s*(.*)') class Commit: """Holds information about a single commit/patch in the series. |