function.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:peval 作者: fjarri 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号