case.py 文件源码

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

项目:adt 作者: llllllllll 项目源码 文件源码
def scrutinize(self, scrutine, context_frame):
        constructor = type(scrutine)
        if constructor.__name__ != self._constructor_name:
            raise NoMatch()

        kwargs = scrutine._kwargs
        # the context to evaluate the thunk in
        context = {
            Call(Normal(name_lookup), (Normal(name),), {}): Normal(value)
            for name, value in merge(
                vars(builtins),
                context_frame.f_globals,
                context_frame.f_locals,
                # the newly bound arguments have the highest precedence
                dict(zip(self._argnames, scrutine._args)),
                {v: kwargs[k] for k, v in self._kwargnames.items()},
            ).items()
        }
        bound_tree = LTree.parse(self._expr).subs(context)
        return strict(bound_tree.lcompile())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号