MCPcopy Index your code
hub / github.com/piccolo-orm/piccolo / _parse_raw_version_string

Method _parse_raw_version_string

piccolo/engine/postgres.py:387–397  ·  view source on GitHub ↗

The format of the version string isn't always consistent. Sometimes it's just the version number e.g. '9.6.18', and sometimes it contains specific build information e.g. '12.4 (Ubuntu 12.4-0ubuntu0.20.04.1)'. Just extract the major and minor version numbers.

(version_string: str)

Source from the content-addressed store, hash-verified

385
386 @staticmethod
387 def _parse_raw_version_string(version_string: str) -> float:
388 """
389 The format of the version string isn't always consistent. Sometimes
390 it's just the version number e.g. '9.6.18', and sometimes
391 it contains specific build information e.g.
392 '12.4 (Ubuntu 12.4-0ubuntu0.20.04.1)'. Just extract the major and
393 minor version numbers.
394 """
395 version_segment = version_string.split(" ")[0]
396 major, minor = version_segment.split(".")[:2]
397 return float(f"{major}.{minor}")
398
399 async def get_version(self) -> float:
400 """

Callers 2

get_versionMethod · 0.95
test_version_parsingMethod · 0.80

Calls

no outgoing calls

Tested by 1

test_version_parsingMethod · 0.64