From 443be7d15b5ce24a8f03e943b52e8aa162301b6b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 14 Oct 2018 14:11:49 +0100 Subject: [PATCH] Escape: Add missing r in regexp literals ('...' => r'...') [7] Detected by flake8, eg ./gbp/deb/git.py:35:6: W605 invalid escape sequence '\)' Signed-off-by: Ian Jackson --- gbp/rpm/__init__.py | 6 +++--- gbp/scripts/common/pq.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gbp/rpm/__init__.py b/gbp/rpm/__init__.py index b37dfda..0048af4 100644 --- a/gbp/rpm/__init__.py +++ b/gbp/rpm/__init__.py @@ -115,11 +115,11 @@ class SrcRpmFile(object): class SpecFile(object): """Class for parsing/modifying spec files""" tag_re = re.compile(r'^(?P[a-z]+)(?P[0-9]+)?\s*:\s*' - '(?P\S(.*\S)?)\s*$', flags=re.I) + r'(?P\S(.*\S)?)\s*$', flags=re.I) directive_re = re.compile(r'^%(?P[a-z]+)(?P[0-9]+)?' - '(\s+(?P.*))?$', flags=re.I) + r'(\s+(?P.*))?$', flags=re.I) gbptag_re = re.compile(r'^\s*#\s*gbp-(?P[a-z-]+)' - '(\s*:\s*(?P\S.*))?$', flags=re.I) + r'(\s*:\s*(?P\S.*))?$', flags=re.I) # Here "sections" stand for all scripts, scriptlets and other directives, # but not macros section_identifiers = ('package', 'description', 'prep', 'build', 'install', diff --git a/gbp/scripts/common/pq.py b/gbp/scripts/common/pq.py index b6033a2..73d419c 100644 --- a/gbp/scripts/common/pq.py +++ b/gbp/scripts/common/pq.py @@ -152,7 +152,7 @@ def write_patch_file(filename, commit_info, diff): name = commit_info['author']['name'] email = commit_info['author']['email'] # Git compat: put name in quotes if special characters found - if re.search("[,.@()\[\]\\\:;]", name): + if re.search(r"[,.@()\[\]\\\:;]", name): name = '"%s"' % name from_header = Header(header_name='from') try: @@ -216,7 +216,7 @@ def format_patch(outdir, repo, commit_info, series, abbrev, numbered=True, if renumber: # Remove any existing numeric prefix if the patch # should be renumbered - name = re.sub('^\d+[-_]*', '', name) + name = re.sub(r'^\d+[-_]*', '', name) else: # Otherwise, clear proposed prefix num_prefix = '' -- 2.30.2