Register entrypoints for an engine

        Load handlers provided by other packages
968331
def register_entry_points(self):
        
        for entrypoint in entrypoints.get_group_all("papermill.engine"):
            self.register(entrypoint.name, entrypoint.load())
1021624
def add_entrypoint(self, entry_point_group):
        """"""
        for ep in iter_entry_points(group=entry_point_group):
            if not resource_isdir(ep.module_name, 'translations'):
                continue
            dirname = resource_filename(ep.module_name, 'translations')
            self.add_path(dirname)
464896
public function setupPackageAutoloaders()
    {
        $pla = \Concrete\Core\Package\PackageList::get();
        $pl = $pla->getPackages();
        $cl = ClassLoader::getInstance();
        /** @var \Package[] $pl */
        foreach ($pl as $p) {
            \Config::package($p);
            if ($p->isPackageInstalled()) {
                $pkg = $this->make('Concrete\Core\Package\PackageService')->getClass($p->getPackageHandle());
                if (is_object($pkg) && (!$pkg instanceof \Concrete\Core\Package\BrokenPackage)) {
                    $cl->registerPackage($pkg);
                    $this->packages[] = $pkg;
                }
            }
        }
    }
998832
public function registerClassLoaders()
    {

        // initialize the registered managers
        /** @var \AppserverIo\Appserver\Core\Interfaces\ClassLoaderInterface $classLoader */
        foreach ($this->getClassLoaders() as $classLoader) {
            // log the class loader we want to initialize
            $this->getInitialContext()->getSystemLogger()->debug(
                sprintf('Now register classloader %s for application %s', get_class($classLoader), $this->getName())
            );

            // register the class loader instance
            $classLoader->register(true, true);

            // log the class loader we've successfully registered
            $this->getInitialContext()->getSystemLogger()->debug(
                sprintf('Successfully registered classloader %s for application %s', get_class($classLoader), $this->getName())
            );
        }
    }
1272095
def register_entry_point(self, entry_point):
        

        module = _import_module(entry_point.module_name)
        self._register_entry_point_module(entry_point, module)
898830
def register_plugin(self):
        """"""
        self.pylint.treewidget.sig_edit_goto.connect(self.main.editor.load)
        self.pylint.redirect_stdio.connect(
            self.main.redirect_internalshell_stdio)
        self.main.add_dockwidget(self)
        
        pylint_act = create_action(self, _("Run static code analysis"),
                                   triggered=self.run_pylint)
        pylint_act.setEnabled(is_module_installed('pylint'))
        self.register_shortcut(pylint_act, context="Pylint",
                               name="Run analysis")
        
        self.main.source_menu_actions += [MENU_SEPARATOR, pylint_act]
        self.main.editor.pythonfile_dependent_actions += [pylint_act]
1107806
def capture(package, prefix, modules=[], level=logging.DEBUG):
    
    handler = LogFileHandler(package, prefix)
    formatter = logging.Formatter(FORMAT)
    handler.setFormatter(formatter)
    modules = set(modules + ['loadkit'])

    for logger in modules:
        if not hasattr(logger, 'addHandler'):
            logger = logging.getLogger(logger)
        logger.setLevel(level=level)
        logger.addHandler(handler)

    return handler
692209
def discover_handler_classes(handlers_package):
    
    if handlers_package is None:
        return

    # Add working directory into PYTHONPATH to import developer packages
    sys.path.insert(0, os.getcwd())

    package = import_module(handlers_package)

    # Continue searching for module if package is not a module
    if hasattr(package, '__path__'):
        for _, modname, _ in pkgutil.iter_modules(package.__path__):
            import_module('{package}.{module}'.format(package=package.__name__, module=modname))

    return registered_handlers
179074
public static void registerUrlProtocolHandler() {
        String handlers = System.getProperty(PROTOCOL_HANDLER, "");
        System.setProperty(PROTOCOL_HANDLER, ("".equals(handlers) ? HANDLERS_PACKAGE
                : handlers + "|" + HANDLERS_PACKAGE));
        resetCachedUrlHandlers();
    }
