class_docstr: :param recognize_paste: When True, try to discover paste actions and turn
      the event into a BracketedPaste.
class_docstr_tok: [":","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):
      """
      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()
  
      # 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))
  
      if self.recognize_paste and self._is_paste(all_keys):
          gen = iter(all_keys)
          for k in gen:
              # Pasting: if the current key consists of text or \n, turn it
              # into a BracketedPaste.
              data = []
              while k and (
                  isinstance(k.key, six.text_type)
                  or k.key == Keys.ControlJ
              ):
                  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:
          for k in all_keys:
              yield k
  
imports: from __future__ import unicode_literals
  from ctypes import windll, pointer
  from ctypes.wintypes import DWORD, HANDLE
  from six.moves import range
  from prompt_toolkit.key_binding.input_processor import KeyPress
  from prompt_toolkit.keys import Keys
  from prompt_toolkit.mouse_events import MouseEventType
  from prompt_toolkit.win32_types import EventTypes, KEY_EVENT_RECORD, MOUSE_EVENT_RECORD, INPUT_RECORD, STD_INPUT_HANDLE
  import msvcrt
  import os
  import sys
  import six
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