From 53cb42117bd99653f6f86280011cd25299356889 Mon Sep 17 00:00:00 2001 From: halcy Date: Wed, 30 Nov 2022 19:33:09 +0200 Subject: Switch back to previous version parser --- mastodon/Mastodon.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 18171e7..2074224 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -69,14 +69,18 @@ except: def parse_version_string(version_string): """Parses a semver version string, stripping off "rc" stuff if present.""" - return tuple(int(x) for x in re.findall(r"\d+", version_string))[:3] - + string_parts = version_string.split(".") + version_parts = ( + int(re.match("([0-9]*)", string_parts[0]).group(0)), + int(re.match("([0-9]*)", string_parts[1]).group(0)), + int(re.match("([0-9]*)", string_parts[2]).group(0)) + ) + return version_parts def max_version(*version_strings): """Returns the maximum version of all provided version strings.""" return max(version_strings, key=parse_version_string) - def api_version(created_ver, last_changed_ver, return_value_ver): """Version check decorator. Currently only checks Bigger Than.""" def api_min_version_decorator(function): -- cgit v1.2.3