@@ -230,7 +230,9 @@ def _warns_docs(attr_or_func: Attribute | Function, **kwargs: Any) -> DocstringS
230230 if attr_or_func .is_attribute :
231231 annotation = attr_or_func .annotation
232232 elif attr_or_func .is_function :
233- annotation = attr_or_func .returns
233+ annotation = attr_or_func .returns # type: ignore[union-attr]
234+ else :
235+ return None
234236 metadata = _metadata (annotation )
235237 if metadata ["warns" ]:
236238 return _to_warns_section ({"annotation" : warned [0 ], "description" : warned [1 ]} for warned in metadata ["warns" ])
@@ -241,7 +243,9 @@ def _raises_docs(attr_or_func: Attribute | Function, **kwargs: Any) -> Docstring
241243 if attr_or_func .is_attribute :
242244 annotation = attr_or_func .annotation
243245 elif attr_or_func .is_function :
244- annotation = attr_or_func .returns
246+ annotation = attr_or_func .returns # type: ignore[union-attr]
247+ else :
248+ return None
245249 metadata = _metadata (annotation )
246250 if metadata ["raises" ]:
247251 return _to_raises_section ({"annotation" : raised [0 ], "description" : raised [1 ]} for raised in metadata ["raises" ])
@@ -255,7 +259,9 @@ def _deprecated_docs(
255259 if attr_or_func .is_attribute :
256260 annotation = attr_or_func .annotation
257261 elif attr_or_func .is_function :
258- annotation = attr_or_func .returns
262+ annotation = attr_or_func .returns # type: ignore[union-attr]
263+ else :
264+ return None
259265 metadata = _metadata (annotation )
260266 if "deprecated" in metadata :
261267 return _to_deprecated_section ({"description" : metadata ["deprecated" ]})
0 commit comments