get plugin instance from config node
        *NOTE* returns an uninitialized instance if one isn't there
        *NOTE* instantiated plugins without names remain anonymous
               FIXME - why would instantiate() even process them
973220
def get_instance(self, node, *args, **kwargs):
        
        # string is a ref to an existing plugin instance
        if isinstance(node, basestring):
            if node in self._instance:
                return self._instance[node]
            # if not an instance, try for init with empty config
            return self.new_plugin({'type': node}, *args, **kwargs)

        if isinstance(node, collections.Mapping):
            if "type" in node:
                # node was a plugin config passed directly
                name = node.get("name", node.get("type"))
            elif len(node) == 1:
                # node was a container with a single plugin config keyed
                # to it
                typ, config = list(node.items())[0]
                name = config.get("name", config.get("type", typ))

            # retrieve existing instance if it exists
            if name in self._instance:
                return self._instance[name]

            # otherwise spawn new plugin
            return self.new_plugin(node, *args, **kwargs)

        raise ValueError("unable to parse plugin for output %s" % str(node))
334199
function init(_pluginInterface) {
    pi = _pluginInterface;
    localStorage = pi.localStorage;
    log = pi.log;
    ipv4.setNetCallbackFunctions(
        function(net, newmac, newip) {
            for (const callbacks of Object.values(NetCallbacks)) {
                if (callbacks.onMacFoundCallback != undefined) {
                    callbacks.onMacFoundCallback(net, newmac, newip);
                }
            }
            // NetCallbacks[plugin_name].onNewIDFoundCallback(newid,newip);
        }
        , function(net, lostmac, lostip) {
            for (const callbacks of Object.values(NetCallbacks)) {
                if (callbacks.onMacLostCallback != undefined) {
                    callbacks.onMacLostCallback(net, lostmac, lostip);
                }
            }
            // NetCallbacks[plugin_name].onIPAddressLostCallback(id,lostip);
        }
        , function(net, mac, oldip, newip) {
            for (const callbacks of Object.values(NetCallbacks)) {
                if (callbacks.onIPChangedCallback != undefined) {
                    callbacks.onIPChangedCallback(net, mac, oldip, newip);
                }
            }
            // NetCallbacks[plugin_name].onIPAddressChangedCallback(id,oldip,newip);
        }
    );

    // Periodical publish test
    /*setInterval(()=>{
        pi.server.publish(
            'HelloTopic'
            ,{desc:'Hello desc'});
    },15000);*/
}
1024312
def load(self):
        
        print("[DEBUG] Loading plugin {} from {}".format(self.name,
                                                         self.source))
        import pydoc
        path, attr = self.source.split(":")
        module = pydoc.locate(path)
        return getattr(module, attr)
676636
private static <T> T instantiateObject(
      String flagName,
      String objectType,
      Class<T> clazz,
      PluginLoader loader,
      String instanceClassName) {
    try {
      return loader.loadPlugin(instanceClassName).asSubclass(clazz).getConstructor().newInstance();
    } catch (ClassCastException cce) {
      throw new CommandLineError(
          String.format(
              "%s \"%s\" is not a subclass of %s.  Classes passed to %s should be %ss. "
                  + "Did you pass it to the wrong flag?",
              objectType,
              instanceClassName,
              clazz.getSimpleName(),
              flagName,
              clazz.getSimpleName()),
          cce);
    } catch (ReflectiveOperationException e) {
      throw new CommandLineError(
          String.format(
              "Cannot instantiate %s \"%s\" registered with flag %s.  Please make "
                  + "sure that the %s exists and is on the compiler classpath and has a public "
                  + "zero arguments constructor.",
              objectType, instanceClassName, flagName, objectType),
          e);
    } catch (ExceptionInInitializerError e) {
      throw new CommandLineError(
          String.format(
              "Cannot instantiate %s \"%s\" registered with flag %s. An error was thrown while "
                  + "loading the class.  There is a bug in the implementation.",
              objectType, instanceClassName, flagName),
          e);
    } catch (SecurityException e) {
      throw new CommandLineError(
          String.format(
              "Cannot instantiate %s \"%s\" registered with flag %s. A security manager is "
                  + "preventing instantiation.",
              objectType, instanceClassName, flagName),
          e);
    }
  }
777411
function getPluginConfig(config, pluginName) {
    var pluginsConfig = config.getValues().get('pluginsConfig');
    if (pluginsConfig === undefined) {
        return {};
    }
    var pluginConf = pluginsConfig.get(pluginName);
    if (pluginConf === undefined) {
        return {};
    } else {
        return pluginConf.toJS();
    }
}
62446
def _get_capture_plugin(self):
        
        for plugin in self.config.plugins.plugins:
            if plugin.name == "capture":
                return plugin
        return None
