astTools.py 文件源码

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

项目:ITAP-django 作者: krivers 项目源码 文件源码
def gatherAllParameters(a, keep_orig=True):
    """Gather all parameters in the tree. Names are returned along
        with their original names (which are used in variable mapping)"""
    if type(a) == list:
        allIds = set()
        for line in a:
            allIds |= gatherAllVariables(line)
        return allIds
    if not isinstance(a, ast.AST):
        return set()

    allIds = set()
    for node in ast.walk(a):
        if type(node) == ast.arg:
            origName = node.originalId if (keep_orig and hasattr(node, "originalId")) else None
            allIds |= set([(node.arg, origName)])
    return allIds
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号