From patchwork Wed Sep 7 21:03:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 667153 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sTwtt4WHPz9s5g for ; Thu, 8 Sep 2016 07:04:06 +1000 (AEST) Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3sTwtt3VckzDsFK for ; Thu, 8 Sep 2016 07:04:06 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Received: from BLU004-OMC3S35.hotmail.com (blu004-omc3s35.hotmail.com [65.55.116.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3sTwtl6hKGzDrvH for ; Thu, 8 Sep 2016 07:03:59 +1000 (AEST) Received: from BLU436-SMTP112 ([65.55.116.72]) by BLU004-OMC3S35.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Wed, 7 Sep 2016 14:03:56 -0700 X-TMN: [IiFg9/0DnlwN8kuZwBtHm7+TRFcBlA4A] X-Originating-Email: [stephenfinucane@hotmail.com] Message-ID: From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 1/3] Mark regexes with 'r' prefixes Date: Wed, 7 Sep 2016 22:03:47 +0100 X-Mailer: git-send-email 2.7.4 X-OriginalArrivalTime: 07 Sep 2016 21:03:53.0670 (UTC) FILETIME=[57297E60:01D2094B] MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Resolves landscape.io errors. Signed-off-by: Stephen Finucane --- patchwork/parser.py | 4 ++-- patchwork/templatetags/syntax.py | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/patchwork/parser.py b/patchwork/parser.py index 1805df8..3389e96 100644 --- a/patchwork/parser.py +++ b/patchwork/parser.py @@ -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: diff --git a/patchwork/templatetags/syntax.py b/patchwork/templatetags/syntax.py index 6cb8ff8..653caf4 100644 --- a/patchwork/templatetags/syntax.py +++ b/patchwork/templatetags/syntax.py @@ -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*>.*$', '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*>.*$', 'quote'), ])) _span = '%s'