Wrap "stop" function to accept "retry_state" parameter.
540140
def stop_func_accept_retry_state(stop_func):
    """"""
    if not six.callable(stop_func):
        return stop_func

    if func_takes_retry_state(stop_func):
        return stop_func

    @_utils.wraps(stop_func)
    def wrapped_stop_func(retry_state):
        warn_about_non_retry_state_deprecation(
            'stop', stop_func, stacklevel=4)
        return stop_func(
            retry_state.attempt_number,
            retry_state.seconds_since_start,
        )
    return wrapped_stop_func
659592
def wait_func_accept_retry_state(wait_func):
    """"""
    if not six.callable(wait_func):
        return wait_func

    if func_takes_retry_state(wait_func):
        return wait_func

    if func_takes_last_result(wait_func):
        @_utils.wraps(wait_func)
        def wrapped_wait_func(retry_state):
            warn_about_non_retry_state_deprecation(
                'wait', wait_func, stacklevel=4)
            return wait_func(
                retry_state.attempt_number,
                retry_state.seconds_since_start,
                last_result=retry_state.outcome,
            )
    else:
        @_utils.wraps(wait_func)
        def wrapped_wait_func(retry_state):
            warn_about_non_retry_state_deprecation(
                'wait', wait_func, stacklevel=4)
            return wait_func(
                retry_state.attempt_number,
                retry_state.seconds_since_start,
            )
    return wrapped_wait_func
339490
def _retry_usb_function(count, func, *args, **kwargs):
  """"""
  helper = timeouts.RetryHelper(count)
  while True:
    try:
      return func(*args, **kwargs)
    except usb_exceptions.CommonUsbError:
      if not helper.retry_if_possible():
        raise
      time.sleep(0.1)
    else:
      break
640356
def error_handler(_, err, arg):
    """"""
    arg.value = err.error
    return libnl.handlers.NL_STOP
1280097
def make_retry_state(previous_attempt_number, delay_since_first_attempt,
                     last_result=None):
    
    required_parameter_unset = (previous_attempt_number is _unset or
                                delay_since_first_attempt is _unset)
    if required_parameter_unset:
        raise _make_unset_exception(
            'wait/stop',
            previous_attempt_number=previous_attempt_number,
            delay_since_first_attempt=delay_since_first_attempt)

    from tenacity import RetryCallState
    retry_state = RetryCallState(None, None, (), {})
    retry_state.attempt_number = previous_attempt_number
    if last_result is not None:
        retry_state.outcome = last_result
    else:
        retry_state.set_result(None)
    _set_delay_since_start(retry_state, delay_since_first_attempt)
    return retry_state
86263
def retry_options
      {
        on: [Octokit::Forbidden],
        tries: MAX_FORBIDDEN_RETRIES,
        base_interval: sleep_base_interval,
        multiplier: 1.0,
        rand_factor: 0.0,
        on_retry: retry_callback
      }
    end
543120
def _should_retry(resp):
  """"""
  return (resp.status_code == httplib.REQUEST_TIMEOUT or
          (resp.status_code >= 500 and
           resp.status_code < 600))
446637
def retry_call(func, cleanup=lambda: None, retries=0, trap=()):
	
	attempts = count() if retries == float('inf') else range(retries)
	for attempt in attempts:
		try:
			return func()
		except trap:
			cleanup()

	return func()
278553
def ensure_stopped(self):
        """"""
        if not self.active:
            return self
        self.stop()
        self.observer.cancel()
        self._manager.remove_routes(self, self.get_routing_keys())
        self._active = False
        return self
405443
def call_with_retry(func: Callable, exceptions, max_retries: int,
                    logger: Logger, *args, **kwargs):
    """"""
    attempt = 0
    while True:
        try:
            return func(*args, **kwargs)
        except exceptions as e:
            attempt += 1
            if attempt >= max_retries:
                raise

            delay = exponential_backoff(attempt, cap=60)
            logger.warning('%s: retrying in %s', e, delay)
            time.sleep(delay.total_seconds())
