Returns API version introspected from the service data.

        If the data has been previously accessed, a memoized version of the
        API version is returned.

        :returns: The service's version
        :rtype: string
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
699308
def get_version(cls):
        
        cmd_pieces = [cls.tool, '--version']
        process = Popen(cmd_pieces, stdout=PIPE, stderr=PIPE)
        out, err = process.communicate()
        if err:
            return ''
        else:
            return out.splitlines()[0].strip()
834767
def describe_version(self):
        
        def _vers(client):
            return client.describe_version()

        d = self._connection()
        d.addCallback(_vers)
        return d
1075385
def get_version():
        
        version_desc = open(os.path.join(os.path.abspath(APISettings.VERSION_FILE)))
        version_file = version_desc.read()

        try:
            version = re.search(r"version=['\"]([^'\"]+)['\"]", version_file).group(1)
            return version
        except FileNotFoundError:
            Shell.fail('File not found!')
            raise FileNotFoundError
        except ValueError:
            Shell.fail('Version not found in file ' + version_file + '!')
            raise ValueError
        finally:
            version_desc.close()
1249077
def get_version(self):
        

        ptr = self._get_version_func(self.alpr_pointer)
        version_number = ctypes.cast(ptr, ctypes.c_char_p).value
        version_number = _convert_from_charp(version_number)
        self._free_json_mem_func(ctypes.c_void_p(ptr))
        return version_number
679147
def bll_version(self):
        
        if not self.started():
            return None
        status, data = self._rest.get_request('objects', 'system1',
                                              ['version', 'name'])
        return data['version']
1343776
def determine_version(self, request, api_version=None):
        """"""
        if api_version is False:
            api_version = None
            for version in self.versions:
                if version and "v{0}".format(version) in request.path:
                    api_version = version
                    break

        request_version = set()
        if api_version is not None:
            request_version.add(api_version)

        version_header = request.get_header("X-API-VERSION")
        if version_header:
            request_version.add(version_header)

        version_param = request.get_param('api_version')
        if version_param is not None:
            request_version.add(version_param)

        if len(request_version) > 1:
            raise ValueError('You are requesting conflicting versions')

        return next(iter(request_version or (None, )))
1100022
def version(self):
        """"""
        url: str = get_url("/service/version.json")
        params = {"service": "remote"}
        r = self._request(url=url, params=params)
        return r.json()
585290
def get_versions() -> FileVersionResult:
    

    version_counter = Counter()
    versions_match = False
    version_str = None
    versions_discovered = OrderedDict()

    for version_obj in version_objects:
        discovered = version_obj.get_version()
        versions_discovered[version_obj.key_name] = discovered
        version_counter.update([discovered])

    if len(version_counter) == 1:
        versions_match = True
        version_str = list(version_counter.keys())[0]

    return FileVersionResult(
        uniform=versions_match,
        version_details=versions_discovered,
        version_result=version_str,
    )
1115517
def server_version(self) -> Version:
        """"""
        if self._server_version_cache is None:
            data = self._client.get("/version")
            self._server_version_cache = Version(data["version"])
        return self._server_version_cache
1041288
def _get_ignored_version():
    
    if os.path.exists(filepath):
        with open(filepath) as data_file:
            data = json.load(data_file)
            version = data.get('version')
    else:
        version = None
    return version
1252562
def get_version():
    
    with open('sj.py') as source:
        for node in ast.walk(ast.parse(source.read(), 'sj.py')):
            if node.__class__.__name__ == 'Assign' and \
               node.targets[0].__class__.__name__ == 'Name' and \
               node.targets[0].id == '__version__':
                return node.value.s
1033905
def _get_api_version(self):
        
        url = "{base_url}/api/server_info".format(base_url=self._base_url())
        server_info = self._make_request(url=url, method="get")
        return server_info["latest_api_version"]
1041124
def get_pypi_version():
    
    try:
        response = requests.get(PYPI_URL, timeout=HALF_SECOND_TIMEOUT)
        response.raise_for_status()
        data = response.json()
        version_str = data["info"]["version"]
        return _parse_version_str(version_str)
    except requests.exceptions.ConnectionError:
        raise VersionException(UNABLE_TO_ACCESS_PYPI + " Failed to connect.")
    except requests.exceptions.Timeout:
        raise VersionException(UNABLE_TO_ACCESS_PYPI + " Timeout")
376124
def get_version():
    

    if all([VERSION, UPDATED, any([isinstance(UPDATED, date), isinstance(UPDATED, datetime), ]), ]):

        return FORMAT_STRING.format(**{"version": VERSION, "updated": UPDATED, })
    elif VERSION:

        return VERSION
    elif UPDATED:

        return localize(UPDATED) if any([isinstance(UPDATED, date), isinstance(UPDATED, datetime), ]) else ""
    else:

        return ""
1200934
def version():
    '''
    
    '''
    _false_return = {'result': False,
                     'comment': 'OSQuery version unavailable.'}
    res = _osquery_cmd(table='osquery_info', attrs=['version'])
    if 'result' in res and res['result']:
        if 'data' in res and isinstance(res['data'], list):
            return res['data'][0].get('version', '') or _false_return
    return _false_return
669880
def versions(self):
        
        if not self.__versions:
            self.__versions = Versions(self.__connection)
        return self.__versions