diff --git a/stdlib/2and3/pickle.pyi b/stdlib/2and3/pickle.pyi index 5ca023db831e..ddf8a4401399 100644 --- a/stdlib/2and3/pickle.pyi +++ b/stdlib/2and3/pickle.pyi @@ -1,10 +1,12 @@ import sys -from typing import IO, Any, Callable, Iterable, Iterator, Mapping, Optional, Tuple, Union +from typing import IO, Any, Callable, Iterable, Iterator, Mapping, Optional, Tuple, Type, Union HIGHEST_PROTOCOL: int if sys.version_info >= (3, 0): DEFAULT_PROTOCOL: int +bytes_types: Tuple[Type[Any], ...] # undocumented + if sys.version_info >= (3, 8): # TODO: holistic design for buffer interface (typing.Buffer?) class PickleBuffer: @@ -179,3 +181,6 @@ if sys.version_info >= (3, 4): STACK_GLOBAL: bytes MEMOIZE: bytes FRAME: bytes + +def encode_long(x: int) -> bytes: ... # undocumented +def decode_long(data: bytes) -> int: ... # undocumented diff --git a/stdlib/2and3/pkgutil.pyi b/stdlib/2and3/pkgutil.pyi index 0bc7167d0e3f..5fd025411325 100644 --- a/stdlib/2and3/pkgutil.pyi +++ b/stdlib/2and3/pkgutil.pyi @@ -1,6 +1,5 @@ -# Stubs for pkgutil - import sys +from _typeshed import SupportsRead from typing import IO, Any, Callable, Iterable, Iterator, NamedTuple, Optional, Tuple, Union if sys.version_info >= (3,): @@ -32,6 +31,7 @@ def get_importer(path_item: str) -> Optional[PathEntryFinder]: ... def get_loader(module_or_name: str) -> Loader: ... def iter_importers(fullname: str = ...) -> Iterator[Union[MetaPathFinder, PathEntryFinder]]: ... def iter_modules(path: Optional[Iterable[str]] = ..., prefix: str = ...) -> Iterator[_ModuleInfoLike]: ... +def read_code(stream: SupportsRead[bytes]) -> Any: ... # undocumented def walk_packages( path: Optional[Iterable[str]] = ..., prefix: str = ..., onerror: Optional[Callable[[str], None]] = ... ) -> Iterator[_ModuleInfoLike]: ... diff --git a/stdlib/2and3/sre_compile.pyi b/stdlib/2and3/sre_compile.pyi index 86621c3dae09..708fa603c91f 100644 --- a/stdlib/2and3/sre_compile.pyi +++ b/stdlib/2and3/sre_compile.pyi @@ -2,9 +2,25 @@ # and https://github.com/python/cpython/blob/master/Lib/sre_compile.py import sys +from sre_constants import ( + SRE_FLAG_DEBUG as SRE_FLAG_DEBUG, + SRE_FLAG_DOTALL as SRE_FLAG_DOTALL, + SRE_FLAG_IGNORECASE as SRE_FLAG_IGNORECASE, + SRE_FLAG_LOCALE as SRE_FLAG_LOCALE, + SRE_FLAG_MULTILINE as SRE_FLAG_MULTILINE, + SRE_FLAG_TEMPLATE as SRE_FLAG_TEMPLATE, + SRE_FLAG_UNICODE as SRE_FLAG_UNICODE, + SRE_FLAG_VERBOSE as SRE_FLAG_VERBOSE, + SRE_INFO_CHARSET as SRE_INFO_CHARSET, + SRE_INFO_LITERAL as SRE_INFO_LITERAL, + SRE_INFO_PREFIX as SRE_INFO_PREFIX, +) from sre_parse import SubPattern from typing import Any, List, Pattern, Tuple, Type, Union +if sys.version_info >= (3,): + from sre_constants import SRE_FLAG_ASCII as SRE_FLAG_ASCII + MAXCODE: int if sys.version_info < (3, 0): STRING_TYPES: Tuple[Type[str], Type[unicode]] diff --git a/stdlib/3/_thread.pyi b/stdlib/3/_thread.pyi index ded307b03659..3984630244ec 100644 --- a/stdlib/3/_thread.pyi +++ b/stdlib/3/_thread.pyi @@ -1,5 +1,3 @@ -# Stubs for _thread - import sys from threading import Thread from types import TracebackType diff --git a/stdlib/3/urllib/request.pyi b/stdlib/3/urllib/request.pyi index bd20c1939e41..1e529067b75f 100644 --- a/stdlib/3/urllib/request.pyi +++ b/stdlib/3/urllib/request.pyi @@ -1,5 +1,3 @@ -# Stubs for urllib.request (Python 3.4) - import os import ssl import sys