def filter_function_def(function_def, bound_argnames):
"""
Filters a node containing a function definition (an ``ast.FunctionDef`` object)
to exclude all arguments with the names present in ``bound_arguments``.
Returns the new ``ast.arguments`` node.
"""
assert type(function_def) == ast.FunctionDef
new_args = filter_arguments(function_def.args, bound_argnames)
params = dict(
name=function_def.name,
args=new_args,
body=function_def.body,
decorator_list=function_def.decorator_list,
returns=function_def.returns)
return ast.FunctionDef(**params)
评论列表
文章目录