if config has plugin, override it, else add it
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))
1175384
def configure(self, options):
        
        self.client.api.configure_plugin(self.name, options)
        self.reload()
1309816
function overrideWebpack({ plugin, options }, cracoConfig, webpackConfig, context) {
    if (isFunction(plugin.overrideWebpackConfig)) {
        const resultingConfig = plugin.overrideWebpackConfig({
            cracoConfig: cracoConfig,
            webpackConfig: webpackConfig,
            pluginOptions: options,
            context: context
        });

        if (!resultingConfig) {
            throw new Error("craco: Plugin returned an undefined webpack config.");
        }
    }

    log("Overrided webpack config with plugin.");

    return webpackConfig;
}
776200
def set_configs(self, key, d):
        """"""
        if '_config' in self.proxy:
            self.proxy['_config'][key] = d
        else:
            self.proxy['_config'] = {key: d}
764480
def add_default_plugins(self, except_global=[], except_local=[]):
        
        # add default global plugins
        for spec in plugins:
            ptype = spec.get('ptype', 'local')
            if ptype == 'global' and spec.module not in except_global:
                self.add_plugin_spec(spec)

            if ptype == 'local' and spec.module not in except_local:
                self.add_plugin_spec(spec)
40797
function set_conf( $confname ){
		$this->confname = $confname;
		$this->confdir = PLUG_HOST_DIR.'/'.$confname;
		if( ! PLUGTool::check_dir($this->confdir) ){
			throw new PLUGException('bad conf');
		}
		// parse default plug conf using external parser
		$confpath = $this->confdir.'/PLUG.conf.php';
		$this->conf_vars = array();
		$this->conf_consts = array ();
		$this->load_conf( $confpath );
	}
698810
function applyPlugin(plugin, next) {
    self.pack.register(plugin.plugin, plugin.options || {}, function(err) {
      if(err) return next(err);
      else    return next();
    });
  }
226030
def add_plugin(self, f):
        
        if f.endswith('.py'):

            # Just the basename without extension
            plugin_name = os.path.splitext(os.path.basename(f))[0]

            # It's possible the plugin has been modified and needs to be reloaded
            if plugin_name in sys.modules:
                try:
                    handler = reload(sys.modules[plugin_name])
                    print'\t- %s %sRELOAD%s' % (plugin_name, color.Yellow, color.Normal)
                except ImportError, error:
                    print 'Failed to import plugin: %s (%s)' % (plugin_name, error)
                    return
            else:
                # Not already loaded so try to import it
                try:
                    handler = __import__(plugin_name, globals(), locals(), [], -1)
                except ImportError, error:
                    print 'Failed to import plugin: %s (%s)' % (plugin_name, error)
                    return

            # Run the handler through plugin validation
            plugin = self.validate(handler)
            print '\t- %s %sOK%s' % (plugin_name, color.Green, color.Normal)
            if plugin:

                # Okay must be successfully loaded so capture the plugin meta-data,
                # modification time and register the plugin through the callback
                plugin['name'] = plugin_name
                plugin['dependencies'] = plugin['class'].dependencies
                plugin['docstring'] = plugin['class'].__doc__
                plugin['mod_time'] = datetime.utcfromtimestamp(os.path.getmtime(f))

                # Plugin may accept sample_sets as input
                try:
                    plugin['sample_set_input'] = getattr(plugin['class'], 'sample_set_input')
                except AttributeError:
                    plugin['sample_set_input'] = False

                # Now pass the plugin back to workbench
                self.plugin_callback(plugin)
245537
function(suppliedConfig) {
    if (typeof suppliedConfig.sdk === 'undefined') suppliedConfig.sdk = {}
    if (suppliedConfig.app_key) suppliedConfig.sdk.appKey = suppliedConfig.app_key
    return $.extend(true, {}, defaultConfig.primary.sdk, suppliedConfig.sdk);
  }
330049
def get_plugin_settings(plugin, directory=None):
    """"""
    repo = require_repo(directory)
    plugins = get_value(repo, 'plugins')
    return plugins.get(plugin) if isinstance(plugins, dict) else None
625619
def override_config(self, options):
        """"""

        for k, v in options.items():
            # Reject names not in the default configuration
            if k not in self.config:
                raise KeyError("'{}' is not a valid option for '{}'".format(k, self.__class__.__name__))
            self.validate_options(k, v)
            self.config[k] = v
158707
private void overrideAndRegisterPlugin(File sourceFile) {
    File destDir = fs.getInstalledPluginsDir();
    File destFile = new File(destDir, sourceFile.getName());
    if (destFile.exists()) {
      // plugin with same filename already installed
      deleteQuietly(destFile);
    }

    try {
      moveFile(sourceFile, destFile);

    } catch (IOException e) {
      throw new IllegalStateException(format("Fail to move plugin: %s to %s",
        sourceFile.getAbsolutePath(), destFile.getAbsolutePath()), e);
    }

    PluginInfo info = PluginInfo.create(destFile);
    PluginInfo existing = pluginInfosByKeys.put(info.getKey(), info);
    if (existing != null) {
      if (!existing.getNonNullJarFile().getName().equals(destFile.getName())) {
        deleteQuietly(existing.getNonNullJarFile());
      }
      LOG.info("Plugin {} [{}] updated to version {}", info.getName(), info.getKey(), info.getVersion());
    } else {
      LOG.info("Plugin {} [{}] installed", info.getName(), info.getKey());
    }
  }
626982
def patch_config(config, data):
    """"""
    is_changed = False
    for name, value in data.items():
        if value is None:
            if config.pop(name, None) is not None:
                is_changed = True
        elif name in config:
            if isinstance(value, dict):
                if isinstance(config[name], dict):
                    if patch_config(config[name], value):
                        is_changed = True
                else:
                    config[name] = value
                    is_changed = True
            elif str(config[name]) != str(value):
                config[name] = value
                is_changed = True
        else:
            config[name] = value
            is_changed = True
    return is_changed
185215
public function setupPlugin(array $config = []): void
	{
		if (!$this->defaults) return;
		$this->setupConfig($this->defaults, $config);
	}
18866
def add_plugin(self, plugin, call):
        
        meth = getattr(plugin, call, None)
        if meth is not None:
            self.plugins.append((plugin, meth))
941111
def start_plugin(file_path=None):
    """"""
    if os.getenv('CONFIG_PATH'):
        file_path = os.getenv('CONFIG_PATH')
    else:
        file_path = file_path
    if file_path is not None:
        config = parse_config(file_path)
        plugin_instance = load_plugin(config)
    else:
        plugin_instance = load_plugin
    return plugin_instance
1038769
def ensure_configured(func):
    """"""
    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        if len(logging.root.handlers) == 0:
            basicConfig()
        return func(*args, **kwargs)
    return wrapper