Skip to content

Commit 7f949b3

Browse files
authored
fix(typing): Remove usage of private _AnnotatedAlias (#4126)
Remove usage of private _AnnotatedAlias
1 parent 72ee19c commit 7f949b3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

litestar/utils/predicates.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@
2424
Set,
2525
Tuple,
2626
TypeVar,
27+
get_origin,
2728
)
2829

2930
from typing_extensions import (
31+
Annotated,
3032
ParamSpec,
3133
TypeGuard,
32-
_AnnotatedAlias,
3334
get_args,
3435
)
3536

@@ -290,7 +291,7 @@ def is_annotated_type(annotation: Any) -> bool:
290291
Returns:
291292
A boolean.
292293
"""
293-
return isinstance(annotation, _AnnotatedAlias) and getattr(annotation, "__args__", None) is not None
294+
return get_origin(annotation) is Annotated
294295

295296

296297
def is_undefined_sentinel(value: Any) -> bool:

0 commit comments

Comments
 (0)