<s> """<STR_LIT>""" <EOL> import sys , random , logging <EOL> import asyncoro <EOL> def client_proc ( server , coro = None ) : <EOL> for i in range ( <NUM_LIT:12> ) : <EOL> asyncoro . logger . debug ( '<STR_LIT>' % i ) <EOL> server . send ( i ) <EOL> yield coro . sleep ( random . uniform ( <NUM_LIT:0> , <NUM_LIT:2> ) ) <EOL> server . send ( '<STR_LIT>' ) <EOL> def server_proc ( coro = None ) : <EOL> def even ( msg ) : <EOL> if msg % <NUM_LIT:2> == <NUM_LIT:0> : <EOL> return '<STR_LIT>' <EOL> return None <EOL> yield coro . sleep ( <NUM_LIT:3> ) <EOL> categories = asyncoro . CategorizeMessages ( coro ) <EOL> categories . add ( even ) <EOL> while True : <EOL> msg = yield categories . receive ( '<STR_LIT>' , timeout = <NUM_LIT:1> ) <EOL> if msg is None : <EOL> msg = yield categories . receive ( timeout = <NUM_LIT:0> ) <EOL> asyncoro . logger . debug ( '<STR_LIT>' % msg ) <EOL> else : <EOL> asyncoro . logger . debug ( '<STR_LIT>' % msg ) <EOL> if msg == <NUM_LIT:8> : <EOL> categories . remove ( even ) <EOL> if msg == '<STR_LIT>' : <EOL> break <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> asyncoro . logger . setLevel ( logging . DEBUG ) <EOL> server = asyncoro . Coro ( server_proc ) <EOL> client = asyncoro . Coro ( client_proc , server ) </s>
