def sub_values(self, var_values): """Substitute given values for variables. Note that there are three ways to substitute values for variables: - syntactic using this function - no substitution by user code, instead flatten to python and use C{eval} together with a C{dict} defining the values of variables, as done in L{eval_init}. For converting non-integer finite types to integer types, use L{replace_finite_by_int}. @return: C{dict} of ASTs after the substitutions, keyed by original clause (before substitution). """ logger.info('substitute values for variables...') a = copy.deepcopy(self._ast) for formula, tree in a.iteritems(): g = tx.Tree.from_recursive_ast(tree) tx.sub_values(g, var_values) a[formula] = g.to_recursive_ast() logger.info('done with substitutions.\n') return a
def sub_values(self, var_values): """Substitute given values for variables. Note that there are three ways to substitute values for variables: - syntactic using this function - no substitution by user code, instead flatten to python and use C{eval} together with a C{dict} defining the values of variables, as done in L{eval_init}. For converting non-integer finite types to integer types, use L{replace_finite_by_int}. @return: C{dict} of ASTs after the substitutions, keyed by original clause (before substitution). """ logger.info('substitute values for variables...') a = copy.deepcopy(self._ast) for formula, tree in a.items(): g = tx.Tree.from_recursive_ast(tree) tx.sub_values(g, var_values) a[formula] = g.to_recursive_ast() logger.info('done with substitutions.\n') return a