Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def filter_variables(self, atom):
keys_to_remove = set()
for k, v in self._variables.items():
if isinstance(v, Expr.Expression) and (v == atom or v.has_atom(atom)):
keys_to_remove.add(k)
for k in keys_to_remove:
self._variables.pop(k)
def filter_variables(self, atom):
keys_to_remove = set()
for k, v in self._variables.items():
if isinstance(v, ailment.Expr.Expression) and (v == atom or v.has_atom(atom)):
keys_to_remove.add(k)
for k in keys_to_remove:
self._variables.pop(k)
def _convert_claripy_bool_ast(self, cond):
"""
Convert recovered reaching conditions from claripy ASTs to ailment Expressions
:return: None
"""
if isinstance(cond, ailment.Expr.Expression):
return cond
if cond.op == "BoolS" and claripy.is_true(cond):
return cond
if cond in self._condition_mapping:
return self._condition_mapping[cond]
_mapping = {
'Not': lambda cond_: ailment.Expr.UnaryOp(None, 'Not', self._convert_claripy_bool_ast(cond_.args[0])),
'And': lambda cond_: ailment.Expr.BinaryOp(None, 'LogicalAnd', (
self._convert_claripy_bool_ast(cond_.args[0]),
self._convert_claripy_bool_ast(cond_.args[1]),
)),
'Or': lambda cond_: ailment.Expr.BinaryOp(None, 'LogicalOr', (
self._convert_claripy_bool_ast(cond_.args[0]),
self._convert_claripy_bool_ast(cond_.args[1]),