Get the proper set of pshard metrics for the specified ES version
550796
def pshard_stats_for_version(version):
    
    pshard_stats_metrics = dict(PRIMARY_SHARD_METRICS)
    if version >= [1, 0, 0]:
        pshard_stats_metrics.update(PRIMARY_SHARD_METRICS_POST_1_0)

    return pshard_stats_metrics
66814
def checkSystemVersion(s, versions=None):
    

    if versions is None:
        versions = getSystemVersions()

    currentVersionMap = dict([(v.package, v) for v in versions])
    mostRecentSystemVersion = s.findFirst(SystemVersion,
                                          sort=SystemVersion.creation.descending)
    mostRecentVersionMap = dict([(v.package, v.asVersion()) for v in
                                 s.query(SoftwareVersion,
                                         (SoftwareVersion.systemVersion ==
                                          mostRecentSystemVersion))])

    if mostRecentVersionMap != currentVersionMap:
        currentSystemVersion = SystemVersion(store=s, creation=Time())
        for v in currentVersionMap.itervalues():
            makeSoftwareVersion(s, v, currentSystemVersion)
1353807
def find_general_mappings(es_major_version):
    

    if es_major_version not in ES_SUPPORTED:
        print("Elasticsearch version not supported %s (supported %s)" % (es_major_version, ES_SUPPORTED))
        sys.exit(1)

    # By default all strings are not analyzed in ES < 6
    if es_major_version == '5':
        # Before version 6, strings were strings
        not_analyze_strings = """
        {
          "dynamic_templates": [
            { "notanalyzed": {
                  "match": "*",
                  "match_mapping_type": "string",
                  "mapping": {
                      "type":        "string",
                      "index":       "not_analyzed"
                  }
               }
            }
          ]
        } """
    else:
        # After version 6, strings are keywords (not analyzed)
        not_analyze_strings = """
        {
          "dynamic_templates": [
            { "notanalyzed": {
                  "match": "*",
                  "match_mapping_type": "string",
                  "mapping": {
                      "type":        "keyword"
                  }
               }
            }
          ]
        } """

    return json.loads(not_analyze_strings)
350539
function listWithoutVersions() {
  const options = {
    transforms() {
      return [filter({wantStrings: true}, function (str) {
        return str.indexOf('@') === -1;
      })];
    }
  };

  return list(options);
}
427303
function getVersionInfo(binding) {
  return [
    ['node-sass', pkg.version, '(Wrapper)', '[JavaScript]'].join('\t'),
    ['libsass  ', binding.libsassVersion(), '(Sass Compiler)', '[C/C++]'].join('\t'),
  ].join(eol);
}
772005
def do_version():
    """"""
    v = ApiPool.ping.model.Version(
        name=ApiPool().current_server_name,
        version=ApiPool().current_server_api.get_version(),
        container=get_container_version(),
    )
    log.info("/version: " + pprint.pformat(v))
    return v
1150938
def _update_ps(self, es):
        
        if not self.is_initialized_base:
            self.initialize_base(es)
        if self._ps_updated_iteration == es.countiter:
            return
        if es.countiter <= es.itereigenupdated:
            # es.B and es.D must/should be those from the last iteration
            assert es.countiter >= es.itereigenupdated
            _print_warning('distribution transformation (B and D) have been updated before ps could be computed',
                          '_update_ps', 'CMAAdaptSigmaBase')
        z = dot(es.B, (1. / es.D) * dot(es.B.T, (es.mean - es.mean_old) / es.sigma_vec))
        z *= es.sp.mueff**0.5 / es.sigma / es.sp.cmean
        self.ps = (1 - self.cs) * self.ps + sqrt(self.cs * (2 - self.cs)) * z
        self._ps_updated_iteration = es.countiter
78762
def _get_comparison_spec(pkgver):
    '''
    
    '''
    oper, verstr = salt.utils.pkg.split_comparison(pkgver.strip())
    if oper in ('=', ''):
        oper = '=='
    return oper, verstr
723945
def version():
    '''
    
    '''
    cmd = ['varnishd', '-V']
    out = __salt__['cmd.run'](cmd, python_shell=False)
    ret = re.search(r'\(varnish-([^\)]+)\)', out).group(1)
    return ret
1242107
def get_parent_ps(self):
        
        if self._bundle is None:
            return None

        metawargs = {k:v for k,v in self.meta.items() if k not in ['qualifier', 'twig', 'uniquetwig']}

        return self._bundle.filter(**metawargs)
1328829
def _get_distset(tgt):
    '''
    
    '''
    # Centos adds 'centos' string to rpm names, removing that to have
    # consistent naming on Centos and Redhat, and allow for Amazon naming
    tgtattrs = tgt.split('-')
    if tgtattrs[0] == 'amzn':
        distset = '--define "dist .{0}1"'.format(tgtattrs[0])
    elif tgtattrs[1] in ['6', '7']:
        distset = '--define "dist .el{0}"'.format(tgtattrs[1])
    else:
        distset = ''

    return distset
1073141
def psd(self):
        
        if not self._psd:
            errMsg = "The PSD has not been set in the metricParameters "
            errMsg += "instance."
            raise ValueError(errMsg)
        return self._psd
406126
function getMyVersion(buildDir) {
  var builds = getBuildFiles(buildDir);
  var chosen = builds[0];

  for (var n=0; n<builds.length; n++) {
    if (semvar.satisfies(getVersion(builds[n]), '<=' + process.versions.node)) chosen = builds[n];
  }

  return require(buildDir + '/' + chosen);
}
1370720
def get_versioned_files(cls):
        """"""
        encoding = cls._get_terminal_encoding()
        output = run(['bzr', 'ls', '-VR'], encoding=encoding)
        return output.splitlines()
1266955
def _fetch_atari_metrics(base_env):
    
    unwrapped = base_env.get_unwrapped()
    if not unwrapped:
        return None
    atari_out = []
    for u in unwrapped:
        monitor = get_wrapper_by_cls(u, MonitorEnv)
        if not monitor:
            return None
        for eps_rew, eps_len in monitor.next_episode_results():
            atari_out.append(RolloutMetrics(eps_len, eps_rew, {}, {}, {}))
    return atari_out
1309603
def version():
    """"""
    with open(os.path.join('curtsies', '__init__.py')) as input_file:
        for line in input_file:
            if line.startswith('__version__'):
                return ast.parse(line).body[0].value.s
719715
function compareVersions(v1, v2) {
    if (semver.gt(v1.tag, v2.tag)) {
        return -1;
    }
    if (semver.lt(v1.tag, v2.tag)) {
        return 1;
    }
    return 0;
}