third_party/blink/tools/blinkpy/common/pretty_diff.py
def parse(lines):
        """Parses diff lines, and creates a sequence of DiffHunk instances.

        Finds a hunk header, creates a sequence of DiffHunk instances, and
        returns a tuple of the DiffHunk list and unconsumed lines. If a hunk
        header isn't found, ValueError is raised.
        """
        old_start = None
        new_start = None
        context = None
        hunk_lines = None
        hunks = []
        hunk_header_re = r'^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)?'
        found_hunk_header = False
        for i, line in enumerate(lines):
            if not found_hunk_header:
                match = re.match(hunk_header_re, line)
                if match:
                    found_hunk_header = True
                    old_start = int(match.group(1))
                    new_start = int(match.group(2))
                    context = match.group(3)
                    hunk_lines = []
                continue
            if line.startswith((' ', '-', '+')):
                hunk_lines.append(line)
                continue
            hunks.append(DiffHunk(old_start, new_start, context, hunk_lines))
            match = re.match(hunk_header_re, line)
            if not match:
                return (hunks, lines[i:])
            old_start = int(match.group(1))
            new_start = int(match.group(2))
            context = match.group(3)
            hunk_lines = []
        if found_hunk_header:
            hunks.append(DiffHunk(old_start, new_start, context, hunk_lines))
        else:
            raise ValueError('Found no hunks')
        return (hunks, [])
Parses diff lines, and creates a sequence of DiffHunk instances.

        Finds a hunk header, creates a sequence of DiffHunk instances, and
        returns a tuple of the DiffHunk list and unconsumed lines. If a hunk
        header isn't found, ValueError is raised.
        
Parses diff lines, and creates a sequence of DiffHunk instances.
Finds a hunk header, creates a sequence of DiffHunk instances, and
returns a tuple of the DiffHunk list and unconsumed lines. If a hunk
header isn't found, ValueError is raised.
Parses diff lines and creates a sequence of DiffHunk instances . Finds a hunk header creates a sequence of DiffHunk instances and returns a tuple of the DiffHunk list and unconsumed lines . If a hunk header isn ' t found ValueError is raised .
def parse(lines):
        old_start = None
        new_start = None
        context = None
        hunk_lines = None
        hunks = []
        hunk_header_re = r'^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)?'
        found_hunk_header = False
        for i, line in enumerate(lines):
            if not found_hunk_header:
                match = re.match(hunk_header_re, line)
                if match:
                    found_hunk_header = True
                    old_start = int(match.group(1))
                    new_start = int(match.group(2))
                    context = match.group(3)
                    hunk_lines = []
                continue
            if line.startswith((' ', '-', '+')):
                hunk_lines.append(line)
                continue
            hunks.append(DiffHunk(old_start, new_start, context, hunk_lines))
            match = re.match(hunk_header_re, line)
            if not match:
                return (hunks, lines[i:])
            old_start = int(match.group(1))
            new_start = int(match.group(2))
            context = match.group(3)
            hunk_lines = []
        if found_hunk_header:
            hunks.append(DiffHunk(old_start, new_start, context, hunk_lines))
        else:
            raise ValueError('Found no hunks')
        return (hunks, [])
def parse ( lines ) : old_start = None new_start = None context = None hunk_lines = None hunks = [ ] hunk_header_re = r'^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)?' found_hunk_header = False for i , line in enumerate ( lines ) : if not found_hunk_header : match = re . match ( hunk_header_re , line ) if match : found_hunk_header = True old_start = int ( match . group ( 1 ) ) new_start = int ( match . group ( 2 ) ) context = match . group ( 3 ) hunk_lines = [ ] continue if line . startswith ( ( ' ' , '-' , '+' ) ) : hunk_lines . append ( line ) continue hunks . append ( DiffHunk ( old_start , new_start , context , hunk_lines ) ) match = re . match ( hunk_header_re , line ) if not match : return ( hunks , lines [ i : ] ) old_start = int ( match . group ( 1 ) ) new_start = int ( match . group ( 2 ) ) context = match . group ( 3 ) hunk_lines = [ ] if found_hunk_header : hunks . append ( DiffHunk ( old_start , new_start , context , hunk_lines ) ) else : raise ValueError ( 'Found no hunks' ) return ( hunks , [ ] )
Parses diff lines, and creates a sequence of DiffHunk instances.
Parses diff lines and creates a sequence of DiffHunk instances .
"""Parses diff lines, and creates a sequence of DiffHunk instances.

        Finds a hunk header, creates a sequence of DiffHunk instances, and
        returns a tuple of the DiffHunk list and unconsumed lines. If a hunk
        header isn't found, ValueError is raised.
        """
lines