try many times as in times with sleep time
180619
def expect(func, args, times=7, sleep_t=0.5):
    """"""
    while times > 0:
        try:
            return func(*args)
        except Exception as e:
            times -= 1
            logger.debug("expect failed - attempts left: %d" % times)
            time.sleep(sleep_t)
            if times == 0:
                raise exceptions.BaseExc(e)
565893
def incrementing_sleep(self, previous_attempt_number, delay_since_first_attempt_ms):
        
        result = self._wait_incrementing_start + (self._wait_incrementing_increment * (previous_attempt_number - 1))
        if result < 0:
            result = 0
        return result
515276
def _expect(self, expected, times=50):
        
        print '[%s] Expecting [%s]' % (self.port, expected)

        retry_times = 10
        while times > 0 and retry_times > 0:
            line = self._readline()
            print '[%s] Got line [%s]' % (self.port, line)

            if line == expected:
                print '[%s] Expected [%s]' % (self.port, expected)
                return

            if not line:
                retry_times -= 1
                time.sleep(0.1)

            times -= 1

        raise Exception('failed to find expected string[%s]' % expected)
965673
def _maybe_repeat(self, x):
    
    if isinstance(x, list):
      assert len(x) == self.n
      return x
    else:
      return [x] * self.n
948324
def wait_until_internet(time_between_attempts=3, max_attempts=10):
    
    counter = 0
    while not is_internet_on():
        time.sleep(time_between_attempts)  # wait until internet is on
        counter += 1

        if counter > max_attempts:
            return False

    return True
962736
def execute_once(self):
        """"""
        symbol = self.tape.get(self.head, self.EMPTY_SYMBOL)

        index = self.alphabet.index(symbol)
        rule = self.states[self.state][index]

        if rule is None:
            raise RuntimeError('Unexpected symbol: ' + symbol)

        self.tape[self.head] = rule[0]

        if rule[1] == 'L':
            self.head -= 1
        elif rule[1] == 'R':
            self.head += 1

        self.state = rule[2]
811496
def touch(file, times=None):
  
  if times:
    if len(times) > 2:
      raise ValueError('times must either be a tuple of (atime, mtime) or else a single time value '
                       'to use for both.')

    if len(times) == 1:
      times = (times, times)

  with safe_open(file, 'a'):
    os.utime(file, times)
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
1078847
function _Process_sleep(time)
{
	return __Scheduler_binding(function(callback) {
		var id = setTimeout(function() {
			callback(__Scheduler_succeed(__Utils_Tuple0));
		}, time);

		return function() { clearTimeout(id); };
	});
}
514320
def incrementing_sleep(self, previous_attempt_number, delay_since_first_attempt_ms):
        
        result = self._wait_incrementing_start + (self._wait_incrementing_increment * (previous_attempt_number - 1))
        if result > self._wait_incrementing_max:
            result = self._wait_incrementing_max
        if result < 0:
            result = 0
        return result
393345
function Repeat (opts) {
    var d = opts.action.duration * opts.times

    Repeat.superclass.constructor.call(this, {duration: d})

    this.times = opts.times
    this.other = opts.action.copy()
    this.total = 0
}
149154
async def repeat(ctx, times: int, content='repeating...'):
    """"""
    for i in range(times):
        await ctx.send(content)
940548
function repeat(input, n) {

    var times = ~~n;

    return (!isString(input) || !times) ? input : strRepeat(input, n);
}
825419
def repeat(obj, times=None):
    """"""
    if times is None:

        return AsyncIterWrapper(sync_itertools.repeat(obj))

    return AsyncIterWrapper(sync_itertools.repeat(obj, times))
73995
def pass_time(self, t):
        """"""
        cont = time.time() + t
        while time.time() < cont:
            time.sleep(0)
846938
function repeat(string, times) {
            var result = ""
            // Optimized repeat function concatenates concatenated
            // strings.
            while (times > 0) {
                if (times & 1) result += string
                times >>= 1
                string += string
            }
            return result
        }
939068
def sleep_and_retry(func):
    '''
    
    '''
    @wraps(func)
    def wrapper(*args, **kargs):
        '''
        Call the rate limited function. If the function raises a rate limit
        exception sleep for the remaing time period and retry the function.

        :param args: non-keyword variable length argument list to the decorated function.
        :param kargs: keyworded variable length argument list to the decorated function.
        '''
        while True:
            try:
                return func(*args, **kargs)
            except RateLimitException as exception:
                time.sleep(exception.period_remaining)
    return wrapper