Ejemplo n.º 1
0
 def validate_witness(self, a):
     if self.witness_conditions == []:
         return True
     elif a in self.witness_cache and isinstance(a, str):
         return True
     else:
         return some_condition(self.witness_conditions, a)
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
 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
Ejemplo n.º 5
0
 def validate_witness(self, a):
     if self.witness_conditions == []:
         return True
     elif a in self.witness_cache and isinstance(a,str):
         return True
     else: return some_condition(self.witness_conditions,a)