<s> __all__ = ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> import random <EOL> def random_color ( ) : <EOL> import colorsys <EOL> h = random . random ( ) <EOL> s = <NUM_LIT:0.5> + random . random ( ) * <NUM_LIT:0.5> <EOL> v = <NUM_LIT> + random . random ( ) * <NUM_LIT> <EOL> ( r , g , b ) = colorsys . hsv_to_rgb ( h , s , v ) <EOL> r = int ( r * <NUM_LIT:255> ) <EOL> g = int ( g * <NUM_LIT:255> ) <EOL> b = int ( b * <NUM_LIT:255> ) <EOL> return '<STR_LIT>' % ( r , g , b ) <EOL> class ColorGenerator ( object ) : <EOL> def __init__ ( self ) : <EOL> self . existing_colors = set ( ) <EOL> def __iter__ ( self ) : <EOL> return self <EOL> def next ( self ) : <EOL> if len ( self . existing_colors ) >= <NUM_LIT> : <EOL> raise StopIteration <EOL> color = random_color ( ) <EOL> while color in self . existing_colors : <EOL> color = random_color ( ) <EOL> self . existing_colors . add ( color ) <EOL> return color </s>
