Skip to content

Commit 9a6b500

Browse files
authored
Add various missing undocumented functions (#4554)
Mostly addresses #2149
1 parent 4876b55 commit 9a6b500

File tree

5 files changed

+24
-7
lines changed

5 files changed

+24
-7
lines changed

stdlib/2and3/pickle.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import sys
2-
from typing import IO, Any, Callable, Iterable, Iterator, Mapping, Optional, Tuple, Union
2+
from typing import IO, Any, Callable, Iterable, Iterator, Mapping, Optional, Tuple, Type, Union
33

44
HIGHEST_PROTOCOL: int
55
if sys.version_info >= (3, 0):
66
DEFAULT_PROTOCOL: int
77

8+
bytes_types: Tuple[Type[Any], ...] # undocumented
9+
810
if sys.version_info >= (3, 8):
911
# TODO: holistic design for buffer interface (typing.Buffer?)
1012
class PickleBuffer:
@@ -179,3 +181,6 @@ if sys.version_info >= (3, 4):
179181
STACK_GLOBAL: bytes
180182
MEMOIZE: bytes
181183
FRAME: bytes
184+
185+
def encode_long(x: int) -> bytes: ... # undocumented
186+
def decode_long(data: bytes) -> int: ... # undocumented

stdlib/2and3/pkgutil.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# Stubs for pkgutil
2-
31
import sys
2+
from _typeshed import SupportsRead
43
from typing import IO, Any, Callable, Iterable, Iterator, NamedTuple, Optional, Tuple, Union
54

65
if sys.version_info >= (3,):
@@ -32,6 +31,7 @@ def get_importer(path_item: str) -> Optional[PathEntryFinder]: ...
3231
def get_loader(module_or_name: str) -> Loader: ...
3332
def iter_importers(fullname: str = ...) -> Iterator[Union[MetaPathFinder, PathEntryFinder]]: ...
3433
def iter_modules(path: Optional[Iterable[str]] = ..., prefix: str = ...) -> Iterator[_ModuleInfoLike]: ...
34+
def read_code(stream: SupportsRead[bytes]) -> Any: ... # undocumented
3535
def walk_packages(
3636
path: Optional[Iterable[str]] = ..., prefix: str = ..., onerror: Optional[Callable[[str], None]] = ...
3737
) -> Iterator[_ModuleInfoLike]: ...

stdlib/2and3/sre_compile.pyi

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,25 @@
22
# and https://github.com/python/cpython/blob/master/Lib/sre_compile.py
33

44
import sys
5+
from sre_constants import (
6+
SRE_FLAG_DEBUG as SRE_FLAG_DEBUG,
7+
SRE_FLAG_DOTALL as SRE_FLAG_DOTALL,
8+
SRE_FLAG_IGNORECASE as SRE_FLAG_IGNORECASE,
9+
SRE_FLAG_LOCALE as SRE_FLAG_LOCALE,
10+
SRE_FLAG_MULTILINE as SRE_FLAG_MULTILINE,
11+
SRE_FLAG_TEMPLATE as SRE_FLAG_TEMPLATE,
12+
SRE_FLAG_UNICODE as SRE_FLAG_UNICODE,
13+
SRE_FLAG_VERBOSE as SRE_FLAG_VERBOSE,
14+
SRE_INFO_CHARSET as SRE_INFO_CHARSET,
15+
SRE_INFO_LITERAL as SRE_INFO_LITERAL,
16+
SRE_INFO_PREFIX as SRE_INFO_PREFIX,
17+
)
518
from sre_parse import SubPattern
619
from typing import Any, List, Pattern, Tuple, Type, Union
720

21+
if sys.version_info >= (3,):
22+
from sre_constants import SRE_FLAG_ASCII as SRE_FLAG_ASCII
23+
824
MAXCODE: int
925
if sys.version_info < (3, 0):
1026
STRING_TYPES: Tuple[Type[str], Type[unicode]]

stdlib/3/_thread.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Stubs for _thread
2-
31
import sys
42
from threading import Thread
53
from types import TracebackType

stdlib/3/urllib/request.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Stubs for urllib.request (Python 3.4)
2-
31
import os
42
import ssl
53
import sys

0 commit comments

Comments
 (0)