Check the status of a mkl functions and raise a python exeption if
    there is an error.
333943
def check_status(status):
    
    if status:
        msg = lib.DftiErrorMessage(status)
        msg = ctypes.c_char_p(msg).value
        raise RuntimeError(msg)
353827
def _check_errors(self, errors, prefix):
        
        args = []

        for uid, messages in errors:
            error_msg = []
            error_msg.append(prefix % uid)
            for msg in messages:
                error_msg.append(" (-) %s" % msg)
            args.append("\n".join(error_msg))

        if args:
            raise RuntimeError(*args)
285480
def check_status(self):
        """"""
        # Recompute the status of the tasks
        # Ignore OK and LOCKED tasks.
        for task in self:
            if task.status in (task.S_OK, task.S_LOCKED): continue
            task.check_status()

        # Take into account possible dependencies. Use a list instead of generators
        for task in self:
            if task.status == task.S_LOCKED: continue
            if task.status < task.S_SUB and all(status == task.S_OK for status in task.deps_status):
                task.set_status(task.S_READY, "Status set to Ready")
352468
def check_last_err(func, self, *args, **kwargs):
    

    if self._last_err is not None:
        try:
            if six.PY2:
                six.reraise(type(self._last_err), self._last_err,
                            self._last_tb)
            else:
                # NB(directxman12): not using six.reraise in Python 3 leads
                #                   to cleaner tracebacks, and raise x is valid
                #                   syntax in Python 3 (unlike raise x, y, z)
                raise self._last_err
        finally:
            if six.PY2:
                del self._last_tb  # in case of cycles, break glass

            self._last_err = None
    else:
        return func(self, *args, **kwargs)

    @deco.decorator
    def check_last_err(func, self, *args, **kwargs):
        if self._last_err is not None:
            try:
                raise self._last_err
            finally:
                self._last_err = None
        else:
            return func(self, *args, **kwargs)
1277397
def raise_for_status(self):
        '''
        
        '''
        if 400 <= self.status_code < 500:
            raise BadStatus('{} Client Error: {} for url: {}'.format(self.status_code, self.reason_phrase, self.url), self.status_code)
        elif 500 <= self.status_code < 600:
            raise BadStatus('{} Server Error: {} for url: {}'.format(self.status_code, self.reason_phrase, self.url), self.status_code)
341198
def clef_error_check(func_to_decorate):
    """"""
    def wrapper(*args, **kwargs):
        try:
            response = func_to_decorate(*args, **kwargs)
        except requests.exceptions.RequestException:
            raise ConnectionError(
                'Clef encountered a network connectivity problem. Are you sure you are connected to the Internet?'
            )
        else:
            raise_right_error(response)
        return response.json() # decode json
    return wrapper
813798
def check (self):
        """"""
        if self.aggregate.config["trace"]:
            trace.trace_on()
        try:
            self.local_check()
        except (socket.error, select.error):
            # on Unix, ctrl-c can raise
            # error: (4, 'Interrupted system call')
            etype, value = sys.exc_info()[:2]
            if etype == errno.EINTR:
                raise KeyboardInterrupt(value)
            else:
                raise
1334033
def _verify(function):
    """"""
    # @functools.wraps
    def wrapped(pin, *args, **kwargs):
        pin = int(pin)
        if pin not in _open:
            ppath = gpiopath(pin)
            if not os.path.exists(ppath):
                log.debug("Creating Pin {0}".format(pin))
                with _export_lock:
                    with open(pjoin(gpio_root, 'export'), 'w') as f:
                        _write(f, pin)
            value = open(pjoin(ppath, 'value'), FMODE)
            direction = open(pjoin(ppath, 'direction'), FMODE)
            _open[pin] = PinState(value=value, direction=direction)
        return function(pin, *args, **kwargs)
    return wrapped
387333
def success(self):
        """"""
        self._check_valid()
        if self._ret_val != 0:
            return False
        return swiglpk.glp_get_status(self._problem._p) == swiglpk.GLP_OPT
