From f33033c03cf96ed769289ebf6d3c26b0cf540683 Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Tue, 3 Nov 2020 17:25:49 -0500 Subject: Use raw strings to avoid unnecessary backslashes Use r'' strings uniformly to avoid needing to escape backslashes. Signed-off-by: Konstantin Ryabitsev --- b4/__init__.py | 8 ++++---- 1 file 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: -- cgit v1.2.3