Fix nested Annotated calls not resolving

This commit is contained in:
Rapptz committed 2022-08-17 10:41:57 -04:00
1 parent 8dd186cf1e
commit 1c7747fe9d
7 files changed
+70 -18

No files matched your search

-5
View File
@@ -184,11 +184,6 @@ def get_flags(namespace: Dict[str, Any], globals: Dict[str, Any], locals: Dict[s
flag.name = name
annotation = flag.annotation = resolve_annotation(flag.annotation, globals, locals, cache)
if hasattr(annotation, '__metadata__'):
# Annotated[X, Y] can access Y via __metadata__
metadata = annotation.__metadata__
if len(metadata) >= 1:
annotation = flag.annotation = metadata[0]
if flag.default is MISSING and hasattr(annotation, '__commands_is_flag__') and annotation._can_be_constructible():
flag.default = annotation._construct_default