648377
def is_error(self):
        
        qstat = self._grep_qstat('error')
        err = self._grep_status('error')
        if qstat and err:
            return True
        return False
1314809
def _do_check(self, handlers, terminate_func=None):
        
        corrections = []
        for h in handlers:
            try:
                if h.check():
                    if h.max_num_corrections is not None \
                            and h.n_applied_corrections >= h.max_num_corrections:
                        msg = "Maximum number of corrections {} reached " \
                              "for handler {}".format(h.max_num_corrections, h)
                        if h.raise_on_max:
                            self.run_log[-1]["handler"] = h
                            self.run_log[-1]["max_errors_per_handler"] = True
                            raise MaxCorrectionsPerHandlerError(msg, True, h.max_num_corrections, h)
                        else:
                            logger.warning(msg+" Correction not applied.")
                            continue
                    if terminate_func is not None and h.is_terminating:
                        logger.info("Terminating job")
                        terminate_func()
                        # make sure we don't terminate twice
                        terminate_func = None
                    d = h.correct()
                    d["handler"] = h
                    logger.error("\n" + pformat(d, indent=2, width=-1))
                    corrections.append(d)
                    h.n_applied_corrections += 1
            except Exception:
                if not self.skip_over_errors:
                    raise
                else:
                    import traceback
                    logger.error("Bad handler %s " % h)
                    logger.error(traceback.format_exc())
                    corrections.append(
                        {"errors": ["Bad handler %s " % h],
                         "actions": []})
        self.total_errors += len(corrections)
        self.errors_current_job += len(corrections)
        self.run_log[-1]["corrections"].extend(corrections)
        # We do a dump of the run log after each check.
        dumpfn(self.run_log, Custodian.LOG_FILE, cls=MontyEncoder,
               indent=4)
        return len(corrections) > 0
180253
function check() {
    module.hot.check(function(err, updatedModules) {
      if (err) return handleError(err);

      if (!updatedModules) {
        logger.warn('Cannot find update any update.');
        return;
      }

      apply(updatedModules);
    });
  }
541815
def valid_status(*valid):
  """"""
  def decorator(func):
    @functools.wraps(func)
    def _valid_status(self, *args, **kwargs):
      if self.status not in valid:
        raise protocol.ProtocolError(
            "`%s` called while in state: %s, valid: (%s)" % (
                func.__name__, self.status, ",".join(map(str, valid))))
      return func(self, *args, **kwargs)
    return _valid_status
  return decorator
1371441
def spiceErrorCheck(f):
    

    @functools.wraps(f)
    def with_errcheck(*args, **kwargs):
        try:
            res = f(*args, **kwargs)
            checkForSpiceError(f)
            return res
        except:
            raise

    return with_errcheck
133700
def _check_error(response):
        """"""
        if 'error' in response:
            raise InfluxDBError(response['error'])
        elif 'results' in response:
            for statement in response['results']:
                if 'error' in statement:
                    msg = '{d[error]} (statement {d[statement_id]})'
                    raise InfluxDBError(msg.format(d=statement))
177742
def raise_on_error(f):
    

    @functools.wraps(f)
    def wrapper(*args, **kwargs):
        result = f(*args, **kwargs)
        retcode = GetLastError()
        if retcode and retcode != ERROR_IO_PENDING:
            err = WinError(code=retcode)
            windll.kernel32.SetLastError(0)  # clear error code so that we don't raise twice.
            raise err
        return result

    return wrapper
976349
def __exitfunction(self):
        '''
        
        '''
        if self._hook.exit_code is None and self._hook.exception is None:
            print("Check did not exit! You should call an exit code method.")
            sys.stdout.flush()
            os._exit(1)
        elif self._hook.exception:
            print("Check failed to run: %s, %s" %
                  (sys.last_type, traceback.format_tb(sys.last_traceback)))
            sys.stdout.flush()
            os._exit(2)