Wait for the YubiKey to either turn ON or OFF certain bits in the status byte.

        mode is either 'and' or 'nand'
        timeout is a number of seconds (precision about ~0.5 seconds)
426182
def _waitfor(self, mode, mask, may_block, timeout=2):
        
        finished = False
        sleep = 0.01
        # After six sleeps, we've slept 0.64 seconds.
        wait_num = (timeout * 2) - 1 + 6
        resp_timeout = False    # YubiKey hasn't indicated RESP_TIMEOUT (yet)
        while not finished:
            time.sleep(sleep)
            this = self._read()
            flags = yubico_util.ord_byte(this[7])

            if flags & yubikey_defs.RESP_TIMEOUT_WAIT_FLAG:
                if not resp_timeout:
                    resp_timeout = True
                    seconds_left = flags & yubikey_defs.RESP_TIMEOUT_WAIT_MASK
                    self._debug("Device indicates RESP_TIMEOUT (%i seconds left)\n" \
                                    % (seconds_left))
                    if may_block:
                        # calculate new wait_num - never more than 20 seconds
                        seconds_left = min(20, seconds_left)
                        wait_num = (seconds_left * 2) - 1 + 6

            if mode is 'nand':
                if not flags & mask == mask:
                    finished = True
                else:
                    self._debug("Status %s (0x%x) has not cleared bits %s (0x%x)\n"
                                % (bin(flags), flags, bin(mask), mask))
            elif mode is 'and':
                if flags & mask == mask:
                    finished = True
                else:
                    self._debug("Status %s (0x%x) has not set bits %s (0x%x)\n"
                                % (bin(flags), flags, bin(mask), mask))
            else:
                assert()

            if not finished:
                wait_num -= 1
                if wait_num == 0:
                    if mode is 'nand':
                        reason = 'Timed out waiting for YubiKey to clear status 0x%x' % mask
                    else:
                        reason = 'Timed out waiting for YubiKey to set status 0x%x' % mask
                    raise yubikey_base.YubiKeyTimeout(reason)
                sleep = min(sleep + sleep, 0.5)
            else:
                return this
1028237
def wait(self, timeout=None):
        """"""
        self._event.wait(timeout)
        return self._event.isSet()
988493
def wait_for_edge(self):
        
        GPIO.remove_event_detect(self._pin)
        GPIO.wait_for_edge(self._pin, self._edge)
822656
private void waitForEventOrTimeout() throws InterruptedException {
        long remainingWait = timeout - timeWaited;
        long millisToWait = remainingWait / 1000000;
        int nanosToWait = (int) (remainingWait % 1000000);
        wait(millisToWait, nanosToWait);
    }
428177
function modalDialog_waitForDialog(aTimeout) {
    var timeout = aTimeout || TIMEOUT_MODAL_DIALOG;

    if (!this._observer) {
      return;
    }

    try {
      mozmill.utils.waitFor(function () {
        return this.finished;
      }, "Modal dialog has been found and processed", timeout, undefined, this);

      // Forward the raised exception so we can detect failures in modal dialogs
      if (this._observer.exception) {
        throw this._observer.exception;
      }
    }
    finally {
      this.stop();
    }
  }
217886
def _wait_for_io_events(socks, events, timeout=None):
    
    if not HAS_SELECT:
        raise ValueError('Platform does not have a selector')
    if not isinstance(socks, list):
        # Probably just a single socket.
        if hasattr(socks, "fileno"):
            socks = [socks]
        # Otherwise it might be a non-list iterable.
        else:
            socks = list(socks)
    with DefaultSelector() as selector:
        for sock in socks:
            selector.register(sock, events)
        return [key[0].fileobj for key in
                selector.select(timeout) if key[1] & events]
230413
def __WaitForVolume(volume, desired_state):
  
  print 'Waiting for volume %s to be %s...' % (volume.id, desired_state)
  while True:
    volume.update()
    sys.stdout.write('.')
    sys.stdout.flush()
    #print 'status is: %s' % volume.status
    if volume.status == desired_state:
        break
    time.sleep(5)  
  return
439003
def wait_for_up(self, timeout=40):
        

        self.wait_for_states(timeout, 'up')
        connectionStatus = self.get_attribute('connectionStatus').strip()
        if connectionStatus.split(':')[0] != self.get_attribute('assignedTo').split(':')[0]:
            raise TgnError('Failed to reach up state, port connection status is {} after {} seconds'.
                           format(connectionStatus, timeout))
823133
def wait(hotkey=None, suppress=False, trigger_on_release=False):
    
    if hotkey:
        lock = _Event()
        remove = add_hotkey(hotkey, lambda: lock.set(), suppress=suppress, trigger_on_release=trigger_on_release)
        lock.wait()
        remove_hotkey(remove)
    else:
        while True:
            _time.sleep(1e6)
802913
def settimeout(self, timeout):
        
        self.sock_opt.timeout = timeout
        if self.sock:
            self.sock.settimeout(timeout)
989863
def _read_response(self, may_block=False):
        
        # wait for response to become available
        res = self._waitfor_set(yubikey_defs.RESP_PENDING_FLAG, may_block)[:7]
        # continue reading while response pending is set
        while True:
            this = self._read()
            flags = yubico_util.ord_byte(this[7])
            if flags & yubikey_defs.RESP_PENDING_FLAG:
                seq = flags & 0b00011111
                if res and (seq == 0):
                    break
                res += this[:7]
            else:
                break
        self._write_reset()
        return res
770185
def wait(self, timeout=15):
        

        Probe(timeout=timeout, fnc=self.is_ready, expected_retval=True).run()
229310
def wait_for_no_keyboard(timeout: nil)
      keyboard_timeout = keyboard_wait_timeout(timeout)
      message = "Timed out after #{keyboard_timeout} seconds waiting for the keyboard to disappear"
      wait_for(message, timeout: keyboard_timeout) do
        !keyboard_visible?
      end
    end
768046
def wait_for_signal(self, timeout=None):
		
		timeout_ms = int(timeout * 1000) if timeout else win32event.INFINITE
		win32event.WaitForSingleObject(self.signal_event, timeout_ms)
1310094
function yubikey__genNonceAsync(callback) {
    // Create a secure, random nonce value
    crypto.randomBytes(40, function(err, buf) {
      if (err) return callback(err);
      return callback(null, buf.toString('hex').slice(0,40));
    });
  }
486947
def _WaitForStatusNotRunning(self):
    """"""
    # We wait slightly longer than the status check sleep time.
    time.sleep(2.0)
    time_slept = 2.0
    while self._status_is_running:
      time.sleep(0.5)
      time_slept += 0.5
      if time_slept >= self._PROCESS_JOIN_TIMEOUT:
        break
768978
@Override
    public void waitForData(long timeout, TimeUnit timeUnit) throws CouldNotPerformException, InterruptedException {
        try {
            if (isDataAvailable()) {
                return;
            }
            long startTime = System.currentTimeMillis();
            getDataFuture().get(timeout, timeUnit);
            long partialTimeout = timeUnit.toMillis(timeout) - (System.currentTimeMillis() - startTime);
            if (partialTimeout <= 0) {
                throw new java.util.concurrent.TimeoutException("Data timeout is reached!");
            }
            dataObservable.waitForValue(partialTimeout, TimeUnit.MILLISECONDS);
        } catch (java.util.concurrent.TimeoutException | CouldNotPerformException | ExecutionException | CancellationException ex) {
            if (shutdownInitiated) {
                throw new InterruptedException("Interrupt request because system shutdown was initiated!");
            }
            throw new NotAvailableException("Data is not yet available!", ex);
        }
    }