Files
typeshed/stdlib/urllib/response.pyi
Alex Waygood 96c9abb058 Always use _typeshed.Self, where applicable (#6880)
* Always use `_typeshed.Self`, where applicable

* Revert changes to `google-cloud-ndb` (ambiguous)

* Remove empty line added by script

* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi`

* Manually add a few more that the script missed

* Improve `filelock` annotation

Source code here: 79ec7b2826/src/filelock/_api.py (L207)

* Improve `opentracing/scope` annotation

Source code here: 3e1d357a34/opentracing/scope.py (L71)

* Improve `redis/client` stub

Source code here: 15f315a496/redis/client.py (L1217)

* Improve `redis/lock` annotation

Source code here: 15f315a496/redis/lock.py (L155)

* Improve `requests/models` annotation

Source code here: d718e75383/requests/models.py (L653)
2022-01-09 19:16:19 -08:00

55 lines
2.1 KiB
Python

import sys
from _typeshed import Self
from email.message import Message
from types import TracebackType
from typing import IO, Any, BinaryIO, Callable, Iterable
class addbase(BinaryIO):
fp: IO[bytes]
def __init__(self, fp: IO[bytes]) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def __iter__(self: 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: bytes) -> int: ...
def writelines(self, lines: Iterable[bytes]) -> None: ...
class addclosehook(addbase):
closehook: Callable[..., object]
hookargs: tuple[Any, ...]
def __init__(self, fp: IO[bytes], closehook: Callable[..., object], *hookargs: Any) -> None: ...
class addinfo(addbase):
headers: Message
def __init__(self, fp: IO[bytes], headers: Message) -> None: ...
def info(self) -> Message: ...
class addinfourl(addinfo):
url: str
code: int | None
if sys.version_info >= (3, 9):
@property
def status(self) -> int | None: ...
def __init__(self, fp: IO[bytes], headers: Message, url: str, code: int | None = ...) -> None: ...
def geturl(self) -> str: ...
def getcode(self) -> int | None: ...