/usr/lib/python3/dist-packages/asyncpg/serverversion.py is in python3-asyncpg 0.8.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # Copyright (C) 2016-present the ayncpg authors and contributors
# <see AUTHORS file>
#
# This module is part of asyncpg and is released under
# the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0
from . import types
def split_server_version_string(version_string):
version_string = version_string.strip()
if version_string.startswith('PostgreSQL '):
version_string = version_string[len('PostgreSQL '):]
parts = version_string.strip().split('.')
if not parts[-1].isdigit():
# release level specified
level = parts[-1].rstrip('0123456789').lower()
serial = parts[-1][level:]
versions = [int(p) for p in parts[:-1]][:3]
else:
level = 'final'
serial = 0
versions = [int(p) for p in parts][:3]
if len(versions) < 3:
versions += [0] * (3 - len(versions))
versions.append(level)
versions.append(serial)
return types.ServerVersion(*versions)
|