def _parse_diff(self, patch):
        hunk_pattern = re.compile('\@\@ \-\d+,\d+ \+(\d+),\d+ \@\@')

        line_num = 1
        additions = []
        line_map = {}
        lines = patch.split("\n")
        for i, line in enumerate(lines):
            # Set the line_num at the start of the hunk
            match = hunk_pattern.match(line)
            if match:
                line_num = int(match.group(1)) - 1
                continue
            # Increment lines through additions and
            # unchanged lines.
            if not line.startswith('-'):
                line_num += 1
            if line.startswith('+'):
                additions.append(line_num)
                line_map[line_num] = i
        self._additions = set(additions)
        self._indexes = line_map
Load a .py based config file by filename and path.
dataset/ETHPy150Open markstory/lint-review/lintreview/diff.py/Diff._parse_diff--crossover with--dataset/ETHPy150Open ipython/ipython-py3k/IPython/config/application.py/Application.load_config_file