MCPcopy Index your code
hub / github.com/MagicStack/asyncpg / _get_pg_version

Method _get_pg_version

asyncpg/cluster.py:601–620  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

599 return bpath
600
601 def _get_pg_version(self):
602 process = subprocess.run(
603 [self._postgres, '--version'],
604 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
605 stdout, stderr = process.stdout, process.stderr
606
607 if process.returncode != 0:
608 raise ClusterError(
609 'postgres --version exited with status {:d}: {}'.format(
610 process.returncode, stderr))
611
612 version_string = stdout.decode('utf-8').strip(' \n')
613 prefix = 'postgres (PostgreSQL) '
614 if not version_string.startswith(prefix):
615 raise ClusterError(
616 'could not determine server version from {!r}'.format(
617 version_string))
618 version_string = version_string[len(prefix):]
619
620 return serverversion.split_server_version_string(version_string)
621
622
623class TempCluster(Cluster):

Callers 1

_init_envMethod · 0.95

Calls 2

ClusterErrorClass · 0.85
runMethod · 0.80

Tested by

no test coverage detected