Return one character from the input queue
194206
def getc(self, block=True):
        """"""
        if not block:
            if not len(self.cookedq):
                return ''
        while not len(self.cookedq):
            time.sleep(0.05)
        self.IQUEUELOCK.acquire()
        ret = self.cookedq[0]
        self.cookedq = self.cookedq[1:]
        self.IQUEUELOCK.release()
        return ret
362127
function(callee, input) {
		for (var i = 0, len = this._queue.length; i < len; ++i)
			input = this._queue[i].call(callee, input);
		return input;
	}
1049679
def handle_input(self, input_str, place=True, check=False):
        ''''''
        user = self.get_player()
        pos = self.validate_input(input_str)
        if pos[0] == 'u':
            self.undo(pos[1])
            return pos
        if place:
            result = self.set_pos(pos, check)
            return result
        else:
            return pos
402061
def expect_lit(char, buf, pos):
    """"""
    if pos >= len(buf) or buf[pos] != char:
        return None, len(buf)
    return char, pos+1
725472
def buffer(self):
        '''
        
        '''
        return buffer(self._input, self._start_pos,
                      (self._end_pos - self._start_pos))
1231645
function strlen(key, req) {
  var val = this.getKey(key, req);
  if(!val) return 0;
  if(val instanceof Buffer) return val.length;
  // redis compatible, return byte length
  return Buffer.byteLength(val);
}
724946
def strip_prompt(self, a_string):
        """"""
        expect_string = r"^(OK|ERROR|Command not recognized\.)$"
        response_list = a_string.split(self.RESPONSE_RETURN)
        last_line = response_list[-1]
        if re.search(expect_string, last_line):
            return self.RESPONSE_RETURN.join(response_list[:-1])
        else:
            return a_string
1036476
def expect(self, c):
        
        if self.peek() != c:
            self.error('Expected "%c"' % (c,))
        self.skip_char()
600847
def get_character(self, position, offset=0):
        """"""
        position = self.get_position(position) + offset
        cursor = self.textCursor()
        cursor.movePosition(QTextCursor.End)
        if position < cursor.position():
            cursor.setPosition(position)
            cursor.movePosition(QTextCursor.Right,
                                QTextCursor.KeepAnchor)
            return to_text_string(cursor.selectedText())
        else:
            return ''
1135022
def input_waiting(self):
        
        # Get input waiting
        buf = array.array('I', [0])
        try:
            fcntl.ioctl(self._fd, termios.TIOCINQ, buf, True)
        except OSError as e:
            raise SerialError(e.errno, "Querying input waiting: " + e.strerror)

        return buf[0]
942752
function( text, index, character ) {
			if(text && text.length > index){
			   return text.substr(0, index) + character + text.substr(index+character.length);
			}else{
				return text;
			}
		}
810012
final boolean lookahead(char c, int n)
  {

    int pos = (m_queueMark + n);
    boolean b;

    if ((pos <= m_ops.getTokenQueueSize()) && (pos > 0)
            && (m_ops.getTokenQueueSize() != 0))
    {
      String tok = ((String) m_ops.m_tokenQueue.elementAt(pos - 1));

      b = (tok.length() == 1) ? (tok.charAt(0) == c) : false;
    }
    else
    {
      b = false;
    }

    return b;
  }
1254335
def process_user_input(self):
        
        user_input = self.get_input()

        try:
            num = int(user_input)
        except Exception:
            return
        if 0 < num < len(self.items) + 1:
            self.current_option = num - 1
            self.select()

        return user_input
624709
def get_input(prompt, default=None, choices=None, option_value=None):
    
    if option_value is not None:
        return option_value
    
    choices = choices or []
    while 1:
        r = raw_input(prompt+' ').strip()
        if not r and default is not None:
            return default
        if choices:
            if r not in choices:
                r = None
            else:
                break
        else:
            break
    return r
515199
def get_input(prompt, default=None, choices=None, option_value=None):
    
    if option_value is not None:
        return option_value
    
    choices = choices or []
    while 1:
        r = input(prompt+' ').strip()
        if not r and default is not None:
            return default
        if choices:
            if r not in choices:
                r = None
            else:
                break
        else:
            break
    return r
104662
synchronized char getChar(long index) {
        int i = loadBufferIfNeeded(index);
        int ch1 = ((int) dumpBuffer[i++]) & 0xFF;
        int ch2 = ((int) dumpBuffer[i]) & 0xFF;

        return (char) ((ch1 << 8) + (ch2 << 0));
    }
35115
def get_one(self, qry, tpl):
        '''  '''
        self.cur.execute(qry + ' LIMIT 1', tpl)
        result = self.cur.fetchone()
        # unpack tuple if it has only
        # one element
        # TODO unpack results
        if type(result) is tuple and len(result) == 1:
            result = result[0]
        return result