massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 2 / _io.pyi
1 from typing import Any, AnyStr, BinaryIO, IO, Text, TextIO, Iterable, Iterator, List, Optional, Type, Tuple, TypeVar, Union\r
2 from mmap import mmap\r
3 from types import TracebackType\r
4 \r
5 _bytearray_like = Union[bytearray, mmap]\r
6 \r
7 DEFAULT_BUFFER_SIZE = ...  # type: int\r
8 \r
9 class BlockingIOError(IOError):\r
10     characters_written = ...  # type: int\r
11 \r
12 class UnsupportedOperation(ValueError, IOError): ...\r
13 \r
14 _T = TypeVar("_T")\r
15 \r
16 class _IOBase(BinaryIO):\r
17     @property\r
18     def closed(self) -> bool: ...\r
19     def _checkClosed(self) -> None: ...\r
20     def _checkReadable(self) -> None: ...\r
21     def _checkSeekable(self) -> None: ...\r
22     def _checkWritable(self) -> None: ...\r
23     # All these methods are concrete here (you can instantiate this)\r
24     def close(self) -> None: ...\r
25     def fileno(self) -> int: ...\r
26     def flush(self) -> None: ...\r
27     def isatty(self) -> bool: ...\r
28     def readable(self) -> bool: ...\r
29     def seek(self, offset: int, whence: int = ...) -> int: ...\r
30     def seekable(self) -> bool: ...\r
31     def tell(self) -> int: ...\r
32     def truncate(self, size: Optional[int] = ...) -> int: ...\r
33     def writable(self) -> bool: ...\r
34     def __enter__(self: _T) -> _T: ...\r
35     def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]) -> bool: ...\r
36     def __iter__(self: _T) -> _T: ...\r
37     # The parameter type of writelines[s]() is determined by that of write():\r
38     def writelines(self, lines: Iterable[bytes]) -> None: ...\r
39     # The return type of readline[s]() and next() is determined by that of read():\r
40     def readline(self, limit: int = ...) -> bytes: ...\r
41     def readlines(self, hint: int = ...) -> List[bytes]: ...\r
42     def next(self) -> bytes: ...\r
43     # These don't actually exist but we need to pretend that it does\r
44     # so that this class is concrete.\r
45     def write(self, s: bytes) -> int: ...\r
46     def read(self, n: int = ...) -> bytes: ...\r
47 \r
48 class _BufferedIOBase(_IOBase):\r
49     def read1(self, n: int) -> bytes: ...\r
50     def read(self, size: int = ...) -> bytes: ...\r
51     def readinto(self, buffer: _bytearray_like) -> int: ...\r
52     def write(self, s: bytes) -> int: ...\r
53     def detach(self) -> _IOBase: ...\r
54 \r
55 class BufferedRWPair(_BufferedIOBase):\r
56     def __init__(self, reader: _RawIOBase, writer: _RawIOBase,\r
57                  buffer_size: int = ..., max_buffer_size: int = ...) -> None: ...\r
58     def peek(self, n: int = ...) -> bytes: ...\r
59     def __enter__(self) -> BufferedRWPair: ...\r
60 \r
61 class BufferedRandom(_BufferedIOBase):\r
62     mode = ...  # type: str\r
63     name = ...  # type: str\r
64     raw = ...  # type: _IOBase\r
65     def __init__(self, raw: _IOBase,\r
66                  buffer_size: int = ...,\r
67                  max_buffer_size: int = ...) -> None: ...\r
68     def peek(self, n: int = ...) -> bytes: ...\r
69 \r
70 class BufferedReader(_BufferedIOBase):\r
71     mode = ...  # type: str\r
72     name = ...  # type: str\r
73     raw = ...  # type: _IOBase\r
74     def __init__(self, raw: _IOBase, buffer_size: int = ...) -> None: ...\r
75     def peek(self, n: int = ...) -> bytes: ...\r
76 \r
77 class BufferedWriter(_BufferedIOBase):\r
78     name = ...  # type: str\r
79     raw = ...  # type: _IOBase\r
80     mode = ...  # type: str\r
81     def __init__(self, raw: _IOBase,\r
82                  buffer_size: int = ...,\r
83                  max_buffer_size: int = ...) -> None: ...\r
84 \r
85 class BytesIO(_BufferedIOBase):\r
86     def __init__(self, initial_bytes: bytes = ...) -> None: ...\r
87     def __setstate__(self, tuple) -> None: ...\r
88     def __getstate__(self) -> tuple: ...\r
89     # BytesIO does not contain a "name" field. This workaround is necessary\r
90     # to allow BytesIO sub-classes to add this field, as it is defined\r
91     # as a read-only property on IO[].\r
92     name: Any\r
93     def getvalue(self) -> bytes: ...\r
94     def write(self, s: bytes) -> int: ...\r
95     def writelines(self, lines: Iterable[bytes]) -> None: ...\r
96     def read1(self, size: int) -> bytes: ...\r
97     def next(self) -> bytes: ...\r
98 \r
99 class _RawIOBase(_IOBase):\r
100     def readall(self) -> str: ...\r
101     def read(self, n: int = ...) -> str: ...\r
102 \r
103 class FileIO(_RawIOBase, BytesIO):  # type: ignore  # for __enter__\r
104     mode = ...  # type: str\r
105     closefd = ...  # type: bool\r
106     def __init__(self, file: Union[str, int], mode: str = ..., closefd: bool = ...) -> None: ...\r
107     def readinto(self, buffer: _bytearray_like)-> int: ...\r
108     def write(self, pbuf: str) -> int: ...\r
109 \r
110 class IncrementalNewlineDecoder(object):\r
111     newlines = ...  # type: Union[str, unicode]\r
112     def __init__(self, decoder, translate, z=...) -> None: ...\r
113     def decode(self, input, final) -> Any: ...\r
114     def getstate(self) -> Tuple[Any, int]: ...\r
115     def setstate(self, state: Tuple[Any, int]) -> None: ...\r
116     def reset(self) -> None: ...\r
117 \r
118 \r
119 # Note: In the actual _io.py, _TextIOBase inherits from _IOBase.\r
120 class _TextIOBase(TextIO):\r
121     errors = ...  # type: Optional[str]\r
122     # TODO: On _TextIOBase, this is always None. But it's unicode/bytes in subclasses.\r
123     newlines = ...  # type: Union[None, unicode, bytes]\r
124     encoding = ...  # type: str\r
125     @property\r
126     def closed(self) -> bool: ...\r
127     def _checkClosed(self) -> None: ...\r
128     def _checkReadable(self) -> None: ...\r
129     def _checkSeekable(self) -> None: ...\r
130     def _checkWritable(self) -> None: ...\r
131     def close(self) -> None: ...\r
132     def detach(self) -> IO: ...\r
133     def fileno(self) -> int: ...\r
134     def flush(self) -> None: ...\r
135     def isatty(self) -> bool: ...\r
136     def next(self) -> unicode: ...\r
137     def read(self, size: int = ...) -> unicode: ...\r
138     def readable(self) -> bool: ...\r
139     def readline(self, limit: int = ...) -> unicode: ...\r
140     def readlines(self, hint: int = ...) -> list[unicode]: ...\r
141     def seek(self, offset: int, whence: int = ...) -> int: ...\r
142     def seekable(self) -> bool: ...\r
143     def tell(self) -> int: ...\r
144     def truncate(self, size: Optional[int] = ...) -> int: ...\r
145     def writable(self) -> bool: ...\r
146     def write(self, pbuf: unicode) -> int: ...\r
147     def writelines(self, lines: Iterable[unicode]) -> None: ...\r
148     def __enter__(self: _T) -> _T: ...\r
149     def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]) -> bool: ...\r
150     def __iter__(self: _T) -> _T: ...\r
151 \r
152 class StringIO(_TextIOBase):\r
153     line_buffering = ...  # type: bool\r
154     def __init__(self,\r
155                  initial_value: Optional[unicode] = ...,\r
156                  newline: Optional[unicode] = ...) -> None: ...\r
157     def __setstate__(self, state: tuple) -> None: ...\r
158     def __getstate__(self) -> tuple: ...\r
159     # StringIO does not contain a "name" field. This workaround is necessary\r
160     # to allow StringIO sub-classes to add this field, as it is defined\r
161     # as a read-only property on IO[].\r
162     name: Any\r
163     def getvalue(self) -> unicode: ...\r
164 \r
165 class TextIOWrapper(_TextIOBase):\r
166     name = ...  # type: str\r
167     line_buffering = ...  # type: bool\r
168     buffer = ...  # type: BinaryIO\r
169     _CHUNK_SIZE = ...  # type: int\r
170     def __init__(self, buffer: IO,\r
171                  encoding: Optional[Text] = ...,\r
172                  errors: Optional[Text] = ...,\r
173                  newline: Optional[Text] = ...,\r
174                  line_buffering: bool = ...,\r
175                  write_through: bool = ...) -> None: ...\r
176 \r
177 def open(file: Union[str, unicode, int],\r
178          mode: unicode = ...,\r
179          buffering: int = ...,\r
180          encoding: Optional[Text] = ...,\r
181          errors: Optional[Text] = ...,\r
182          newline: Optional[Text] = ...,\r
183          closefd: bool = ...) -> IO[Any]: ...\r