From aa75400ff7cf34553eaf22289ce00060a64e86b5 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Sat, 30 Nov 2019 15:40:15 +0000 Subject: [PATCH] parser: Fix style issues NOTE(stephenfin): Modified to fix another latent style issue that's popping up here. Signed-off-by: Stephen Finucane Fixes: 8c229caa ("Improve pull request URL matching regex") (cherry picked from commit 3ed6a1434dd90f073f5db5a6e85a80469aaaed40) --- patchwork/parser.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/patchwork/parser.py b/patchwork/parser.py index e71d2de7..889a3721 100644 --- a/patchwork/parser.py +++ b/patchwork/parser.py @@ -167,7 +167,7 @@ def clean_header(header): # on Py2, we want to do unicode(), on Py3, str(). # That gets us the decoded, un-wrapped header. if six.PY2: - header_str = unicode(sane_header) + header_str = unicode(sane_header) # noqa else: header_str = str(sane_header) @@ -890,13 +890,14 @@ def parse_patch(content): def parse_pull_request(content): - git_re = re.compile(r'^The following changes since commit.*' + - r'^are available in the git repository at:\n' - r'^\s*([\w+-]+(?:://|@)[\w/.@:~-]+[\s\\]*[\w/._-]*)\s*$', - re.DOTALL | re.MULTILINE | re.IGNORECASE) + git_re = re.compile( + r'^The following changes since commit.*' + r'^are available in the git repository at:\n' + r'^\s*([\w+-]+(?:://|@)[\w/.@:~-]+[\s\\]*[\w/._-]*)\s*$', + re.DOTALL | re.MULTILINE | re.IGNORECASE) match = git_re.search(content) if match: - return re.sub('\s+', ' ', match.group(1)).strip() + return re.sub(r'\s+', ' ', match.group(1)).strip() return None -- 2.47.3