Format: application/octet-stream
⬇ Download File (1.8 KB)
   1  from abc import ABCMeta
   2  from types import TracebackType
   3  from typing import IO, Iterable, Iterator, List, Optional, Union, overload
   4  
   5  # This class isn't actually abstract, but you can't instantiate it
   6  # directly, so we might as well treat it as abstract in the stub.
   7  class InputType(IO[str], Iterator[str], metaclass=ABCMeta):
   8      def getvalue(self) -> str: ...
   9      def close(self) -> None: ...
  10      @property
  11      def closed(self) -> bool: ...
  12      def flush(self) -> None: ...
  13      def isatty(self) -> bool: ...
  14      def read(self, size: int = ...) -> str: ...
  15      def readline(self, size: int = ...) -> str: ...
  16      def readlines(self, hint: int = ...) -> List[str]: ...
  17      def seek(self, offset: int, whence: int = ...) -> int: ...
  18      def tell(self) -> int: ...
  19      def truncate(self, size: Optional[int] = ...) -> int: ...
  20      def __iter__(self) -> InputType: ...
  21      def next(self) -> str: ...
  22      def reset(self) -> None: ...
  23  
  24  class OutputType(IO[str], Iterator[str], metaclass=ABCMeta):
  25      @property
  26      def softspace(self) -> int: ...
  27      def getvalue(self) -> str: ...
  28      def close(self) -> None: ...
  29      @property
  30      def closed(self) -> bool: ...
  31      def flush(self) -> None: ...
  32      def isatty(self) -> bool: ...
  33      def read(self, size: int = ...) -> str: ...
  34      def readline(self, size: int = ...) -> str: ...
  35      def readlines(self, hint: int = ...) -> List[str]: ...
  36      def seek(self, offset: int, whence: int = ...) -> int: ...
  37      def tell(self) -> int: ...
  38      def truncate(self, size: Optional[int] = ...) -> int: ...
  39      def __iter__(self) -> OutputType: ...
  40      def next(self) -> str: ...
  41      def reset(self) -> None: ...
  42      def write(self, b: Union[str, unicode]) -> int: ...
  43      def writelines(self, lines: Iterable[Union[str, unicode]]) -> None: ...
  44  
  45  @overload
  46  def StringIO() -> OutputType: ...
  47  @overload
  48  def StringIO(s: str) -> InputType: ...
  49