969881
def repeat_call(func, retries, *args, **kwargs):
    '''
    
    '''
    retries = max(0, int(retries))
    try_num = 0
    while True:
        if try_num == retries:
            return func(*args, **kwargs)
        else:
            try:
                return func(*args, **kwargs)
            except Exception as e:
                if isinstance(e, KeyboardInterrupt):
                    raise e
                try_num += 1
931084
def after_func_accept_retry_state(fn):
    """"""
    if not six.callable(fn):
        return fn

    if func_takes_retry_state(fn):
        return fn

    @_utils.wraps(fn)
    def wrapped_after_sleep_func(retry_state):
        # func, trial_number, trial_time_taken
        warn_about_non_retry_state_deprecation('after', fn, stacklevel=4)
        return fn(
            retry_state.fn,
            retry_state.attempt_number,
            retry_state.seconds_since_start)
    return wrapped_after_sleep_func
644814
function retry(err) {
      if (retries < maxRetries) {
        return _Bluebird2['default'].delay(ms).then(function () {
          return loop(fn, retries + 1);
        });
      }

      return _Bluebird2['default'].reject(err);
    }
516452
def do_retry(self, arg):
        """"""
        prev_line = self.curframe.f_lineno - 1
        # Make sure not to jump to the middle of the previous statement
        while True:
            try:
                self.curframe.f_lineno = prev_line
                break

            except ValueError:
                prev_line -= 1

        self.do_jump(prev_line)
        self.do_continue(arg)
        return 1
328872
def retryable(fn, protocol=None):
    
    def wrapper(self, *args, **kwargs):
        pool = self._choose_pool(protocol)

        def thunk(transport):
            return fn(self, transport, *args, **kwargs)

        return self._with_retries(pool, thunk)

    wrapper.__doc__ = fn.__doc__
    wrapper.__repr__ = fn.__repr__

    return wrapper
290393
function retry(fn, N, retryTimeout, canContinue) {
    if(typeof N === "function" && retryTimeout === canContinue === undefined) {
        canContinue = N;
        N = retryTimeout = undefined;
    }
    else if(typeof retryTimeout === "function") {
        canContinue = retryTimeout;
        retryTimeout = undefined;
    }
    // Default args
    N = ((N === undefined || N < 0) ? 0 : N - 1);
    retryTimeout = (retryTimeout === undefined ? 0 : retryTimeout);
    canContinue = (canContinue === undefined) ?
        function() { return true; } :
        canContinue;


    return function wrapper() {
        // Actual arguments (passed first time)
        var args = arguments;
        var d = Q.defer();

        // Our failure counter (decounter by decrementing)
        var remainingTries = N;

        // Create function without args
        // that calls fn with args
        // this makes it easier to wrap
        var f = function () {
            return fn.apply(null, args);
        };

        // The function with the try logic
        var _try = function _try() {
            // Call function

            Q.invoke(f)
            .then(function(result) {
                // Success
                d.resolve(result);
            }, function(err) {
                // Failure

                // Decrement
                remainingTries -= 1;

                // No tries left, so reject promise with last error
                if(remainingTries >= 0 && canContinue(err, N - remainingTries)) {
                    // We have some retries left, so retryTimeout
                    if(retryTimeout) {
                        setTimeout(_try, retryTimeout);
                    } else {
                        _try();
                    }
                } else {
                    // Total failure
                    d.reject(err);
                    return;
                }
            }).done();
        };

        // Start trying
        _try();

        // Give promise
        return d.promise;
    };
}
1344995
def stop():
    '''
    
    '''
    ret = {'comment': '', 'success': False}

    cmd = __execute_cmd('riak', 'stop')

    if cmd['retcode'] != 0:
        ret['comment'] = cmd['stderr']
    else:
        ret['comment'] = cmd['stdout']
        ret['success'] = True

    return ret