]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
Mark regexes with 'r' prefixes
authorStephen Finucane <stephenfinucane@hotmail.com>
Wed, 7 Sep 2016 21:03:47 +0000 (22:03 +0100)
committerStephen Finucane <stephenfinucane@hotmail.com>
Mon, 19 Sep 2016 23:17:03 +0000 (00:17 +0100)
Resolves landscape.io errors.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
patchwork/parser.py
patchwork/templatetags/syntax.py

index 1805df8cda7f5927dfd4e286dd9aead87e90f94d..3389e96c4f3e8ea72545d70196f9bf8181f5db04 100644 (file)
@@ -463,7 +463,7 @@ def parse_patch(content):
                 patchbuf += buf + line
                 buf = ''
                 state = 2
-            elif hunk and line.startswith('\ No newline at end of file'):
+            elif hunk and line.startswith(r'\ No newline at end of file'):
                 # If we had a hunk and now we see this, it's part of the patch,
                 # and we're still expecting another @@ line.
                 patchbuf += line
@@ -479,7 +479,7 @@ def parse_patch(content):
                 lc[0] -= 1
             elif line.startswith('+'):
                 lc[1] -= 1
-            elif line.startswith('\ No newline at end of file'):
+            elif line.startswith(r'\ No newline at end of file'):
                 # Special case: Not included as part of the hunk's line count
                 pass
             else:
index 6cb8ff89cdd73dac2f6f76c4170f3f83e456541a..653caf47a4b4435f8a016923848ef6fe4943a677 100644 (file)
@@ -35,23 +35,23 @@ def _compile(t):
     return (re.compile(r, re.M | re.I), str)
 
 _patch_span_res = list(map(_compile, [
-    ('^(Index:?|diff|\-\-\-|\+\+\+|\*\*\*) .*$', 'p_header'),
-    ('^\+.*$', 'p_add'),
-    ('^-.*$', 'p_del'),
-    ('^!.*$', 'p_mod'),
+    (r'^(Index:?|diff|\-\-\-|\+\+\+|\*\*\*) .*$', 'p_header'),
+    (r'^\+.*$', 'p_add'),
+    (r'^-.*$', 'p_del'),
+    (r'^!.*$', 'p_mod'),
 ]))
 
 _patch_chunk_re = \
-    re.compile('^(@@ \-\d+(?:,\d+)? \+\d+(?:,\d+)? @@)(.*)$', re.M | re.I)
+    re.compile(r'^(@@ \-\d+(?:,\d+)? \+\d+(?:,\d+)? @@)(.*)$', re.M | re.I)
 
 _comment_span_res = list(map(_compile, [
-    ('^\s*Signed-off-by: .*$', 'signed-off-by'),
-    ('^\s*Acked-by: .*$', 'acked-by'),
-    ('^\s*Nacked-by: .*$', 'nacked-by'),
-    ('^\s*Tested-by: .*$', 'tested-by'),
-    ('^\s*Reviewed-by: .*$', 'reviewed-by'),
-    ('^\s*From: .*$', 'from'),
-    ('^\s*&gt;.*$', 'quote'),
+    (r'^\s*Signed-off-by: .*$', 'signed-off-by'),
+    (r'^\s*Acked-by: .*$', 'acked-by'),
+    (r'^\s*Nacked-by: .*$', 'nacked-by'),
+    (r'^\s*Tested-by: .*$', 'tested-by'),
+    (r'^\s*Reviewed-by: .*$', 'reviewed-by'),
+    (r'^\s*From: .*$', 'from'),
+    (r'^\s*&gt;.*$', 'quote'),
 ]))
 
 _span = '<span class="%s">%s</span>'