mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-09 13:02:22 +08:00
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar, Union, overload
|
||||
from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, Optional, TypeVar, Union, overload
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
@@ -35,6 +35,10 @@ def copy_context() -> Context: ...
|
||||
# a different value.
|
||||
class Context(Mapping[ContextVar[Any], Any]):
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def get(self, __key: ContextVar[Any]) -> Optional[Any]: ...
|
||||
@overload
|
||||
def get(self, __key: ContextVar[Any], __default: Optional[Any]) -> Any: ...
|
||||
def run(self, callable: Callable[..., _T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def copy(self) -> Context: ...
|
||||
def __getitem__(self, key: ContextVar[Any]) -> Any: ...
|
||||
|
||||
@@ -183,18 +183,33 @@ class HTTPConnection:
|
||||
def send(self, data: _DataType) -> None: ...
|
||||
|
||||
class HTTPSConnection(HTTPConnection):
|
||||
def __init__(
|
||||
self,
|
||||
host: str,
|
||||
port: Optional[int] = ...,
|
||||
key_file: Optional[str] = ...,
|
||||
cert_file: Optional[str] = ...,
|
||||
timeout: Optional[float] = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ...,
|
||||
*,
|
||||
context: Optional[ssl.SSLContext] = ...,
|
||||
check_hostname: Optional[bool] = ...,
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def __init__(
|
||||
self,
|
||||
host: str,
|
||||
port: Optional[int] = ...,
|
||||
key_file: Optional[str] = ...,
|
||||
cert_file: Optional[str] = ...,
|
||||
timeout: Optional[float] = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ...,
|
||||
*,
|
||||
context: Optional[ssl.SSLContext] = ...,
|
||||
check_hostname: Optional[bool] = ...,
|
||||
blocksize: int = ...,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
host: str,
|
||||
port: Optional[int] = ...,
|
||||
key_file: Optional[str] = ...,
|
||||
cert_file: Optional[str] = ...,
|
||||
timeout: Optional[float] = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ...,
|
||||
*,
|
||||
context: Optional[ssl.SSLContext] = ...,
|
||||
check_hostname: Optional[bool] = ...,
|
||||
) -> None: ...
|
||||
|
||||
class HTTPException(Exception): ...
|
||||
|
||||
|
||||
@@ -63,21 +63,39 @@ class DefaultCookiePolicy(CookiePolicy):
|
||||
DomainRFC2965Match: int
|
||||
DomainLiberal: int
|
||||
DomainStrict: int
|
||||
def __init__(
|
||||
self,
|
||||
blocked_domains: Optional[Sequence[str]] = ...,
|
||||
allowed_domains: Optional[Sequence[str]] = ...,
|
||||
netscape: bool = ...,
|
||||
rfc2965: bool = ...,
|
||||
rfc2109_as_netscape: Optional[bool] = ...,
|
||||
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 = ...,
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def __init__(
|
||||
self,
|
||||
blocked_domains: Optional[Sequence[str]] = ...,
|
||||
allowed_domains: Optional[Sequence[str]] = ...,
|
||||
netscape: bool = ...,
|
||||
rfc2965: bool = ...,
|
||||
rfc2109_as_netscape: Optional[bool] = ...,
|
||||
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 = ...,
|
||||
secure_protocols: Sequence[str] = ...,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
blocked_domains: Optional[Sequence[str]] = ...,
|
||||
allowed_domains: Optional[Sequence[str]] = ...,
|
||||
netscape: bool = ...,
|
||||
rfc2965: bool = ...,
|
||||
rfc2109_as_netscape: Optional[bool] = ...,
|
||||
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 = ...,
|
||||
) -> None: ...
|
||||
def blocked_domains(self) -> Tuple[str, ...]: ...
|
||||
def set_blocked_domains(self, blocked_domains: Sequence[str]) -> None: ...
|
||||
def is_blocked(self, domain: str) -> bool: ...
|
||||
|
||||
@@ -82,7 +82,7 @@ class _NNTPBase:
|
||||
def ihave(self, message_id: Any, data: Union[bytes, Iterable[bytes]]) -> str: ...
|
||||
def quit(self) -> str: ...
|
||||
def login(self, user: Optional[str] = ..., password: Optional[str] = ..., usenetrc: bool = ...) -> None: ...
|
||||
def starttls(self, ssl_context: Optional[ssl.SSLContext] = ...) -> None: ...
|
||||
def starttls(self, context: Optional[ssl.SSLContext] = ...) -> None: ...
|
||||
|
||||
class NNTP(_NNTPBase):
|
||||
port: int
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
|
||||
if sys.version_info < (3, 9):
|
||||
if sys.version_info < (3, 8):
|
||||
import os
|
||||
|
||||
DEV_NULL = os.devnull
|
||||
|
||||
@@ -2,7 +2,7 @@ from email.message import Message as _Message
|
||||
from socket import socket
|
||||
from ssl import SSLContext
|
||||
from types import TracebackType
|
||||
from typing import Any, Dict, List, Optional, Pattern, Protocol, Sequence, Tuple, Type, Union, overload
|
||||
from typing import Any, Dict, Optional, Pattern, Protocol, Sequence, Tuple, Type, Union, overload
|
||||
|
||||
_Reply = Tuple[int, bytes]
|
||||
_SendErrs = Dict[str, _Reply]
|
||||
@@ -117,7 +117,7 @@ class SMTP:
|
||||
to_addrs: Union[str, Sequence[str]],
|
||||
msg: Union[bytes, str],
|
||||
mail_options: Sequence[str] = ...,
|
||||
rcpt_options: List[str] = ...,
|
||||
rcpt_options: Sequence[str] = ...,
|
||||
) -> _SendErrs: ...
|
||||
def send_message(
|
||||
self,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import sys
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
MAGIC: int
|
||||
@@ -72,7 +73,10 @@ REPEAT: _NamedIntConstant
|
||||
REPEAT_ONE: _NamedIntConstant
|
||||
SUBPATTERN: _NamedIntConstant
|
||||
MIN_REPEAT_ONE: _NamedIntConstant
|
||||
RANGE_IGNORE: _NamedIntConstant
|
||||
if sys.version_info >= (3, 7):
|
||||
RANGE_UNI_IGNORE: _NamedIntConstant
|
||||
else:
|
||||
RANGE_IGNORE: _NamedIntConstant
|
||||
MIN_REPEAT: _NamedIntConstant
|
||||
MAX_REPEAT: _NamedIntConstant
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class BackgroundBrowser(GenericBrowser):
|
||||
def open(self, url: Text, new: int = ..., autoraise: bool = ...) -> bool: ...
|
||||
|
||||
class UnixBrowser(BaseBrowser):
|
||||
raise_opts: List[str]
|
||||
raise_opts: Optional[List[str]]
|
||||
background: bool
|
||||
redirect_stdout: bool
|
||||
remote_args: List[str]
|
||||
@@ -70,7 +70,6 @@ class Chrome(UnixBrowser):
|
||||
background: bool
|
||||
|
||||
class Opera(UnixBrowser):
|
||||
raise_opts: List[str]
|
||||
remote_args: List[str]
|
||||
remote_action: str
|
||||
remote_action_newwin: str
|
||||
|
||||
Reference in New Issue
Block a user