diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-11-03 17:25:49 -0500 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-11-03 17:25:49 -0500 |
commit | f33033c03cf96ed769289ebf6d3c26b0cf540683 (patch) | |
tree | e8aa6c58e44ca971701cff078b9fd44b8e798ac8 | |
parent | 4af401f8dcb78ff9c77b41bc7910ee0b66e0a12f (diff) | |
download | b4-f33033c03cf96ed769289ebf6d3c26b0cf540683.tar.gz |
Use raw strings to avoid unnecessary backslashes
Use r'' strings uniformly to avoid needing to escape backslashes.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r-- | b4/__init__.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/b4/__init__.py b/b4/__init__.py index 161a9f5..988df71 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -1382,15 +1382,15 @@ class LoreSubject: # Remove any leading [] that don't have "patch", "resend" or "rfc" in them while True: oldsubj = subject - subject = re.sub(r'^\s*\[[^]]*]\s*(\[[^]]*(:?patch|resend|rfc).*)', '\\1', subject, flags=re.IGNORECASE) + subject = re.sub(r'^\s*\[[^]]*]\s*(\[[^]]*(:?patch|resend|rfc).*)', r'\1', subject, flags=re.IGNORECASE) if oldsubj == subject: break # Remove any brackets inside brackets while True: oldsubj = subject - subject = re.sub(r'^\s*\[([^]]*)\[([^\[\]]*)]', '[\\1\\2]', subject) - subject = re.sub(r'^\s*\[([^]]*)]([^\[\]]*)]', '[\\1\\2]', subject) + subject = re.sub(r'^\s*\[([^]]*)\[([^\[\]]*)]', r'[\1\2]', subject) + subject = re.sub(r'^\s*\[([^]]*)]([^\[\]]*)]', r'[\1\2]', subject) if oldsubj == subject: break @@ -1401,7 +1401,7 @@ class LoreSubject: subject = re.sub(r'^\w+:\s*\[', '[', subject) # Fix [PATCHv3] to be properly [PATCH v3] - subject = re.sub(r'^\[\s*(patch)(v\d+)(.*)', '[\\1 \\2\\3', subject, flags=re.I) + subject = re.sub(r'^\[\s*(patch)(v\d+)(.*)', r'[\1 \2\3', subject, flags=re.I) # Find all [foo] in the title while subject.find('[') == 0: |