Add various missing undocumented functions (#4554)

Mostly addresses #2149
This commit is contained in:
Sebastian Rittau
2020-09-20 07:59:35 +02:00
committed by GitHub
parent 4876b55382
commit 9a6b500909
5 changed files with 24 additions and 7 deletions

View File

@@ -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

View File

@@ -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]: ...

View File

@@ -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]]

View File

@@ -1,5 +1,3 @@
# Stubs for _thread
import sys
from threading import Thread
from types import TracebackType

View File

@@ -1,5 +1,3 @@
# Stubs for urllib.request (Python 3.4)
import os
import ssl
import sys