io, codecs: improve bytes handling (#9059)

This commit is contained in:
Nikita Sobolev
2022-11-02 19:32:06 +03:00
committed by GitHub
parent ab9988a5ed
commit f972bdfd96
2 changed files with 5 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
import types
from _typeshed import Self
from _typeshed import ReadableBuffer, Self
from abc import abstractmethod
from collections.abc import Callable, Generator, Iterable
from typing import Any, BinaryIO, Protocol, TextIO
@@ -173,7 +173,7 @@ class IncrementalDecoder:
errors: str
def __init__(self, errors: str = ...) -> None: ...
@abstractmethod
def decode(self, input: bytes, final: bool = ...) -> str: ...
def decode(self, input: ReadableBuffer, final: bool = ...) -> str: ...
def reset(self) -> None: ...
def getstate(self) -> tuple[bytes, int]: ...
def setstate(self, state: tuple[bytes, int]) -> None: ...
@@ -190,8 +190,8 @@ class BufferedIncrementalDecoder(IncrementalDecoder):
buffer: bytes
def __init__(self, errors: str = ...) -> None: ...
@abstractmethod
def _buffer_decode(self, input: bytes, errors: str, final: bool) -> tuple[str, int]: ...
def decode(self, input: bytes, final: bool = ...) -> str: ...
def _buffer_decode(self, input: ReadableBuffer, errors: str, final: bool) -> tuple[str, int]: ...
def decode(self, input: ReadableBuffer, final: bool = ...) -> str: ...
# TODO: it is not possible to specify the requirement that all other
# attributes and methods are passed-through from the stream.