Return the version of a Postgres server.

    CLI Example:

    .. code-block:: bash

        salt '*' postgres.version
164881
def version(user=None, host=None, port=None, maintenance_db=None,
            password=None, runas=None):
    '''
    
    '''
    query = 'SELECT setting FROM pg_catalog.pg_settings ' \
            'WHERE name = \'server_version\''
    cmd = _psql_cmd('-c', query,
                    '-t',
                    host=host,
                    user=user,
                    port=port,
                    maintenance_db=maintenance_db,
                    password=password)
    ret = _run_psql(
        cmd, runas=runas, password=password, host=host, port=port, user=user)

    for line in salt.utils.itertools.split(ret['stdout'], '\n'):
        # Just return the first line
        return line
614063
def get_version
      response = get_json_response(build_request_url('getVersion'))
      response.trim(:getVersionResponse)
      if response.response.has_key?('version')
        response.results = response.response['version']
      end
      return response
    end
641369
def get_version(self):
        # type: () -> str
        
        # Get the version value
        version = getattr(self.__module, "__version__", None)
        if version:
            return version

        # Convert the __version_info__ entry
        info = getattr(self.__module, "__version_info__", None)
        if info:
            return ".".join(str(part) for part in __version_info__)

        # No version
        return "0.0.0"
484005
def version(cls):  # noqa: N805  # pylint: disable=no-self-argument
        
        return cls._version_ or getattr(sys.modules.get(cls.__module__, None),
                                        '__version__', None)
155204
def get_pyserial_version(self):
        
        pyserial_version = pkg_resources.require("pyserial")[0].version
        version = 3.0
        match = self.re_float.search(pyserial_version)
        if match:
            try:
                version = float(match.group(0))
            except ValueError:
                version = 3.0   # We will assume you've got latest (3.0+)
        return version
337673
def check_version(version):
    

    if isinstance(version, string_types):
        version = tuple(map(int, version.split(".")))

    if version > version_info:
        str_version = ".".join(map(str, version))
        raise ValueError("pgi version '%s' requested, '%s' available" %
                         (str_version, __version__))
59685
def Version():
    
    version = ''
    try:
        version = pkg_resources.require('vent')[0].version
        if not version.startswith('v'):
            version = 'v' + version
    except Exception as e:  # pragma: no cover
        version = 'Error: ' + str(e)
    return version
33101
def _get_version(prog, path):
        ''''''
        assert prog in prog_to_version_cmd
        args, regex = prog_to_version_cmd[prog]
        cmd = path + ' ' + args
        if prog == 'spades':
            cmd_output = subprocess.Popen(['python3', path, args], shell=False, stdout=subprocess.PIPE,
                                          stderr=subprocess.PIPE).communicate()
        else:
            cmd_output = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()

        cmd_output = common.decode(cmd_output[0]).split('\n')[:-1] + common.decode(cmd_output[1]).split('\n')[:-1]

        for line in cmd_output:
            hits = regex.search(line)
            if hits:
                return True, hits.group(1)

        return False, 'I tried to get the version of ' + prog + ' with: "' + cmd + '" and the output didn\'t match this regular expression: "' + regex.pattern + '"'
1322542
def version(self):
        
        branches = self.branches()
        if self.info['branch'] == branches.sandbox:
            try:
                return self.software_version()
            except Exception as exc:
                raise utils.CommandError(
                    'Could not obtain repo version, do you have a makefile '
                    'with version entry?\n%s' % exc
                )
        else:
            branch = self.info['branch'].lower()
            branch = re.sub('[^a-z0-9_-]+', '-', branch)
            return f"{branch}-{self.info['head']['id'][:8]}"
458172
def version(self, conn):
        

        command = b'version\r\n'
        response = yield from self._execute_simple_command(
            conn, command)
        if not response.startswith(const.VERSION):
            raise ClientException('Memcached version failed', response)
        version, number = response.split()
        return number
685047
def get_version():
    
    try:
        f = open('version.txt')
    except IOError:
        os.system("./version.sh > version.txt")
        f = open('version.txt')
    version = ''.join(f.readlines()).rstrip()
    f.close()
    return version
968857
def get_package_version(self):
        
        output = subprocess.check_output([
            '{}'.format(self.python),
            'setup.py',
            '--version',
        ]).decode()
        return output.rstrip()
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
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
59435
def chocolatey_version():
    '''
    
    '''
    if 'chocolatey._version' in __context__:
        return __context__['chocolatey._version']

    cmd = [_find_chocolatey(__context__, __salt__)]
    cmd.append('-v')
    out = __salt__['cmd.run'](cmd, python_shell=False)
    __context__['chocolatey._version'] = out

    return __context__['chocolatey._version']
98595
def get_version(dev_version=False):
    
    if dev_version:
        version = git_dev_version()
        if not version:
            raise RuntimeError("Could not generate dev version from git.")

        return version

    return "1!%d.%d" % (MAJOR, MINOR)
208385
def get_version(self):
        
        return Version.objects.get(
            content_type=self.content_type,
            object_id=self.object_id,
            version_number=self.publish_version,
        )