fix inheritance for urllib.response.addbase (#11152)

This commit is contained in:
Stephen Morton
2023-12-12 04:03:37 -08:00
committed by GitHub
parent cff2b3db0c
commit 1600850258

View File

@@ -1,39 +1,23 @@
import sys
import tempfile
from _typeshed import ReadableBuffer
from collections.abc import Callable, Iterable
from email.message import Message
from types import TracebackType
from typing import IO, Any, BinaryIO
from typing_extensions import Self
from typing import IO, Any
__all__ = ["addbase", "addclosehook", "addinfo", "addinfourl"]
class addbase(BinaryIO):
class addbase(tempfile._TemporaryFileWrapper[bytes]):
fp: IO[bytes]
def __init__(self, fp: IO[bytes]) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def __iter__(self) -> Self: ...
def __next__(self) -> bytes: ...
def close(self) -> None: ...
# These methods don't actually exist, but the class inherits at runtime from
# tempfile._TemporaryFileWrapper, which uses __getattr__ to delegate to the
# underlying file object. To satisfy the BinaryIO interface, we pretend that this
# class has these additional methods.
def fileno(self) -> int: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def read(self, n: int = ...) -> bytes: ...
def readable(self) -> bool: ...
def readline(self, limit: int = ...) -> bytes: ...
def readlines(self, hint: int = ...) -> list[bytes]: ...
def seek(self, offset: int, whence: int = ...) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, size: int | None = ...) -> int: ...
def writable(self) -> bool: ...
def write(self, s: ReadableBuffer) -> int: ...
def writelines(self, lines: Iterable[ReadableBuffer]) -> None: ...