Returns the available versions for a repository

 @param constraints [Array] The constraints
 @param elm_version [String] The Elm version to match against

 @return [Array] The versions
16575
def versions(constraints, elm_version, should_update, only_update)
      if repository.cloned? &&
         !repository.fetched &&
         should_update &&
         (!only_update || only_update == package_name)
        # Get updates from upstream
        Logger.arrow "Getting updates for: #{package_name.bold}"
        repository.fetch
      end

      case @branch
      when Branch::Just
        [identifier.version(fetch(@branch.ref))]
      when Branch::Nothing
        matching_versions constraints, elm_version
      end
    end
137461
function (constraint) {
        let first = /((?:\d+(?:\.\d+){0,2}))\s+(\<=|\>=|\<|\>)\s+v/;
        let second = /v\s+(\<=|\>=|\<|\>)\s+((?:\d+(?:\.\d+){0,2}))/;
        let firstMatch = constraint.match(first);
        let secondMatch = constraint.match(second);
        ;
        let alwaysFail = (v) => false;
        let firstOp = {
            '<': (a) => (v) => a < v,
            '<=': (a) => (v) => a <= v,
            '>': (a) => (v) => a > v,
            '>=': (a) => (v) => a >= v,
        };
        let secondOp = {
            '<': (a) => (v) => v < a,
            '<=': (a) => (v) => v <= a,
            '>': (a) => (v) => v > a,
            '>=': (a) => (v) => v >= a,
        };
        if (firstMatch && secondMatch) {
            let firstVersion = parseVersionString(firstMatch[1]);
            let secondVersion = parseVersionString(secondMatch[2]);
            return [
                firstVersion ? firstOp[firstMatch[2]](firstVersion) : alwaysFail,
                secondVersion ? secondOp[secondMatch[1]](secondVersion) : alwaysFail
            ];
        }
        return null;
    }
300105
def _find_base_version_ids(self, symbol, version_ids):
        
        cursor = self._versions.find({'symbol': symbol,
                                      '_id': {'$nin': version_ids},
                                      'base_version_id': {'$exists': True},
                                      },
                                     projection={'base_version_id': 1})
        return [version["base_version_id"] for version in cursor]
670456
public java.util.List<com.google.appengine.v1.Version> getVersionsList() {
    return versions_;
  }
68945
function (version) {
        return __awaiter(this, void 0, void 0, function* () {
            let versions = yield ForestInternal.queryElmVersions();
            let result = ForestInternal.findSuitable(version, versions);
            if (result === null) {
                throw new ForestError(Errors.NoMatchingVersion, `Unable to find an Elm version matching ${version} on NPM`);
            }
            return Promise.resolve(result);
        });
    }
1156560
def find_any_valid_version(self):  # type: () -> str
        
        versions = self.all_current_versions()

        if not versions and not self.force_init:
            raise JiggleVersionException(
                "Have no versions to work with, failed to find any. Include --init to start out at 0.1.0"
            )

        if not versions and self.force_init:
            versions = {"force_init": "0.1.0"}

        if len(versions) > 1:
            if not self.all_versions_equal(versions):
                if not self.all_versions_equal(versions):
                    almost_same = self.almost_the_same_version(
                        [x for x in versions.values()]
                    )
                    if almost_same:
                        # TODO: disable with strict option
                        logger.warning(
                            "Version very by a patch level, will use greater."
                        )
                        return unicode(almost_same)

        if not versions.keys():
            raise JiggleVersionException("Noooo! Must find a value" + unicode(versions))
        return unicode(first_value_in_dict(versions))
491092
def semver_newer(v1, v2):
    
    v1_parts = v1.split('.')
    v2_parts = v2.split('.')
    if len(v1_parts) < 3 or len(v2_parts) < 3:
        # one isn't a semantic version
        return False

    v1_major, v1_minor, v1_patch = get_version_parts(v1_parts, int)
    v2_major, v2_minor, v2_patch = get_version_parts(v2_parts, int)

    if v1_major > v2_major:
        return False

    if v1_major == v2_major and v1_minor >= v2_minor:
        return False

    return True
