#NEWLINE# def _parse_diff( self , patch ) : #NEWLINE# #INDENT# "\n        Parses the diff data and stores the list of\n        line numbers that were added in this diff.\n\n        We don't care about deletions as they won't\n        have lint errors in them.\n        " #NEWLINE# hunk_pattern = re . compile ( '\\@\\@ \\-\\d+,\\d+ \\+(\\d+),\\d+ \\@\\@' ) #NEWLINE# line_num = 1 #NEWLINE# additions = [ ] #NEWLINE# line_map = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# lines = patch . split ( '\n' ) #NEWLINE# for ( i , line ) in enumerate ( lines ) : #NEWLINE# #INDENT# match = hunk_pattern . match ( line ) #NEWLINE# if match : #NEWLINE# #INDENT# line_num = ( int ( match . group ( 1 ) ) - 1 ) #NEWLINE# continue #NEWLINE# #UNINDENT# if ( not line . startswith ( '-' ) ) : #NEWLINE# #INDENT# line_num += 1 #NEWLINE# #UNINDENT# if line . startswith ( '+' ) : #NEWLINE# #INDENT# additions . append ( line_num ) #NEWLINE# line_map [ line_num ] = i #NEWLINE# #UNINDENT# #UNINDENT# self . _additions = set ( additions ) #NEWLINE# self . _indexes = line_map