operators.py 文件源码

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

项目:prophet 作者: MKLab-ITI 项目源码 文件源码
def simplify(expr):
    if isinstance(expr, ParseResults) and len(expr) == 1:
        return simplify(expr[0])

    if isinstance(expr, (list, ParseResults)):
        return map(simplify, expr)
    if not isinstance(expr, CompValue):
        return expr
    if expr.name.endswith('Expression'):
        if expr.other is None:
            return simplify(expr.expr)

    for k in expr.keys():
        expr[k] = simplify(expr[k])
        # expr['expr']=simplify(expr.expr)
        #    expr['other']=simplify(expr.other)

    return expr
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号