Waits *timeout* seconds until an event is available from the
        joystick. Returns `True` if an event became available, and `False`
        if the timeout expired.
496266
def _wait(self, timeout=None):
        
        r, w, x = select.select([self._stick_file], [], [], timeout)
        return bool(r)
532849
def wait(self, timeout=None):
        
        self.ev_done.wait(timeout=timeout)

        if not self.ev_done.is_set():
            raise TaskTimeout("Task %s timed out." % self)

        # --> self.result is set
        # If it is an exception, then raise it in this waiter
        if isinstance(self.result, Exception):
            raise self.result

        # Release waiters and perform callbacks
        # done() has already been called, because of self.ev_done check
        # "asynchronous" tasks should could call done() here
        #self.done(self.result)

        return self.result
1352003
def wait_for(self,
               condition,
               interval = DEFAULT_WAIT_INTERVAL,
               timeout  = DEFAULT_WAIT_TIMEOUT):
    

    start = time.time()

    # at least execute the check once!
    while True:
      res = condition()
      if res:
        return res

      # timeout?
      if time.time() - start > timeout:
        break

      # wait a bit
      time.sleep(interval)

    # timeout occured!
    raise WaitTimeoutError("wait_for timed out")
822656
private void waitForEventOrTimeout() throws InterruptedException {
        long remainingWait = timeout - timeWaited;
        long millisToWait = remainingWait / 1000000;
        int nanosToWait = (int) (remainingWait % 1000000);
        wait(millisToWait, nanosToWait);
    }
133745
def wait_for_zap(self, timeout):
        """"""
        timeout_time = time.time() + timeout
        while not self.is_running():
            if time.time() > timeout_time:
                raise ZAPError('Timed out waiting for ZAP to start.')
            time.sleep(2)
1245442
def wait(timeout = SimCtl.default_timeout)
      Timeout.timeout(timeout) do
        loop do
          break if yield SimCtl.device(udid: udid)
        end
      end
      reload
    end
712787
def wait_for_mode(self, mode, timeout=None):
        '''
        '''

        if not isinstance(mode, VehicleMode):
            mode = VehicleMode(mode)

        self.mode = mode

        self.wait_for(lambda: self.mode.name == mode.name,
                      timeout=timeout,
                      errmsg='failed to set flight mode')
964489
def wait(timeout = nil)
      raise ConditionError, "cannot wait for signals while exclusive" if Celluloid.exclusive?

      if actor = Thread.current[:celluloid_actor]
        task = Task.current
        if timeout
          bt = caller
          timer = actor.timers.after(timeout) do
            exception = ConditionError.new("timeout after #{timeout.inspect} seconds")
            exception.set_backtrace bt
            task.resume exception
          end
        end
      else
        task = Thread.current
      end
      waiter = Waiter.new(self, task, Celluloid.mailbox, timeout)

      @mutex.synchronize do
        @waiters << waiter
      end

      result = Celluloid.suspend :condwait, waiter
      timer.cancel if timer
      raise result if result.is_a?(ConditionError)
      return yield(result) if block_given?
      result
    end
1200191
def _wait(self, generator, method, timeout=None, *args, **kwargs):
        """"""
        if self.debug:
            print("waiting for %s to pause" % generator)

        original_timeout = timeout
        while timeout is None or timeout > 0:
            last_time = time.time()
            if self._lock.acquire(False):  # timeout param was added in 3.2
                try:
                    if self.can_resume():
                        return method(generator, *args, **kwargs)
                    elif self.has_terminated():
                        raise RuntimeError("%s has already terminated" % generator)
                finally:
                    self._lock.release()

            if timeout is not None:
                timeout -= time.time() - last_time

        msg = "%s did not pause after %ss" % (generator, original_timeout)
        if self.debug:
            print(msg)
        raise WaitTimeoutError(msg)
132815
def wait_for_service_available(container, url, timeout):
    
    start = time.time()
    remaining = timeout
    while True:
        remaining = start + timeout - time.time()
        if remaining < 0:
            raise ServiceTimeout
        try:
            response = get(url,
                timeout=min(remaining, REQUEST_TIMEOUT_SECONDS))
            if 500 <= response.status_code < 600:
                return False
            return True
        except (ConnectionError, Timeout):
            pass
        if not inspect_container(container)['State']['Running']:
            return False

        remaining = start + timeout - time.time()
        delay = max(0, min(RETRY_DELAY_SECONDS, remaining))
        time.sleep(delay)

    raise ServiceTimeout
528842
def wait_for_bump(self, buttons, timeout_ms=None):
        
        start_time = time.time()

        if self.wait_for_pressed(buttons, timeout_ms):
            if timeout_ms is not None:
                timeout_ms -= int((time.time() - start_time) * 1000)
            return self.wait_for_released(buttons, timeout_ms)

        return False
732864
def wait_for_close(options={})
      seconds = options[:timeout] || 5
      timeout(seconds) do
        begin
          yield if block_given?
          sleep 0.05
        end until 0 == IsWindow(handle)
      end
    end
443363
def wait_until_jquery_requests_are_closed(self, timeout=None):
        
        timeout = timeout if timeout is not None else self.timeout

        def wait():
            '''
            Wait function passed to executor
            '''
            WebDriverWait(self.driver, timeout).until(
                lambda d: self.js_executor.execute_template('isJqueryAjaxComplete', {}))
            return True

        return self.execute_and_handle_webdriver_exceptions(
            wait, timeout, None, 'Timeout waiting for all jQuery AJAX requests to close')
18804
def wait_for_available(self, locator):
        
        for i in range(timeout_seconds):
            try:
                if self.is_element_available(locator):
                    break
            except:
                pass
            time.sleep(1)
        else:
            raise ElementVisiblityTimeout("%s availability timed out" % locator)
        return True
842251
def wait_for_element(self, selector, by=By.CSS_SELECTOR,
                         timeout=settings.LARGE_TIMEOUT):
        
        if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
            timeout = self.__get_new_timeout(timeout)
        return self.wait_for_element_visible(selector, by=by, timeout=timeout)
1190264
def revive(self, timeout=None):
        
        if timeout is not None:
            self.timeout = timeout

        self.revive_event.set()
633544
def wait(self, timeout):
        ''''''
        logger.debug('Waiting for %fs', timeout)
        return self._event.wait(timeout)