def anonymizeStatementNames(a, globalMap, scopeName, imports, goBackwards=False):
"""Gather the local variables, then update variable names in each line"""
localMap = gatherLocalScope(a, globalMap, scopeName, imports, goBackwards=goBackwards)
varMap = { }
varMap.update(globalMap)
varMap.update(localMap)
randomCounter = [0]
functionsSeen = []
if type(a) == ast.FunctionDef:
for arg in a.args.args:
updateVariableNames(arg, varMap, scopeName, randomCounter, imports)
for line in a.body:
updateVariableNames(line, varMap, scopeName, randomCounter, imports)
评论列表
文章目录