def _potential_solutions(self, primitive, constraints):
        """see if a primitive can satisfy any solver constraint

        primitive -- primitive db object (dict) to test
        constraints -- list of constraint structures
                       (as from _build_constraints) that must be
                       satisfied
        """

        self.logger.debug('Can %s solve any constraints %s?' %
                          (primitive['name'],
                           [x['constraint'] for x in constraints]))

        f_builder = ast.FilterBuilder(ast.FilterTokenizer())
        valid_solutions = []

        for constraint in constraints:
            # walk through the constraints and see if the
            # primitive can solve this constraint with
            # any namespace binding.
            constraint_ast = constraint['consequence_ast']

            for consequence in primitive['consequences']:
                f_builder.set_input(consequence)
                consequence_ast = f_builder.build()

                satisfies, req_ns = self.can_solve(constraint_ast,
                                                   consequence_ast)
                if satisfies:
                    solution = {'primitive': primitive,
                                'ns': req_ns,
                                'solves': constraint['constraint'],
                                'consequence': constraint['consequence']}
                    valid_solutions.append(solution)

        self.logger.debug('Answer: %s' % valid_solutions)
        return valid_solutions
dataset/ETHPy150Open rcbops/opencenter/opencenter/webapp/solver.py/Solver._potential_solutions/original