fava.py 文件源码

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

项目:insights-core 作者: RedHatInsights 项目源码 文件源码
def make_wrapper(new_variables, value):
    """
    Define a set of new variables by createing a call to a lambda function.
    The value becomes the body of the lambda.
    The names of the new_variables become the names of the formal parameters to the lambda.
    The values of the new_variables become the values of the actual arguments to the call.
    """
    return FavaCode(
        Call(
            func=Lambda(
                args=arguments(
                    args=[Name(id=key, ctx=Param()) for key, val in new_variables.iteritems()],
                    vararg=None, kwarg=None, defaults=[]),
                body=value.get_ast()),
            args=[val.get_ast() for key, val in new_variables.iteritems()],
            keywords=[],
            starargs=None,
            kwargs=None),
        [value] + [val for key, val in new_variables.iteritems()])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号