functional.py 文件源码

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

项目:thorn 作者: robinhood 项目源码 文件源码
def compile_node(self, field):
        """Compile node into a cached function that performs the match.

        Returns:
            Callable: taking the object to match.
        """
        # can embed other Q objects
        if isinstance(field, type(self)):
            return field

        # convert Django Q objects in-place.
        elif isinstance(field, _Q_):
            field.__class__ = type(self)
            return field

        # or it's a key, value pair.
        lhs, rhs = field
        lhs, opcode = self.prepare_statement(lhs, rhs)

        # this creates the new matching function to be added to the stack.
        return self.compile_op(lhs, rhs, opcode)
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号