1044582
static function instance( $module_id ) {
			$key = 'm_' . $module_id;

			if ( ! isset( self::$_instances[ $key ] ) ) {
				self::$_instances[ $key ] = new FS_Plugin_Manager( $module_id );
			}

			return self::$_instances[ $key ];
        }
496400
def get_plugin(self, name):
        
        for plugin in self.plugins:
            if plugin.name == name:
                return plugin

        raise PluginDoesNotExistError("Plugin '{}' not found".format(name))
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
562750
def load_plugin(self, p):
        
        if p.is_loaded():
            return
        # load required plugins first
        reqnames = p.required
        reqplugins = []
        for name in reqnames:
            try:
                reqplugins.append(self.__plugins[name])
            except KeyError as e:
                log.error("Required Plugin %s not found. Cannot load %s." % (name, p))
                raise errors.PluginInitError('Required Plugin %s not found. Cannot load %s. Reason: %s' % (name, p, e))
        for plug in reqplugins:
            try:
                self.load_plugin(plug)
            except errors.PluginInitError as e:
                log.error("Required Plugin %s could not be loaded. Cannot load %s" % (plug, p))
                raise errors.PluginInitError('Required Plugin %s could not be loaded. Cannot load %s. Reason: %s' % (plug,p, e))
        # load the actual plugin
        p._load()
        log.info('Initialized the plugin: %s' % p)
419720
function runPluginWithIdentifier (pluginName, identifier, options = {}) {
  const pluginFolderPath = options.dir || pluginFolder();

  // Append `.sketchplugin` if not passed in with the plugin name
  if (!pluginName.endsWith('.sketchplugin')) {
    pluginName += '.sketchplugin';
  }
  const pluginPath = `${pluginFolderPath}/${pluginName}`;

  // Check if the plugin actually exists before running anything!
  const exists = fs.existsSync(pluginPath);
  invariant(
    exists,
    `Plugin '${pluginPath}' not found! Cannot run plugin command!`
  );

  let args = '';

  if (options.context) {
    args += `--context='${JSON.stringify(options.context)}' `;
  }

  sketchtoolExec(`run ${escape(pluginPath)} ${identifier} ${args}`);
}
430234
function initPlugins() {
        var name,
            plugin,
            plugins = config.plugins || {};
        for (name in plugins) {
            plugin = scope.createComponent('plugin-' + name);
            if (plugin && util.isFn(plugin.init)) {
                plugin.init(config.plugins[name]);
            }
        }
    }
854702
def plugin(cls, name):
        
        cls.loadPlugins()
        plugs = getattr(cls, '_%s__plugins' % cls.__name__, {})
        return plugs.get(nstr(name))
305115
static function instance( $module_id, $slug = false, $is_init = false ) {
            if ( empty( $module_id ) ) {
                return false;
            }

            /**
             * Load the essential static data prior to initiating FS_Plugin_Manager since there's an essential MS network migration logic that needs to be executed prior to the initiation.
             */
            self::_load_required_static();

            if ( ! is_numeric( $module_id ) ) {
                if ( ! $is_init && true === $slug ) {
                    $is_init = true;
                }

                $slug = $module_id;

                $module = FS_Plugin_Manager::instance( $slug )->get();

                if ( is_object( $module ) ) {
                    $module_id = $module->id;
                }
            }

            $key = 'm_' . $module_id;

            if ( ! isset( self::$_instances[ $key ] ) ) {
                self::$_instances[ $key ] = new Freemius( $module_id, $slug, $is_init );
            }

            return self::$_instances[ $key ];
        }
978891
public static TinyPlugz getInstance() {
        final TinyPlugz plugz = instance;
        Require.state(plugz != null, "TinyPlugz has not been initialized");
        return plugz;
    }
1208703
def getDynDnsClientForConfig(config, plugins=None):
    
    initparams = {}
    if "interval" in config:
        initparams["detect_interval"] = config["interval"]

    if plugins is not None:
        initparams["plugins"] = plugins

    if "updater" in config:
        for updater_name, updater_options in config["updater"]:
            initparams["updater"] = get_updater_class(updater_name)(**updater_options)

    # find class and instantiate the detector:
    if "detector" in config:
        detector_name, detector_opts = config["detector"][-1]
        try:
            klass = get_detector_class(detector_name)
        except KeyError as exc:
            LOG.warning("Invalid change detector configuration: '%s'",
                        detector_name, exc_info=exc)
            return None
        thedetector = klass(**detector_opts)
        initparams["detector"] = thedetector

    return DynDnsClient(**initparams)
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)