# Path: chirp/stream/looper.py
# class Looper(object):
#     MAX_TRAPPED_EXCEPTIONS = 100
#     def __init__(self):
#     def _begin_looping(self):
#     def _loop_once(self):
#     def _done_looping(self):
#     def _trap_exceptions(self, callable_to_wrap):
#     def loop(self):
#     def stop(self):
#     def loop_in_thread(self):
#     def wait(self):
#     def wait_until_looped_once(self):


import hashlib
import Queue
import time
from chirp.stream import looper
        Returns:
          The next Message object, or None if we time out.
        """
        try:
            return self._message_queue.get(timeout=timeout)
        except Queue.Empty:
            return None

    def get_all_messages(self):
        """Try to yield all messages in the queue.

        Note that this is not thread-safe.  For best results, only call
        this after you know that no more messages will be added and that
        you are the only reader.
        """
        while not self._message_queue.empty():
            yield self._message_queue.get()

    def wait_until_empty(self):
        """Wait for all messages to be drained from the queue.

        Note that this is not thread-safe and not reliable.  For best
        results, only call this from the same thread that is adding
        messages to this MessageSource.  This should only be used in
        unit tests.
        """
        while not self._message_queue.empty():
            time.sleep(0.05)  # Wait for 50ms



# Path: chirp/stream/looper.py
# class Looper(object):
#     MAX_TRAPPED_EXCEPTIONS = 100
#     def __init__(self):
#     def _begin_looping(self):
#     def _loop_once(self):
#     def _done_looping(self):
#     def _trap_exceptions(self, callable_to_wrap):
#     def loop(self):
#     def stop(self):
#     def loop_in_thread(self):
#     def wait(self):
#     def wait_until_looped_once(self):


# Path: chirp/stream/message.py
import hashlib
import Queue
import time
from chirp.stream import looper

        Returns:
          The next Message object, or None if we time out.
        """
        try:
            return self._message_queue.get(timeout=timeout)
        except Queue.Empty:
            return None

    def get_all_messages(self):
        """Try to yield all messages in the queue.

        Note that this is not thread-safe.  For best results, only call
        this after you know that no more messages will be added and that
        you are the only reader.
        """
        while not self._message_queue.empty():
            yield self._message_queue.get()

    def wait_until_empty(self):
        """Wait for all messages to be drained from the queue.

        Note that this is not thread-safe and not reliable.  For best
        results, only call this from the same thread that is adding
        messages to this MessageSource.  This should only be used in
        unit tests.
        """
        while not self._message_queue.empty():
            time.sleep(0.05)  # Wait for 50ms



class MessageConsumer(looper.Looper):