mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
fix: handle non-numeric patch suffixes and support Python 3.15
This commit is contained in:
parent
2cb3d51ddb
commit
af3185edff
1 changed files with 6 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import uuid
|
||||
|
||||
import isort
|
||||
|
|
@ -29,10 +30,13 @@ def parse_python_version(version: str | None) -> tuple[int, int, int]:
|
|||
split_version = version.split(".")
|
||||
if len(split_version) != 3:
|
||||
raise ValueError("Invalid version format")
|
||||
major, minor, patch = int(split_version[0]), int(split_version[1]), int(split_version[2])
|
||||
patch_str = re.match(r"\d+", split_version[2])
|
||||
if not patch_str:
|
||||
raise ValueError("Invalid patch version")
|
||||
major, minor, patch = int(split_version[0]), int(split_version[1]), int(patch_str.group())
|
||||
assert major == 3, "Only Python 3 is supported"
|
||||
assert minor >= 9, "Only Python 3.9 and above is supported"
|
||||
assert minor <= 14, "Unsupported Python version"
|
||||
assert minor <= 15, "Unsupported Python version"
|
||||
assert patch >= 0, "Only Python 3.9 and above is supported"
|
||||
assert patch < 100, "Invalid version format"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue