[diffoscope] 01/01: diff: wrap long regular expression for improved readability

Mattia Rizzolo mattia at debian.org
Thu Feb 1 00:31:52 CET 2018


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch master
in repository diffoscope.

commit e1869c39dc61625150ac880cf523da8be843099c
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Thu Feb 1 00:31:12 2018 +0100

    diff: wrap long regular expression for improved readability
    
    Signed-off-by: Mattia Rizzolo <mattia at debian.org>
---
 diffoscope/diff.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/diffoscope/diff.py b/diffoscope/diff.py
index f6d1552..bb6df57 100644
--- a/diffoscope/diff.py
+++ b/diffoscope/diff.py
@@ -42,7 +42,19 @@ re_diff_change = re.compile(r'^([+-@]).*', re.MULTILINE)
 
 class DiffParser(object):
     RANGE_RE = re.compile(
-        r'^@@\s+-(?P<start1>\d+)(,(?P<len1>\d+))?\s+\+(?P<start2>\d+)(,(?P<len2>\d+))?\s+@@$',
+        # example: '@@ -26814,9 +26814,8 @@'
+        r'''
+          ^
+            @@\s+
+              -
+              (?P<start1>\d+)(,(?P<len1>\d+))?
+            \s+
+              \+
+              (?P<start2>\d+)(,(?P<len2>\d+))?
+            \s+@@
+          $
+        ''',
+        re.VERBOSE,
     )
 
     def __init__(self, output, end_nl_q1, end_nl_q2):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list