timid/extensions.py
def activate(cls, ctxt, args):
        """
        Initialize the extensions.  This loops over each extension
        invoking its ``activate()`` method; those extensions that
        return an object are considered "activated" and will be called
        at later phases of extension processing.

        :param ctxt: An instance of ``timid.context.Context``.
        :param args: An instance of ``argparse.Namespace`` containing
                     the result of processing command line arguments.

        :returns: An instance of ``ExtensionSet``.
        """

        debugger = ExtensionDebugger('activate')

        exts = []
        for ext in cls._get_extension_classes():
            # Not using debugger as a context manager here, because we
            # want to know about the exception even if we're ignoring
            # it...but we need to notify which extension is being
            # processed!
            debugger(ext)

            try:
                # Check if the extension is being activated
                obj = ext.activate(ctxt, args)
            except Exception:
                # Hmmm, failed to activate; handle the error
                exc_info = sys.exc_info()
                if not debugger.__exit__(*exc_info):
                    six.reraise(*exc_info)
            else:
                # OK, if the extension is activated, use it
                if obj is not None:
                    exts.append(obj)
                    debugger.debug(2, 'Activating extension "%s.%s"' %
                                   (ext.__module__, ext.__name__))

        # Initialize and return the ExtensionSet
        return cls(exts)
def activate(cls, ctxt, args):
        """
        Initialize the extensions.  This loops over each extension
        invoking its ``activate()`` method; those extensions that
        return an object are considered "activated" and will be called
        at later phases of extension processing.

        :param ctxt: An instance of ``timid.context.Context``.
        :param args: An instance of ``argparse.Namespace`` containing
                     the result of processing command line arguments.

        :returns: An instance of ``ExtensionSet``.
        """

        debugger = ExtensionDebugger('activate')

        exts = []
        for ext in cls._get_extension_classes():
            # Not using debugger as a context manager here, because we
            # want to know about the exception even if we're ignoring
            # it...but we need to notify which extension is being
            # processed!
            debugger(ext)

            try:
                # Check if the extension is being activated
                obj = ext.activate(ctxt, args)
            except Exception:
                # Hmmm, failed to activate; handle the error
                exc_info = sys.exc_info()
                if not debugger.__exit__(*exc_info):
                    six.reraise(*exc_info)
            else:
                # OK, if the extension is activated, use it
                if obj is not None:
                    exts.append(obj)
                    debugger.debug(2, 'Activating extension "%s.%s"' %
                                   (ext.__module__, ext.__name__))

        # Initialize and return the ExtensionSet
        return cls(exts)
def activate ( cls , ctxt , args ) : debugger = ExtensionDebugger ( 'activate' ) exts = [ ] for ext in cls . _get_extension_classes ( ) : # Not using debugger as a context manager here, because we # want to know about the exception even if we're ignoring # it...but we need to notify which extension is being # processed! debugger ( ext ) try : # Check if the extension is being activated obj = ext . activate ( ctxt , args ) except Exception : # Hmmm, failed to activate; handle the error exc_info = sys . exc_info ( ) if not debugger . __exit__ ( * exc_info ) : six . reraise ( * exc_info ) else : # OK, if the extension is activated, use it if obj is not None : exts . append ( obj ) debugger . debug ( 2 , 'Activating extension "%s.%s"' % ( ext . __module__ , ext . __name__ ) ) # Initialize and return the ExtensionSet return cls ( exts )
Initialize the extensions.  This loops over each extension
        invoking its ``activate()`` method; those extensions that
        return an object are considered "activated" and will be called
        at later phases of extension processing.

        :param ctxt: An instance of ``timid.context.Context``.
        :param args: An instance of ``argparse.Namespace`` containing
                     the result of processing command line arguments.

        :returns: An instance of ``ExtensionSet``.
Initialize the extensions . This loops over each extension invoking its activate () method ; those extensions that return an object are considered activated and will be called at later phases of extension processing .