From 190ad30a7b5e49356156cb28f3bc631820833c9b Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Sat, 6 Oct 2018 18:04:25 +0200 Subject: [PATCH] Fix invalid escape sequence '\(' or '\)' (found by flake8) flake8 found issues: ubuntutools/sponsor_patch/bugtask.py:46:11: W605 invalid escape sequence '\(' ubuntutools/sponsor_patch/bugtask.py:62:50: W605 invalid escape sequence '\(' ubuntutools/sponsor_patch/bugtask.py:62:58: W605 invalid escape sequence '\)' setup.py:14:8: W605 invalid escape sequence '\(' setup.py:14:14: W605 invalid escape sequence '\)' Fix these issues by marking these strings as raw strings. --- setup.py | 2 +- ubuntutools/sponsor_patch/bugtask.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 221e3a2..851d331 100755 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ import codecs changelog = "debian/changelog" if os.path.exists(changelog): head = codecs.open(changelog, 'r', 'utf-8', 'replace').readline() - match = re.compile(".*\((.*)\).*").match(head) + match = re.compile(r".*\((.*)\).*").match(head) if match: version = match.group(1) diff --git a/ubuntutools/sponsor_patch/bugtask.py b/ubuntutools/sponsor_patch/bugtask.py index 167cef7..ebb40f6 100644 --- a/ubuntutools/sponsor_patch/bugtask.py +++ b/ubuntutools/sponsor_patch/bugtask.py @@ -43,7 +43,7 @@ class BugTask(object): self.bug_task = bug_task self.launchpad = launchpad - components = re.split(" \(| ", self.bug_task.bug_target_name.strip(")")) + components = re.split(r" \(| ", self.bug_task.bug_target_name.strip(")")) assert len(components) >= 1 and len(components) <= 3 if len(components) == 1: self.package = None @@ -59,7 +59,7 @@ class BugTask(object): self.series = components[2].lower() if self.package is None: - title_re = '^Sync ([a-z0-9+.-]+) [a-z0-9.+:~-]+ \([a-z]+\) from.*' + title_re = r'^Sync ([a-z0-9+.-]+) [a-z0-9.+:~-]+ \([a-z]+\) from.*' match = re.match(title_re, self.get_bug_title(), re.U | re.I) if match is not None: self.package = match.group(1)