pep 484: explicit reexport as intended (#4586)

See discussion on typing-sig.
This doesn't take care of some third_party libraries, will follow up on
those.

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2020-09-30 10:04:23 -07:00
committed by GitHub
parent 27dfbf68aa
commit e3889c776e
13 changed files with 76 additions and 30 deletions

View File

@@ -1,7 +1,7 @@
# These are not exported.
# These are exported.
from typing import (
AbstractSet as Set,
AbstractSet,
Any,
Callable as Callable,
Container as Container,
@@ -30,6 +30,8 @@ from typing import (
overload,
)
Set = AbstractSet
_S = TypeVar("_S")
_T = TypeVar("_T")
_KT = TypeVar("_KT")

View File

@@ -1,6 +1,10 @@
from itertools import ifilter as filter, imap as map, izip as zip
from itertools import ifilter, imap, izip
from typing import Any
filter = ifilter
map = imap
zip = izip
def ascii(obj: Any) -> str: ...
def hex(x: int) -> str: ...
def oct(x: int) -> str: ...

View File

@@ -1,6 +1,7 @@
# Stubs for Python 2.7 md5 stdlib module
from hashlib import md5 as md5, md5 as new
from hashlib import md5 as md5
new = md5
blocksize: int
digest_size: int

View File

@@ -1,6 +1,6 @@
import sys
from _typeshed import AnyPath, FileDescriptorLike
from builtins import OSError as error
from builtins import OSError
from io import TextIOWrapper as _TextIOWrapper
from posix import listdir as listdir, stat_result as stat_result # TODO: use this, see https://github.com/python/mypy/issues/3078
from typing import (
@@ -35,6 +35,8 @@ _T = TypeVar("_T")
# ----- os variables -----
error = OSError
if sys.version_info >= (3, 2):
supports_bytes_environ: bool
@@ -152,7 +154,9 @@ TMP_MAX: int # Undocumented, but used by tempfile
# ----- os classes (structures) -----
if sys.version_info >= (3, 6):
from builtins import _PathLike as PathLike # See comment in builtins
from builtins import _PathLike
PathLike = _PathLike # See comment in builtins
class _StatVFS(NamedTuple):
f_bsize: int

View File

@@ -155,7 +155,11 @@ class Event:
def wait(self, timeout: Optional[float] = ...) -> bool: ...
if sys.version_info >= (3, 8):
from _thread import ExceptHookArgs as _ExceptHookArgs, _ExceptHookArgs as ExceptHookArgs # don't ask
import _thread
# don't ask...
_ExceptHookArgs = _thread.ExceptHookArgs
ExceptHookArgs = _thread._ExceptHookArgs
excepthook: Callable[[_ExceptHookArgs], Any]

View File

@@ -155,7 +155,11 @@ class Event:
def wait(self, timeout: Optional[float] = ...) -> bool: ...
if sys.version_info >= (3, 8):
from _thread import ExceptHookArgs as _ExceptHookArgs, _ExceptHookArgs as ExceptHookArgs # don't ask
import _thread
# don't ask...
_ExceptHookArgs = _thread.ExceptHookArgs
ExceptHookArgs = _thread._ExceptHookArgs
excepthook: Callable[[_ExceptHookArgs], Any]

View File

@@ -1,7 +1,7 @@
import sys
import typing
from typing import (
AbstractSet as Set,
AbstractSet,
Any,
AsyncIterable as AsyncIterable,
AsyncIterator as AsyncIterator,
@@ -36,6 +36,8 @@ from typing import (
overload,
)
Set = AbstractSet
if sys.version_info >= (3, 6):
from typing import AsyncGenerator as AsyncGenerator, Collection as Collection

View File

@@ -8,7 +8,7 @@ from _typeshed import (
OpenBinaryModeWriting,
OpenTextMode,
)
from builtins import OSError as error
from builtins import OSError
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper as _TextIOWrapper
from posix import listdir as listdir, times_result
from typing import (
@@ -46,6 +46,8 @@ _T = TypeVar("_T")
# ----- os variables -----
error = OSError
supports_bytes_environ: bool
supports_dir_fd: Set[Callable[..., Any]]
@@ -268,7 +270,9 @@ class stat_result:
st_type: int
if sys.version_info >= (3, 6):
from builtins import _PathLike as PathLike # See comment in builtins
from builtins import _PathLike
PathLike = _PathLike # See comment in builtins
_FdOrAnyPath = Union[int, AnyPath]

View File

@@ -3,7 +3,9 @@
import sys
if sys.version_info < (3, 9):
from os import devnull as DEV_NULL
import os
DEV_NULL = os.devnull
from typing import NamedTuple, Optional, Tuple
if sys.version_info >= (3, 8):