def query(self, a): if check_stack('query', dict(a=a, self=self)): return '*' elif a in self.witness_cache: return True elif isinstance(a, HypObj) and show(self) in showall(a.types): return True elif isinstance(a, HypObj) and forsome( a.types, lambda T: show(self) in showall(T.supertype_cache)): return True elif isinstance(a, LazyObj): if isinstance(a.eval(), LazyObj): return a.eval().type().subtype_of(self) else: return self.query(a.eval()) elif forsome(self.witness_types, lambda T: T.in_poss(self.poss).query(a)): if not isinstance(a, HypObj): self.witness_cache.append(a) return True else: if some_condition(self.witness_conditions, a): if not isinstance(a, HypObj): self.witness_cache.append(a) return True else: return False
def query(self,a): if super().query(a): return True elif forsome(self.comps.pred.witness_funs, lambda f: f(self.comps.args).in_poss(self.poss).query(a)): self.witness_cache.append(a) return True else: return False
def RecOfRecType(r,T,M): TypeLabels = [l for l in T.comps.__dict__] RecordLabels = [l for l in r.__dict__] if forsome(TypeLabels, lambda l: l not in RecordLabels): return False elif forall(TypeLabels, lambda l: l in RecordLabels and QueryField(l,r,T,M)): return True else: return False
def query(self, a): if super().query(a): return True elif forsome(self.comps.pred.witness_funs, lambda f: f(self.comps.args).in_poss(self.poss).query(a)): self.witness_cache.append(a) return True else: return False
def query(self, a): if a in self.witness_cache: return True elif isinstance(a,HypObj) and show(self) in showall(a.types): return True elif isinstance(a,HypObj) and forsome(a.types, lambda T: show(self) in showall(T.supertype_cache)): return True elif isinstance(a, LazyObj): if isinstance(a.eval(), LazyObj): return a.eval().type().subtype_of(self) else: return self.query(a.eval()) elif forsome(self.witness_types, lambda T: T.in_poss(self.poss).query(a)): self.witness_cache.append(a) return True else: if some_condition(self.witness_conditions,a): self.witness_cache.append(a) return True else: return False
def RecOfRecType(r, T, M, c, oracle): if not isinstance(r, Rec): return PConstraint(0) else: TypeLabels = [l for l in T.comps.__dict__] RecordLabels = [l for l in r.__dict__] if forsome(TypeLabels, lambda l: l not in RecordLabels): return PConstraint(0) else: #print(show(ConjProb(list(map(lambda l: QueryField(l,r,T,M),TypeLabels)),c,oracle))) return ConjProb( list(map(lambda l: QueryField(l, r, T, M), TypeLabels)), c, oracle)
def query(self, a): if a in self.witness_cache: return True elif isinstance(a, HypObj) and show(self) in showall(a.types): return True elif isinstance(a, HypObj) and forsome( a.types, lambda T: show(self) in showall(T.supertype_cache)): return True elif isinstance(a, LazyObj): if isinstance(a.eval(), LazyObj): return a.eval().type().subtype_of(self) else: return self.query(a.eval()) else: if some_condition(self.witness_conditions, a): self.witness_cache.append(a) return True else: return False