astTools.py 文件源码

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

项目:ITAP-django 作者: krivers 项目源码 文件源码
def gatherAssignedVars(targets):
    """Take a list of assigned variables and extract the names/subscripts/attributes"""
    if type(targets) != list:
        targets = [targets]
    newTargets = []
    for target in targets:
        if type(target) in [ast.Tuple, ast.List]:
            newTargets += gatherAssignedVars(target.elts)
        elif type(target) in [ast.Name, ast.Subscript, ast.Attribute]:
            newTargets.append(target)
        else:
            log("astTools\tgatherAssignedVars\tWeird Assign Type: " + str(type(target)),"bug")
    return newTargets
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号