http: improve types (#9055)

This commit is contained in:
Jelle Zijlstra authored and GitHub committed 2022-11-03 09:55:56 +01:00
1 parent 460158fc40
commit 6b702452b6
3 files changed
+25 -9

No files matched your search

+4 -4
View File
@@ -2,10 +2,10 @@ import email.message
import io
import ssl
import types
from _typeshed import Self, WriteableBuffer
from _typeshed import ReadableBuffer, Self, SupportsRead, WriteableBuffer
from collections.abc import Callable, Iterable, Iterator, Mapping
from socket import socket
from typing import IO, Any, BinaryIO, TypeVar, overload
from typing import Any, BinaryIO, TypeVar, overload
from typing_extensions import TypeAlias
__all__ = [
@@ -30,7 +30,7 @@ __all__ = [
"HTTPSConnection",
]
_DataType: TypeAlias = bytes | IO[Any] | Iterable[bytes] | str
_DataType: TypeAlias = SupportsRead[bytes] | Iterable[ReadableBuffer] | ReadableBuffer
_T = TypeVar("_T")
HTTP_PORT: int
@@ -164,7 +164,7 @@ class HTTPConnection:
def putrequest(self, method: str, url: str, skip_host: bool = ..., skip_accept_encoding: bool = ...) -> None: ...
def putheader(self, header: str, *argument: str) -> None: ...
def endheaders(self, message_body: _DataType | None = ..., *, encode_chunked: bool = ...) -> None: ...
def send(self, data: _DataType) -> None: ...
def send(self, data: _DataType | str) -> None: ...
class HTTPSConnection(HTTPConnection):
# Can be `None` if `.connect()` was not called: