def service(cls):
    '''
    Marks the decorated class as a singleton ``service``.

    Injects following classmethods:

        .. py:method:: .get(context)

            Returns a singleton instance of the class for given ``context``

            :param context: context to look in
            :type context: :class:`Context`
            :returns: ``cls``
    '''

    if not cls:
        return None

    # Inject methods
    def get(cls, context):
        return context.get_service(cls)
    cls.get = get.__get__(cls)

    log.debug('Registering [%s] (service)', get_fqdn(cls))

    return cls
def service ( cls ) : if not cls : return None def get ( cls , context ) : return context . get_service ( cls ) cls . get = get . __get__ ( cls ) log . debug ( 'Registering [%s] (service)' , get_fqdn ( cls ) ) return cls
Marks the decorated class as a singleton ``service``.

    Injects following classmethods:

        .. py:method:: .get(context)

            Returns a singleton instance of the class for given ``context``

            :param context: context to look in
            :type context: :class:`Context`
            :returns: ``cls``