Register an external service.

        :param plugin_name: Service name
        :param plugin_instance: PluginBase
        :return:
968233
def _register_external_service(self, plugin_name, plugin_instance):
        
        for attr in plugin_instance.get_external_services().keys():
            if attr in self._external_services:
                raise PluginException("External service with name {} already exists! Unable to add "
                                      "services from plugin {}.".format(attr, plugin_name))
            self._external_services[attr] = plugin_instance.get_external_services().get(attr)
1145636
def register_service(cls, service):
        
        logger.debug('Registering service {0}'.format(service.name))
        return local_store.instance.register(service)
1064924
private function registerPlugin(Plugin $plugin): void
    {
        if ($this->hasPlugin($plugin->getName())) {
            return;
        }

        $this->plugins[$plugin->getName()] = $plugin;
    }
550296
public void registerService(ProvidedServiceInstance serviceInstance) {
        getServiceDirectoryClient().registerServiceInstance(serviceInstance);
        getCacheServiceInstances().put(new ServiceInstanceToken(serviceInstance.getServiceName(), serviceInstance.getProviderId()), new InstanceHealthPair(null));
    }
381747
def register(self, typ):
        
        # should be able to combine class/instance namespace, and inherit from either
        # would need to store meta or rely on copy ctor
        def _func(cls):
            if typ in self._class:
                raise ValueError("duplicated type name '%s'" % typ)
            cls.plugin_type = typ
            self._class[typ] = cls
            return cls
        return _func
418706
def register(self, name: str):
        ''''''
        if name in self._callbacks:
            raise ValueError('Hook already registered')

        self._callbacks[name] = None

        if self._event_dispatcher is not None:
            self._event_dispatcher.register(name)
404729
def load_default_tc_plugins(self):
        
        for plugin_name, plugin_class in default_plugins.items():
            if issubclass(plugin_class, PluginBase):
                try:
                    self.register_tc_plugins(plugin_name, plugin_class())
                except PluginException as error:
                    self.logger.debug(error)
                    continue
536349
function plugin(suite) {
	// API
	suite.api.mock = {}; // TODO: remove this
	// Add the plugin's `root`
	suite.addRoot(path.join(__dirname, 'defaults'));

	// Instance
	var instance = {};

	// Instance's name
	instance.name = pkg.name;

	return instance;
}
873843
def register(name, mod, options)
      elements[name] = plugin_type.new(mod, options)
    end
319260
function registerPlugin(type, Plugin) {
    if (!plugins[type]) {
      throw new Error('Attempting to register "' + Plugin + '" as "' + type + '" which is not a valid HTMLBars plugin type.');
    }

    plugins[type].push(Plugin);
  }
712650
function registerPlugin(name, obj) {
    if (name && name.length && obj) {
        plugins[name] = obj;
    }
}
938199
def load_plug_in(self, name):
        
        if not isinstance(name, basestring):
            raise TypeError("name can only be an instance of type basestring")
        plug_in_name = self._call("loadPlugIn",
                     in_p=[name])
        return plug_in_name
1298940
def register_plugin(self, plugin: Plugin):
        
        if isinstance(plugin, Plugin):
            lazy = False
        elif issubclass(plugin, Plugin):
            lazy = True
        else:
            msg = 'plugin %r must be an object/class of type Plugin' % plugin
            raise DiayException(msg)

        predicate = inspect.isfunction if lazy else inspect.ismethod
        methods = inspect.getmembers(plugin, predicate=predicate)
        for _, method in methods:
            if getattr(method, '__di__', {}).get('provides'):
                if lazy:
                    self.register_lazy_provider_method(plugin, method)
                else:
                    self.register_provider(method)
268197
def register(self, service, name=''):
        
        # expose a sub-factory
        if isinstance(service, ApiFactory):
            self.services[name] = (service.factory, None)

        # expose a module dynamically as a service
        elif inspect.ismodule(service):
            name = name or service.__name__.split('.')[-1]

            # exclude endpoints with patterns
            for obj in vars(service).values():
                endpoint = getattr(obj, 'endpoint', None)
                if isinstance(endpoint, Endpoint) and endpoint.pattern:
                    route = Route('', endpoint.pattern)
                    self.routes.append((route, endpoint))

            self.services[name] = (ModuleService, service)

        # expose a class dynamically as a service
        elif inspect.isclass(service):
            name = name or service.__name__
            self.services[name] = (ClassService, service)

        # expose an endpoint directly
        elif isinstance(getattr(service, 'endpoint', None), Endpoint):
            if service.endpoint.pattern:
                route = Route('', service.endpoint.pattern)
                self.routes.append((route, service.endpoint))
            else:
                self.services[service.endpoint.name] = (service.endpoint, None)

        # expose a scope
        elif isinstance(service, dict):
            for srv in service.values():
                try:
                    self.register(srv)
                except RuntimeError:
                    pass

        # expose a list of services
        elif isinstance(service, list):
            for srv in service:
                try:
                    self.register(srv)
                except RuntimeError:
                    pass

        # expose a service directly
        else:
            raise RuntimeError('Invalid service provide: {0} ({1}).'.format(service, type(service)))
939048
def load_plugin(category, name, aux_info=None):
    ''''''
    func = load_simple_endpoint(category, name)
    if aux_info is None:
        return func()
    else:
        return func(aux_info)
    raise KeyError(name)
1348852
def register(PluginClass):
    
    if PluginClass in _cache.keys():
        raise Exception("Plugin class already registered")
    plugin = PluginClass()
    _cache[PluginClass] = plugin

    if getattr(PluginClass, 'extra_page_actions', False):
        for key in plugin.extra_page_actions:
            if key not in _extra_page_actions:
                _extra_page_actions[key] = []
            _extra_page_actions[key].extend(plugin.extra_page_actions[key])

    if getattr(PluginClass, 'extra_edit_actions', False):
        for key in plugin.extra_edit_actions:
            if key not in _extra_edit_actions:
                _extra_edit_actions[key] = []
            _extra_edit_actions[key].extend(plugin.extra_edit_actions[key])


    if getattr(PluginClass, 'navbar_links', False):
        _navbar_links.extend(list(plugin.navbar_links))
185537
def register_plugin(self):
        """"""
        self.profiler.datatree.sig_edit_goto.connect(self.main.editor.load)
        self.profiler.redirect_stdio.connect(
            self.main.redirect_internalshell_stdio)
        self.main.add_dockwidget(self)

        profiler_act = create_action(self, _("Profile"),
                                     icon=self.get_plugin_icon(),
                                     triggered=self.run_profiler)
        profiler_act.setEnabled(is_profiler_installed())
        self.register_shortcut(profiler_act, context="Profiler",
                               name="Run profiler")
        
        self.main.run_menu_actions += [profiler_act]
        self.main.editor.pythonfile_dependent_actions += [profiler_act]