Maps a local version name to one recognised by the Requirement class

        Parameters
        ----------
        requirement : str
            Name of the requirement
        version : str
            version string
14911
def map_version(self, requirement, local_version):
        
        if isinstance(self._versions_map, dict):
            version = self._versions_map.get(requirement, {}).get(
                local_version, local_version)
        else:
            version = self._versions_map(requirement, local_version)
        return version
282599
def version(self, version_str: str) -> None:
        
        ver = []
        for i in version_str.split('.'):
            ver.append(int(i))
            self.filter_negatives(int(i))
        self._major, self._minor, self._patch = ver[0], ver[1], ver[2]
652966
def version():
    '''
    
    '''
    ret = _client_wrapper('version')
    version_re = re.compile(VERSION_RE)
    if 'Version' in ret:
        match = version_re.match(six.text_type(ret['Version']))
        if match:
            ret['VersionInfo'] = tuple(
                [int(x) for x in match.group(1).split('.')]
            )
    if 'ApiVersion' in ret:
        match = version_re.match(six.text_type(ret['ApiVersion']))
        if match:
            ret['ApiVersionInfo'] = tuple(
                [int(x) for x in match.group(1).split('.')]
            )
    return ret
940555
def version_required #:nodoc:
            max = [ "1.0", 0 ]

            self.each_key do |field|
                attributes = self.class.fields[field.value]
                if attributes.nil?
                    STDERR.puts "Warning: object #{self.class} has undocumented field #{field.value}"
                    next
                end

                version = attributes[:Version] || '1.0'
                level = attributes[:ExtensionLevel] || 0
                current = [ version, level ]

                max = [ max, current, self[field.value].version_required ].max
            end

            max
        end
1226922
def _require_min_api_version(self, version):
    
    actual_version = self._get_resource_root().version
    version = max(version, self._api_version())
    if actual_version < version:
      raise Exception("API version %s is required but %s is in use."
          % (version, actual_version))
615175
def version(self, version):
        
        if isinstance(version, type_check):
            self._version = int(version)
        elif isinstance(version, int):
            self._version = version
483862
def get_package_version(module_obj, value):
    
    for key in ['version', '__version__']:
        if hasattr(module_obj, key):
            return getattr(module_obj, key)
    parts = value.split('.')
    for index, part in enumerate(parts):
        try:
            return pkg_resources.get_distribution(
                '.'.join(parts[0:index + 1])).version
        except (pkg_resources.DistributionNotFound,
                pkg_resources.RequirementParseError):
            continue
129048
def validate_version(self, prefix='v'):
        
        version = self.software_version()
        repo = self.github_repo()
        repo.releases.validate_tag(version, prefix)
        return version
1097997
def get_version_name(version_id):
    
    ver = registry.version_info.get(version_id)
    if ver:
        return ver.name

    return 'unknown'
409658
def load_version(fname: str) -> str:
    
    if not os.path.exists(fname):
        logger.warning("No version file found. Defaulting to 1.0.3")
        return "1.0.3"
    with open(fname) as inp:
        return inp.read().strip()
869277
def set_version(package_name, version_str):
    
    current_version = get_version(package_name)
    version_file_path = helpers.package_file_path('_version.py', package_name)
    version_file_content = helpers.get_file_content(version_file_path)
    version_file_content = version_file_content.replace(current_version, version_str)
    with open(version_file_path, 'w') as version_file:
        version_file.write(version_file_content)
287790
def version():
    
    global _version
    if _version:
        return _version
    init_file = read_file(MODULE_NAME, '__init__.py')
    matches = re.search(
        r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', init_file, re.M)
    if not matches:
        raise RuntimeError("Unable to find version string in __init__.py .")
    _version = matches.group(1)  # noqa
    return _version
1340990
def EnsurePythonVersion(self, major, minor):
        """"""
        if sys.version_info < (major, minor):
            v = sys.version.split()[0]
            print("Python %d.%d or greater required, but you have Python %s" %(major,minor,v))
            sys.exit(2)
307901
def validate_registry_uri_version(query: str) -> None:
    
    query_dict = parse.parse_qs(query, keep_blank_values=True)
    if "version" not in query_dict:
        raise ValidationError(f"{query} is not a correctly formatted version param.")
629105
private String getPrefixItem(String requirement, String minVersion, String maxVersion) {
        
        switch (requirement) {
        case Languages.JAVA: return "java";
        case Languages.PYTHON: return "python";
        case Languages.RUBY: return "ruby";
        case Languages.NET: return "dotnet";
        case Languages.PHP: return "php";
        
        case Containers.JBOSS6: return "jboss";
        case Containers.JBOSS7: return "jboss";
        case Containers.JETTY6: return "jetty";
        case Containers.TOMCAT: return "tomcat";
        case Containers.TOMCAT8: return "tomcat";

        case Categories.MYSQL: return "mysql";
        case Categories.MARIADB: return "maria";
        case Categories.POSTGRESQL: return "postgresql";
        case Categories.MONGODB: return "mongoDB";
        case Categories.REDIS: return "redis";

        default:
            return "";
        }
    }
829549
def matches_requirement(self, req):
        
        # Requirement may contain extras - parse to lose those
        # from what's passed to the matcher
        r = parse_requirement(req)
        scheme = get_scheme(self.metadata.scheme)
        try:
            matcher = scheme.matcher(r.requirement)
        except UnsupportedVersionError:
            # XXX compat-mode if cannot read the version
            logger.warning('could not read version %r - using name only',
                           req)
            name = req.split()[0]
            matcher = scheme.matcher(name)

        name = matcher.key   # case-insensitive

        result = False
        for p in self.provides:
            p_name, p_ver = parse_name_and_version(p)
            if p_name != name:
                continue
            try:
                result = matcher.match(p_ver)
                break
            except UnsupportedVersionError:
                pass
        return result
1275456
def version(self, event):
        
        name = "%s.%s" % (self.__class__.__module__, self.__class__.__name__)
        return "%s [%s]" % (settings.GNOTTY_VERSION_STRING, name)