def applies(self, P, _is_constant, _symbols): try: get_conversion(self.castable_to, P) # XXX: will have to invert this except NotLeq: msg = 'Could not find a conversion from %s to %s.' % ( P, self.castable_to) raise_desc(OpSpecDoesntMatch, msg)
def applies(self, rtype, is_constant, symbols): # needs to match self.other.applies(rtype, is_constant, symbols) if self.symbol in symbols: R0 = symbols[self.symbol] try: get_conversion(R0, rtype) # XXX: will have to invert this except NotLeq: msg = 'Could not convert %s to %s.' % (rtype, R0) raise_desc(OpSpecDoesntMatch, msg) else: symbols[self.symbol] = rtype
def applies(self, P, _is_constant, _symbols): try: get_conversion(self.castable_to, P) # XXX: will have to invert this except NotLeq: msg = 'Could not find a conversion from %s to %s.' % (P, self.castable_to) raise_desc(OpSpecDoesntMatch, msg)
def Conversion_a(): A = parse_poset('kg') B = parse_poset('g') return get_conversion(A, B)