__init__.py 文件源码

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

项目:ITAP-django 作者: krivers 项目源码 文件源码
def checkGlobalIds(a, l):
    if not isinstance(a, ast.AST):
        return
    elif type(a) in [ ast.Load, ast.Store, ast.Del, ast.AugLoad, ast.AugStore, ast.Param ]:
        return
    if not hasattr(a, "global_id"):
        addedNodes = ["propagatedVariable", "orderedBinOp", 
            "augAssignVal", "augAssignBinOp", 
            "combinedConditional", "combinedConditionalOp", 
            "multiCompPart", "multiCompOp",
            "second_global_id", "moved_line",
            # above this line has individualize functions. below does not.
            "addedNot", "addedNotOp", "addedOther", "addedOtherOp", 
            "collapsedExpr", "removedLines", 
            "helperVar", "helperReturn",
            "typeCastFunction", ]
        for t in addedNodes:
            if hasattr(a, t):
                break
        else: # only enter the else if none of the provided types are an attribute of a
            log("canonicalize\tcheckGlobalIds\tNo global id: " + str(l) + "," + str(a.__dict__) + "," + printFunction(a, 0), "bug")
    for f in ast.iter_child_nodes(a):
        checkGlobalIds(f, l + [type(a)])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号