Beispiel #1
0
 def available(self, exception_flag=False):
     """ True if the solver is available """
     if self._assert_available:
         return True
     if not OptSolver.available(self,exception_flag):
         return False
     try:
         ans = self.executable()
     except NotImplementedError:
         ans = None
     if ans is None:
         if exception_flag:
             msg = "No executable found for solver '%s'"
             raise ApplicationError(msg % self.name)
         return False
     return True
Beispiel #2
0
 def available(self, exception_flag=False):
     """ True if the solver is available """
     if self._assert_available:
         return True
     if not OptSolver.available(self, exception_flag):
         return False
     try:
         # HACK: Suppress logged warnings about the executable not
         # being found
         cm = nullcontext() if exception_flag else LoggingIntercept()
         with cm:
             ans = self.executable()
     except NotImplementedError:
         ans = None
     if ans is None:
         if exception_flag:
             msg = "No executable found for solver '%s'"
             raise ApplicationError(msg % self.name)
         return False
     return True