1 from _typeshed import OpenBinaryModeReading, OpenBinaryModeWriting, OpenTextModeReading, OpenTextModeWriting
2 from typing import Any, ClassVar
4 from docutils import TransformSpec
8 class InputError(IOError): ...
9 class OutputError(IOError): ...
11 def check_encoding(stream: Any, encoding: str) -> bool | None: ...
13 class Input(TransformSpec):
14 component_type: ClassVar[str]
15 default_source_path: ClassVar[str | None]
16 def read(self) -> Any: ...
17 def __getattr__(self, name: str) -> Any: ... # incomplete
19 class Output(TransformSpec):
20 component_type: ClassVar[str]
21 default_destination_path: ClassVar[str | None]
24 destination: Any | None = ...,
25 destination_path: Any | None = ...,
26 encoding: str | None = ...,
27 error_handler: str = ...,
29 def write(self, data: str) -> Any: ... # returns bytes or str
30 def encode(self, data: str) -> Any: ... # returns bytes or str
32 class FileInput(Input):
35 source: Any | None = ...,
36 source_path: Any | None = ...,
37 encoding: str | None = ...,
38 error_handler: str = ...,
39 autoclose: bool = ...,
40 mode: OpenTextModeReading | OpenBinaryModeReading = ...,
42 def readlines(self) -> list[str]: ...
43 def close(self) -> None: ...
45 class FileOutput(Output):
46 mode: ClassVar[OpenTextModeWriting | OpenBinaryModeWriting]
47 def __getattr__(self, name: str) -> Any: ... # incomplete
49 class BinaryFileOutput(FileOutput): ...
51 class StringInput(Input):
52 default_source_path: ClassVar[str]
54 class StringOutput(Output):
55 default_destination_path: ClassVar[str]
56 destination: str | bytes # only defined after call to write()
58 class NullInput(Input):
59 default_source_path: ClassVar[str]
60 def read(self) -> str: ...
62 class NullOutput(Output):
63 default_destination_path: ClassVar[str]
64 def write(self, data: object) -> None: ...
66 class DocTreeInput(Input):
67 default_source_path: ClassVar[str]