class_docstr: Parser for VT100 input stream.
  
  Feed the data through the `feed` method and the correct callbacks of the
  `input_processor` will be called.
  
  ::
  
      def callback(key):
          pass
      i = InputStream(callback)
      i.feed('data...')
  
  :attr input_processor: :class:`~prompt_toolkit.key_binding.InputProcessor` instance.
docstr: Feed the input stream.
  
  :param data: Input string (unicode).
docstr_tok: ["Feed","the","input","stream",".",":","param","data",":","Input","string","(","unicode",")","."]
code: def feed(self, data):
      """
      Feed the input stream.
  
      :param data: Input string (unicode).
      """
      assert isinstance(data, six.text_type)
  
      if _DEBUG_RENDERER_INPUT:
          self.LOG.write(repr(data).encode("utf-8") + b"\n")
          self.LOG.flush()
  
      # Handle bracketed paste. (We bypass the parser that matches all other
      # key presses and keep reading input until we see the end mark.)
      # This is much faster then parsing character by character.
      if self._in_bracketed_paste:
          self._paste_buffer += data
          end_mark = "\x1b[201~"
  
          if end_mark in self._paste_buffer:
              end_index = self._paste_buffer.index(end_mark)
  
              # Feed content to key bindings.
              paste_content = self._paste_buffer[:end_index]
              self.feed_key_callback(
                  KeyPress(Keys.BracketedPaste, paste_content)
              )
  
              # Quit bracketed paste mode and handle remaining input.
              self._in_bracketed_paste = False
              remaining = self._paste_buffer[
                  end_index + len(end_mark) :
              ]
              self._paste_buffer = ""
  
              self.feed(remaining)
  
      # Handle normal input character by character.
      else:
          for i, c in enumerate(data):
              if self._in_bracketed_paste:
                  # Quit loop and process from this position when the parser
                  # entered bracketed paste.
                  self.feed(data[i:])
                  break
              else:
                  # Replace \r by \n. (Some clients send \r instead of \n
                  # when enter is pressed. E.g. telnet and some other
                  # terminals.)
  
                  # XXX: We should remove this in a future version. It *is*
                  #      now possible to recognise the difference.
                  #      (We remove ICRNL/INLCR/IGNCR below.)
                  #      However, this breaks IPython and maybe other applications,
                  #      because they bind ControlJ (\n) for handling the Enter key.
  
                  #      When this is removed, replace Enter=ControlJ by
                  #      Enter=ControlM in keys.py.
                  if c == "\r":
                      c = "\n"
                  self._input_parser.send(c)
  
imports: from __future__ import unicode_literals
  import os
  import re
  import six
  import termios
  import tty
  from six.moves import range
  from ..keys import Keys
  from ..key_binding.input_processor import KeyPress
label_desc: Use image node_id 7 for calling the InputStream obj's underlying member method code with example usage: obj.feed(data) without return types