def _InitColorize(output_file):
 color = False
 if ((options.options.colorize is not None) and curses and ((options.options.color == 'yes') or ((options.options.color == 'auto') and output_file.isatty()))):
  try:
   curses.setupterm()
   if (curses.tigetnum('colors') > 0):
    color = True
  except Exception:
   pass
 if (not color):
  return []
 directives = []
 normal = unicode(curses.tigetstr('sgr0'), 'ascii')
 fg_color = unicode((curses.tigetstr('setaf') or curses.tigetstr('setf') or ''), 'ascii')
 for directive in options.options.colorize:
  (regexp, color_index) = directive.split('=')
  color = unicode(curses.tparm(fg_color, int(color_index)), 'ascii')
  directives.append(ColorDirective(re.compile(regexp), color, normal))
 return directives

def _InitColorize ( output_file ) : color = False if ( ( options . options . colorize is not None ) and curses and ( ( options . options . color == 'yes' ) or ( ( options . options . color == 'auto' ) and output_file . isatty ( ) ) ) ) : try : curses . setupterm ( ) if ( curses . tigetnum ( 'colors' ) > 0 ) : color = True except Exception : pass if ( not color ) : return [ ] directives = [ ] normal = unicode ( curses . tigetstr ( 'sgr0' ) , 'ascii' ) fg_color = unicode ( ( curses . tigetstr ( 'setaf' ) or curses . tigetstr ( 'setf' ) or '' ) , 'ascii' ) for directive in options . options . colorize : ( regexp , color_index ) = directive . split ( '=' ) color = unicode ( curses . tparm ( fg_color , int ( color_index ) ) , 'ascii' ) directives . append ( ColorDirective ( re . compile ( regexp ) , color , normal ) ) return directives
initializes the colorization directives via --colorize as a mapping between compiled regular expressions meant to be matched against log filename and target curses color escape codes .