

def read(self):
    "\n        Read from the Windows console and return a list of `KeyPress` instances.\n        It can return an empty list when there was nothing to read. (This\n        function doesn't block.)\n\n        http://msdn.microsoft.com/en-us/library/windows/desktop/ms684961(v=vs.85).aspx\n        "
    max_count = 1024
    result = []
    read = DWORD(0)
    arrtype = (INPUT_RECORD * max_count)
    input_records = arrtype()
    windll.kernel32.ReadConsoleInputW(self.handle, pointer(input_records), max_count, pointer(read))
    for i in range(read.value):
        ir = input_records[i]
        if (ir.EventType in EventTypes):
            ev = getattr(ir.Event, EventTypes[ir.EventType])
            if ((type(i) == KEY_EVENT_RECORD) and ev.KeyDown):
                key_presses = self._event_to_key_presses(ev)
                if key_presses:
                    result.extend(key_presses)
            elif (type(ev) == MOUSE_EVENT_RECORD):
                result.extend(self._handle_mouse(ev))
    return result

dataset/ETHPy150Open jonathanslenders/python-prompt-toolkit/prompt_toolkit/terminal/win32_input.py ConsoleInputReader.read/VarMisuse@116/252 `ev`->`i`