#NEWLINE# def main( argv = None ) : #NEWLINE# #INDENT# 'script main.\n\n    parses command line options in sys.argv, unless *argv* is given.\n    ' #NEWLINE# if ( argv is None ) : #NEWLINE# #INDENT# argv = sys . argv #NEWLINE# #UNINDENT# parser = E . OptionParser ( version = '%prog version: $Id: numbers2rgb.py 2782 2009-09-10 11:40:29Z andreas $' ) #NEWLINE# parser . add_option ( '-m' , '--method' , dest = 'method' , type = 'string' , help = 'method to use.' ) #NEWLINE# parser . set_defaults ( method = 'random_rgb' ) #NEWLINE# ( options , args ) = E . Start ( parser , add_pipe_options = True ) #NEWLINE# numbers = map ( ( lambda x : int ( x [ : ( - 1 ) ] . split ( '\t' ) [ 0 ] ) ) , filter ( ( lambda x : ( x [ 0 ] != '#' ) ) , sys . stdin . readlines ( ) ) ) #NEWLINE# if ( options . method == 'random_rgb' ) : #NEWLINE# #INDENT# f = ( lambda x : ( '%i,%i,%i' % ( random . randint ( 0 , 256 ) , random . randint ( 0 , 256 ) , random . randint ( 0 , 256 ) ) ) ) #NEWLINE# #UNINDENT# map_number2output = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for x in numbers : #NEWLINE# #INDENT# if ( x not in map_number2output ) : #NEWLINE# #INDENT# map_number2output [ x ] = f ( x ) #NEWLINE# #UNINDENT# #UNINDENT# for ( x , y ) in map_number2output . items ( ) : #NEWLINE# #INDENT# options . stdout . write ( ( '%i\t%s\n' % ( x , y ) ) ) #NEWLINE# #UNINDENT# E . Stop ( )