class_docstr: :param recognize_paste: When True, try to discover paste actions and turn
      the event into a BracketedPaste.
docstr: Return a list of `KeyPress` instances. It won't return anything 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
docstr_tok: ["Return","a","list","of","`","KeyPress","`","instances",".","It","wo","n't","return","anything","when","there","was","nothing","to","read",".","(","This","function","does","n't","block",".",")","http",":","\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/ms684961","(","v=vs.85",")",".aspx"]
code: def read(self) -> Iterable[KeyPress]:
      """
      Return a list of `KeyPress` instances. It won't return anything 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 = 2048  # Max events to read at the same time.
  
      read = DWORD(0)
      arrtype = INPUT_RECORD * max_count
      input_records = arrtype()
  
      # Check whether there is some input to read. `ReadConsoleInputW` would
      # block otherwise.
      # (Actually, the event loop is responsible to make sure that this
      # function is only called when there is something to read, but for some
      # reason this happened in the asyncio_win32 loop, and it's better to be
      # safe anyway.)
      if not wait_for_handles([self.handle], timeout=0):
          return
  
      # Get next batch of input event.
      windll.kernel32.ReadConsoleInputW(
          self.handle, pointer(input_records), max_count, pointer(read)
      )
  
      # First, get all the keys from the input buffer, in order to determine
      # whether we should consider this a paste event or not.
      all_keys = list(self._get_keys(read, input_records))
  
      # Fill in 'data' for key presses.
      all_keys = [self._insert_key_data(key) for key in all_keys]
  
      # Correct non-bmp characters that are passed as separate surrogate codes
      all_keys = list(self._merge_paired_surrogates(all_keys))
  
      if self.recognize_paste and self._is_paste(all_keys):
          gen = iter(all_keys)
          k: KeyPress | None
  
          for k in gen:
              # Pasting: if the current key consists of text or \n, turn it
              # into a BracketedPaste.
              data = []
              while k and (
                  not isinstance(k.key, Keys)
                  or k.key in {Keys.ControlJ, Keys.ControlM}
              ):
                  data.append(k.data)
                  try:
                      k = next(gen)
                  except StopIteration:
                      k = None
  
              if data:
                  yield KeyPress(Keys.BracketedPaste, "".join(data))
              if k is not None:
                  yield k
      else:
          yield from all_keys
  
imports: from __future__ import annotations
  import os
  import sys
  from abc import abstractmethod
  from asyncio import get_running_loop
  from contextlib import contextmanager
  from ..utils import SPHINX_AUTODOC_RUNNING
  from ctypes import Array, pointer
  from ctypes.wintypes import DWORD, HANDLE
  from typing import Callable, ContextManager, Iterable, Iterator, TextIO
  from prompt_toolkit.eventloop import run_in_executor_with_context
  from prompt_toolkit.eventloop.win32 import create_win32_event, wait_for_handles
  from prompt_toolkit.key_binding.key_processor import KeyPress
  from prompt_toolkit.keys import Keys
  from prompt_toolkit.mouse_events import MouseButton, MouseEventType
  from prompt_toolkit.win32_types import INPUT_RECORD, KEY_EVENT_RECORD, MOUSE_EVENT_RECORD, STD_INPUT_HANDLE, EventTypes
  from .ansi_escape_sequences import REVERSE_ANSI_SEQUENCES
  from .base import Input
label_desc: Use image node_id 3 for calling the ConsoleInputReader obj's underlying member method code with example usage: obj.read() without return types