def drain_events(self, timeout=None):
        """Wait for an event on a channel."""
        chanmap = self.channels
        chanid, method_sig, args, content = self._wait_multiple(
            chanmap, None, timeout=timeout,
        )

        channel = chanmap[chanid]

        if (content and
                channel.auto_encode_decode and
                hasattr(content, 'content_encoding')):
            try:
                content.body = content.body.decode(content.content_encoding)
            except Exception:
                pass

        amqp_method = (self._method_override.get(method_sig) or
                       channel._METHOD_MAP.get(method_sig, None))

        if amqp_method is None:
            raise AMQPNotImplementedError(
                'Unknown AMQP method {0!r}'.format(method_sig))

        if content is None:
            return amqp_method(channel, args)
        else:
            return amqp_method(channel, args, content)
def drain_events ( self , timeout = None ) : chanmap = self . channels chanid , method_sig , args , content = self . _wait_multiple ( chanmap , None , timeout = timeout , ) channel = chanmap [ chanid ] if ( content and channel . auto_encode_decode and hasattr ( content , 'content_encoding' ) ) : try : content . body = content . body . decode ( content . content_encoding ) except Exception : pass amqp_method = ( self . _method_override . get ( method_sig ) or channel . _METHOD_MAP . get ( method_sig , None ) ) if amqp_method is None : raise AMQPNotImplementedError ( 'Unknown AMQP method {0!r}' . format ( method_sig ) ) if content is None : return amqp_method ( channel , args ) else : return amqp_method ( channel , args , content )
Wait for an event on a channel.