Return plugin match with longer version, if not available
        will return plugin match with ``presence=True``
15846
def get_most_complete_pm(pms):
    
    if not pms:
        return None

    selected_version = None
    selected_presence = None

    for pm in pms:
        if pm.version:
            if not selected_version:
                selected_version = pm
            else:
                if len(pm.version) > len(selected_version.version):
                    selected_version = pm
        elif pm.presence:
            selected_presence = pm

    return selected_version or selected_presence
554442
function queryPluginVersion(pluginDir) {
        var pluginXml = path.join(pluginDir, 'plugin.xml');

        var domPluginXml = jsdom.jsdom(fs.readFileSync(pluginXml).toString());
        return $(domPluginXml).find('plugin').attr('version');
    }
926808
def check_version(ctx, param, value):
    """"""
    if ctx.resilient_parsing:
        return

    if not value and ctx.invoked_subcommand != 'run':
        ctx.call_on_close(_check_version)
450361
def has_conversion(self, plugin):
        """"""
        plugin = kurt.plugin.Kurt.get_plugin(plugin)
        return plugin.name in self._plugins
1108904
def at_version!(version)
      return self if log_data.version == version
      return false unless log_data.find_by_version(version)

      apply_diff(version, log_data.changes_to(version: version))
    end
919552
def get_plugin_spec(self, name):
        """"""
        l_name = name.lower()
        for spec in self.plugins:
            name = spec.get('name', spec.get('klass', spec.module))
            if name.lower() == l_name:
                return spec
        raise KeyError(name)
436495
def extractVersion(string, default='?'):
    
    return extract(VERSION_PATTERN, string, condense=True, default=default,
                   one=True)
529076
def inspect_plugin(self, name):
        
        url = self._url('/plugins/{0}/json', name)
        return self._result(self._get(url), True)
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
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)
751601
function validVersion(version, spec) {
  // Normalize route versions
  var test = spec.versions || [spec.version]

  // Check for direct version match
  if (~test.indexOf(version)) {
    return true
  }

  // Use semver and attempt to match on supplied version
  return !!test.filter(function(v) {
    return semver.satisfies(v, version)
  }).length
}
31719
def check_name(self, name=None):
        '''
        
        '''
        if name:
            self.plugin_info['check_name'] = name

        if self.plugin_info['check_name'] is not None:
            return self.plugin_info['check_name']

        return self.__class__.__name__
542581
def _get_version():
    '''
    
    '''
    version_string = __salt__['cmd.run'](
        [_check_pkgin(), '-v'],
        output_loglevel='trace')
    if version_string is None:
        # Dunno why it would, but...
        return False

    version_match = VERSION_MATCH.search(version_string)
    if not version_match:
        return False

    return version_match.group(1).split('.')
304752
def check_version(self, check, timeout=None, metadata=None,
                      credentials=None):
        """"""
        return self.stub.CheckVersion(check, timeout=timeout,
                                      metadata=metadata,
                                      credentials=credentials)
431212
def version_parts(self, best=False):
        
        version_str = self.version(best=best)
        if version_str:
            version_regex = re.compile(r'(\d+)\.?(\d+)?\.?(\d+)?')
            matches = version_regex.match(version_str)
            if matches:
                major, minor, build_number = matches.groups()
                return major, minor or '', build_number or ''
        return '', '', ''
89061
def get_plugin(self, identifier, cls=None):
        
        if ((cls is None or cls == 'provider')
                and identifier in self.available_providers):
            return self.available_providers[identifier]
        elif ((cls is None or cls == 'checker')
                and identifier in self.available_checkers):
            return self.available_checkers[identifier]
        return Config.load_local_plugin(identifier)
513330
function isVersionAtLeast(dottedVersion, major, minor, patch){
	var i, v, t,
		verParts = $.map($.trim(dottedVersion).split("."), function(e){ return parseInt(e, 10); }),
		testParts = $.map(Array.prototype.slice.call(arguments, 1), function(e){ return parseInt(e, 10); });

	for( i = 0; i < testParts.length; i++ ){
		v = verParts[i] || 0;
		t = testParts[i] || 0;
		if( v !== t ){
			return ( v > t );
		}
	}
	return true;
}