Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if free_var.is_symbolic():
if (len(self.for_loops) > 0) and (free_var.name() == self.for_loops[-1].name):
vals.append(self.for_loops[-1].index_variable)
else:
vals.append(self.get_integer(self.current_class.symbols[free_var.name()].value))
# Evaluate the expression
F = ca.Function('get_integer', free_vars, [expr])
ret = F.call(vals, *self.function_mode)
if ret[0].is_constant():
# We managed to evaluate the expression. Assume the result to be integer.
return int(ret[0])
else:
# Expression depends on other symbols. Could not extract integer value.
return ret[0]
if isinstance(tree, ast.Slice):
start = self.get_integer(tree.start)
step = self.get_integer(tree.step)
stop = self.get_integer(tree.stop)
return slice(start, stop, step)
else:
raise Exception('Unexpected node type {}'.format(tree.__class__.__name__))