Get the uploaded VCL for a particular service and version with HTML syntax highlighting.
17992
def get_vcl_html(self, service_id, version_number, name):
		""""""
		content = self._fetch("/service/%s/version/%d/vcl/%s/content" % (service_id, version_number, name))
		return content.get("content", None)
889928
def get_online_version ():
    """"""
    session = requests.session()
    page = urlopen(UPDATE_URL, session)
    version, url = None, None
    for line in page.text.splitlines():
        if line.startswith(VERSION_TAG):
            version = line.split(':', 1)[1].strip()
        elif line.startswith(URL_TAG):
            url = line.split(':', 1)[1].strip()
            url = url.replace('${version}', version)
    return version, url
1033840
private static String getVersionFromVerFile() throws IOException {
        //declared in a try-with-resource statement, it will be closed regardless of it completes normally or not
        try (BufferedReader br = new BufferedReader(new InputStreamReader(DoradusServer.class.getResourceAsStream("/" + VERSION_FILE), "UTF-8"))) {
            return br.readLine();
        }

    }
714919
def get_version(version=None):
    """"""
    if version is None:
        version = VERSION
    assert len(version) == 5
    assert version[3] in ('alpha', 'beta', 'rc', 'final')

    # Now build the two parts of the version number:
    # main = X.Y[.Z]
    # sub = .devN - for pre-alpha releases
    #     | {a|b|c}N - for alpha, beta and rc releases

    parts = 2 if version[2] == 0 else 3
    main = '.'.join(str(x) for x in version[:parts])

    sub = ''
    if version[3] == 'alpha' and version[4] == 0:
        # At the toplevel, this would cause an import loop.
        from django.utils.version import get_svn_revision
        svn_revision = get_svn_revision()[4:]
        if svn_revision != 'unknown':
            sub = '.dev%s' % svn_revision

    elif version[3] != 'final':
        mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
        sub = mapping[version[3]] + str(version[4])

    return main + sub
1341584
def get_version(package, url_pattern=URL_PATTERN):
    """"""
    req = requests.get(url_pattern.format(package=package))
    version = parse('0')
    if req.status_code == requests.codes.ok:
        # j = json.loads(req.text.encode(req.encoding))
        j = req.json()
        releases = j.get('releases', [])
        for release in releases:
            ver = parse(release)
            if not ver.is_prerelease:
                version = max(version, ver)
    return version
820381
function getVersionInfo(machineName, versionKey) {
        let route = getVersionInfoRoute(machineName, versionKey);
        return jsonfile.readFileSync(repositoryPath + "/" + route);
    }
771895
function getVersionSCXML(machineName, versionKey) {
        let route = getVersionModelRoute(machineName, versionKey);
        return fs.readFileSync(repositoryPath + "/" + route).toString('utf8');
    }
1216148
def service(ctx, opts):
    """"""
    click.echo("Retrieving service status ... ", nl=False)

    context_msg = "Failed to retrieve status!"
    with handle_api_exceptions(ctx, opts=opts, context_msg=context_msg):
        with maybe_spinner(opts):
            status, version = get_status(with_version=True)

    click.secho("OK", fg="green")

    config = cloudsmith_api.Configuration()

    click.echo()
    click.echo(
        "The service endpoint is: %(endpoint)s"
        % {"endpoint": click.style(config.host, bold=True)}
    )
    click.echo(
        "The service status is:   %(status)s"
        % {"status": click.style(status, bold=True)}
    )
    click.echo(
        "The service version is:  %(version)s "
        % {"version": click.style(version, bold=True)},
        nl=False,
    )

    api_version = get_api_version_info()

    if semver.compare(version, api_version) > 0:
        click.secho("(maybe out-of-date)", fg="yellow")

        click.echo()
        click.secho(
            "The API library used by this CLI tool is built against "
            "service version: %(version)s"
            % {"version": click.style(api_version, bold=True)},
            fg="yellow",
        )
    else:
        click.secho("(up-to-date)", fg="green")

        click.echo()
        click.secho(
            "The API library used by this CLI tool seems to be up-to-date.", fg="green"
        )
537205
def update_vcl(self, service_id, version_number, name_key, **kwargs):
		""""""
		body = self._formdata(kwargs, FastlyVCL.FIELDS)
		content = self._fetch("/service/%s/version/%d/vcl/%s" % (service_id, version_number, name_key), method="PUT", body=body)
		return FastlyVCL(self, content)
