mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Add missing attributes for docutils.io (#8716)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
@@ -4,7 +4,6 @@ docutils.frontend.ConfigParser.read
|
||||
docutils.frontend.OptionParser.__getattr__
|
||||
docutils.io.FileOutput.__getattr__
|
||||
docutils.io.FileOutput.__init__
|
||||
docutils.io.Input.__getattr__
|
||||
docutils.io.Input.__init__
|
||||
docutils.languages.LanguageImporter.__getattr__
|
||||
docutils.nodes.Element.__getattr__
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from _typeshed import OpenBinaryModeReading, OpenBinaryModeWriting, OpenTextModeReading, OpenTextModeWriting
|
||||
from _typeshed import OpenBinaryModeReading, OpenBinaryModeWriting, OpenTextModeReading, OpenTextModeWriting, SupportsWrite
|
||||
from re import Pattern
|
||||
from typing import Any, ClassVar
|
||||
from typing_extensions import Literal
|
||||
|
||||
from docutils import TransformSpec
|
||||
|
||||
@@ -9,12 +11,17 @@ 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 __getattr__(self, name: str) -> Any: ... # incomplete
|
||||
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 | None: ...
|
||||
def isatty(self) -> bool: ...
|
||||
|
||||
class Output(TransformSpec):
|
||||
component_type: ClassVar[str]
|
||||
@@ -29,6 +36,18 @@ class Output(TransformSpec):
|
||||
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,
|
||||
@@ -39,6 +58,7 @@ class FileInput(Input):
|
||||
autoclose: bool = ...,
|
||||
mode: OpenTextModeReading | OpenBinaryModeReading = ...,
|
||||
) -> None: ...
|
||||
def read(self) -> str: ...
|
||||
def readlines(self) -> list[str]: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user