Wait for a MiFare card to be available and return its UID when found.
        Will wait up to timeout_sec seconds and return None if no card is found,
        otherwise a bytearray with the UID of the found card is returned.
779894
def read_passive_target(self, card_baud=PN532_MIFARE_ISO14443A, timeout_sec=1):
        
        # Send passive read command for 1 card.  Expect at most a 7 byte UUID.
        response = self.call_function(PN532_COMMAND_INLISTPASSIVETARGET,
                                      params=[0x01, card_baud],
                                      response_length=17)
        # If no response is available return None to indicate no card is present.
        if response is None:
            return None
        # Check only 1 card with up to a 7 byte UID is present.
        if response[0] != 0x01:
            raise RuntimeError('More than one card detected!')
        if response[5] > 7:
            raise RuntimeError('Found card with unexpectedly long UID!')
        # Return UID of card.
        return response[6:6+response[5]]
650796
def select_until(read_array, write_array, err_array, timeout_at)
      if !timeout_at
        return IO.select(read_array, write_array, err_array)
      end

      remaining = (timeout_at - Time.now)
      return nil if remaining <= 0

      IO.select(read_array, write_array, err_array, remaining)
    end
1365528
def wait(*args, **kwargs):
    
    kwargs.setdefault('sleep_seconds', (1, None))
    kwargs.setdefault('expected_exceptions', WebDriverException)
    kwargs.setdefault('timeout_seconds', webium.settings.wait_timeout)

    return wait_lib(*args, **kwargs)
1068486
def wait_for_visible(self, locator):
        
        for i in range(timeout_seconds):
            try:
                if self.driver.is_visible(locator):
                    break
            except:
                pass
            time.sleep(1)
        else:
            raise ElementVisiblityTimeout("%s visibility timed out" % locator)
        return True
1139410
def wait_until_stale(self, timeout=None):
        
        timeout = timeout if timeout is not None else self.driver_wrapper.timeout

        def wait():
            """
            Wrapper to wait for element to be stale
            """
            WebDriverWait(self.driver, timeout).until(EC.staleness_of(self.element))
            return self

        return self.execute_and_handle_webelement_exceptions(wait, 'wait for staleness')
1074549
def wait_for_event(self, event, timeout=10):
        
        return self.__handler.wait_for_event(event, timeout=timeout)
147251
def wait_for_text(self, locator, text):
        
        for i in range(timeout_seconds):
            try:
                e = self.driver.find_element_by_locator(locator)
                if e.text == text:
                    break
            except:
                pass
            time.sleep(1)
        else:
            raise ElementTextTimeout("%s value timed out" % locator)
        return True
40483
def wait_for_disappearance(self, timeout=120):
        

        start = time.time()
        while self.exists():
            self.poco.sleep_for_polling_interval()
            if time.time() - start > timeout:
                raise PocoTargetTimeout('disappearance', self)
1064549
private long tryWaitForEnoughBytes(final long bytes) throws IOException {
        // we can only wait for a positive number of bytes
        assert bytes > 0 : "Number of bytes are negative or zero : " + bytes;

        // if we haven't enough bytes, the loop starts and wait for enough bytes
        while (bytes > availableBytes) {
            try {
                // first of all, check for a closed stream
                if (streamClosed) {
                    // is the stream closed, return only the current available bytes
                    return availableBytes;
                }
                // wait for a next loop run and block until a modification is signalized
                signalModification.acquire();
            } catch (InterruptedException ex) {
                throw new IOException(ex);
            }
        }
        // return the available bytes (maybe higher as the required bytes)
        return availableBytes;
    }
228996
def wait_for(self, timeout=3000):
        """"""
        results = [None]
        results_called = [False]

        def results_callback(val):
            results[0] = val
            results_called[0] = True

        self.then(results_callback)

        start = time.time()
        while not results_called[0]:
            if time.time() - start > timeout / 1000.:
                raise Exception('Timeout of %d ms reached' % timeout)
            ip.kernel.do_one_iteration()
        return results[0]
837858
def wait_until_gone(self, timeout=0, *args, **selectors):
        
        return self.device(**selectors).wait.gone(timeout=timeout)
1245442
def wait(timeout = SimCtl.default_timeout)
      Timeout.timeout(timeout) do
        loop do
          break if yield SimCtl.device(udid: udid)
        end
      end
      reload
    end
1217321
def fetch(self, wait=0):
        
        if self.started:
            return fetch(self.id, wait=wait, cached=self.cached)
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
86621
def _wait_for_reader(self):
        """"""
        if self.max_size <= 0:  # Unlimited queue
            return
        if self.write_item_offset - self.cached_remote_offset <= self.max_size:
            return  # Hasn't reached max size
        remote_offset = internal_kv._internal_kv_get(self.read_ack_key)
        if remote_offset is None:
            # logger.debug("[writer] Waiting for reader to start...")
            while remote_offset is None:
                time.sleep(0.01)
                remote_offset = internal_kv._internal_kv_get(self.read_ack_key)
        remote_offset = int(remote_offset)
        if self.write_item_offset - remote_offset > self.max_size:
            logger.debug(
                "[writer] Waiting for reader to catch up {} to {} - {}".format(
                    remote_offset, self.write_item_offset, self.max_size))
            while self.write_item_offset - remote_offset > self.max_size:
                time.sleep(0.01)
                remote_offset = int(
                    internal_kv._internal_kv_get(self.read_ack_key))
        self.cached_remote_offset = remote_offset
451538
def wait(self, timeout):
    

    with self._condition:
      previous_iteration = self._iteration
      self._condition.wait(timeout)
      return previous_iteration != self._iteration
1216981
def wait(self, timeout=None):
        
        # The 'or' part is for Python 2.6
        result = self.__event.wait(timeout)
        # pylint: disable=E0702
        # Pylint seems to miss the "is None" check below
        if self.__exception is None:
            return result
        else:
            raise self.__exception