generify
This commit is contained in:
parent
167625d24d
commit
d774f3ca86
|
@ -232,30 +232,38 @@ class DebugInterpreter(ast.NodeVisitor):
|
||||||
arguments = []
|
arguments = []
|
||||||
for arg in call.args:
|
for arg in call.args:
|
||||||
arg_explanation, arg_result = self.visit(arg)
|
arg_explanation, arg_result = self.visit(arg)
|
||||||
arg_name = "__exprinfo_%s" % (len(ns),)
|
if type(arg) is ast.Starred:
|
||||||
ns[arg_name] = arg_result
|
|
||||||
arguments.append(arg_name)
|
|
||||||
arg_explanations.append(arg_explanation)
|
|
||||||
for keyword in call.keywords:
|
|
||||||
arg_explanation, arg_result = self.visit(keyword.value)
|
|
||||||
if keyword.arg:
|
|
||||||
arg_name = "__exprinfo_%s" % (len(ns),)
|
|
||||||
ns[arg_name] = arg_result
|
|
||||||
keyword_source = "%s=%%s" % (keyword.arg)
|
|
||||||
arguments.append(keyword_source % (arg_name,))
|
|
||||||
arg_explanations.append(keyword_source % (arg_explanation,))
|
|
||||||
else: # starargs in 3.5+
|
|
||||||
arg_name = "__exprinfo_star"
|
arg_name = "__exprinfo_star"
|
||||||
ns[arg_name] = arg_result
|
ns[arg_name] = arg_result
|
||||||
arguments.append("*%s" % (arg_name,))
|
arguments.append("*%s" % (arg_name,))
|
||||||
arg_explanations.append("*%s" % (arg_explanation,))
|
arg_explanations.append("*%s" % (arg_explanation,))
|
||||||
if getattr(call, 'starargs', None): # no starargs in 3.5
|
else:
|
||||||
|
arg_name = "__exprinfo_%s" % (len(ns),)
|
||||||
|
ns[arg_name] = arg_result
|
||||||
|
arguments.append(arg_name)
|
||||||
|
arg_explanations.append(arg_explanation)
|
||||||
|
for keyword in call.keywords:
|
||||||
|
arg_explanation, arg_result = self.visit(keyword.value)
|
||||||
|
if keyword.arg:
|
||||||
|
arg_name = "__exprinfo_%s" % (len(ns),)
|
||||||
|
keyword_source = "%s=%%s" % (keyword.arg)
|
||||||
|
arguments.append(keyword_source % (arg_name,))
|
||||||
|
arg_explanations.append(keyword_source % (arg_explanation,))
|
||||||
|
else:
|
||||||
|
arg_name = "__exprinfo_kwds"
|
||||||
|
arguments.append("**%s" % (arg_name,))
|
||||||
|
arg_explanations.append("**%s" % (arg_explanation,))
|
||||||
|
|
||||||
|
ns[arg_name] = arg_result
|
||||||
|
|
||||||
|
if getattr(call, 'starargs', None):
|
||||||
arg_explanation, arg_result = self.visit(call.starargs)
|
arg_explanation, arg_result = self.visit(call.starargs)
|
||||||
arg_name = "__exprinfo_star"
|
arg_name = "__exprinfo_star"
|
||||||
ns[arg_name] = arg_result
|
ns[arg_name] = arg_result
|
||||||
arguments.append("*%s" % (arg_name,))
|
arguments.append("*%s" % (arg_name,))
|
||||||
arg_explanations.append("*%s" % (arg_explanation,))
|
arg_explanations.append("*%s" % (arg_explanation,))
|
||||||
if call.kwargs:
|
|
||||||
|
if getattr(call, 'kwargs', None):
|
||||||
arg_explanation, arg_result = self.visit(call.kwargs)
|
arg_explanation, arg_result = self.visit(call.kwargs)
|
||||||
arg_name = "__exprinfo_kwds"
|
arg_name = "__exprinfo_kwds"
|
||||||
ns[arg_name] = arg_result
|
ns[arg_name] = arg_result
|
||||||
|
|
Loading…
Reference in New Issue