mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
stdlib: add argument default values (#9501)
This commit is contained in:
@@ -114,12 +114,12 @@ class HTTPResponse(io.BufferedIOBase, BinaryIO):
|
||||
chunk_left: int | None
|
||||
length: int | None
|
||||
will_close: bool
|
||||
def __init__(self, sock: socket, debuglevel: int = ..., method: str | None = ..., url: str | None = ...) -> None: ...
|
||||
def peek(self, n: int = ...) -> bytes: ...
|
||||
def read(self, amt: int | None = ...) -> bytes: ...
|
||||
def read1(self, n: int = ...) -> bytes: ...
|
||||
def __init__(self, sock: socket, debuglevel: int = 0, method: str | None = None, url: str | None = None) -> None: ...
|
||||
def peek(self, n: int = -1) -> bytes: ...
|
||||
def read(self, amt: int | None = None) -> bytes: ...
|
||||
def read1(self, n: int = -1) -> bytes: ...
|
||||
def readinto(self, b: WriteableBuffer) -> int: ...
|
||||
def readline(self, limit: int = ...) -> bytes: ... # type: ignore[override]
|
||||
def readline(self, limit: int = -1) -> bytes: ... # type: ignore[override]
|
||||
@overload
|
||||
def getheader(self, name: str) -> str | None: ...
|
||||
@overload
|
||||
@@ -148,28 +148,28 @@ class HTTPConnection:
|
||||
def __init__(
|
||||
self,
|
||||
host: str,
|
||||
port: int | None = ...,
|
||||
port: int | None = None,
|
||||
timeout: float | None = ...,
|
||||
source_address: tuple[str, int] | None = ...,
|
||||
blocksize: int = ...,
|
||||
source_address: tuple[str, int] | None = None,
|
||||
blocksize: int = 8192,
|
||||
) -> None: ...
|
||||
def request(
|
||||
self,
|
||||
method: str,
|
||||
url: str,
|
||||
body: _DataType | str | None = ...,
|
||||
body: _DataType | str | None = None,
|
||||
headers: Mapping[str, str] = ...,
|
||||
*,
|
||||
encode_chunked: bool = ...,
|
||||
encode_chunked: bool = False,
|
||||
) -> None: ...
|
||||
def getresponse(self) -> HTTPResponse: ...
|
||||
def set_debuglevel(self, level: int) -> None: ...
|
||||
def set_tunnel(self, host: str, port: int | None = ..., headers: Mapping[str, str] | None = ...) -> None: ...
|
||||
def set_tunnel(self, host: str, port: int | None = None, headers: Mapping[str, str] | None = None) -> None: ...
|
||||
def connect(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def putrequest(self, method: str, url: str, skip_host: bool = ..., skip_accept_encoding: bool = ...) -> None: ...
|
||||
def putrequest(self, method: str, url: str, skip_host: bool = False, skip_accept_encoding: bool = False) -> None: ...
|
||||
def putheader(self, header: str, *argument: str) -> None: ...
|
||||
def endheaders(self, message_body: _DataType | None = ..., *, encode_chunked: bool = ...) -> None: ...
|
||||
def endheaders(self, message_body: _DataType | None = None, *, encode_chunked: bool = False) -> None: ...
|
||||
def send(self, data: _DataType | str) -> None: ...
|
||||
|
||||
class HTTPSConnection(HTTPConnection):
|
||||
@@ -178,15 +178,15 @@ class HTTPSConnection(HTTPConnection):
|
||||
def __init__(
|
||||
self,
|
||||
host: str,
|
||||
port: int | None = ...,
|
||||
key_file: str | None = ...,
|
||||
cert_file: str | None = ...,
|
||||
port: int | None = None,
|
||||
key_file: str | None = None,
|
||||
cert_file: str | None = None,
|
||||
timeout: float | None = ...,
|
||||
source_address: tuple[str, int] | None = ...,
|
||||
source_address: tuple[str, int] | None = None,
|
||||
*,
|
||||
context: ssl.SSLContext | None = ...,
|
||||
check_hostname: bool | None = ...,
|
||||
blocksize: int = ...,
|
||||
context: ssl.SSLContext | None = None,
|
||||
check_hostname: bool | None = None,
|
||||
blocksize: int = 8192,
|
||||
) -> None: ...
|
||||
|
||||
class HTTPException(Exception): ...
|
||||
@@ -203,7 +203,7 @@ class UnknownTransferEncoding(HTTPException): ...
|
||||
class UnimplementedFileMode(HTTPException): ...
|
||||
|
||||
class IncompleteRead(HTTPException):
|
||||
def __init__(self, partial: bytes, expected: int | None = ...) -> None: ...
|
||||
def __init__(self, partial: bytes, expected: int | None = None) -> None: ...
|
||||
partial: bytes
|
||||
expected: int | None
|
||||
|
||||
|
||||
@@ -28,14 +28,14 @@ class CookieJar(Iterable[Cookie]):
|
||||
domain_re: ClassVar[Pattern[str]] # undocumented
|
||||
dots_re: ClassVar[Pattern[str]] # undocumented
|
||||
magic_re: ClassVar[Pattern[str]] # undocumented
|
||||
def __init__(self, policy: CookiePolicy | None = ...) -> None: ...
|
||||
def __init__(self, policy: CookiePolicy | None = None) -> None: ...
|
||||
def add_cookie_header(self, request: Request) -> None: ...
|
||||
def extract_cookies(self, response: HTTPResponse, request: Request) -> None: ...
|
||||
def set_policy(self, policy: CookiePolicy) -> None: ...
|
||||
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 | None = ..., path: str | None = ..., name: str | None = ...) -> None: ...
|
||||
def clear(self, domain: str | None = None, path: str | None = None, name: str | None = None) -> None: ...
|
||||
def clear_session_cookies(self) -> None: ...
|
||||
def clear_expired_cookies(self) -> None: ... # undocumented
|
||||
def __iter__(self) -> Iterator[Cookie]: ...
|
||||
@@ -45,20 +45,22 @@ class FileCookieJar(CookieJar):
|
||||
filename: str
|
||||
delayload: bool
|
||||
if sys.version_info >= (3, 8):
|
||||
def __init__(self, filename: StrPath | None = ..., delayload: bool = ..., policy: CookiePolicy | None = ...) -> None: ...
|
||||
def __init__(
|
||||
self, filename: StrPath | None = None, delayload: bool = False, policy: CookiePolicy | None = None
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(self, filename: str | None = ..., delayload: bool = ..., policy: CookiePolicy | None = ...) -> None: ...
|
||||
|
||||
def save(self, filename: str | None = ..., ignore_discard: bool = ..., ignore_expires: bool = ...) -> None: ...
|
||||
def load(self, filename: str | None = ..., ignore_discard: bool = ..., ignore_expires: bool = ...) -> None: ...
|
||||
def revert(self, filename: str | None = ..., ignore_discard: bool = ..., ignore_expires: bool = ...) -> None: ...
|
||||
def save(self, filename: str | None = None, ignore_discard: bool = False, ignore_expires: bool = False) -> None: ...
|
||||
def load(self, filename: str | None = None, ignore_discard: bool = False, ignore_expires: bool = False) -> None: ...
|
||||
def revert(self, filename: str | None = None, ignore_discard: bool = False, ignore_expires: bool = False) -> None: ...
|
||||
|
||||
class MozillaCookieJar(FileCookieJar):
|
||||
if sys.version_info < (3, 10):
|
||||
header: ClassVar[str] # undocumented
|
||||
|
||||
class LWPCookieJar(FileCookieJar):
|
||||
def as_lwp_str(self, ignore_discard: bool = ..., ignore_expires: bool = ...) -> str: ... # undocumented
|
||||
def as_lwp_str(self, ignore_discard: bool = True, ignore_expires: bool = True) -> str: ... # undocumented
|
||||
|
||||
class CookiePolicy:
|
||||
netscape: bool
|
||||
@@ -85,18 +87,18 @@ class DefaultCookiePolicy(CookiePolicy):
|
||||
if sys.version_info >= (3, 8):
|
||||
def __init__(
|
||||
self,
|
||||
blocked_domains: Sequence[str] | None = ...,
|
||||
allowed_domains: Sequence[str] | None = ...,
|
||||
netscape: bool = ...,
|
||||
rfc2965: bool = ...,
|
||||
rfc2109_as_netscape: bool | None = ...,
|
||||
hide_cookie2: bool = ...,
|
||||
strict_domain: bool = ...,
|
||||
strict_rfc2965_unverifiable: bool = ...,
|
||||
strict_ns_unverifiable: bool = ...,
|
||||
strict_ns_domain: int = ...,
|
||||
strict_ns_set_initial_dollar: bool = ...,
|
||||
strict_ns_set_path: bool = ...,
|
||||
blocked_domains: Sequence[str] | None = None,
|
||||
allowed_domains: Sequence[str] | None = None,
|
||||
netscape: bool = True,
|
||||
rfc2965: bool = False,
|
||||
rfc2109_as_netscape: bool | None = None,
|
||||
hide_cookie2: bool = False,
|
||||
strict_domain: bool = False,
|
||||
strict_rfc2965_unverifiable: bool = True,
|
||||
strict_ns_unverifiable: bool = False,
|
||||
strict_ns_domain: int = 0,
|
||||
strict_ns_set_initial_dollar: bool = False,
|
||||
strict_ns_set_path: bool = False,
|
||||
secure_protocols: Sequence[str] = ...,
|
||||
) -> None: ...
|
||||
else:
|
||||
@@ -170,7 +172,7 @@ class Cookie:
|
||||
comment: str | None,
|
||||
comment_url: str | None,
|
||||
rest: dict[str, str],
|
||||
rfc2109: bool = ...,
|
||||
rfc2109: bool = False,
|
||||
) -> None: ...
|
||||
def has_nonstandard_attr(self, name: str) -> bool: ...
|
||||
@overload
|
||||
@@ -178,4 +180,4 @@ class Cookie:
|
||||
@overload
|
||||
def get_nonstandard_attr(self, name: str, default: _T) -> str | _T: ...
|
||||
def set_nonstandard_attr(self, name: str, value: str) -> None: ...
|
||||
def is_expired(self, now: int | None = ...) -> bool: ...
|
||||
def is_expired(self, now: int | None = None) -> bool: ...
|
||||
|
||||
@@ -31,29 +31,29 @@ class Morsel(dict[str, Any], Generic[_T]):
|
||||
def key(self) -> str: ...
|
||||
def __init__(self) -> None: ...
|
||||
def set(self, key: str, val: str, coded_val: _T) -> None: ...
|
||||
def setdefault(self, key: str, val: str | None = ...) -> str: ...
|
||||
def setdefault(self, key: str, val: str | None = None) -> str: ...
|
||||
# The dict update can also get a keywords argument so this is incompatible
|
||||
@overload # type: ignore[override]
|
||||
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: list[str] | None = ..., header: str = ...) -> str: ...
|
||||
def output(self, attrs: list[str] | None = None, header: str = "Set-Cookie:") -> str: ...
|
||||
__str__ = output
|
||||
def js_output(self, attrs: list[str] | None = ...) -> str: ...
|
||||
def OutputString(self, attrs: list[str] | None = ...) -> str: ...
|
||||
def js_output(self, attrs: list[str] | None = None) -> str: ...
|
||||
def OutputString(self, attrs: list[str] | None = None) -> str: ...
|
||||
def __eq__(self, morsel: object) -> bool: ...
|
||||
def __setitem__(self, K: str, V: Any) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
|
||||
class BaseCookie(dict[str, Morsel[_T]], Generic[_T]):
|
||||
def __init__(self, input: _DataType | None = ...) -> None: ...
|
||||
def __init__(self, input: _DataType | None = None) -> None: ...
|
||||
def value_decode(self, val: str) -> _T: ...
|
||||
def value_encode(self, val: _T) -> str: ...
|
||||
def output(self, attrs: list[str] | None = ..., header: str = ..., sep: str = ...) -> str: ...
|
||||
def output(self, attrs: list[str] | None = None, header: str = "Set-Cookie:", sep: str = "\r\n") -> str: ...
|
||||
__str__ = output
|
||||
def js_output(self, attrs: list[str] | None = ...) -> str: ...
|
||||
def js_output(self, attrs: list[str] | None = None) -> str: ...
|
||||
def load(self, rawdata: _DataType) -> None: ...
|
||||
def __setitem__(self, key: str, value: str | Morsel[_T]) -> None: ...
|
||||
|
||||
|
||||
@@ -35,17 +35,17 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
|
||||
monthname: ClassVar[Sequence[str | None]] # undocumented
|
||||
def handle_one_request(self) -> None: ...
|
||||
def handle_expect_100(self) -> bool: ...
|
||||
def send_error(self, code: int, message: str | None = ..., explain: str | None = ...) -> None: ...
|
||||
def send_response(self, code: int, message: str | None = ...) -> None: ...
|
||||
def send_error(self, code: int, message: str | None = None, explain: str | None = None) -> None: ...
|
||||
def send_response(self, code: int, message: str | None = None) -> None: ...
|
||||
def send_header(self, keyword: str, value: str) -> None: ...
|
||||
def send_response_only(self, code: int, message: str | None = ...) -> None: ...
|
||||
def send_response_only(self, code: int, message: str | None = None) -> None: ...
|
||||
def end_headers(self) -> None: ...
|
||||
def flush_headers(self) -> None: ...
|
||||
def log_request(self, code: int | str = ..., size: int | str = ...) -> None: ...
|
||||
def log_request(self, code: int | str = "-", size: int | str = "-") -> None: ...
|
||||
def log_error(self, format: str, *args: Any) -> None: ...
|
||||
def log_message(self, format: str, *args: Any) -> None: ...
|
||||
def version_string(self) -> str: ...
|
||||
def date_time_string(self, timestamp: int | None = ...) -> str: ...
|
||||
def date_time_string(self, timestamp: int | None = None) -> str: ...
|
||||
def log_date_time_string(self) -> str: ...
|
||||
def address_string(self) -> str: ...
|
||||
def parse_request(self) -> bool: ... # undocumented
|
||||
@@ -60,7 +60,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
|
||||
client_address: _socket._RetAddress,
|
||||
server: socketserver.BaseServer,
|
||||
*,
|
||||
directory: str | None = ...,
|
||||
directory: str | None = None,
|
||||
) -> None: ...
|
||||
def do_GET(self) -> None: ...
|
||||
def do_HEAD(self) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user