def is_complete_edit(initial_line, original, wanted, cmds):
 buf = original[:]
 for cmd in cmds:
  (ctype, line, col, char) = cmd
  line -= initial_line
  if (ctype == 'D'):
   if (char != '\n'):
    buf[line] = (buf[line][:col] + buf[line][(col + len(char)):])
   elif ((line + 1) < len(buf)):
    buf[line] = (buf[line] + buf[(line + 1)])
    del buf[(line + 1)]
   else:
    del buf[line]
  elif (ctype == 'I'):
   buf[line] = ((buf[line][:col] + char) + buf[line][col:])
  buf = '\n'.join(buf).split('\n')
 return ((len(buf) == len(wanted)) and all(((j == k) for (j, k) in zip(buf, wanted))))

def is_complete_edit ( initial_line , original , wanted , cmds ) : buf = original [ : ] for cmd in cmds : ( ctype , line , col , char ) = cmd line -= initial_line if ( ctype == 'D' ) : if ( char != '\n' ) : buf [ line ] = ( buf [ line ] [ : col ] + buf [ line ] [ ( col + len ( char ) ) : ] ) elif ( ( line + 1 ) < len ( buf ) ) : buf [ line ] = ( buf [ line ] + buf [ ( line + 1 ) ] ) del buf [ ( line + 1 ) ] else : del buf [ line ] elif ( ctype == 'I' ) : buf [ line ] = ( ( buf [ line ] [ : col ] + char ) + buf [ line ] [ col : ] ) buf = '\n' . join ( buf ) . split ( '\n' ) return ( ( len ( buf ) == len ( wanted ) ) and all ( ( ( j == k ) for ( j , k ) in zip ( buf , wanted ) ) ) )
returns true if original is changed to wanted with the edit commands in cmds .