Register a parser.

        :param plugin_name: Parser name
        :param plugin_instance: PluginBase
        :return: Nothing
773545
def _register_dataparser(self, plugin_name, plugin_instance):
        
        for parser in plugin_instance.get_parsers().keys():
            if self.responseparser.has_parser(parser):
                raise PluginException("Parser {} already registered to parsers! Unable to "
                                      "add parsers from {}.".format(parser, plugin_name))
            self.responseparser.add_parser(parser, plugin_instance.get_parsers().get(parser))
1335515
public static function registerParser(string $parserName)
    {
        $parser = new $parserName();

        if ($parser instanceof ContentTypeParser) {
            self::$registeredParsers[] = $parser;
        } else {
            throw new \Exception("$parserName is not a valid parser");
        }
    }
576864
def register(cls, instance_class, name=None):
        
        if name is None:
            name = instance_class.__name__
        cls.INSTANCE_CLASSES[name] = instance_class
640265
def get_plugin(self, name):
        
        for p in self._plugins:
            if p.name == name:
                return p
        return None
959371
def create_plugin(plugin_name, conn=None):
    
    results = {}
    if not plugin_exists(plugin_name, conn=conn):
        results = RPX.table_create(plugin_name,
                                   primary_key=COMMAND_NAME_KEY).run(conn)
    return results
534351
def _register_allocator(self, plugin_name, plugin_instance):
        
        for allocator in plugin_instance.get_allocators().keys():
            if allocator in self._allocators:
                raise PluginException("Allocator with name {} already exists! unable to add "
                                      "allocators from plugin {}".format(allocator, plugin_name))
            self._allocators[allocator] = plugin_instance.get_allocators().get(allocator)
754593
def get_plugins_by_name(self, *names):
        
        self._import_plugins()
        plugin_instances = []
        for name in names:
            if isinstance(name, six.string_types):
                try:
                    plugin_instances.append(self.plugins[name.lower()])
                except KeyError:
                    raise PluginNotFound("No plugin named '{0}'.".format(name))
            elif isinstance(name, type) and issubclass(name, ContentPlugin):
                # Will also allow classes instead of strings.
                plugin_instances.append(self.plugins[self._name_for_model[name.model]])
            else:
                raise TypeError("get_plugins_by_name() expects a plugin name or class, not: {0}".format(name))
        return plugin_instances
691879
def register_plugin(self, name):
        """"""
        logger.info("Registering plugin: " + name)
        module = importlib.import_module(name)
        module.register_plugin(self)
432276
def register_run_plugins(self, plugin_name, plugin_class):
        
        if plugin_name in self.registered_plugins:
            raise PluginException("Plugin {} already registered! "
                                  "Duplicate plugins?".format(plugin_name))
        self.logger.debug("Registering plugin %s", plugin_name)
        if plugin_class.get_allocators():
            register_func = self.plugin_types[PluginTypes.ALLOCATOR]
            register_func(plugin_name, plugin_class)
        self.registered_plugins.append(plugin_name)
47218
def register( cls, plugin ):
        
        if ( not plugin ):
            return
            
        if ( cls._plugins is None ):
            cls._plugins = {}
            
        cls._plugins[plugin.uniqueName()] = plugin
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)
854702
def plugin(cls, name):
        
        cls.loadPlugins()
        plugs = getattr(cls, '_%s__plugins' % cls.__name__, {})
        return plugs.get(nstr(name))
130525
def activate(name):
    
    if name in plugins:
        plugins[name].activate()
    else:
        raise Exception("plugin {} not found".format(name))
13881
def add_plugin(self, phase, name, args, reason=None):
        
        plugin_modified = False

        for plugin in self.template[phase]:
            if plugin['name'] == name:
                plugin['args'] = args
                plugin_modified = True

        if not plugin_modified:
            self.template[phase].append({"name": name, "args": args})
            if reason:
                logger.info('{}:{} with args {}, {}'.format(phase, name, args, reason))
1117181
def init_argument_parser(name=None, **kwargs):
    

    if name is None:
        name = "default"

    if name in _parsers:
        raise ValueError(("kwargs besides 'name' can only be passed in the"
            " first time. '%s' ArgumentParser already exists: %s") % (
            name, _parsers[name]))

    kwargs.setdefault('formatter_class', argparse.ArgumentDefaultsHelpFormatter)
    kwargs.setdefault('conflict_handler', 'resolve')
    _parsers[name] = ArgumentParser(**kwargs)
61861
def _is_plugin_ok(self, instance):
        ''' 

        '''
        try:
            verifyObject(IPlugin, instance)
        except BrokenImplementation:
            logger.warning(
                "Plugin '%(name)s' doesn't provide the plugin interface",
                {'name': self._full_class_name(instance)}
            )
            return False

        # Check if the plugin is already registered
        reg = self.plugins.get(instance.name)
        if reg:
            logger.warning(
                "Plugin '%(name)s' by '%(instance)s' is already provided by '%(reg)s'", {
                    'name': instance.name, 'instance': self._full_class_name(instance),
                    'reg': self._full_class_name(reg)
                }
            )
            return False

        for tag in instance.tags:
            if tag not in PLUGIN_TAGS:
                logger.warning(
                    "Invalid tag '%(tag)s' in '%(instance)s'",
                    {'tag': tag, 'instance': self._full_class_name(instance)}
                )
                return False

        return True
1004386
def register_type_name(t, name):
    
    assert isinstance(t, type)
    assert isinstance(name, unicode)
    __type_names[t] = name