mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 13:34:58 +08:00
http/html stubtest fixes (#5208)
This commit is contained in:
@@ -3,7 +3,7 @@ from typing import List, Optional, Tuple
|
||||
|
||||
class HTMLParser(ParserBase):
|
||||
def __init__(self, *, convert_charrefs: bool = ...) -> None: ...
|
||||
def feed(self, feed: str) -> None: ...
|
||||
def feed(self, data: str) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def getpos(self) -> Tuple[int, int]: ...
|
||||
|
||||
@@ -3,6 +3,7 @@ import io
|
||||
import ssl
|
||||
import sys
|
||||
import types
|
||||
from _typeshed import WriteableBuffer
|
||||
from socket import socket
|
||||
from typing import (
|
||||
IO,
|
||||
@@ -103,6 +104,9 @@ class HTTPResponse(io.BufferedIOBase, BinaryIO):
|
||||
reason: str
|
||||
def __init__(self, sock: socket, debuglevel: int = ..., method: Optional[str] = ..., url: Optional[str] = ...) -> None: ...
|
||||
def read(self, amt: Optional[int] = ...) -> bytes: ...
|
||||
def read1(self, n: int = ...) -> bytes: ...
|
||||
def readinto(self, b: WriteableBuffer) -> int: ...
|
||||
def readline(self, limit: int = ...) -> bytes: ... # type: ignore
|
||||
@overload
|
||||
def getheader(self, name: str) -> Optional[str]: ...
|
||||
@overload
|
||||
@@ -198,14 +202,25 @@ error = HTTPException
|
||||
|
||||
class NotConnected(HTTPException): ...
|
||||
class InvalidURL(HTTPException): ...
|
||||
class UnknownProtocol(HTTPException): ...
|
||||
|
||||
class UnknownProtocol(HTTPException):
|
||||
def __init__(self, version: str) -> None: ...
|
||||
|
||||
class UnknownTransferEncoding(HTTPException): ...
|
||||
class UnimplementedFileMode(HTTPException): ...
|
||||
class IncompleteRead(HTTPException): ...
|
||||
|
||||
class IncompleteRead(HTTPException):
|
||||
def __init__(self, partial: bytes, expected: Optional[int] = ...) -> None: ...
|
||||
|
||||
class ImproperConnectionState(HTTPException): ...
|
||||
class CannotSendRequest(ImproperConnectionState): ...
|
||||
class CannotSendHeader(ImproperConnectionState): ...
|
||||
class ResponseNotReady(ImproperConnectionState): ...
|
||||
class BadStatusLine(HTTPException): ...
|
||||
class LineTooLong(HTTPException): ...
|
||||
|
||||
class BadStatusLine(HTTPException):
|
||||
def __init__(self, line: str) -> None: ...
|
||||
|
||||
class LineTooLong(HTTPException):
|
||||
def __init__(self, line_type: str) -> None: ...
|
||||
|
||||
class RemoteDisconnected(ConnectionResetError, BadStatusLine): ...
|
||||
|
||||
@@ -16,7 +16,7 @@ class CookieJar(Iterable[Cookie]):
|
||||
def make_cookies(self, response: HTTPResponse, request: Request) -> Sequence[Cookie]: ...
|
||||
def set_cookie(self, cookie: Cookie) -> None: ...
|
||||
def set_cookie_if_ok(self, cookie: Cookie, request: Request) -> None: ...
|
||||
def clear(self, domain: str = ..., path: str = ..., name: str = ...) -> None: ...
|
||||
def clear(self, domain: Optional[str] = ..., path: Optional[str] = ..., name: Optional[str] = ...) -> None: ...
|
||||
def clear_session_cookies(self) -> None: ...
|
||||
def __iter__(self) -> Iterator[Cookie]: ...
|
||||
def __len__(self) -> int: ...
|
||||
@@ -26,10 +26,12 @@ class FileCookieJar(CookieJar):
|
||||
delayload: bool
|
||||
if sys.version_info >= (3, 8):
|
||||
def __init__(
|
||||
self, filename: Union[str, PathLike[str]] = ..., delayload: bool = ..., policy: Optional[CookiePolicy] = ...
|
||||
self, filename: Optional[Union[str, PathLike[str]]] = ..., delayload: bool = ..., policy: Optional[CookiePolicy] = ...
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(self, filename: str = ..., delayload: bool = ..., policy: Optional[CookiePolicy] = ...) -> None: ...
|
||||
def __init__(
|
||||
self, filename: Optional[str] = ..., delayload: bool = ..., policy: Optional[CookiePolicy] = ...
|
||||
) -> None: ...
|
||||
def save(self, filename: Optional[str] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...) -> None: ...
|
||||
def load(self, filename: Optional[str] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...) -> None: ...
|
||||
def revert(self, filename: Optional[str] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...) -> None: ...
|
||||
@@ -126,4 +128,4 @@ class Cookie:
|
||||
@overload
|
||||
def get_nonstandard_attr(self, name: str, default: _T) -> Union[str, _T]: ...
|
||||
def set_nonstandard_attr(self, name: str, value: str) -> None: ...
|
||||
def is_expired(self, now: int = ...) -> bool: ...
|
||||
def is_expired(self, now: Optional[int] = ...) -> bool: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from typing import Any, Dict, Generic, List, Mapping, Optional, TypeVar, Union, overload
|
||||
from typing import Any, Dict, Generic, Iterable, List, Mapping, Optional, Tuple, TypeVar, Union, overload
|
||||
|
||||
_DataType = Union[str, Mapping[str, Union[str, Morsel[Any]]]]
|
||||
_T = TypeVar("_T")
|
||||
@@ -18,10 +18,17 @@ class Morsel(Dict[str, Any], Generic[_T]):
|
||||
value: str
|
||||
coded_value: _T
|
||||
key: str
|
||||
def __init__(self) -> None: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def set(self, key: str, val: str, coded_val: _T) -> None: ...
|
||||
else:
|
||||
def set(self, key: str, val: str, coded_val: _T, LegalChars: str = ...) -> None: ...
|
||||
def setdefault(self, key: str, val: Optional[str] = ...) -> str: ...
|
||||
# The dict update can also get a keywords argument so this is incompatible
|
||||
@overload # type: ignore
|
||||
def update(self, values: Mapping[str, str]) -> None: ...
|
||||
@overload
|
||||
def update(self, values: Iterable[Tuple[str, str]]) -> None: ...
|
||||
def isReservedKey(self, K: str) -> bool: ...
|
||||
def output(self, attrs: Optional[List[str]] = ..., header: str = ...) -> str: ...
|
||||
def js_output(self, attrs: Optional[List[str]] = ...) -> str: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import email.message
|
||||
import socketserver
|
||||
import sys
|
||||
from typing import Any, Callable, ClassVar, Dict, List, Mapping, Optional, Sequence, Tuple, Union
|
||||
from typing import Any, ClassVar, Dict, List, Mapping, Optional, Sequence, Tuple, Union
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from builtins import _PathLike
|
||||
@@ -9,7 +9,6 @@ if sys.version_info >= (3, 7):
|
||||
class HTTPServer(socketserver.TCPServer):
|
||||
server_name: str
|
||||
server_port: int
|
||||
def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: Callable[..., BaseHTTPRequestHandler]) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
class ThreadingHTTPServer(socketserver.ThreadingMixIn, HTTPServer):
|
||||
|
||||
@@ -147,23 +147,8 @@ encodings.utf_8.encode
|
||||
enum.EnumMeta.__call__
|
||||
enum.EnumMeta.__new__
|
||||
getopt.GetoptError.__init__
|
||||
html.parser.HTMLParser.feed
|
||||
http.HTTPStatus.description
|
||||
http.HTTPStatus.phrase
|
||||
http.client.BadStatusLine.__init__
|
||||
http.client.HTTPResponse.read1
|
||||
http.client.HTTPResponse.readinto
|
||||
http.client.HTTPResponse.readline
|
||||
http.client.IncompleteRead.__init__
|
||||
http.client.LineTooLong.__init__
|
||||
http.client.UnknownProtocol.__init__
|
||||
http.cookiejar.Cookie.is_expired
|
||||
http.cookiejar.CookieJar.clear
|
||||
http.cookiejar.FileCookieJar.__init__
|
||||
http.cookies.Morsel.__init__
|
||||
http.cookies.Morsel.setdefault
|
||||
http.cookies.Morsel.update
|
||||
http.server.HTTPServer.__init__
|
||||
http.HTTPStatus.description # set in __new__
|
||||
http.HTTPStatus.phrase # set in __new__
|
||||
imaplib.IMAP4_SSL.ssl
|
||||
importlib.abc.FileLoader.get_filename # Wrapped with _check_name decorator which changes runtime signature
|
||||
importlib.abc.FileLoader.load_module # Wrapped with _check_name decorator which changes runtime signature
|
||||
|
||||
Reference in New Issue
Block a user