31432
def list_vcls(self, service_id, version_number):
		""""""
		content = self._fetch("/service/%s/version/%d/vcl" % (service_id, version_number))
		return map(lambda x: FastlyVCL(self, x), content)
1207022
def upload_vcl(self, service_id, version_number, name, content, main=None, comment=None):
		""""""
		body = self._formdata({
			"name": name,
			"content": content,
			"comment": comment,
			"main": main,
		}, FastlyVCL.FIELDS)
		content = self._fetch("/service/%s/version/%d/vcl" % (service_id, version_number), method="POST", body=body)
		return FastlyVCL(self, content)
1157290
def get_version(file_name='beautysh/__init__.py'):
    """"""
    with open(file_name) as v_file:
        for line in v_file:
            if "__version__" in line:
                return eval(line.split('=')[-1])
127536
def get_version(*args):
    """"""
    contents = get_contents(*args)
    metadata = dict(re.findall('__([a-z]+)__ = [\'"]([^\'"]+)', contents))
    return metadata['version']
1059337
def svn_versions_from_vcs(tag_prefix, root, verbose=False):
    

    if not os.path.exists(os.path.join(root, '.svn')):
        if verbose:
            print("no .svn in %s." % root)
        return {}

    current_module = sys.modules[__name__]

    # If we're running from _version.py .
    tag_url = getattr(current_module, 'svn_tag_url', None)
    
    # If we're running from versioneer.py .
    if tag_url is None:
        vcs_settings = getattr(current_module, 'vcs_settings', None)
        if vcs_settings is not None and \
           'svn' in vcs_settings and \
           'tag_url' in vcs_settings['svn']:
            tag_url = vcs_settings['svn']['tag_url']

    if tag_url is None:
        raise ValueError("Please define VCS-specific 'tag_url' setting for "
                         "'svn' within 'versioneer'.")

    svn_commands = ['svn']
    info_xml = run_command(svn_commands, ['ls', '--xml', tag_url], cwd=root)
# TODO(dustin): This should raise an EnvironmentError upon failure.
    if info_xml is None:
        print("Error accessing Subversion for latest version.")
        return {}

    (releases, latest_revision) = svn_parse_tag_xml(info_xml)

    release_info = releases[latest_revision]
    release_name = release_info['name']
    versions = { 'default': release_name, 
                 'version': release_name, 
                 'full': release_name }

# Examples of strings returned by Git.
#
#    versions["closest_tag"]
#    versions["distance"]
#    versions["short_revisionid"]
#    versions["dirty"]
#    versions["pep440"]
#    versions["describe"]
#    versions["default"]
#    versions["dash_dirty"]
#    versions["closest_tag_or_zero"]
#    versions["dash_distance"]

    return versions
1281906
def version(request):
    
    version_json = import_string(version_callback)(settings.BASE_DIR)
    if version_json is None:
        return HttpResponseNotFound('version.json not found')
    else:
        return JsonResponse(version_json)
1370892
function getVcl(conf) {
  const config = _.extend({
    version: new Date().toISOString(),
    timeout: defaultTimeout,
    urlPassList: ['cache-control=no-cache'],
    hash: [
      'req.url',
      [
        'req.http.host',
        'server.ip',
      ],
    ],
    hisForPassTTL: 120,
  }, conf);
  /* istanbul ignore if */
  if (!config.directors || !config.name) {
    throw new Error('directors, name can not be null');
  }
  if (!config.directors.length) {
    throw new Error('directors can not be empty');
  }
  if (config.name === '$HOSTNAME') {
    config.name = os.hostname();
  } else if (config.name[0] === '$') {
    config.name = process.env[config.name.substring(1)];
  }
  _.forEach(config.directors, (item) => {
    if (!item.timeout) {
      /* eslint no-param-reassign:0 */
      item.timeout = config.timeout;
    }
    if (item.type === 'shard') {
      throw new Error('shard director is not support');
    }
  });
  const cloneConfig = _.extend({
    stale: 3,
    varnish: '5',
    hashConfig: getHash(config.hash),
    passRules: getPassRules(config.urlPassList),
  }, config);
  return getConfig(cloneConfig.directors).then((data) => {
    _.extend(cloneConfig, data);
    return readFilePromise(path.join(__dirname, 'template/varnish.tpl'));
  }).then(tpl => _.template(tpl)(cloneConfig));
}
1372623
def _version_view(self):
        
        version_json = self._version_callback(self.version_path)
        if version_json is None:
            return 'version.json not found', 404
        else:
            return jsonify(version_json)