It should return the selected death assertion unless it is
 not set in which case it will return the first
197804
def death
      death = deaths.find{|b|!b.selected.nil?}
      death ||= deaths[0]
      death
    end
650796
def select_until(read_array, write_array, err_array, timeout_at)
      if !timeout_at
        return IO.select(read_array, write_array, err_array)
      end

      remaining = (timeout_at - Time.now)
      return nil if remaining <= 0

      IO.select(read_array, write_array, err_array, remaining)
    end
715030
function onUnexpected(worker, code, signal) {
    var exitCode = worker.process.exitCode;
    var err = new Error(util.format('worker:%s died unexpected (code: %s, signal: %s, exitedAfterDisconnect: %s, state: %s)',
      worker.process.pid, exitCode, signal, worker.exitedAfterDisconnect, worker.state));
    err.name = 'WorkerDiedUnexpectedError';

    debug('[%s] [cfork:master:%s] (total %d disconnect, %d unexpected exit) %s',
      Date(), process.pid, disconnectCount, unexpectedCount, err.stack);
  }
732743
function getLastStatement(statement) {
  if (!t.isStatement(statement.body)) return statement;
  return getLastStatement(statement.body);
}
712905
boolean tryToRetire(Node<K, V> node, WeightedValue<V> expect) {
        if (expect.isAlive()) {
            final WeightedValue<V> retired = new WeightedValue<V>(expect.value, -expect.weight);
            return node.compareAndSet(expect, retired);
        }
        return false;
    }
734306
def is_dead(self, proc, name):
        
        LOGGER.debug('Checking %s (%r)', name, proc)
        try:
            status = proc.status()
        except psutil.NoSuchProcess:
            LOGGER.debug('NoSuchProcess: %s (%r)', name, proc)
            return True

        LOGGER.debug('Process %s (%s) status: %r (Unresponsive Count: %s)',
                     name, proc.pid, status, self.unresponsive[name])
        if status in _PROCESS_RUNNING:
            return False
        elif status == psutil.STATUS_ZOMBIE:
            try:
                proc.wait(0.1)
            except psutil.TimeoutExpired:
                pass
            try:
                proc.terminate()
                status = proc.status()
            except psutil.NoSuchProcess:
                LOGGER.debug('NoSuchProcess: %s (%r)', name, proc)
                return True
        return status in _PROCESS_STOPPED_OR_DEAD
1013018
public MethodState getSaved(int idx) {
        if (idx < 0) {
            throw new IllegalArgumentException();
        }

        MethodState state = firstPointer;
        for (int i = 0; i < idx; i++) {
            state = state.getNext();
            if (state == null) {
               throw new IllegalArgumentException();
            }
        }
        return state;
    }
309723
def check_result(running, recurse=False, highstate=None):
    '''
    
    '''
    if not isinstance(running, dict):
        return False

    if not running:
        return False

    ret = True
    for state_id, state_result in six.iteritems(running):
        expected_type = dict
        # The __extend__ state is a list
        if "__extend__" == state_id:
            expected_type = list
        if not recurse and not isinstance(state_result, expected_type):
            ret = False
        if ret and isinstance(state_result, dict):
            result = state_result.get('result', _empty)
            if result is False:
                ret = False
            # only override return value if we are not already failed
            elif result is _empty and isinstance(state_result, dict) and ret:
                ret = check_result(
                    state_result, recurse=True, highstate=highstate)
        # if we detect a fail, check for onfail requisites
        if not ret:
            # ret can be None in case of no onfail reqs, recast it to bool
            ret = bool(check_onfail_requisites(state_id, state_result,
                                               running, highstate))
        # return as soon as we got a failure
        if not ret:
            break
    return ret
