1 # Stubs for cStringIO (Python 2.7)
\r
2 # See https://docs.python.org/2/library/stringio.html
\r
4 from abc import ABCMeta
\r
5 from typing import overload, IO, List, Iterable, Iterator, Optional, Union
\r
6 from types import TracebackType
\r
8 # TODO the typing.IO[] generics should be split into input and output.
\r
10 # This class isn't actually abstract, but you can't instantiate it
\r
11 # directly, so we might as well treat it as abstract in the stub.
\r
12 class InputType(IO[str], Iterator[str], metaclass=ABCMeta):
\r
13 def getvalue(self) -> str: ...
\r
14 def close(self) -> None: ...
\r
16 def closed(self) -> bool: ...
\r
17 def flush(self) -> None: ...
\r
18 def isatty(self) -> bool: ...
\r
19 def read(self, size: int = ...) -> str: ...
\r
20 def readline(self, size: int = ...) -> str: ...
\r
21 def readlines(self, hint: int = ...) -> List[str]: ...
\r
22 def seek(self, offset: int, whence: int = ...) -> int: ...
\r
23 def tell(self) -> int: ...
\r
24 def truncate(self, size: Optional[int] = ...) -> int: ...
\r
25 def __iter__(self) -> 'InputType': ...
\r
26 def next(self) -> str: ...
\r
27 def reset(self) -> None: ...
\r
30 class OutputType(IO[str], Iterator[str], metaclass=ABCMeta):
\r
32 def softspace(self) -> int: ...
\r
33 def getvalue(self) -> str: ...
\r
34 def close(self) -> None: ...
\r
36 def closed(self) -> bool: ...
\r
37 def flush(self) -> None: ...
\r
38 def isatty(self) -> bool: ...
\r
39 def read(self, size: int = ...) -> str: ...
\r
40 def readline(self, size: int = ...) -> str: ...
\r
41 def readlines(self, hint: int = ...) -> List[str]: ...
\r
42 def seek(self, offset: int, whence: int = ...) -> int: ...
\r
43 def tell(self) -> int: ...
\r
44 def truncate(self, size: Optional[int] = ...) -> int: ...
\r
45 def __iter__(self) -> 'OutputType': ...
\r
46 def next(self) -> str: ...
\r
47 def reset(self) -> None: ...
\r
48 def write(self, b: Union[str, unicode]) -> int: ...
\r
49 def writelines(self, lines: Iterable[Union[str, unicode]]) -> None: ...
\r
52 def StringIO() -> OutputType: ...
\r
54 def StringIO(s: str) -> InputType: ...
\r