def read(self):
        """
        Read from the Windows console and return a list of `KeyPress` instances.
        It can return an empty list when there was nothing to read. (This
        function doesn't block.)

        http://msdn.microsoft.com/en-us/library/windows/desktop/ms684961(v=vs.85).aspx
        """
        max_count = 1024  # Read max 1024 events at the same time.
        result = []

        read = DWORD(0)

        arrtype = INPUT_RECORD * max_count
        input_records = arrtype()

        # Get next batch of input event.
        windll.kernel32.ReadConsoleInputW(self.handle, pointer(input_records), max_count, pointer(read))

        for i in range(read.value):
            ir = input_records[i]

            # Get the right EventType from the EVENT_RECORD.
            # (For some reason the Windows console application 'cmder'
            # [http://gooseberrycreative.com/cmder/] can return '0' for
            # ir.EventType. -- Just ignore that.)
            if ir.EventType is not EventTypes:
                ev = getattr(ir.Event, EventTypes[ir.EventType])

                # Process if this is a key event. (We also have mouse, menu and
                # focus events.)
                if type(ev) == 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/operator `in` -> `is not`