latest non-preview api version for resource
493183
def resource_api_version(self, resource_id):
        

        namespace = ResourceIdParser.get_namespace(resource_id)
        resource_type = ResourceIdParser.get_resource_type(resource_id)

        cache_id = namespace + resource_type

        if cache_id in self._provider_cache:
            return self._provider_cache[cache_id]

        resource_client = self.client('azure.mgmt.resource.ResourceManagementClient')
        provider = resource_client.providers.get(namespace)

        rt = next((t for t in provider.resource_types
            if StringUtils.equal(t.resource_type, resource_type)), None)

        if rt and rt.api_versions:
            versions = [v for v in rt.api_versions if 'preview' not in v.lower()]
            api_version = versions[0] if versions else rt.api_versions[0]
            self._provider_cache[cache_id] = api_version
            return api_version
523617
def preview_page_version(request, revision_id):
    
    revision = get_object_or_404(PageRevision, pk=revision_id)

    if not revision.page.permissions_for_user(request.user).can_publish():
        raise PermissionDenied

    page                = revision.as_page_object()
    request.revision_id = revision_id

    return page.serve_preview(request, page.default_preview_mode)
837461
def determine_api_version(new_file_content: nil, old_file_content: nil)
      # we know 100% there is a difference, so no need to compare
      unless old_file_content.length >= new_file_content.length
        old_api_version = find_api_version_string(content: old_file_content)

        return DEFAULT_API_VERSION_STRING if old_api_version.nil?

        return increment_api_version_string(api_version_string: old_api_version)
      end

      relevant_old_file_content = old_file_content[0..(new_file_content.length - 1)]

      if relevant_old_file_content == new_file_content
        # no changes at all, just return the same old api version string
        return find_api_version_string(content: old_file_content)
      else
        # there are differences, so calculate a new api_version_string
        old_api_version = find_api_version_string(content: old_file_content)

        return DEFAULT_API_VERSION_STRING if old_api_version.nil?

        return increment_api_version_string(api_version_string: old_api_version)
      end
    end
262573
def get_version_text(self):
        """"""
        try:
            version_text = self.device.send('uname -sr', timeout=10)
        except CommandError:
            self.log("Non Unix jumphost type detected")
            return None
            raise ConnectionError("Non Unix jumphost type detected.")
        return version_text
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
617310
def get_api_versions(call=None, kwargs=None):  # pylint: disable=unused-argument
    '''
    
    '''
    if kwargs is None:
        kwargs = {}

    if 'resource_provider' not in kwargs:
        raise SaltCloudSystemExit(
            'A resource_provider must be specified'
        )

    if 'resource_type' not in kwargs:
        raise SaltCloudSystemExit(
            'A resource_type must be specified'
        )

    api_versions = []

    try:
        resconn = get_conn(client_type='resource')
        provider_query = resconn.providers.get(
            resource_provider_namespace=kwargs['resource_provider']
        )

        for resource in provider_query.resource_types:
            if six.text_type(resource.resource_type) == kwargs['resource_type']:
                resource_dict = resource.as_dict()
                api_versions = resource_dict['api_versions']
    except CloudError as exc:
        __utils__['azurearm.log_cloud_error']('resource', exc.message)

    return api_versions
128816
def api_version(self, verbose=False):
        '''
        
        '''
        return self.__auth_req_get(self.rest_url, verbose=verbose)
146182
def available_api_versions(base_url, timeout=10, verify=True):
    
    try:
        r = requests.get('%s/api' % base_url, timeout=timeout,
                         verify=verify)  # no session required
        
        if r.status_code == 200:
            j = json.loads(r.text)
            versions = []
            for version in j['version']:
                versions.append(version['rel'])
            return versions
        
        raise SMCConnectionError(
            'Invalid status received while getting entry points from SMC. '
            'Status code received %s. Reason: %s' % (r.status_code, r.reason))

    except requests.exceptions.RequestException as e:
        raise SMCConnectionError(e)
273444
def versions(ctx, archive_name):
    '''
    
    '''

    _generate_api(ctx)

    var = ctx.obj.api.get_archive(archive_name)
    click.echo(pprint.pformat(map(str, var.get_versions())))
1068447
private static String getVersion() {
        Properties properties = new Properties();
        try (InputStream ins = HttpRosetteAPI.class.getClassLoader().getResourceAsStream("version.properties")) {
            properties.load(ins);
        } catch (IOException e) {
            // should not happen
        }
        return properties.getProperty("version", "undefined");
    }
802777
def version():
    
    click.echo(
        click.style(
            "F.A.B Version: {0}.".format(current_app.appbuilder.version),
            bg="blue",
            fg="white"
        )
    )
426637
def api_version(self):
        
        # Lean on the cache first.
        if self._api_version is not None:
            return self._api_version

        # We don't have a cache. Build it.
        self._api_version = self._introspect_api_version(
            self.session.core_session,
            self.service_name
        )
        return self._api_version
24390
def _check_rest_version(self, version):
        """"""
        version = str(version)

        if version not in self.supported_rest_versions:
            msg = "Library is incompatible with REST API version {0}"
            raise ValueError(msg.format(version))

        array_rest_versions = self._list_available_rest_versions()
        if version not in array_rest_versions:
            msg = "Array is incompatible with REST API version {0}"
            raise ValueError(msg.format(version))

        return LooseVersion(version)
1314474
@Override
    public void checkVersion() throws IOException {
        ESVersion esVersion = getVersion();
        if (esVersion.major != compatibleVersion()) {
            throw new RuntimeException("The Elasticsearch client version [" +
                    compatibleVersion() + "] is not compatible with the Elasticsearch cluster version [" +
                    esVersion.toString() + "].");
        }
        if (esVersion.minor < 4) {
            throw new RuntimeException("This version of FSCrawler is not compatible with " +
                    "Elasticsearch version [" +
                    esVersion.toString() + "]. Please upgrade Elasticsearch to at least a 6.4.x version.");
        }
    }
252478
def versions_request(self):
        """"""
        ret = self.handle_api_exceptions('GET', '', api_ver='')
        return [str_dict(x) for x in ret.json()]
1167419
private Response assertOutdatedStatus(boolean outdated) throws JSONException {
        Response response = httpGet("keys/" + keyName);
        JSONObject actual = new JSONObject(response.asString());
        Assertions.assertThat(actual.getBoolean("outdated")).isEqualTo(outdated);
        return response;
    }
1055639
def my_version():
    """"""
    if os.path.exists(resource_filename(__name__, 'version')):
        return resource_string(__name__, 'version')

    return open(os.path.join(os.path.dirname(__file__),
                             "..", "version")).read()