1
1
from _typeshed import OpenBinaryModeReading , OpenBinaryModeWriting , OpenTextModeReading , OpenTextModeWriting
2
- from typing import Any , ClassVar
2
+ from typing import Any , AnyStr , ClassVar , Pattern , Tuple
3
3
4
4
from docutils import TransformSpec
5
5
@@ -9,11 +9,17 @@ class InputError(IOError): ...
9
9
class OutputError (IOError ): ...
10
10
11
11
def check_encoding (stream : Any , encoding : str ) -> bool | None : ...
12
+ def error_string (err : str ) -> str : ...
12
13
13
14
class Input (TransformSpec ):
14
15
component_type : ClassVar [str ]
15
16
default_source_path : ClassVar [str | None ]
16
17
def read (self ) -> Any : ...
18
+ def decode (self , data : AnyStr ) -> str : ...
19
+ coding_slug : ClassVar [Pattern [bytes ]]
20
+ byte_order_marks : ClassVar [tuple [tuple [bytes , str ], ...]]
21
+ def determine_encoding_from_data (self , data : AnyStr ) -> str : ...
22
+ def isatty (self ) -> bool : ...
17
23
def __getattr__ (self , name : str ) -> Any : ... # incomplete
18
24
19
25
class Output (TransformSpec ):
@@ -29,6 +35,18 @@ class Output(TransformSpec):
29
35
def write (self , data : str ) -> Any : ... # returns bytes or str
30
36
def encode (self , data : str ) -> Any : ... # returns bytes or str
31
37
38
+ class ErrorOutput :
39
+ def __init__ (
40
+ self ,
41
+ destination : Any | None = ...,
42
+ encoding : str | None = ...,
43
+ encoding_errors : str | None = ...,
44
+ decoding_errors : str | None = ...,
45
+ ) -> None : ...
46
+ def write (self , data : AnyStr ) -> None : ...
47
+ def close (self ) -> None : ...
48
+ def isatty (self ) -> bool : ...
49
+
32
50
class FileInput (Input ):
33
51
def __init__ (
34
52
self ,
@@ -39,6 +57,7 @@ class FileInput(Input):
39
57
autoclose : bool = ...,
40
58
mode : OpenTextModeReading | OpenBinaryModeReading = ...,
41
59
) -> None : ...
60
+ def read (self ) -> str : ...
42
61
def readlines (self ) -> list [str ]: ...
43
62
def close (self ) -> None : ...
44
63
0 commit comments