def randomize_predicate(predicate): randomizer = PredicateRandomizer() tree = randomizer.visit(parse(predicate)) return ast2code.to_source(tree)
def change_context(self, string, old, new): self.old = old self.new = new tree = ast.parse(string, mode='eval') self.visit(tree) return ast2code.to_source(tree)