You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
better name for call generator rule
This commit is contained in:
@@ -33,7 +33,7 @@ def customize_for_version26_27(self, version):
|
||||
'except_cond2': ( '%|except %c as %c:\n', 1, 5 ),
|
||||
# When a generator is a single parameter of a function,
|
||||
# it doesn't need the surrounding parenethesis.
|
||||
'generator_no_parens': ('%c%P', 0, (1, -1, ', ', 100)),
|
||||
'call_generator': ('%c%P', 0, (1, -1, ', ', 100)),
|
||||
})
|
||||
else:
|
||||
TABLE_DIRECT.update({
|
||||
@@ -53,7 +53,7 @@ def customize_for_version26_27(self, version):
|
||||
if args_node == 'expr':
|
||||
n = args_node[0]
|
||||
if n == 'generator_exp':
|
||||
node.kind = 'generator_no_parens'
|
||||
node.kind = 'call_generator'
|
||||
pass
|
||||
pass
|
||||
|
||||
|
@@ -37,7 +37,7 @@ def customize_for_version3(self, version):
|
||||
|
||||
# When a generator is a single parameter of a function,
|
||||
# it doesn't need the surrounding parenethesis.
|
||||
'generator_no_parens': ('%c%P', 0, (1, -1, ', ', 100)),
|
||||
'call_generator' : ('%c%P', 0, (1, -1, ', ', 100)),
|
||||
|
||||
'importmultiple' : ( '%|import %c%c\n', 2, 3 ),
|
||||
'import_cont' : ( ', %c', 2 ),
|
||||
|
@@ -201,7 +201,7 @@ def flatten_list(node):
|
||||
def gen_function_parens_adjust(mapping_key, node):
|
||||
"""If we can avoid the outer parenthesis
|
||||
of a generator function, set the node key to
|
||||
'generator_no_parens' and the caller will do the default
|
||||
'call_generator' and the caller will do the default
|
||||
action on that. Otherwise we do nothing.
|
||||
"""
|
||||
if mapping_key.kind != 'CALL_FUNCTION_1':
|
||||
@@ -212,7 +212,7 @@ def gen_function_parens_adjust(mapping_key, node):
|
||||
assert args_node[0] == 'expr'
|
||||
n = args_node[0][0]
|
||||
if n == 'generator_exp':
|
||||
node.kind = 'generator_no_parens'
|
||||
node.kind = 'call_generator'
|
||||
pass
|
||||
return
|
||||
|
||||
|
Reference in New Issue
Block a user