helper to all groups for plugins
429451
def define_plugin_entries(groups):
    
    result = dict()

    for group, modules in groups:
        tempo = []
        for module_name, names in modules:
            tempo.extend([define_plugin_entry(name, module_name)
                          for name in names])
        result[group] = tempo

    return result
455533
def plugin_name(plugin)
     tuple = elements.find { |(_, p)| p.equal?(plugin) }
     tuple[0] if tuple
    end
1308018
def _iter_lexerclasses(plugins=True):
    """"""
    for key in sorted(LEXERS):
        module_name, name = LEXERS[key][:2]
        if name not in _lexer_cache:
            _load_lexers(module_name)
        yield _lexer_cache[name]
    if plugins:
        for lexer in find_plugin_lexers():
            yield lexer
988989
def getAllAsDict(self):
        """"""
        return {p: self._plugins[p].get_raw() for p in self._plugins}
982487
function normalizePluginsList(plugins, addDefaults) {
    // Normalize list to an array
    plugins = _.isString(plugins) ? plugins.split(',') : (plugins || []);

    // Remove empty parts
    plugins = _.compact(plugins);

    // Divide as {name, version} to handle format like 'myplugin@1.0.0'
    plugins = _.map(plugins, function(plugin) {
        if (plugin.name) return plugin;

        var parts = plugin.split('@');
        var name = parts[0];
        var version = parts[1];
        return {
            'name': name,
            'version': version, // optional
            'isDefault': isDefaultPlugin(name, version)
        };
    });

    // List plugins to remove
    var toremove = _.chain(plugins)
    .filter(function(plugin) {
        return plugin.name.length > 0 && plugin.name[0] == '-';
    })
    .map(function(plugin) {
        return plugin.name.slice(1);
    })
    .value();

    // Merge with defaults
    if (addDefaults !== false) {
        _.each(DEFAULT_PLUGINS, function(plugin) {
            if (_.find(plugins, { name: plugin })) {
                return;
            }

            plugins.push({
                'name': plugin,
                'isDefault': true
            });
        });
    }

    // Remove plugin that start with '-'
    plugins = _.filter(plugins, function(plugin) {
        return !_.contains(toremove, plugin.name) && !(plugin.name.length > 0 && plugin.name[0] == '-');
    });

    // Remove duplicates
    plugins = _.uniq(plugins, 'name');

    return plugins;
}
573867
def manage_plugins(command, plugin_names=None):
     
    if plugin_names is None:
        plugin_names = []
    active_plugins = config.get("plugin", [])
    plugins = init_plugins()
    if command == "enable":
        for name in plugin_names:
            if name not in plugins:
                raise ValueError("Unknown plugin: {}".format(name))
            if name not in active_plugins:
                active_plugins.append(name)
    elif command == "disable":
        for name in plugin_names:
            if name in active_plugins:
                active_plugins.remove(name)
    elif command == "list":
        print("{:20}{}".format("plugin", "enabled"))
        for plugin in sorted(plugins):
            print("{:20}{}".format(plugin, {False:"", True:"*"}[plugin in active_plugins]))
    else:
        raise ValueError("Invalid plugin command")
    config["plugin"] = active_plugins
    config.save()

    if command in ["enable", "disable"]:
        print("Enabled plugins: {}".format(", ".join(sorted(active_plugins))))
151442
function plugin(options){
  options = options || {};
  var keys = options.keys || [];

  return function(files, metalsmith, done){
    setImmediate(done);
    Object.keys(files).forEach(function(file){
      debug('checking file: %s', file);
      if (!isHtml(file)) return;
      var data = files[file];
      var dir = dirname(file);
      var html = basename(file, extname(file)) + '.html';
      if ('.' != dir) html = dir + '/' + html;

      debug('Encoding html entities in file: %s', file);

      var reg = /\`\`\`([\s\S]+?)\`\`\`/gi;
      var rep = function(match, group) {
        if (group) {
          return he.encode(group, {useNamedReferences: true});
        }
        else {
          return "";
        }
      };
      var encoded = data.contents.toString().replace(reg, rep);
      data.contents = new Buffer(encoded);

      keys.forEach(function(key) {
        data[key] = data[key].replace(reg, rep);
      });

      delete files[file];
      files[html] = data;
    });
  };
}
1359977
function plugin(options){
  options = options || {};
  var keys = options.keys || [];

  return function(files, metalsmith, done){
    setImmediate(done);
    Object.keys(files).forEach(function(file){
      debug('checking file: %s', file);
      if (!markdown(file)) return;
      var data = files[file];
      var dir = dirname(file);
      var html = basename(file, extname(file)) + '.html';
      if ('.' != dir) html = dir + '/' + html;

      debug('converting file: %s', file);
      var str = mmd.convert(data.contents.toString(), options);
      data.contents = new Buffer(str);
      keys.forEach(function(key) {
        data[key] = mmd.convert(data[key], options);
      });

      delete files[file];
      files[html] = data;
    });
  };
}
960831
function(plugins) {
    _.each(
      plugins,
      _.bind(function(plugin) {
        if (!this.plugins[plugin]) {
          this.plugins[plugin] = this.requirePlugin(plugin);
        }
      }, this)
    );
  }
795258
def find_plugins():
     
    plugin_dir = os.path.dirname(os.path.realpath(__file__))
    plugin_dir = os.path.join(plugin_dir, "plugins")
    plugin_files = [x[:-3] for x in os.listdir(plugin_dir) if x.endswith(".py")]
    sys.path.insert(0, plugin_dir)
    for plugin in plugin_files:
        __import__(plugin)
1120455
def list_plugins(self):
        

        vals = self.plugins.items()

        return {x: y for x, y in vals}
361546
def helpers
      @helpers ||= begin
        helpers = Module.new
        all = ActionController::Base.all_helpers_from_path(helpers_paths)
        ActionController::Base.modules_for_helpers(all).each do |mod|
          helpers.include(mod)
        end
        helpers
      end
    end
1287091
def all_plugin_hook_configs
      hook_configs = {}

      Overcommit::Utils.supported_hook_types.each do |hook_type|
        hook_type_class_name = Overcommit::Utils.camel_case(hook_type)

        directory = File.join(plugin_directory, hook_type.tr('-', '_'))
        plugin_paths = Dir[File.join(directory, '*.rb')].sort

        hook_names = plugin_paths.map do |path|
          Overcommit::Utils.camel_case(File.basename(path, '.rb'))
        end

        hook_configs[hook_type_class_name] = Hash[
          hook_names.map do |hook_name|
            [hook_name, for_hook(hook_name, Overcommit::Utils.camel_case(hook_type))]
          end
        ]
      end

      hook_configs
    end
1350964
def get_plugins_from_dir(dir_path, classbase):
    """"""

    if dir_path == "sys":
        dir_path = os.path.abspath(
            os.path.join(os.path.dirname(__file__), 'plugins'))
        dir_plugins = get_plugins(dir_path)
        return {"dir": dir_path, "plugins": dir_plugins, "class": classbase}

    if dir_path == ".":
        dir_path = os.path.expanduser(
            os.path.expandvars(os.path.join(os.getcwd(), 'plugins')))
        dir_plugins = get_plugins(dir_path)
        return {"dir": dir_path, "plugins": dir_plugins, "class": classbase}
    else:

        dir_path = os.path.expanduser(os.path.expandvars(dir_path))
        prefix = "{0}/{1}".format(dir_path, classbase)

        user_path = "{0}/plugins".format(prefix)

        create_dir(user_path)
        create_file("{0}/__init__.py".format(prefix))
        create_file("{0}/plugins/__init__.py".format(prefix))
        sys.path.append(os.path.expanduser(dir_path))
        dir_plugins = get_plugins(user_path)
        # pprint({"dir": dir_path, "plugins": dir_plugins, "class": classbase})
        return {"dir": dir_path, "plugins": dir_plugins, "class": classbase}
23284
function parsePlugins(config) {
  let plugins = [];

  function parse(plugins) {
    return plugins.map(plugin => {
      if ('string' == typeof plugin) plugin = path.resolve(plugin);
      return plugin;
    });
  }

  // Handle plugin paths defined in config file
  if (config.plugins) {
    plugins.push(...parse(config.plugins));
    delete config.plugins;
  }
  // Handle plugin paths/functions defined in runtime options
  if (config.runtimeOptions.plugins) {
    plugins.push(...parse(config.runtimeOptions.plugins));
    delete config.runtimeOptions.plugins;
  }

  return plugins;
}
1031147
def pluginNames(cls, enabled=True):
        
        return map(lambda x: x.name(), cls.plugins(enabled))
556093
def get_plugin_info(self, plugin_name):
        """"""
        if plugin_name:
            for i in self.get_all_plugins:
                if i["plugin_name"] == plugin_name:
                    return i