Like waitfor(), but removes the matched data from the incoming
        buffer.
349815
def expect(self, relist, timeout=None, cleanup=None):
        
        return self._waitfor(relist, timeout, True, cleanup=cleanup)
980535
def _cleanup_buffer(self):
        '''
        
        '''
        if not self._buffer:
            return
        while True:
            time.sleep(60)
            log.debug('Cleaning up buffer')
            items = self._buffer.items()
            # The ``items`` function should also cleanup the buffer
            log.debug('Collected items')
            log.debug(list(items))
1197612
boolean removeEq(Object o) {
        for (int i = 0; i < size; i++) {
            if (o == queue[i]) {
                removeAt(i);
                return true;
            }
        }
        return false;
    }
88952
def waiting(self, timeout=0):
        ""
        if self.linebuffer:
            return True
        (winput, woutput, wexceptions) = select.select((self.sock,), (), (), timeout)
        return winput != []
723127
def wait(self) -> None:
        """"""
        if self._out_thread.is_alive():
            self._out_thread.join()
        if self._err_thread.is_alive():
            self._err_thread.join()

        # Handle case where the process ended before the last read could be done.
        # This will return None for the streams that weren't pipes.
        out, err = self._proc.communicate()

        if out:
            self._write_bytes(self._stdout, out)
        if err:
            self._write_bytes(self._stderr, err)
252173
def wait_until(predicate, timeout=30):
    
    not_expired = Timeout(timeout)
    while not_expired():
        r = predicate()
        if r:
            break
199103
def wait_event(self, filter: Callable[[T_Event], bool] = None) -> Awaitable[T_Event]:
        """"""
        return wait_event([self], filter)
244573
private void skip() throws IOException, KriptonRuntimeException {
		while (position < limit || fillBuffer(1)) {
			int c = buffer[position];
			if (c > ' ') {
				break;
			}
			position++;
		}
	}
399537
def clear(self):
        """"""
        io_loop = IOLoop.current()
        while self._tombstones:
            _, req_timeout = self._tombstones.popitem()
            io_loop.remove_timeout(req_timeout)
525572
def wait_for(self, text, seconds):
        
        found = False
        stream = self.stream
        start_time = time.time()
        while not found:
            if time.time() - start_time > seconds:
                break
            stream.data_available.wait(0.5)
            stream.data_unoccupied.clear()
            while stream.data:
                line = stream.data.pop(0)
                value = line.getvalue()
                if text in value:
                    found = True
                self.lines.append(value)
                stream.data_available.clear()
                stream.data_unoccupied.set()
                if time.time() - start_time > seconds:
                    break
        return found
805801
public void waitForData() throws InterruptedException {
        try {
            if (registryRemote == null) {
                waitForValue();
                return;
            }
            getRegistryRemote().waitForData();
        } catch (CouldNotPerformException ex) {
            ExceptionPrinter.printHistory("Could not wait until " + getName() + " is ready!", ex, logger);
        }
    }
2294
def clear(self, match="*", count=1000):
        
        cursor = '0'
        while cursor != 0:
            cursor, keys = self.scan(cursor=cursor, match=match, count=count)
            if keys:
                self._client.delete(*keys)
1169346
def clear(self, fill = 0x00):
        
        self._buffer = [ fill ] * ( self.width * self.height )
786554
private int scanForOne(byte[] data , int index , int end ) {
		while (index < end && data[index] != 1) {
			index++;
		}
		return index;
	}
1075519
private void waitForMoveCompletion() {
    boolean shouldWait;
    int waitedIterations = 0;
    do {
      shouldWait = false;
      for (BalancerDatanode target : plan.targets) {
        if (!target.isPendingQEmpty()) {
          shouldWait = true;
        }
      }
      if (shouldWait) {
        try {
          if (waitedIterations > MAX_WAIT_ITERATIONS) {
            for (BalancerDatanode target : plan.targets) {
              target.killPending();
            }
            continue;
          }
          waitedIterations++;
          Thread.sleep(blockMoveWaitTime);
        } catch (InterruptedException ignored) {
        }
      }
    } while (shouldWait);
  }
28746
def flush (self, overlap=0):
        """"""
        self.buf += self.empty.join(self.tmpbuf)
        self.tmpbuf = []
        if overlap and overlap < self.pos:
            data = self.buf[:-overlap]
            self.buf = self.buf[-overlap:]
        else:
            data = self.buf
            self.buf = self.empty
        return data
1050522
protected void cleanup() {
		int closed = 0;
		SendBuffer buffer;
		synchronized (buffers) {
			int buffersToClose = buffers.size() - maxConnections;
			if (buffersToClose < 1) {
				return;
			}
			Iterator<SendBuffer> i = buffers.values().iterator();
			while (i.hasNext()) {
				buffer = i.next();
				if (buffer.tryToClose()) {
					i.remove();
					closed++;
					if (closed >= buffersToClose) {
						return;
					}
				}
			}
		}
	}