|
1 | 1 | import sys
|
| 2 | +import tempfile |
2 | 3 | from _typeshed import ReadableBuffer
|
3 | 4 | from collections.abc import Callable, Iterable
|
4 | 5 | from email.message import Message
|
5 | 6 | from types import TracebackType
|
6 |
| -from typing import IO, Any, BinaryIO |
7 |
| -from typing_extensions import Self |
| 7 | +from typing import IO, Any |
8 | 8 |
|
9 | 9 | __all__ = ["addbase", "addclosehook", "addinfo", "addinfourl"]
|
10 | 10 |
|
11 |
| -class addbase(BinaryIO): |
| 11 | +class addbase(tempfile._TemporaryFileWrapper[bytes]): |
12 | 12 | fp: IO[bytes]
|
13 | 13 | def __init__(self, fp: IO[bytes]) -> None: ...
|
14 |
| - def __enter__(self) -> Self: ... |
15 | 14 | def __exit__(
|
16 | 15 | self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
|
17 | 16 | ) -> None: ...
|
18 |
| - def __iter__(self) -> Self: ... |
19 |
| - def __next__(self) -> bytes: ... |
20 |
| - def close(self) -> None: ... |
21 | 17 | # These methods don't actually exist, but the class inherits at runtime from
|
22 | 18 | # tempfile._TemporaryFileWrapper, which uses __getattr__ to delegate to the
|
23 | 19 | # underlying file object. To satisfy the BinaryIO interface, we pretend that this
|
24 | 20 | # class has these additional methods.
|
25 |
| - def fileno(self) -> int: ... |
26 |
| - def flush(self) -> None: ... |
27 |
| - def isatty(self) -> bool: ... |
28 |
| - def read(self, n: int = ...) -> bytes: ... |
29 |
| - def readable(self) -> bool: ... |
30 |
| - def readline(self, limit: int = ...) -> bytes: ... |
31 |
| - def readlines(self, hint: int = ...) -> list[bytes]: ... |
32 |
| - def seek(self, offset: int, whence: int = ...) -> int: ... |
33 |
| - def seekable(self) -> bool: ... |
34 |
| - def tell(self) -> int: ... |
35 |
| - def truncate(self, size: int | None = ...) -> int: ... |
36 |
| - def writable(self) -> bool: ... |
37 | 21 | def write(self, s: ReadableBuffer) -> int: ...
|
38 | 22 | def writelines(self, lines: Iterable[ReadableBuffer]) -> None: ...
|
39 | 23 |
|
|
0 commit comments