Add __all__ for modules beginning with 'h' and 'i' (#7327)

This commit is contained in:
Alex Waygood
2022-02-20 22:01:45 +00:00
committed by GitHub
parent 2279c87257
commit 8f2f857ffc
15 changed files with 150 additions and 0 deletions

View File

@@ -3,6 +3,27 @@ from _typeshed import ReadableBuffer, Self
from typing import AbstractSet
from typing_extensions import final
__all__ = (
"md5",
"sha1",
"sha224",
"sha256",
"sha384",
"sha512",
"blake2b",
"blake2s",
"sha3_224",
"sha3_256",
"sha3_384",
"sha3_512",
"shake_128",
"shake_256",
"new",
"algorithms_guaranteed",
"algorithms_available",
"pbkdf2_hmac",
)
class _Hash:
@property
def digest_size(self) -> int: ...

View File

@@ -2,6 +2,8 @@ from _heapq import *
from _typeshed import SupportsRichComparison
from typing import Any, Callable, Iterable, TypeVar
__all__ = ["heappush", "heappop", "heapify", "heapreplace", "merge", "nlargest", "nsmallest", "heappushpop"]
_S = TypeVar("_S")
__about__: str

View File

@@ -1,4 +1,6 @@
from typing import AnyStr
__all__ = ["escape", "unescape"]
def escape(s: AnyStr, quote: bool = ...) -> AnyStr: ...
def unescape(s: AnyStr) -> AnyStr: ...

View File

@@ -1,3 +1,5 @@
__all__ = ["html5", "name2codepoint", "codepoint2name", "entitydefs"]
name2codepoint: dict[str, int]
html5: dict[str, str]
codepoint2name: dict[int, str]

View File

@@ -1,6 +1,8 @@
from _markupbase import ParserBase
from typing import Pattern
__all__ = ["HTMLParser"]
class HTMLParser(ParserBase):
def __init__(self, *, convert_charrefs: bool = ...) -> None: ...
def feed(self, data: str) -> None: ...

View File

@@ -2,6 +2,8 @@ import sys
from enum import IntEnum
from typing_extensions import Literal
__all__ = ["HTTPStatus"]
class HTTPStatus(IntEnum):
@property
def phrase(self) -> str: ...

View File

@@ -7,6 +7,28 @@ from _typeshed import Self, WriteableBuffer
from socket import socket
from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, Mapping, Protocol, TypeVar, Union, overload
__all__ = [
"HTTPResponse",
"HTTPConnection",
"HTTPException",
"NotConnected",
"UnknownProtocol",
"UnknownTransferEncoding",
"UnimplementedFileMode",
"IncompleteRead",
"InvalidURL",
"ImproperConnectionState",
"CannotSendRequest",
"CannotSendHeader",
"ResponseNotReady",
"BadStatusLine",
"LineTooLong",
"RemoteDisconnected",
"error",
"responses",
"HTTPSConnection",
]
_DataType = Union[bytes, IO[Any], Iterable[bytes], str]
_T = TypeVar("_T")

View File

@@ -4,6 +4,17 @@ from http.client import HTTPResponse
from typing import ClassVar, Iterable, Iterator, Pattern, Sequence, TypeVar, overload
from urllib.request import Request
__all__ = [
"Cookie",
"CookieJar",
"CookiePolicy",
"DefaultCookiePolicy",
"FileCookieJar",
"LWPCookieJar",
"LoadError",
"MozillaCookieJar",
]
_T = TypeVar("_T")
class LoadError(OSError): ...

View File

@@ -4,6 +4,8 @@ from typing import Any, Generic, Iterable, Mapping, TypeVar, Union, overload
if sys.version_info >= (3, 9):
from types import GenericAlias
__all__ = ["CookieError", "BaseCookie", "SimpleCookie"]
_DataType = Union[str, Mapping[str, Union[str, Morsel[Any]]]]
_T = TypeVar("_T")

View File

@@ -5,6 +5,8 @@ import sys
from _typeshed import StrPath, SupportsRead, SupportsWrite
from typing import Any, AnyStr, BinaryIO, ClassVar, Mapping, Sequence
__all__ = ["HTTPServer", "ThreadingHTTPServer", "BaseHTTPRequestHandler", "SimpleHTTPRequestHandler", "CGIHTTPRequestHandler"]
class HTTPServer(socketserver.TCPServer):
server_name: str
server_port: int

View File

@@ -8,6 +8,8 @@ from types import TracebackType
from typing import IO, Any, Callable, Pattern, Union
from typing_extensions import Literal
__all__ = ["IMAP4", "IMAP4_stream", "Internaldate2tuple", "Int2AP", "ParseFlags", "Time2Internaldate", "IMAP4_SSL"]
# TODO: Commands should use their actual return types, not this type alias.
# E.g. Tuple[Literal["OK"], List[bytes]]
_CommandResults = tuple[str, list[Any]]

View File

@@ -1,6 +1,8 @@
from _typeshed import StrPath
from typing import Any, BinaryIO, Callable, Protocol, overload
__all__ = ["what"]
class _ReadableBinary(Protocol):
def tell(self) -> int: ...
def read(self, size: int) -> bytes: ...

View File

@@ -2,6 +2,8 @@ from importlib.abc import Loader
from types import ModuleType
from typing import Mapping, Sequence
__all__ = ["__import__", "import_module", "invalidate_caches", "reload"]
# Signature of `builtins.__import__` should be kept identical to `importlib.__import__`
def __import__(
name: str,

View File

@@ -5,6 +5,38 @@ from pathlib import Path
from types import ModuleType
from typing import Any, BinaryIO, Iterator, TextIO, Union
if sys.version_info >= (3, 10):
__all__ = [
"Package",
"Resource",
"ResourceReader",
"as_file",
"contents",
"files",
"is_resource",
"open_binary",
"open_text",
"path",
"read_binary",
"read_text",
]
elif sys.version_info >= (3, 9):
__all__ = [
"Package",
"Resource",
"as_file",
"contents",
"files",
"is_resource",
"open_binary",
"open_text",
"path",
"read_binary",
"read_text",
]
else:
__all__ = ["Package", "Resource", "contents", "is_resource", "open_binary", "open_text", "path", "read_binary", "read_text"]
Package = Union[str, ModuleType]
Resource = Union[str, os.PathLike[Any]]

View File

@@ -7,6 +7,50 @@ from types import TracebackType
from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, TextIO
from typing_extensions import Literal
if sys.version_info >= (3, 8):
__all__ = [
"BlockingIOError",
"open",
"open_code",
"IOBase",
"RawIOBase",
"FileIO",
"BytesIO",
"StringIO",
"BufferedIOBase",
"BufferedReader",
"BufferedWriter",
"BufferedRWPair",
"BufferedRandom",
"TextIOBase",
"TextIOWrapper",
"UnsupportedOperation",
"SEEK_SET",
"SEEK_CUR",
"SEEK_END",
]
else:
__all__ = [
"BlockingIOError",
"open",
"IOBase",
"RawIOBase",
"FileIO",
"BytesIO",
"StringIO",
"BufferedIOBase",
"BufferedReader",
"BufferedWriter",
"BufferedRWPair",
"BufferedRandom",
"TextIOBase",
"TextIOWrapper",
"UnsupportedOperation",
"SEEK_SET",
"SEEK_CUR",
"SEEK_END",
]
DEFAULT_BUFFER_SIZE: Literal[8192]
SEEK_SET: Literal[0]