|
11 | 11 | from datetime import date
|
12 | 12 | from enum import Enum
|
13 | 13 | from functools import cache
|
14 |
| -from typing import TYPE_CHECKING, Annotated, Generic, Union, cast |
| 14 | +from typing import ( |
| 15 | + TYPE_CHECKING, |
| 16 | + Annotated, |
| 17 | + Generic, |
| 18 | + Union, |
| 19 | + _BaseGenericAlias, # pyright: ignore[reportAttributeAccessIssue] |
| 20 | + cast, |
| 21 | +) |
15 | 22 |
|
16 | 23 | import fastapi.params
|
17 | 24 | import fastapi.security.base
|
|
79 | 86 | from cadwyn.structure.versions import HeadVersion, Version, VersionBundle
|
80 | 87 |
|
81 | 88 |
|
82 |
| -if sys.version_info >= (3, 10): |
83 |
| - from typing import _BaseGenericAlias # pyright: ignore[reportAttributeAccessIssue] |
84 |
| -else: |
85 |
| - from typing_extensions import _BaseGenericAlias # pyright: ignore[reportAttributeAccessIssue] |
86 |
| - |
87 | 89 | _Call = TypeVar("_Call", bound=Callable[..., Any])
|
88 | 90 |
|
89 | 91 | _FieldName: TypeAlias = str
|
@@ -584,7 +586,7 @@ def migrate_route_to_version(self, route: fastapi.routing.APIRoute, *, ignore_re
|
584 | 586 | def _change_version_of_a_non_container_annotation(self, annotation: Any) -> Any:
|
585 | 587 | from typing_inspection.typing_objects import is_any, is_newtype, is_typealiastype
|
586 | 588 |
|
587 |
| - if isinstance(annotation, (_BaseGenericAlias, types.GenericAlias)): |
| 589 | + if isinstance(annotation, (types.GenericAlias, _BaseGenericAlias)): |
588 | 590 | return get_origin(annotation)[tuple(self.change_version_of_annotation(arg) for arg in get_args(annotation))]
|
589 | 591 | elif is_typealiastype(annotation):
|
590 | 592 | if (
|
|
0 commit comments