419573
public void checkOptionalNotContinued(ExecuteArgAnalyzer executeArgAnalyzer) {
        boolean opt = false;
        int index = 0;
        for (Parameter parameter : executeMethod.getParameters()) {
            final Class<?> paramType = parameter.getType();
            final boolean currentOpt = isOptionalParameterType(paramType);
            if (opt) {
                if (!currentOpt && !executeArgAnalyzer.isActionFormParameter(parameter)) {
                    throwExecuteMethodOptionalNotContinuedException(index, paramType);
                }
            } else {
                if (currentOpt) {
                    opt = true;
                }
            }
            ++index;
        }
    }
1173595
def post_mortem_excepthook(type, value, tb):
    
    clear_post_mortem()
    ipython_shell = get_ipython()
    ipython_shell.showtraceback((type, value, tb))
    p = pdb.Pdb(ipython_shell.colors)

    if not type == SyntaxError:
        # wait for stderr to print (stderr.flush does not work in this case)
        time.sleep(0.1)
        _print('*' * 40)
        _print('Entering post mortem debugging...')
        _print('*' * 40)
        #  add ability to move between frames
        p.send_initial_notification = False
        p.reset()
        frame = tb.tb_frame
        prev = frame
        while frame.f_back:
            prev = frame
            frame = frame.f_back
        frame = prev
        # wait for stdout to print
        time.sleep(0.1)
        p.interaction(frame, tb)
1002608
def dead(self):
        
        if not self._weak:
            return False
        cb = self._callback()
        if cb is None:
            return True
        return False
1055442
function(a, b) {
        if ((a.timesNotSelected || 0) < b.timesNotSelected) {
            return -1;
        }
        else if ((a.timesNotSelected || 0) > b.timesNotSelected) {
            return 1;
        }
        return 0;
    }
702307
def select(self, timeout):
        ''''''
        if self.fd is None:
            time.sleep(min(timeout,0.5))
            return True
        try:
            (rin, win, xin) = select.select([self.fd], [], [], timeout)
        except select.error:
            return False
        return len(rin) == 1
785776
def get_decider_result(rule, original_subtarget, record)
        # must test first
        decider = rule.decider
        case decider.arity
        when 0
          if rule.decider_type == :if
            return decider.() ? BALI_TRUE : BALI_FALSE
          elsif rule.decider_type == :unless
            unless decider.()
              return BALI_TRUE
            else
              return BALI_FALSE
            end
          end
        when 1
          if rule.decider_type == :if
            return decider.(record) ? BALI_TRUE : BALI_FALSE
          elsif rule.decider_type == :unless
            unless decider.(record)
              return BALI_TRUE
            else
              return BALI_FALSE
            end
          end
        when 2
          if rule.decider_type == :if
            return decider.(record, original_subtarget) ? BALI_TRUE : BALI_FALSE
          elsif rule.decider_type == :unless
            unless decider.(record, original_subtarget)
              return BALI_TRUE
            else
              return BALI_FALSE
            end
          end
        end
      end
696925
@Override
    public void aborted(DataBinder parameters, Throwable throwable) {
        try { first.aborted(parameters, throwable);  } catch (Throwable t) {}
        try { second.aborted(parameters, throwable); } catch (Throwable t) {}
    }
384823
def _one(self, query):
        """"""
        try:
            result = query.one()
            if result.has_expired(self._expirations):
                raise NotFoundError
            return result
        except (NoResultFound, MultipleResultsFound):
            raise NotFoundError
688168
def mark_dead(self, connection, now=None):
        
        # allow inject for testing purposes
        now = now if now else time.time()
        try:
            self.connections.remove(connection)
        except ValueError:
            # connection not alive or another thread marked it already, ignore
            return
        else:
            dead_count = self.dead_count.get(connection, 0) + 1
            self.dead_count[connection] = dead_count
            timeout = self.dead_timeout * 2 ** min(dead_count - 1,
                                                   self.timeout_cutoff)
            self.dead.put((now + timeout, connection))
            logger.warning(
                'Connection %r has failed for %i times in a row,'
                ' putting on %i second timeout.',
                connection, dead_count, timeout
            )