1200108
def _get_scope_versions(self, pkg_versions):
        '''
        
        '''
        get_in_versions = []
        for p_version in pkg_versions:
            if fnmatch.fnmatch(p_version, self.version):
                get_in_versions.append(p_version)
        return get_in_versions
659624
def versions(runas=None):
    '''
    
    '''
    ret = _pyenv_exec('versions', '--bare', runas=runas)
    return [] if ret is False else ret.splitlines()
811835
def _bse_cli_get_versions(args):
    ''''''
    name = args.basis.lower()
    metadata = api.get_metadata(args.data_dir)
    if not name in metadata:
        raise KeyError(
            "Basis set {} does not exist. For a complete list of basis sets, use the 'list-basis-sets' command".format(
                name))

    version_data = {k: v['revdesc'] for k, v in metadata[name]['versions'].items()}

    if args.no_description:
        liststr = version_data.keys()
    else:
        liststr = format_columns(version_data.items())

    return '\n'.join(liststr)
1272804
public com.google.appengine.v1.Version getVersions(int index) {
    return versions_.get(index);
  }
424262
def transform_constraint(elm_constraint)
      elm_constraint.gsub!(/\s/, '')

      CONVERTERS
        .map { |regexp, prefix| [elm_constraint.match(regexp), prefix] }
        .select { |(match)| match }
        .map { |(match, prefix)| "#{prefix} #{match[1]}" }
        .map { |constraint| Solve::Constraint.new constraint }
    end
898380
async function getPkgReleases({ lookupName, registryUrls }) {
  const versions = [];
  const dependency = getDependencyParts(lookupName);
  if (!is.nonEmptyArray(registryUrls)) {
    logger.error(`No repositories defined for ${dependency.display}`);
    return null;
  }
  const repositories = registryUrls.map(repository =>
    repository.replace(/\/?$/, '/')
  );
  logger.debug(
    `Found ${repositories.length} repositories for ${dependency.display}`
  );
  const repoForVersions = {};
  for (let i = 0; i < repositories.length; i += 1) {
    const repoUrl = repositories[i];
    logger.debug(
      `Looking up ${dependency.display} in repository #${i} - ${repoUrl}`
    );
    const mavenMetadata = await downloadMavenXml(
      dependency,
      repoUrl,
      'maven-metadata.xml'
    );
    if (mavenMetadata) {
      const newVersions = extractVersions(mavenMetadata).filter(
        version => !versions.includes(version)
      );
      const latestVersion = getLatestVersion(newVersions);
      if (latestVersion) {
        repoForVersions[latestVersion] = repoUrl;
      }
      versions.push(...newVersions);
      logger.debug(`Found ${newVersions.length} new versions for ${dependency.display} in repository ${repoUrl}`); // prettier-ignore
    }
  }

  if (versions.length === 0) {
    logger.info(`No versions found for ${dependency.display} in ${repositories.length} repositories`); // prettier-ignore
    return null;
  }
  logger.debug(`Found ${versions.length} versions for ${dependency.display}`);
  const latestVersion = getLatestVersion(versions);
  const repoUrl = repoForVersions[latestVersion];
  const dependencyInfo = await getDependencyInfo(
    dependency,
    repoUrl,
    latestVersion
  );

  return {
    ...dependency,
    ...dependencyInfo,
    releases: versions.map(v => ({ version: v })),
  };
}
422336
def get_version_req(dep)
      req = get_key_or_sym(dep, :version_requirement)
      req = get_key_or_sym(dep, :version_range) unless req
      req
    end
133913
def _get_version(name, results):
    '''
    
    '''
    for line in salt.utils.itertools.split(results, '\n'):
        if not line:
            continue
        try:
            pkgname, pkgver = line.rsplit('-', 1)
        except ValueError:
            continue
        if pkgname == name:
            return pkgver
    return None
1264331
function getVersion(patterns) {
      return reduce(patterns, function(result, pattern) {
        return result || (RegExp(pattern +
          '(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)', 'i').exec(ua) || 0)[1] || null;
      });
    }
654057
def get_package_versions(self, name):
        
        package_data = self._packages.get(name)
        versions = []

        if package_data:
            versions = sort_versions(list(package_data.get('versions', [])))

        return versions