def __call__(self, *args): # NOTE: This no longer catches all exceptions. try: return FunctionHypothesis.__call__(self, *args) except TypeError as e: print "TypeError in function call: ", e, str(self), " ; ", type(self), args raise TypeError except NameError as e: print "NameError in function call: ", e, " ; ", str(self), args raise NameError
def __call__(self, *args): # NOTE: This no longer catches all exceptions. try: return FunctionHypothesis.__call__(self, *args) except TypeError as e: print "TypeError in function call: ", e, str(self), " ; ", type( self), args raise TypeError except NameError as e: print "NameError in function call: ", e, " ; ", str(self), args raise NameError
def recursive_call(self, *args): """ This gets called internally on recursive calls. It keeps track of the depth and throws an error if you go too deep """ self.recursive_call_depth += 1 if self.recursive_call_depth > self.recursive_depth_bound: raise RecursionDepthException # Call with sending myself as the recursive call return FunctionHypothesis.__call__(self, self.recursive_call, *args)
def __call__(self, *args): """ The main calling function. Resets recursive_call_depth and then calls """ self.recursive_call_depth = 0 try: # call with passing self.recursive_Call as the recursive call return FunctionHypothesis.__call__(self, self.recursive_call, *args) except TypeError as e: print "TypeError in function call: ", e, str(self), " ; ", type( self), args raise TypeError except NameError as e: print "NameError in function call: ", e, " ; ", str(self), args raise NameError