#NEWLINE# def get_opcodes( self ) : #NEWLINE# #INDENT# sequence_matcher = SequenceMatcher ( None , self . a , self . b ) #NEWLINE# for ( tag , i1 , i2 , j1 , j2 ) in sequence_matcher . get_opcodes ( ) : #NEWLINE# #INDENT# if ( tag == 'replace' ) : #NEWLINE# #INDENT# oldlines = self . a [ i1 : i2 ] #NEWLINE# newlines = self . b [ i1 : j2 ] #NEWLINE# i = i_start = 0 #NEWLINE# j = j_start = 0 #NEWLINE# while ( ( i < len ( oldlines ) ) and ( j < len ( newlines ) ) ) : #NEWLINE# #INDENT# new_tag = None #NEWLINE# ( new_i , new_j ) = ( i , j ) #NEWLINE# if ( ( oldlines [ i ] == '' ) and ( newlines [ j ] == '' ) ) : #NEWLINE# #INDENT# new_tag = 'equal' #NEWLINE# new_i += 1 #NEWLINE# new_j += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( oldlines [ i ] == '' ) : #NEWLINE# #INDENT# new_tag = 'insert' #NEWLINE# new_j += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( newlines [ j ] == '' ) : #NEWLINE# #INDENT# new_tag = 'delete' #NEWLINE# new_i += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# new_tag = 'replace' #NEWLINE# new_i += 1 #NEWLINE# new_j += 1 #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( new_tag != tag ) : #NEWLINE# #INDENT# if ( ( i > i_start ) or ( j > j_start ) ) : #NEWLINE# #INDENT# ( yield ( tag , ( i1 + i_start ) , ( i1 + i ) , ( j1 + j_start ) , ( j1 + j ) ) ) #NEWLINE# #UNINDENT# tag = new_tag #NEWLINE# ( i_start , j_start ) = ( i , j ) #NEWLINE# #UNINDENT# ( i , j ) = ( new_i , new_j ) #NEWLINE# #UNINDENT# ( yield ( tag , ( i1 + i_start ) , ( i1 + i ) , ( j1 + j_start ) , ( j1 + j ) ) ) #NEWLINE# i_start = i #NEWLINE# j_start = j #NEWLINE# if ( ( i2 > ( i1 + i_start ) ) or ( j2 > ( j1 + j_start ) ) ) : #NEWLINE# #INDENT# tag = None #NEWLINE# if ( len ( oldlines ) > len ( newlines ) ) : #NEWLINE# #INDENT# tag = 'delete' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( oldlines ) < len ( newlines ) ) : #NEWLINE# #INDENT# tag = 'insert' #NEWLINE# #UNINDENT# #UNINDENT# if ( tag is not None ) : #NEWLINE# #INDENT# ( yield ( tag , ( i1 + i_start ) , i2 , ( j1 + j_start ) , j2 ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# ( yield ( tag , i1 , i2 , j1 , j2 ) )