1114298
def update_components(self, forcereload=False, forcerebuild=False,
                          forcecopy=True, install=False):
        """"""

        # TODO: See if we can pull out major parts of the component handling.
        # They are also used in the manage tool to instantiate the
        # component frontend bits.

        self.log("Updating components")
        components = {}

        if True:  # try:

            from pkg_resources import iter_entry_points

            entry_point_tuple = (
                iter_entry_points(group='hfos.base', name=None),
                iter_entry_points(group='hfos.sails', name=None),
                iter_entry_points(group='hfos.components', name=None)
            )

            for iterator in entry_point_tuple:
                for entry_point in iterator:
                    try:
                        name = entry_point.name
                        location = entry_point.dist.location
                        loaded = entry_point.load()

                        self.log("Entry point: ", entry_point,
                                 name,
                                 entry_point.resolve(), lvl=verbose)

                        self.log("Loaded: ", loaded, lvl=verbose)
                        comp = {
                            'package': entry_point.dist.project_name,
                            'location': location,
                            'version': str(entry_point.dist.parsed_version),
                            'description': loaded.__doc__
                        }

                        components[name] = comp
                        self.loadable_components[name] = loaded

                        self.log("Loaded component:", comp, lvl=verbose)

                    except Exception as e:
                        self.log("Could not inspect entrypoint: ", e,
                                 type(e), entry_point, iterator, lvl=error,
                                 exc=True)

                        # for name in components.keys():
                        #     try:
                        #         self.log(self.loadable_components[name])
                        #         configobject = {
                        #             'type': 'object',
                        #             'properties':
                        # self.loadable_components[name].configprops
                        #         }
                        #         ComponentBaseConfigSchema['schema'][
                        # 'properties'][
                        #             'settings'][
                        #             'oneOf'].append(configobject)
                        #     except (KeyError, AttributeError) as e:
                        #         self.log('Problematic configuration
                        # properties in '
                        #                  'component ', name, exc=True)
                        #
                        # schemastore['component'] = ComponentBaseConfigSchema

        # except Exception as e:
        #    self.log("Error: ", e, type(e), lvl=error, exc=True)
        #    return

        self.log("Checking component frontend bits in ", self.frontendroot,
                 lvl=verbose)

        # pprint(self.config._fields)
        diff = set(components) ^ set(self.config.components)
        if diff or forcecopy and self.config.frontendenabled:
            self.log("Old component configuration differs:", diff, lvl=debug)
            self.log(self.config.components, components, lvl=verbose)
            self.config.components = components
        else:
            self.log("No component configuration change. Proceeding.")

        if forcereload:
            self.log("Restarting all components.", lvl=warn)
            self._instantiate_components(clear=True)
227145
def register_responses_handlers(self):
        
        self.handlers["SymbolInfo"] = self.handle_symbol_info
        self.handlers["IndexerReadyEvent"] = self.handle_indexer_ready
        self.handlers["AnalyzerReadyEvent"] = self.handle_analyzer_ready
        self.handlers["NewScalaNotesEvent"] = self.buffer_typechecks
        self.handlers["NewJavaNotesEvent"] = self.buffer_typechecks_and_display
        self.handlers["BasicTypeInfo"] = self.show_type
        self.handlers["ArrowTypeInfo"] = self.show_type
        self.handlers["FullTypeCheckCompleteEvent"] = self.handle_typecheck_complete
        self.handlers["StringResponse"] = self.handle_string_response
        self.handlers["CompletionInfoList"] = self.handle_completion_info_list
        self.handlers["TypeInspectInfo"] = self.handle_type_inspect
        self.handlers["SymbolSearchResults"] = self.handle_symbol_search
        self.handlers["SourcePositions"] = self.handle_source_positions
        self.handlers["DebugOutputEvent"] = self.handle_debug_output
        self.handlers["DebugBreakEvent"] = self.handle_debug_break
        self.handlers["DebugBacktrace"] = self.handle_debug_backtrace
        self.handlers["DebugVmError"] = self.handle_debug_vm_error
        self.handlers["RefactorDiffEffect"] = self.apply_refactor
        self.handlers["ImportSuggestions"] = self.handle_import_suggestions
        self.handlers["PackageInfo"] = self.handle_package_info
        self.handlers["FalseResponse"] = self.handle_false_response
