@@ -124,12 +124,12 @@ def _other_parameters_docs(func: Function, **kwargs: Any) -> DocstringSectionPar
124124 "typing.Annotated" ,
125125 "typing_extensions.Annotated" ,
126126 }:
127- annotation = annotation .slice .elements [0 ] # type: ignore[attr-defined ]
127+ annotation = annotation .slice .elements [0 ] # type: ignore[union-attr ]
128128 if isinstance (annotation , ExprSubscript ) and annotation .canonical_path in {
129129 "typing.Unpack" ,
130130 "typing_extensions.Unpack" ,
131131 }:
132- slice_path = annotation .slice .canonical_path
132+ slice_path = annotation .slice .canonical_path # type: ignore[union-attr]
133133 typed_dict = func .modules_collection [slice_path ]
134134 params_doc = {
135135 attr .name : {"annotation" : attr .annotation , "description" : _metadata (attr .annotation ).get ("doc" , "" )}
@@ -149,13 +149,13 @@ def _yields_docs(func: Function, **kwargs: Any) -> DocstringSectionYields | None
149149
150150 if isinstance (annotation , ExprSubscript ):
151151 if annotation .canonical_path in {"typing.Generator" , "typing_extensions.Generator" }:
152- yield_annotation = annotation .slice .elements [0 ] # type: ignore[attr-defined ]
152+ yield_annotation = annotation .slice .elements [0 ] # type: ignore[union-attr ]
153153 elif annotation .canonical_path in {"typing.Iterator" , "typing_extensions.Iterator" }:
154154 yield_annotation = annotation .slice
155155
156156 if yield_annotation :
157157 if isinstance (yield_annotation , ExprSubscript ) and yield_annotation .is_tuple :
158- yield_elements = yield_annotation .slice .elements # type: ignore[attr-defined ]
158+ yield_elements = yield_annotation .slice .elements # type: ignore[union-attr ]
159159 else :
160160 yield_elements = [yield_annotation ]
161161 yields_section = _to_yields_section ({"annotation" : element , ** _metadata (element )} for element in yield_elements )
@@ -173,11 +173,11 @@ def _receives_docs(func: Function, **kwargs: Any) -> DocstringSectionReceives |
173173 "typing.Generator" ,
174174 "typing_extensions.Generator" ,
175175 }:
176- receive_annotation = annotation .slice .elements [1 ] # type: ignore[attr-defined ]
176+ receive_annotation = annotation .slice .elements [1 ] # type: ignore[union-attr ]
177177
178178 if receive_annotation :
179179 if isinstance (receive_annotation , ExprSubscript ) and receive_annotation .is_tuple :
180- receive_elements = receive_annotation .slice .elements # type: ignore[attr-defined ]
180+ receive_elements = receive_annotation .slice .elements # type: ignore[union-attr ]
181181 else :
182182 receive_elements = [receive_annotation ]
183183 receives_section = _to_receives_section (
@@ -197,7 +197,7 @@ def _returns_docs(func: Function, **kwargs: Any) -> DocstringSectionReturns | No
197197 "typing.Generator" ,
198198 "typing_extensions.Generator" ,
199199 }:
200- return_annotation = annotation .slice .elements [2 ] # type: ignore[attr-defined ]
200+ return_annotation = annotation .slice .elements [2 ] # type: ignore[union-attr ]
201201 elif isinstance (annotation , ExprSubscript ) and annotation .canonical_path in {
202202 "typing.Annotated" ,
203203 "typing_extensions.Annotated" ,
@@ -206,7 +206,7 @@ def _returns_docs(func: Function, **kwargs: Any) -> DocstringSectionReturns | No
206206
207207 if return_annotation :
208208 if isinstance (return_annotation , ExprSubscript ) and return_annotation .is_tuple :
209- return_elements = return_annotation .slice .elements # type: ignore[attr-defined ]
209+ return_elements = return_annotation .slice .elements # type: ignore[union-attr ]
210210 else :
211211 return_elements = [return_annotation ]
212212 returns_section = _to_returns_section (
0 commit comments