Repeatedly call a function while a test function returns false.
Same options as #while
185551
function untilFn(test, fn) {
    return this.then(function(last) {
        if (!test(last)) {
            return Q(fn(last)).then(function(value) {
                return Q(value).until(test, fn);
            });
        }
        return last;
    });
}
1105155
def none_returns(func):
    

    @functools.wraps(func)
    def _execute(*args, **kwargs):
        """Executes function, if error returns None else value of function

        :param args: args of function
        :param kwargs: extra args of function
        :param *args: args
        :param **kwargs: extra args
        :return: None else value of function
        """

        try:
            return func(*args, **kwargs)
        except:
            return None

    return _execute
758832
function mock (mock) {
  if (mock === false) {
    mocking = false
  } else {
    mocking = true
    cli.stderr = ''
    cli.stdout = ''
  }
}
787035
def calledWithMatch(cls, spy, *args, **kwargs): #pylint: disable=invalid-name
        
        cls.__is_spy(spy)
        if not (spy.calledWithMatch(*args, **kwargs)):
            raise cls.failException(cls.message)
689076
function every (arr, fn, thisObj) {
    var scope = thisObj || global;
    for (var i = 0, j = arr.length; i < j; ++i) {
      if (!fn.call(scope, arr[i], i, arr)) {
        return false;
      }
    }
    return true;
  }
668209
def true_false_returns(func):
    

    @functools.wraps(func)
    def _execute(*args, **kwargs):
        """Executes function, if error returns False, else True

        :param args: args of function
        :param kwargs: extra args of function
        :param *args: args
        :param **kwargs: extra args
        :return: True iff ok, else False
        """

        try:
            func(*args, **kwargs)
            return True
        except:
            return False

    return _execute
396982
def call_only_once(func):
    '''
    
    '''

    def new_func(*args, **kwargs):
        if not new_func._called:
            new_func._called = True
            return func(*args, **kwargs)

    new_func._called = False
    return new_func
1040947
function once (fn) {
  var called = false;
  return function () {
    var args = [], len = arguments.length;
    while ( len-- ) args[ len ] = arguments[ len ];

    if (called) { return }
    called = true;
    return fn.apply(this, args)
  }
}
1189172
def execute_until_false(method, interval_s):  # pylint: disable=invalid-name
  
  interval = Interval(method, stop_if_false=True)
  interval.start(interval_s)
  return interval
416367
def loop(_=None, force=False):   # pylint: disable=invalid-name
  """"""
  if not force:
    raise AttributeError(
        'threads.loop() is DEPRECATED.  If you really like this and want to '
        'keep it, file an issue at https://github.com/google/openhtf/issues '
        'and use it as @loop(force=True) for now.')

  def real_loop(fn):
    @functools.wraps(fn)
    def _proc(*args, **kwargs):
      """Wrapper to return."""
      while True:
        fn(*args, **kwargs)
    _proc.once = fn  # way for tests to invoke the function once
                     # you may need to pass in "self" since this may be unbound.
    return _proc
  return real_loop
832727
def _call_wrapper(self, time, function, *args):
        """"""
        # execute the function
        function(*args)
        if function in self._callback.keys():
            repeat = self._callback[function][1]
            if repeat:
                # setup the call back again and update the id
                callback_id = self.tk.after(time, self._call_wrapper, time, function, *args)
                self._callback[function][0] = callback_id
            else:
                # remove it from the call back dictionary
                self._callback.pop(function)
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
475284
def loop(self, value):
		
		if not type(value) == bool:
			raise TypeError("can only be True or False")
		self._loop = value
390840
function tryCatch(fnc, context, args) {

		try {
			// Start execusting the function
			switch (args.length) {
				// Avoid apply for up to 3 arguments
				case 1:
					fnc.call(context, args[0]);
					break;
				case 2:
					fnc.call(context, args[0], args[1]);
					break;
				case 3:
					fnc.call(context, args[0], args[1], args[2]);
					break;
				case 4:
					fnc.call(context, args[0], args[1], args[2], args[3]);
					break;
				// Use the slower apply
				default:
					fnc.apply(context, args);
			}
		} catch (err) {
			return err;
		}

		return null;
	}
477937
function (test) {
        var end = +(new Date());

        test.runTime = end - test.start;

        results[test.name] = {
            name : test.name,
            runTime : test.runTime,
            baseline : results["__baseline__"] ? (results["__baseline__"].runTime - test.runTime) : NaN
        };

        addSelector(test.selector, test.cfg.incremental);

        // Yeld before calling the callback
        setTimeout(function () {
            next(test);
        }, 15);
    }
885965
def no_interrupt(syscall, *args, **kwargs):
    
    ret = None

    while True:
        try:
            ret = syscall(*args, **kwargs)
        except OSError as e:
            if e.errno == errno.EINTR:
                continue
            else:
                raise
        else:
            break

    return ret
462611
def call(function, args, pseudo_type=None):
    ''''''

    if not isinstance(function, Node):
        function = local(function)
    return Node('call', function=function, args=args, pseudo_type=pseudo_type)