class_docstr: Vt100 input for Posix systems.
  (This uses a posix file descriptor that can be registered in the event loop.)
code: def __init__(self, stdin: TextIO) -> None:
      # Test whether the given input object has a file descriptor.
      # (Idle reports stdin to be a TTY, but fileno() is not implemented.)
      try:
          # This should not raise, but can return 0.
          stdin.fileno()
      except io.UnsupportedOperation as e:
          if "idlelib.run" in sys.modules:
              raise io.UnsupportedOperation(
                  "Stdin is not a terminal. Running from Idle is not supported."
              ) from e
          else:
              raise io.UnsupportedOperation(
                  "Stdin is not a terminal."
              ) from e
  
      # Even when we have a file descriptor, it doesn't mean it's a TTY.
      # Normally, this requires a real TTY device, but people instantiate
      # this class often during unit tests as well. They use for instance
      # pexpect to pipe data into an application. For convenience, we print
      # an error message and go on.
      isatty = stdin.isatty()
      fd = stdin.fileno()
  
      if not isatty and fd not in Vt100Input._fds_not_a_terminal:
          msg = "Warning: Input is not a terminal (fd=%r).\n"
          sys.stderr.write(msg % fd)
          sys.stderr.flush()
          Vt100Input._fds_not_a_terminal.add(fd)
  
      #
      self.stdin = stdin
  
      # Create a backup of the fileno(). We want this to work even if the
      # underlying file is closed, so that `typeahead_hash()` keeps working.
      self._fileno = stdin.fileno()
  
      self._buffer: list[
          KeyPress
      ] = []  # Buffer to collect the Key objects.
      self.stdin_reader = PosixStdinReader(
          self._fileno, encoding=stdin.encoding
      )
      self.vt100_parser = Vt100Parser(
          lambda key_press: self._buffer.append(key_press)
      )
  
imports: from __future__ import annotations
  import sys
  import contextlib
  import io
  import termios
  import tty
  from asyncio import AbstractEventLoop, get_running_loop
  from typing import Callable, ContextManager, Generator, TextIO
  from ..key_binding import KeyPress
  from .base import Input
  from .posix_utils import PosixStdinReader
  from .vt100_parser import Vt100Parser
label_desc: Use image node_id 1 to create a new Vt100Input object from inherited base classes: Input with example: obj = Vt100Input(stdin)