mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
add missing attributes in codecs module (#13145)
This commit is contained in:
@@ -3,7 +3,7 @@ from _codecs import *
|
||||
from _typeshed import ReadableBuffer
|
||||
from abc import abstractmethod
|
||||
from collections.abc import Callable, Generator, Iterable
|
||||
from typing import Any, BinaryIO, Final, Literal, Protocol, TextIO
|
||||
from typing import Any, BinaryIO, ClassVar, Final, Literal, Protocol, TextIO
|
||||
from typing_extensions import Self
|
||||
|
||||
__all__ = [
|
||||
@@ -202,6 +202,7 @@ class StreamWriter(Codec):
|
||||
def write(self, object: str) -> None: ...
|
||||
def writelines(self, list: Iterable[str]) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def seek(self, offset: int, whence: int = 0) -> None: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
def __getattr__(self, name: str, getattr: Callable[[Any, str], Any] = ...) -> Any: ...
|
||||
@@ -209,11 +210,14 @@ class StreamWriter(Codec):
|
||||
class StreamReader(Codec):
|
||||
stream: _ReadableStream
|
||||
errors: str
|
||||
# This is set to str, but some subclasses set to bytes instead.
|
||||
charbuffertype: ClassVar[type] = ...
|
||||
def __init__(self, stream: _ReadableStream, errors: str = "strict") -> None: ...
|
||||
def read(self, size: int = -1, chars: int = -1, firstline: bool = False) -> str: ...
|
||||
def readline(self, size: int | None = None, keepends: bool = True) -> str: ...
|
||||
def readlines(self, sizehint: int | None = None, keepends: bool = True) -> list[str]: ...
|
||||
def reset(self) -> None: ...
|
||||
def seek(self, offset: int, whence: int = 0) -> None: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
|
||||
Reference in New Issue
Block a user