<s> import simplejson as json <EOL> import time <EOL> import random <EOL> from optparse import OptionParser <EOL> import client <EOL> FAKE_SIGS = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] <EOL> FAKE_DATA = { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:test>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : None } <EOL> class TestClient ( client . Client ) : <EOL> """<STR_LIT>""" <EOL> def run ( self , num_events ) : <EOL> for i in xrange ( <NUM_LIT:0> , num_events ) : <EOL> do_multiply = <NUM_LIT:1> <EOL> sig_multiple = random . randint ( <NUM_LIT:2> , <NUM_LIT> ) <EOL> fake_sig = random . choice ( FAKE_SIGS ) + str ( random . randint ( <NUM_LIT:100> , <NUM_LIT> ) ) <EOL> if do_multiply == <NUM_LIT:0> : <EOL> FAKE_DATA [ '<STR_LIT>' ] = fake_sig * sig_multiple <EOL> else : <EOL> FAKE_DATA [ '<STR_LIT>' ] = fake_sig <EOL> encoded = json . dumps ( FAKE_DATA ) <EOL> self . emit ( encoded ) <EOL> if not i % <NUM_LIT:100> : <EOL> time . sleep ( random . random ( ) ) <EOL> def main ( ) : <EOL> parser = OptionParser ( usage = '<STR_LIT>' ) <EOL> parser . add_option ( <EOL> '<STR_LIT:-c>' , '<STR_LIT>' , action = '<STR_LIT:store>' , dest = '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> parser . add_option ( <EOL> '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT:store>' , dest = '<STR_LIT>' , type = '<STR_LIT:int>' , <EOL> default = <NUM_LIT> , help = '<STR_LIT>' ) <EOL> ( options , args ) = parser . parse_args ( ) <EOL> main = TestClient ( options . conf_path ) <EOL> main . run ( options . num_events ) </s>
