|
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 |
| 28 | +from typing import Annotated, Any, Callable, Dict, List, Literal, Optional, Sequence, Union, _UnionGenericAlias # type: ignore |
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, 14): |
41 | | - # Union[t1, t2] and t1 | t2 both create builtin_types.UnionType, and |
42 | | - # typing._UnionGenericAlias is deprecated. |
43 | | - VersionedUnionType = builtin_types.UnionType |
44 | | - _UNION_TYPES = (typing.Union, builtin_types.UnionType) |
45 | | -else: |
| 40 | +if sys.version_info >= (3, 10): |
46 | 41 | # Supports both Union[t1, t2] and t1 | t2 |
47 | | - VersionedUnionType = Union[builtin_types.UnionType, typing._UnionGenericAlias] # type: ignore |
| 42 | + VersionedUnionType = Union[builtin_types.UnionType, _UnionGenericAlias] |
48 | 43 | _UNION_TYPES = (typing.Union, builtin_types.UnionType) |
| 44 | +else: |
| 45 | + # Supports only Union[t1, t2] |
| 46 | + VersionedUnionType = _UnionGenericAlias |
| 47 | + _UNION_TYPES = (typing.Union,) |
49 | 48 |
|
50 | 49 | _is_pillow_image_imported = False |
51 | 50 | if typing.TYPE_CHECKING: |
|
0 commit comments