Update deprecated Python 3.8 typing (#13971)
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
import ast
|
||||
import json
|
||||
import re
|
||||
from typing import Any, Sequence, Tuple, Union
|
||||
from collections.abc import Sequence
|
||||
from typing import Any, Union
|
||||
|
||||
from transformers import PreTrainedTokenizerBase
|
||||
|
||||
@@ -204,7 +205,7 @@ def _handle_single_tool(call: ast.Call) -> ToolCall:
|
||||
arguments=json.dumps(arguments)))
|
||||
|
||||
|
||||
def _make_valid_python(text: str) -> Union[Tuple[str, str], None]:
|
||||
def _make_valid_python(text: str) -> Union[tuple[str, str], None]:
|
||||
bracket_stack = []
|
||||
for index, char in enumerate(text):
|
||||
if char in {"[", "(", "{"}:
|
||||
|
||||
Reference in New Issue
Block a user