If we can avoid the outer parenthesis of a generator function, set the node key to 'call_generator' and the caller will do the default action on that. Otherwise we do nothing.
(mapping_key, node)
| 195 | # fmt: on |
| 196 | |
| 197 | def gen_function_parens_adjust(mapping_key, node): |
| 198 | """If we can avoid the outer parenthesis |
| 199 | of a generator function, set the node key to |
| 200 | 'call_generator' and the caller will do the default |
| 201 | action on that. Otherwise we do nothing. |
| 202 | """ |
| 203 | if mapping_key.kind != "CALL_FUNCTION_1": |
| 204 | return |
| 205 | |
| 206 | args_node = node[-2] |
| 207 | if args_node == "pos_arg": |
| 208 | assert args_node[0] == "expr" |
| 209 | n = args_node[0][0] |
| 210 | if n == "generator_exp": |
| 211 | node.kind = "call_generator" |
| 212 | pass |
| 213 | return |
| 214 | |
| 215 | def n_assert_invert(node): |
| 216 | testtrue = node[0] |