add gemini minimal python version warning

This commit is contained in:
better629 2023-12-21 14:18:50 +08:00
parent f3eb9f638e
commit bdb427d5b7
3 changed files with 14 additions and 3 deletions

View file

@ -19,6 +19,7 @@ import json
import os
import platform
import re
import sys
import traceback
import typing
from pathlib import Path
@ -47,6 +48,12 @@ def check_cmd_exists(command) -> int:
return result
def require_python_version(req_version: tuple[int]) -> bool:
if not (2 <= len(req_version) <= 3):
raise ValueError("req_version should be (3, 9) or (3, 10, 13)")
return True if sys.version_info > req_version else False
class OutputParser:
@classmethod
def parse_blocks(cls, text: str):
@ -219,7 +226,7 @@ class OutputParser:
if start_index != -1 and end_index != -1:
# Extract the structure part
structure_text = text[start_index : end_index + 1]
structure_text = text[start_index: end_index + 1]
try:
# Attempt to convert the text to a Python data type using ast.literal_eval