Get the latest version that matches the provided ami-id
  Args:
    context: a populated EFVersionContext object
    value: the value of the version to look for
504133
def get_version_by_value(context, value):
  
  versions = get_versions(context)
  for version in versions:
    if version.value == value:
      return version
  fail("Didn't find a matching version for: "
       "{}:{} in env/service: {}/{}".format(
          context.key, value,
          context.env, context.service_name))
280624
private static int getAppVersion(Context context) {
        try {
            PackageInfo packageInfo = context.getPackageManager()
                    .getPackageInfo(context.getPackageName(), 0);
            return packageInfo.versionCode;
        } catch (NameNotFoundException e) {
            // should never happen
            throw new RuntimeException("Coult not get package name: " + e);
        }
    }
216321
def get_version(mod, default="0.0.0"):
    
    name = mod
    if hasattr(mod, "__name__"):
        name = mod.__name__

    try:
        import pkg_resources

        return pkg_resources.get_distribution(name).version

    except Exception as e:
        LOG.warning("Can't determine version for %s: %s", name, e, exc_info=e)
        return default
34899
def get(self, identity):
        
        return EntityContext(self._version, service_sid=self._solution['service_sid'], identity=identity, )
137118
def extract_version(filepath='jeni.py', name='__version__'):
    
    context = {}
    for line in open(filepath):
        if name in line:
            exec(line, context)
            break
    else:
        raise RuntimeError('{} not found in {}'.format(name, filepath))
    return context[name]
1373076
def version_id(self):
        
        return hashlib.sha1('{0}__{1}'.format(
            self.id, self.updated).encode('utf-8')).hexdigest()
414847
@Override
	public Object getCurrentVersion(Serializable id, SharedSessionContractImplementor session) throws HibernateException {

		if ( log.isTraceEnabled() ) {
			log.trace( "Getting version: " + MessageHelper.infoString( this, id, getFactory() ) );
		}
		final Tuple resultset = getFreshTuple( EntityKeyBuilder.fromPersister( this, id, session ), session );

		if ( resultset == null ) {
			return null;
		}
		else {
			return gridVersionType.nullSafeGet( resultset, getVersionColumnName(), session, null );
		}
	}
1147855
private boolean isMavenVersionTag(GraphContext context, FileLocationModel model)
    {
        if (isMavenFile(context, model))
        {
            Document doc = ((XmlFileModel) model.getFile()).asDocument();
            for (Element elm : $(doc).find("version"))
            {
                String text = StringUtils.trim($(elm).text());
                if (StringUtils.equals(text, model.getSourceSnippit()))
                {
                    return true;
                }
            }
        }
        return false;
    }
557789
public static int getVersionCode(Context context, int fallback) {
        try {
            PackageManager manager = context.getPackageManager();
            PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
            return info.versionCode;
        } catch (NameNotFoundException e) {
            Log.e(TAG, "no such package installed on the device: ", e);
        }
        return fallback;
    }
327168
def version(self, v):
        
        if not isinstance(v, int) or v != 1:
            raise AttributeError
        self._version = v
557660
def version(self) -> int:
        
        version = self._config.get('version', 1)

        if version not in SUPPORTED_SCENARIO_VERSIONS:
            raise InvalidScenarioVersion(f'Unexpected scenario version {version}')
        return version
585466
def es_version_check(f):
    """"""
    @wraps(f)
    def inner(*args, **kwargs):
        cluster_ver = current_search.cluster_version[0]
        client_ver = ES_VERSION[0]
        if cluster_ver != client_ver:
            raise click.ClickException(
                'Elasticsearch version mismatch. Invenio was installed with '
                'Elasticsearch v{client_ver}.x support, but the cluster runs '
                'Elasticsearch v{cluster_ver}.x.'.format(
                    client_ver=client_ver,
                    cluster_ver=cluster_ver,
                ))
        return f(*args, **kwargs)
    return inner
381301
def rhn_schema_version(context):
    
    if context.content:
        content = context.content
        if len(content) == 1 and 'No such' not in content[0]:
            ver = content[0].strip()
            if ver:
                return ver
285633
def determine_version(self, request, *args, **kwargs):
        
        if self.versioning_class is None:
            return (None, None)
        scheme = self.versioning_class()
        return (scheme.determine_version(request, *args, **kwargs), scheme)
1058503
def update_context(self, ctx):
        
        assert isinstance(ctx, dict)
        ctx[str(self.context_id)] = self.value
1142856
def match_version(desired, available, cmp_func=None, ignore_epoch=False):
    '''
    
    '''
    oper, version = split_comparison(desired)
    if not oper:
        oper = '=='
    for candidate in available:
        if salt.utils.versions.compare(ver1=candidate,
                                       oper=oper,
                                       ver2=version,
                                       cmp_func=cmp_func,
                                       ignore_epoch=ignore_epoch):
            return candidate
    return None
182429
def get_version(package_name, ignore_cache=False):
    
    if ignore_cache:
        with microcache.temporarily_disabled():
            found = helpers.regex_in_package_file(
                VERSION_SET_REGEX, '_version.py', package_name, return_match=True
            )
    else:
        found = helpers.regex_in_package_file(
            VERSION_SET_REGEX, '_version.py', package_name, return_match=True
        )
    if found is None:
        raise ProjectError('found {}, but __version__ is not defined')
    current_version = found['version']
    return current_version