chore: bump minimum supported Python version to 3.11 (#10386)

This commit is contained in:
Bowen Liang 2024-11-24 13:28:46 +08:00 committed by GitHub
commit 6c8e208ef3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
81 changed files with 271 additions and 300 deletions

View file

@ -1,7 +1,7 @@
import json
from collections.abc import Mapping
from copy import deepcopy
from datetime import datetime, timezone
from datetime import UTC, datetime
from mimetypes import guess_type
from typing import Any, Optional, Union
@ -158,7 +158,7 @@ class ToolEngine:
"""
Invoke the tool with the given arguments.
"""
started_at = datetime.now(timezone.utc)
started_at = datetime.now(UTC)
meta = ToolInvokeMeta(
time_cost=0.0,
error=None,
@ -176,7 +176,7 @@ class ToolEngine:
meta.error = str(e)
raise ToolEngineInvokeError(meta)
finally:
ended_at = datetime.now(timezone.utc)
ended_at = datetime.now(UTC)
meta.time_cost = (ended_at - started_at).total_seconds()
return meta, response