def turnPositive(a):
"""Take a negative number and make it positive"""
if type(a) == ast.UnaryOp and type(a.op) == ast.USub:
return a.operand
elif type(a) == ast.Num and type(a.n) != complex and a.n < 0:
a.n = a.n * -1
return a
else:
log("transformations\tturnPositive\tFailure: " + str(a), "bug")
return a
评论列表
文章目录