massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 3 / io.pyi
1 from typing import (\r
2     List, BinaryIO, TextIO, Iterator, Union, Optional, Callable, Tuple, Type, Any, IO, Iterable\r
3 )\r
4 import builtins\r
5 import codecs\r
6 from mmap import mmap\r
7 import sys\r
8 from types import TracebackType\r
9 from typing import TypeVar\r
10 \r
11 _bytearray_like = Union[bytearray, mmap]\r
12 \r
13 DEFAULT_BUFFER_SIZE = ...  # type: int\r
14 \r
15 SEEK_SET = ...  # type: int\r
16 SEEK_CUR = ...  # type: int\r
17 SEEK_END = ...  # type: int\r
18 \r
19 _T = TypeVar('_T', bound='IOBase')\r
20 \r
21 open = builtins.open\r
22 \r
23 BlockingIOError = builtins.BlockingIOError\r
24 class UnsupportedOperation(OSError, ValueError): ...\r
25 \r
26 class IOBase:\r
27     def __iter__(self) -> Iterator[bytes]: ...\r
28     def __next__(self) -> bytes: ...\r
29     def __enter__(self: _T) -> _T: ...\r
30     def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException],\r
31                  exc_tb: Optional[TracebackType]) -> bool: ...\r
32     def close(self) -> None: ...\r
33     def fileno(self) -> int: ...\r
34     def flush(self) -> None: ...\r
35     def isatty(self) -> bool: ...\r
36     def readable(self) -> bool: ...\r
37     def readlines(self, hint: int = ...) -> List[bytes]: ...\r
38     def seek(self, offset: int, whence: int = ...) -> int: ...\r
39     def seekable(self) -> bool: ...\r
40     def tell(self) -> int: ...\r
41     def truncate(self, size: Optional[int] = ...) -> int: ...\r
42     def writable(self) -> bool: ...\r
43     def writelines(self, lines: Iterable[Union[bytes, bytearray]]) -> None: ...\r
44     def readline(self, size: int = ...) -> bytes: ...\r
45     def __del__(self) -> None: ...\r
46     @property\r
47     def closed(self) -> bool: ...\r
48 \r
49 class RawIOBase(IOBase):\r
50     def readall(self) -> bytes: ...\r
51     def readinto(self, b: bytearray) -> Optional[int]: ...\r
52     def write(self, b: Union[bytes, bytearray]) -> Optional[int]: ...\r
53     def read(self, size: int = ...) -> Optional[bytes]: ...\r
54 \r
55 class BufferedIOBase(IOBase):\r
56     def detach(self) -> RawIOBase: ...\r
57     def readinto(self, b: _bytearray_like) -> int: ...\r
58     def write(self, b: Union[bytes, bytearray]) -> int: ...\r
59     if sys.version_info >= (3, 5):\r
60         def readinto1(self, b: _bytearray_like) -> int: ...\r
61     def read(self, size: Optional[int] = ...) -> bytes: ...\r
62     def read1(self, size: int = ...) -> bytes: ...\r
63 \r
64 \r
65 class FileIO(RawIOBase):\r
66     mode = ...  # type: str\r
67     name = ...  # type: Union[int, str]\r
68     def __init__(\r
69         self,\r
70         name: Union[str, bytes, int],\r
71         mode: str = ...,\r
72         closefd: bool = ...,\r
73         opener: Optional[Callable[[Union[int, str], str], int]] = ...\r
74     ) -> None: ...\r
75 \r
76 # TODO should extend from BufferedIOBase\r
77 class BytesIO(BinaryIO):\r
78     def __init__(self, initial_bytes: bytes = ...) -> None: ...\r
79     # BytesIO does not contain a "name" field. This workaround is necessary\r
80     # to allow BytesIO sub-classes to add this field, as it is defined\r
81     # as a read-only property on IO[].\r
82     name: Any\r
83     def getvalue(self) -> bytes: ...\r
84     def getbuffer(self) -> memoryview: ...\r
85     # copied from IOBase\r
86     def __iter__(self) -> Iterator[bytes]: ...\r
87     def __next__(self) -> bytes: ...\r
88     def __enter__(self) -> 'BytesIO': ...\r
89     def __exit__(self, t: Optional[Type[BaseException]] = ..., value: Optional[BaseException] = ...,\r
90                  traceback: Optional[TracebackType] = ...) -> bool: ...\r
91     def close(self) -> None: ...\r
92     def fileno(self) -> int: ...\r
93     def flush(self) -> None: ...\r
94     def isatty(self) -> bool: ...\r
95     def readable(self) -> bool: ...\r
96     def readlines(self, hint: int = ...) -> List[bytes]: ...\r
97     def seek(self, offset: int, whence: int = ...) -> int: ...\r
98     def seekable(self) -> bool: ...\r
99     def tell(self) -> int: ...\r
100     def truncate(self, size: Optional[int] = ...) -> int: ...\r
101     def writable(self) -> bool: ...\r
102     # TODO should be the next line instead\r
103     # def writelines(self, lines: List[Union[bytes, bytearray]]) -> None: ...\r
104     def writelines(self, lines: Any) -> None: ...\r
105     def readline(self, size: int = ...) -> bytes: ...\r
106     def __del__(self) -> None: ...\r
107     closed = ...  # type: bool\r
108     # copied from BufferedIOBase\r
109     def detach(self) -> RawIOBase: ...\r
110     def readinto(self, b: _bytearray_like) -> int: ...\r
111     def write(self, b: Union[bytes, bytearray]) -> int: ...\r
112     if sys.version_info >= (3, 5):\r
113         def readinto1(self, b: _bytearray_like) -> int: ...\r
114     def read(self, size: Optional[int] = ...) -> bytes: ...\r
115     def read1(self, size: int = ...) -> bytes: ...\r
116 \r
117 class BufferedReader(BufferedIOBase):\r
118     def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...\r
119     def peek(self, size: int = ...) -> bytes: ...\r
120 \r
121 class BufferedWriter(BufferedIOBase):\r
122     def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...\r
123     def flush(self) -> None: ...\r
124     def write(self, b: Union[bytes, bytearray]) -> int: ...\r
125 \r
126 class BufferedRandom(BufferedReader, BufferedWriter):\r
127     def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...\r
128     def seek(self, offset: int, whence: int = ...) -> int: ...\r
129     def tell(self) -> int: ...\r
130 \r
131 class BufferedRWPair(BufferedIOBase):\r
132     def __init__(self, reader: RawIOBase, writer: RawIOBase,\r
133                  buffer_size: int = ...) -> None: ...\r
134 \r
135 \r
136 class TextIOBase(IOBase):\r
137     encoding = ...  # type: str\r
138     errors = ...  # type: Optional[str]\r
139     newlines = ...  # type: Union[str, Tuple[str, ...], None]\r
140     def __iter__(self) -> Iterator[str]: ...  # type: ignore\r
141     def __next__(self) -> str: ...  # type: ignore\r
142     def detach(self) -> IOBase: ...\r
143     def write(self, s: str) -> int: ...\r
144     def readline(self, size: int = ...) -> str: ...  # type: ignore\r
145     def read(self, size: Optional[int] = ...) -> str: ...\r
146     def seek(self, offset: int, whence: int = ...) -> int: ...\r
147     def tell(self) -> int: ...\r
148 \r
149 # TODO should extend from TextIOBase\r
150 class TextIOWrapper(TextIO):\r
151     line_buffering = ...  # type: bool\r
152     # TODO uncomment after fixing mypy about using write_through\r
153     # def __init__(self, buffer: IO[bytes], encoding: str = ...,\r
154     #              errors: Optional[str] = ..., newline: Optional[str] = ...,\r
155     #              line_buffering: bool = ..., write_through: bool = ...) \\r
156     #              -> None: ...\r
157     def __init__(\r
158         self,\r
159         buffer: IO[bytes],\r
160         encoding: str = ...,\r
161         errors: Optional[str] = ...,\r
162         newline: Optional[str] = ...,\r
163         line_buffering: bool = ...,\r
164         write_through: bool = ...\r
165     ) -> None: ...\r
166     # copied from IOBase\r
167     def __exit__(self, t: Optional[Type[BaseException]] = ..., value: Optional[BaseException] = ...,\r
168                  traceback: Optional[TracebackType] = ...) -> bool: ...\r
169     def close(self) -> None: ...\r
170     def fileno(self) -> int: ...\r
171     def flush(self) -> None: ...\r
172     def isatty(self) -> bool: ...\r
173     def readable(self) -> bool: ...\r
174     def readlines(self, hint: int = ...) -> List[str]: ...\r
175     def seekable(self) -> bool: ...\r
176     def truncate(self, size: Optional[int] = ...) -> int: ...\r
177     def writable(self) -> bool: ...\r
178     # TODO should be the next line instead\r
179     # def writelines(self, lines: List[str]) -> None: ...\r
180     def writelines(self, lines: Any) -> None: ...\r
181     def __del__(self) -> None: ...\r
182     closed = ...  # type: bool\r
183     # copied from TextIOBase\r
184     encoding = ...  # type: str\r
185     errors = ...  # type: Optional[str]\r
186     newlines = ...  # type: Union[str, Tuple[str, ...], None]\r
187     def __iter__(self) -> Iterator[str]: ...\r
188     def __next__(self) -> str: ...\r
189     def __enter__(self) -> 'TextIO': ...\r
190     def detach(self) -> IOBase: ...\r
191     def write(self, s: str) -> int: ...\r
192     def readline(self, size: int = ...) -> str: ...\r
193     def read(self, size: Optional[int] = ...) -> str: ...\r
194     def seek(self, offset: int, whence: int = ...) -> int: ...\r
195     def tell(self) -> int: ...\r
196 \r
197 class StringIO(TextIOWrapper):\r
198     def __init__(self, initial_value: str = ...,\r
199                  newline: Optional[str] = ...) -> None: ...\r
200     # StringIO does not contain a "name" field. This workaround is necessary\r
201     # to allow StringIO sub-classes to add this field, as it is defined\r
202     # as a read-only property on IO[].\r
203     name: Any\r
204     def getvalue(self) -> str: ...\r
205     def __enter__(self) -> 'StringIO': ...\r
206 \r
207 class IncrementalNewlineDecoder(codecs.IncrementalDecoder):\r
208     def decode(self, input: bytes, final: bool = ...) -> str: ...\r