429951
def load_eggs(entry_point_name):
    """"""

    def _load_eggs():
        distributions, errors = working_set.find_plugins(Environment())
        for dist in distributions:
            # pylint: disable=unsupported-membership-test
            if dist not in working_set:
                LOGGER.debug('Adding plugin %s from %s', dist, dist.location)
                working_set.add(dist)

        def _log_error(item, err):
            if isinstance(err, DistributionNotFound):
                LOGGER.debug('Skipping "%s": ("%s" not found)', item, err)
            elif isinstance(err, VersionConflict):
                LOGGER.error('Skipping "%s": (version conflict "%s")', item, err)
            elif isinstance(err, UnknownExtra):
                LOGGER.error('Skipping "%s": (unknown extra "%s")', item, err)
            else:
                LOGGER.error('Skipping "%s": %s', item, err)

        for dist, err in errors.items():
            _log_error(dist, err)

        for entry in sorted(
            working_set.iter_entry_points(entry_point_name),
            key=lambda entry: entry.name,
        ):
            try:
                entry.load(require=True)
            except Exception as exc:  # pylint: disable=broad-except
                _log_error(entry, exc)

    return _load_eggs
638168
def RegisterBuiltin(cls, arg):
        '''
        '''
        if arg in cls.types_dict:
            raise RuntimeError, '%s already registered' %arg
        class _Wrapper(arg):
            'Wrapper for builtin %s\n%s' %(arg, cls.__doc__)
        _Wrapper.__name__ = '_%sWrapper' %arg.__name__
        cls.types_dict[arg] = _Wrapper
748343
def load_entry_point_group(self, entry_point_group):
        """"""
        for ep in pkg_resources.iter_entry_points(group=entry_point_group):
            self.register(ep.name, ep.load())
381653
async function register(server, options) {
    const validation = validateOptions(options);

    if (validation.error) {
        throw validation.error;
    }

    const {
        components,
        handlebars,
        helpersPath,
        path,
        uriContext,
        routes,
        rootDir
    } = validation.value;


    server.log(['info', 'windshield'], "application directory identified as: " + rootDir);

    server.views({
        engines: {html: handlebars},
        relativeTo: rootDir,
        path,
        helpersPath
    });

    const componentMap = ComponentMap(components);

    const hapiHandler = handlerComposer(componentMap);
    const hapiRoutes = processRoutes(hapiHandler, uriContext, routes);
    server.route(hapiRoutes);
    templateInit(handlebars);

    return componentMap.init(handlebars);
}
941661
def load_plugins(self):
        """"""
        from pkg_resources import iter_entry_points
        seen = set()
        for entry_point in self.entry_points:
            for ep in iter_entry_points(entry_point):
                if ep.name in seen:
                    continue
                seen.add(ep.name)
                try:
                    plugincls = ep.load()
                except Exception as exc:
                    # never let a plugin load kill us
                    warn("Unable to load plugin %s: %s" % (ep, exc),
                         RuntimeWarning)
                    continue
                plugin = plugincls()
                self.add_plugin(plugin)
        super(EntryPointPluginManager, self).load_plugins()
930747
function registerBracketsFunctions() {
        functionMap["brackets.notifyinitializationComplete"] = handleInitializationComplete;
        functionMap["brackets.showStatusInfo"]               = showStatusInfo;
        functionMap["brackets.notifyDownloadSuccess"]        = handleDownloadSuccess;
        functionMap["brackets.showErrorMessage"]             = showErrorMessage;
        functionMap["brackets.notifyDownloadFailure"]        = handleDownloadFailure;
        functionMap["brackets.notifySafeToDownload"]         = handleSafeToDownload;
        functionMap["brackets.notifyvalidationStatus"]       = handleValidationStatus;
        functionMap["brackets.notifyInstallationStatus"]     = handleInstallationStatus;

        ProjectManager.on("beforeProjectClose beforeAppClose", _handleAppClose);
    }