def _simplify(self, codes): request = Request() request.simplify.SetInParent() for code in codes: request.simplify.codes.append(compiler.desugar(code)) reply = self._call(request) return list(reply.simplify.codes)
def validate_facts(self, facts, block=True): assert isinstance(facts, list), facts request = Request() request.validate_facts.SetInParent() for fact in facts: assert isinstance(fact, basestring), fact request.validate_facts.facts.append(compiler.desugar(fact)) reply = self._call(request) while block and reply.validate_facts.result == Response.MAYBE: time.sleep(VALIDATE_POLL_SEC) reply = self._call(request) return TROOL[reply.validate_facts.result]