def parse_rx_excludes(options, fatal):
 excluded_patterns = []
 for flag in options:
  (option, parameter) = flag
  if (option == '--exclude-rx'):
   try:
    excluded_patterns.append(re.compile(parameter))
   except re.error as ex:
    fatal(('invalid --exclude-rx pattern (%s): %s' % (parameter, ex)))
  elif (option == '--exclude-rx-from'):
   try:
    f = open(resolve_parent(parameter))
   except IOError as e:
    raise fatal(("couldn't read %s" % parameter))
   for pattern in f.readlines():
    spattern = pattern.rstrip('\n')
    if (not spattern):
     continue
    try:
     excluded_patterns.append(re.compile(spattern))
    except re.error as ex:
     fatal(('invalid --exclude-rx pattern (%s): %s' % (spattern, ex)))
 return excluded_patterns

def parse_rx_excludes ( options , fatal ) : excluded_patterns = [ ] for flag in options : ( option , parameter ) = flag if ( option == '--exclude-rx' ) : try : excluded_patterns . append ( re . compile ( parameter ) ) except re . error as ex : fatal ( ( 'invalid --exclude-rx pattern (%s): %s' % ( parameter , ex ) ) ) elif ( option == '--exclude-rx-from' ) : try : f = open ( resolve_parent ( parameter ) ) except IOError as e : raise fatal ( ( "couldn't read %s" % parameter ) ) for pattern in f . readlines ( ) : spattern = pattern . rstrip ( '\n' ) if ( not spattern ) : continue try : excluded_patterns . append ( re . compile ( spattern ) ) except re . error as ex : fatal ( ( 'invalid --exclude-rx pattern (%s): %s' % ( spattern , ex ) ) ) return excluded_patterns
traverse the options and extract all rx excludes .