@@ -601,9 +601,8 @@ def _read_yields_section(
601
601
else :
602
602
# try to retrieve the annotation from the docstring parent
603
603
with suppress (AttributeError , IndexError , KeyError , ValueError ):
604
- annotation = docstring .parent .annotation # type: ignore[union-attr]
605
604
annotation = _maybe_destructure_annotation (
606
- _unpack_generators (annotation , 0 , mandatory = True ),
605
+ _unpack_generators (docstring . parent . annotation , 0 , mandatory = True ), # type: ignore[union-attr]
607
606
index ,
608
607
multiple = returns_multiple_items ,
609
608
)
@@ -650,10 +649,9 @@ def _read_receives_section(
650
649
annotation = parse_docstring_annotation (annotation , docstring )
651
650
else :
652
651
# try to retrieve the annotation from the docstring parent
653
- with suppress (AttributeError , KeyError ):
654
- annotation = docstring .parent .returns # type: ignore[union-attr]
652
+ with suppress (AttributeError , IndexError , KeyError , ValueError ):
655
653
annotation = _maybe_destructure_annotation (
656
- _unpack_generators (annotation , 1 , mandatory = True ),
654
+ _unpack_generators (docstring . parent . returns , 1 , mandatory = True ), # type: ignore[union-attr]
657
655
index ,
658
656
multiple = receives_multiple_items ,
659
657
)
0 commit comments