# Path: gnsq/decorators.py
# class cached_property(object):
#     """A decorator that converts a function into a lazy property."""
# 
#     def __init__(self, func, name=None, doc=None):
#         self.__name__ = name or func.__name__
#         self.__module__ = func.__module__
#         self.__doc__ = doc or func.__doc__
#         self.func = func
# 
#     def __get__(self, obj, type=None):
#         if obj is None:
#             return self
# 
#         if self.__name__ in obj.__dict__:
#             return obj.__dict__[self.__name__]
# 
#         value = obj.__dict__[self.__name__] = self.func(obj)
#         return value
# 
# Path: gnsq/errors.py
# class NSQException(Exception):
#     pass


import blinker
from .decorators import cached_property
from .errors import NSQException
    @cached_property
    def on_touch(self):
        """Emitted after :meth:`touch`.

        The signal sender is the message instance.
        """
        return blinker.Signal(doc='Emitted after message is touched.')

    def enable_async(self):
        """Enables asynchronous processing for this message.

        :class:`~gnsq.Consumer` will not automatically respond to the message
        upon return of :meth:`~gnsq.Consumer.handle_message`.
        """
        self._is_async = True

    def is_async(self):
        """Returns whether or not asynchronous processing has been enabled."""
        return self._is_async

    def has_responded(self):
        """Returns whether or not this message has been responded to."""
        return self._has_responded

    def finish(self):
        """
        Respond to nsqd that you’ve processed this message successfully
        (or would like to silently discard it).
        """
        if self._has_responded:

# Path: gnsq/decorators.py
# class cached_property(object):
#     """A decorator that converts a function into a lazy property."""
# 
#     def __init__(self, func, name=None, doc=None):
#         self.__name__ = name or func.__name__
#         self.__module__ = func.__module__
#         self.__doc__ = doc or func.__doc__
#         self.func = func
# 
#     def __get__(self, obj, type=None):
#         if obj is None:
#             return self
# 
#         if self.__name__ in obj.__dict__:
#             return obj.__dict__[self.__name__]
# 
#         value = obj.__dict__[self.__name__] = self.func(obj)
#         return value
# 
# Path: gnsq/errors.py
# class NSQException(Exception):
#     pass


# Path: gnsq/message.py
import blinker
from .decorators import cached_property
from .errors import NSQException

    @cached_property
    def on_touch(self):
        """Emitted after :meth:`touch`.

        The signal sender is the message instance.
        """
        return blinker.Signal(doc='Emitted after message is touched.')

    def enable_async(self):
        """Enables asynchronous processing for this message.

        :class:`~gnsq.Consumer` will not automatically respond to the message
        upon return of :meth:`~gnsq.Consumer.handle_message`.
        """
        self._is_async = True

    def is_async(self):
        """Returns whether or not asynchronous processing has been enabled."""
        return self._is_async

    def has_responded(self):
        """Returns whether or not this message has been responded to."""
        return self._has_responded

    def finish(self):
        """
        Respond to nsqd that you’ve processed this message successfully
        (or would like to silently discard it).
        """
        if self._has_responded:

            raise NSQException('already responded')