@@ -124,12 +124,12 @@ def _other_parameters_docs(func: Function, **kwargs: Any) -> DocstringSectionPar
124
124
"typing.Annotated" ,
125
125
"typing_extensions.Annotated" ,
126
126
}:
127
- annotation = annotation .slice .elements [0 ] # type: ignore[attr-defined ]
127
+ annotation = annotation .slice .elements [0 ] # type: ignore[union-attr ]
128
128
if isinstance (annotation , ExprSubscript ) and annotation .canonical_path in {
129
129
"typing.Unpack" ,
130
130
"typing_extensions.Unpack" ,
131
131
}:
132
- slice_path = annotation .slice .canonical_path
132
+ slice_path = annotation .slice .canonical_path # type: ignore[union-attr]
133
133
typed_dict = func .modules_collection [slice_path ]
134
134
params_doc = {
135
135
attr .name : {"annotation" : attr .annotation , "description" : _metadata (attr .annotation ).get ("doc" , "" )}
@@ -149,13 +149,13 @@ def _yields_docs(func: Function, **kwargs: Any) -> DocstringSectionYields | None
149
149
150
150
if isinstance (annotation , ExprSubscript ):
151
151
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 ]
153
153
elif annotation .canonical_path in {"typing.Iterator" , "typing_extensions.Iterator" }:
154
154
yield_annotation = annotation .slice
155
155
156
156
if yield_annotation :
157
157
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 ]
159
159
else :
160
160
yield_elements = [yield_annotation ]
161
161
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 |
173
173
"typing.Generator" ,
174
174
"typing_extensions.Generator" ,
175
175
}:
176
- receive_annotation = annotation .slice .elements [1 ] # type: ignore[attr-defined ]
176
+ receive_annotation = annotation .slice .elements [1 ] # type: ignore[union-attr ]
177
177
178
178
if receive_annotation :
179
179
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 ]
181
181
else :
182
182
receive_elements = [receive_annotation ]
183
183
receives_section = _to_receives_section (
@@ -197,7 +197,7 @@ def _returns_docs(func: Function, **kwargs: Any) -> DocstringSectionReturns | No
197
197
"typing.Generator" ,
198
198
"typing_extensions.Generator" ,
199
199
}:
200
- return_annotation = annotation .slice .elements [2 ] # type: ignore[attr-defined ]
200
+ return_annotation = annotation .slice .elements [2 ] # type: ignore[union-attr ]
201
201
elif isinstance (annotation , ExprSubscript ) and annotation .canonical_path in {
202
202
"typing.Annotated" ,
203
203
"typing_extensions.Annotated" ,
@@ -206,7 +206,7 @@ def _returns_docs(func: Function, **kwargs: Any) -> DocstringSectionReturns | No
206
206
207
207
if return_annotation :
208
208
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 ]
210
210
else :
211
211
return_elements = [return_annotation ]
212
212
returns_section = _to_returns_section (
0 commit comments