Get a plugin class from its name.
480474
def get_plugin(name):
    """"""
    for plugin in IPluginRegistry.plugins:
        if name in plugin.__name__:
            return plugin
    raise ValueError("The plugin %s cannot be found." % name)
94924
def from_name(cls, fullname, soco, *args, **kwargs):
        """"""

        _LOG.info('Loading plugin %s', fullname)

        parts = fullname.split('.')
        modname = '.'.join(parts[:-1])
        clsname = parts[-1]

        mod = importlib.import_module(modname)
        class_ = getattr(mod, clsname)

        _LOG.info('Loaded class %s', class_)

        return class_(soco, *args, **kwargs)
1373036
def get_klass(self):
        
        # Extract the klass name from the URL arguments
        klass_name = self.kwargs.get('klass', None)
        klass = self.registry.get(klass_name, None)
        if not klass:
            raise Http404("Unknown autocomplete class `{}`".format(klass_name))
        return klass
824795
def get_class(self, module, class_name):
        """"""
        # let's get the class
        class_object = getattr(module, class_name, None)
        if not class_object or not issubclass(class_object, Controller):
            class_object = None

        return class_object
678723
def get(self, name):
        """"""
        try:
            return self.plugins[name]
        except KeyError:
            raise RuntimeError("plugin {} does not exist".format(name))
801624
def get_name(self, plugin):
        
        for name, val in self._name2plugin.items():
            if plugin == val:
                return name
1029403
def _get_entity_by_class(self, entity_cls):
        """"""
        entity_qualname = fully_qualified_name(entity_cls)
        if entity_qualname in self._registry:
            return self._registry[entity_qualname]
        else:
            return self._find_entity_in_records_by_class_name(entity_cls.__name__)
171562
def import_class_by_string(name):
    """"""
    components = name.split('.')
    clazz = components.pop()
    mod = __import__('.'.join(components))

    components += [clazz]
    for comp in components[1:]:
        mod = getattr(mod, comp)

    return mod
723597
def get_plugin(cls, name: str) -> Type[ConnectionPlugin]:
        
        if name not in cls.available:
            raise ConnectionPluginNotRegistered(
                f"Connection {name!r} is not registered"
            )
        return cls.available[name]
444516
def load_plugins_from_module(module_name):
    
    plugins = {}

    try:
        if module_name.endswith('.py'):
            import imp
            mod = imp.load_source('module.name', module_name)
        else:
            mod = importlib.import_module(module_name)
    except Exception as e:
        logger.debug("Import module <{}> failed: {}".format(module_name, e))
        return {}
    for _, cls in inspect.getmembers(mod, inspect.isclass):
        # Don't try to register plugins imported into this module elsewhere
        if issubclass(cls, (Catalog, DataSource)):
            plugins[cls.name] = cls

    return plugins
990729
def load_plugin(plugin_name):
    
    plugin_cls = plugin_map.get(plugin_name, None)
    if not plugin_cls:
        try:
            plugin_module_name, plugin_cls_name = plugin_name.split(":")
            plugin_module = import_module(plugin_module_name)
            plugin_cls = getattr(plugin_module, plugin_cls_name)
        except ValueError:
            raise click.ClickException(
                '"{}" is not a valid plugin path'.format(plugin_name)
            )
        except ImportError:
            raise click.ClickException(
                '"{}" does not name a Python module'.format(
                    plugin_module_name
                )
            )
        except AttributeError:
            raise click.ClickException(
                'Module "{}" does not contain the class "{}"'.format(
                    plugin_module_name, plugin_cls_name
                )
            )
    return plugin_cls
1215221
def GetNames(cls):
    
    names = []
    for plugin_class in cls._plugins.values():
      name = getattr(plugin_class, 'ARTIFACT_DEFINITION_NAME', None)
      if name:
        names.append(name)

    return names
127027
def get_plugin(self, name):
        
        if name in self._active_plugins:
            return self._active_plugins[name]

        elif self.has_plugin_preset:
            plugin_cls = self._active_preset.request_plugin(name)
            plugin = self._init_plugin(plugin_cls)

            # Remember that this plugin was provided by preset.
            self._provided_by_preset.append(id(plugin))

            self.register_plugin(name, plugin)
            return plugin

        else:
            raise AngrNoPluginError("No such plugin: %s" % name)
375127
def plugin(name, module=''):
        
        if module:
            mod = projex.importfile(module)
            if mod:
                return getattr(mod, nstr(name), None)

        return Builder._plugins.get(nstr(name))
1140586
def find_filter_class(filtername):
    """"""
    if filtername in FILTERS:
        return FILTERS[filtername]
    for name, cls in find_plugin_filters():
        if name == filtername:
            return cls
    return None
1020341
def _get_instance(self, klasses):
        
        return [x for x in self.plugins if isinstance(x, klasses)]
154383
def find_class(name, classes):
    """"""
    name = name.lower()
    cls = next((c for c in classes if c.configuration_key == name), None)
    if cls is None:
        raise ValueError("No class named '%s' could be found" % name)
    return cls