|
25 | 25 | import sys |
26 | 26 | import types as builtin_types |
27 | 27 | import typing |
28 | | -from typing import Annotated, Any, Callable, Dict, List, Literal, Optional, Sequence, Union, _UnionGenericAlias # type: ignore |
| 28 | +from typing import Annotated, Any, Callable, Dict, List, Literal, Optional, Sequence, Union |
29 | 29 | import pydantic |
30 | 30 | from pydantic import ConfigDict, Field, PrivateAttr, WrapValidator, model_validator |
31 | 31 | from typing_extensions import Self, TypedDict |
|
37 | 37 | _UploadToFileSearchStoreOperation_from_mldev, |
38 | 38 | ) |
39 | 39 |
|
40 | | -if sys.version_info >= (3, 10): |
41 | | - # Supports both Union[t1, t2] and t1 | t2 |
42 | | - VersionedUnionType = Union[builtin_types.UnionType, _UnionGenericAlias] |
| 40 | +if sys.version_info >= (3, 14): |
| 41 | + # Union[t1, t2] and t1 | t2 both create builtin_types.UnionType, and |
| 42 | + # typing._UnionGenericAlias is deprecated. |
| 43 | + VersionedUnionType = builtin_types.UnionType |
43 | 44 | _UNION_TYPES = (typing.Union, builtin_types.UnionType) |
44 | 45 | else: |
45 | | - # Supports only Union[t1, t2] |
46 | | - VersionedUnionType = _UnionGenericAlias |
47 | | - _UNION_TYPES = (typing.Union,) |
| 46 | + # Supports both Union[t1, t2] and t1 | t2 |
| 47 | + VersionedUnionType = Union[builtin_types.UnionType, typing._UnionGenericAlias] # type: ignore |
| 48 | + _UNION_TYPES = (typing.Union, builtin_types.UnionType) |
48 | 49 |
|
49 | 50 | _is_pillow_image_imported = False |
50 | 51 | if typing.TYPE_CHECKING: |
|
0 commit comments