aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhalcy <halcy@ARARAGI-KUN>2022-11-30 19:33:09 +0200
committerhalcy <halcy@ARARAGI-KUN>2022-11-30 19:33:09 +0200
commit53cb42117bd99653f6f86280011cd25299356889 (patch)
tree872bcdcf718fc3925b21eabc5af2d55e5b5ad288 /mastodon
parent245343835383e7ac597c90fdb3201921ee0de8ad (diff)
downloadmastodon.py-53cb42117bd99653f6f86280011cd25299356889.tar.gz
Switch back to previous version parser
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py10
1 files 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:
69 69
70def parse_version_string(version_string): 70def parse_version_string(version_string):
71 """Parses a semver version string, stripping off "rc" stuff if present.""" 71 """Parses a semver version string, stripping off "rc" stuff if present."""
72 return tuple(int(x) for x in re.findall(r"\d+", version_string))[:3] 72 string_parts = version_string.split(".")
73 73 version_parts = (
74 int(re.match("([0-9]*)", string_parts[0]).group(0)),
75 int(re.match("([0-9]*)", string_parts[1]).group(0)),
76 int(re.match("([0-9]*)", string_parts[2]).group(0))
77 )
78 return version_parts
74 79
75def max_version(*version_strings): 80def max_version(*version_strings):
76 """Returns the maximum version of all provided version strings.""" 81 """Returns the maximum version of all provided version strings."""
77 return max(version_strings, key=parse_version_string) 82 return max(version_strings, key=parse_version_string)
78 83
79
80def api_version(created_ver, last_changed_ver, return_value_ver): 84def api_version(created_ver, last_changed_ver, return_value_ver):
81 """Version check decorator. Currently only checks Bigger Than.""" 85 """Version check decorator. Currently only checks Bigger Than."""
82 def api_min_version_decorator(function): 86 def api_min_version_decorator(function):
Powered by cgit v1.2.3 (git 2.41.0)