MCPcopy Index your code
hub / github.com/rocky/python-uncompyle6 / gen_function_parens_adjust

Function gen_function_parens_adjust

uncompyle6/semantics/customize37.py:197–213  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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]

Callers 1

n_callFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected