You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Realign make_function3 with master
This commit is contained in:
@@ -637,13 +637,6 @@ def make_function3(self, node, is_lambda, nested=1, code_node=None):
|
|||||||
# dump parameter list (with default values)
|
# dump parameter list (with default values)
|
||||||
if is_lambda:
|
if is_lambda:
|
||||||
self.write("lambda ", ", ".join(params))
|
self.write("lambda ", ", ".join(params))
|
||||||
else:
|
|
||||||
self.write("(", ", ".join(params))
|
|
||||||
# self.println(indent, '#flags:\t', int(code.co_flags))
|
|
||||||
|
|
||||||
else:
|
|
||||||
if is_lambda:
|
|
||||||
self.write("lambda ")
|
|
||||||
# If the last statement is None (which is the
|
# If the last statement is None (which is the
|
||||||
# same thing as "return None" in a lambda) and the
|
# same thing as "return None" in a lambda) and the
|
||||||
# next to last statement is a "yield". Then we want to
|
# next to last statement is a "yield". Then we want to
|
||||||
@@ -661,35 +654,8 @@ def make_function3(self, node, is_lambda, nested=1, code_node=None):
|
|||||||
ast[-1] = ast_expr
|
ast[-1] = ast_expr
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self.write("(")
|
self.write("(", ", ".join(params))
|
||||||
pass
|
# self.println(indent, '#flags:\t', int(code.co_flags))
|
||||||
|
|
||||||
last_line = self.f.getvalue().split("\n")[-1]
|
|
||||||
l = len(last_line)
|
|
||||||
indent = ' ' * l
|
|
||||||
line_number = self.line_number
|
|
||||||
|
|
||||||
if code_has_star_arg(code):
|
|
||||||
self.write('*%s' % code.co_varnames[argc + kw_pairs])
|
|
||||||
argc += 1
|
|
||||||
|
|
||||||
i = len(paramnames) - len(defparams)
|
|
||||||
self.write(", ".join(paramnames[:i]))
|
|
||||||
if i > 0:
|
|
||||||
suffix = ', '
|
|
||||||
else:
|
|
||||||
suffix = ''
|
|
||||||
for n in node:
|
|
||||||
if n == 'pos_arg':
|
|
||||||
self.write(suffix)
|
|
||||||
self.write(paramnames[i] + '=')
|
|
||||||
i += 1
|
|
||||||
self.preorder(n)
|
|
||||||
if (line_number != self.line_number):
|
|
||||||
suffix = ",\n" + indent
|
|
||||||
line_number = self.line_number
|
|
||||||
else:
|
|
||||||
suffix = ', '
|
|
||||||
|
|
||||||
ends_in_comma = False
|
ends_in_comma = False
|
||||||
if kw_args > 0:
|
if kw_args > 0:
|
||||||
|
Reference in New Issue
Block a user