#NEWLINE# def drain_events( self , timeout = None ) : #NEWLINE# #INDENT# 'Wait for an event on a channel.' #NEWLINE# chanmap = self . channels #NEWLINE# ( chanid , method_sig , args , content ) = self . _wait_multiple ( chanmap , None , timeout = timeout ) #NEWLINE# channel = chanmap [ chanid ] #NEWLINE# if ( content and channel . auto_decode and hasattr ( args , 'content_encoding' ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# content . body = content . body . decode ( content . content_encoding ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# amqp_method = ( self . _method_override . get ( method_sig ) or channel . _METHOD_MAP . get ( method_sig , None ) ) #NEWLINE# if ( amqp_method is None ) : #NEWLINE# #INDENT# raise Exception ( ( 'Unknown AMQP method (%d, %d)' % method_sig ) ) #NEWLINE# #UNINDENT# if ( content is None ) : #NEWLINE# #INDENT# return amqp_method ( channel , args ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return amqp_method ( channel , args , content )