def findListId(a, id):
# We want to go one level up to get the list this belongs to
if type(a) == list and len(a) > 0 and hasattr(a[0], "global_id") and a[0].global_id == id:
return a
if type(a) == list:
for item in a:
tmp = findListId(item, id)
if tmp != None:
return tmp
elif isinstance(a, ast.AST):
for (field, val) in ast.iter_fields(a):
tmp = findListId(val, id)
if tmp != None:
return tmp
return None
评论列表
文章目录