forked from python/typeshed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
io.pyi
86 lines (71 loc) · 2.75 KB
/
io.pyi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
from _typeshed import OpenBinaryModeReading, OpenBinaryModeWriting, OpenTextModeReading, OpenTextModeWriting, SupportsWrite
from typing import Any, ClassVar, Pattern
from typing_extensions import Literal
from docutils import TransformSpec
__docformat__: str
class InputError(IOError): ...
class OutputError(IOError): ...
def check_encoding(stream: Any, encoding: str) -> bool | None: ...
def error_string(err: BaseException) -> str: ...
class Input(TransformSpec):
component_type: ClassVar[str]
default_source_path: ClassVar[str | None]
def read(self) -> Any: ...
def decode(self, data: str | bytes) -> str: ...
coding_slug: ClassVar[Pattern[bytes]]
byte_order_marks: ClassVar[tuple[tuple[bytes, str], ...]]
def determine_encoding_from_data(self, data: str | bytes) -> str: ...
def isatty(self) -> bool: ...
class Output(TransformSpec):
component_type: ClassVar[str]
default_destination_path: ClassVar[str | None]
def __init__(
self,
destination: Any | None = ...,
destination_path: Any | None = ...,
encoding: str | None = ...,
error_handler: str = ...,
) -> None: ...
def write(self, data: str) -> Any: ... # returns bytes or str
def encode(self, data: str) -> Any: ... # returns bytes or str
class ErrorOutput:
def __init__(
self,
destination: str | SupportsWrite[str] | SupportsWrite[bytes] | Literal[False] | None = ...,
encoding: str | None = ...,
encoding_errors: str = ...,
decoding_errors: str = ...,
) -> None: ...
def write(self, data: str | bytes | Exception) -> None: ...
def close(self) -> None: ...
def isatty(self) -> bool: ...
class FileInput(Input):
def __init__(
self,
source: Any | None = ...,
source_path: Any | None = ...,
encoding: str | None = ...,
error_handler: str = ...,
autoclose: bool = ...,
mode: OpenTextModeReading | OpenBinaryModeReading = ...,
) -> None: ...
def read(self) -> str: ...
def readlines(self) -> list[str]: ...
def close(self) -> None: ...
class FileOutput(Output):
mode: ClassVar[OpenTextModeWriting | OpenBinaryModeWriting]
def __getattr__(self, name: str) -> Any: ... # incomplete
class BinaryFileOutput(FileOutput): ...
class StringInput(Input):
default_source_path: ClassVar[str]
class StringOutput(Output):
default_destination_path: ClassVar[str]
destination: str | bytes # only defined after call to write()
class NullInput(Input):
default_source_path: ClassVar[str]
def read(self) -> str: ...
class NullOutput(Output):
default_destination_path: ClassVar[str]
def write(self, data: object) -> None: ...
class DocTreeInput(Input):
default_source_path: ClassVar[str]