def _RemoveRedundantHandlers(handler_list):
 no_duplicates = []
 patterns_found_so_far = set()
 for i in xrange(len(handler_list)):
  current_handler = handler_list[i]
  matched_by_later = False
  for j in xrange((i + 1), len(handler_list)):
   if current_handler.IsFullyHandledBy(handler_list[j]):
    matched_by_later = True
    break
  if ((not matched_by_later) and (current_handler.pattern not in patterns_found_so_far)):
   no_duplicates.append(current_handler)
   patterns_found_so_far.add(current_handler.pattern)
 return no_duplicates

def _RemoveRedundantHandlers ( handler_list ) : no_duplicates = [ ] patterns_found_so_far = set ( ) for i in xrange ( len ( handler_list ) ) : current_handler = handler_list [ i ] matched_by_later = False for j in xrange ( ( i + 1 ) , len ( handler_list ) ) : if current_handler . IsFullyHandledBy ( handler_list [ j ] ) : matched_by_later = True break if ( ( not matched_by_later ) and ( current_handler . pattern not in patterns_found_so_far ) ) : no_duplicates . append ( current_handler ) patterns_found_so_far . add ( current_handler . pattern ) return no_duplicates
removes duplicated or unnecessary handlers from the list .