diff --git a/stdlib/2and3/contextlib.pyi b/stdlib/2and3/contextlib.pyi index 2832d94b8..f0dec3239 100644 --- a/stdlib/2and3/contextlib.pyi +++ b/stdlib/2and3/contextlib.pyi @@ -1,12 +1,10 @@ -# Stubs for contextlib - +# ContextManager aliased here for backwards compatibility; TODO eventually remove this from typing import ( Any, Callable, Generator, IO, Iterable, Iterator, Optional, Type, Generic, TypeVar, overload ) from types import TracebackType import sys -# Aliased here for backwards compatibility; TODO eventually remove this from typing import ContextManager as ContextManager if sys.version_info >= (3, 5): diff --git a/stdlib/2and3/shutil.pyi b/stdlib/2and3/shutil.pyi index eec6ccd9e..5e8b9183e 100644 --- a/stdlib/2and3/shutil.pyi +++ b/stdlib/2and3/shutil.pyi @@ -1,10 +1,6 @@ import os import sys -# 'bytes' paths are not properly supported: they don't work with all functions, -# sometimes they only work partially (broken exception messages), and the test -# cases don't use them. - from typing import ( List, Iterable, Callable, Any, Tuple, Sequence, NamedTuple, AnyStr, Optional, Union, Set, TypeVar, overload, Type, Protocol, Text diff --git a/stdlib/2and3/sysconfig.pyi b/stdlib/2and3/sysconfig.pyi index 5d6c9cb19..6548f4058 100644 --- a/stdlib/2and3/sysconfig.pyi +++ b/stdlib/2and3/sysconfig.pyi @@ -1,12 +1,10 @@ -# Stubs for sysconfig - from typing import overload, Any, Dict, IO, List, Optional, Tuple, Union +def get_config_var(name: str) -> Optional[str]: ... @overload def get_config_vars() -> Dict[str, Any]: ... @overload def get_config_vars(arg: str, *args: str) -> List[Any]: ... -def get_config_var(name: str) -> Optional[str]: ... def get_scheme_names() -> Tuple[str, ...]: ... def get_path_names() -> Tuple[str, ...]: ... def get_path(name: str, scheme: str = ..., vars: Optional[Dict[str, Any]] = ..., expand: bool = ...) -> Optional[str]: ... diff --git a/stdlib/3/ast.pyi b/stdlib/3/ast.pyi index 3b76bf7f4..d798376a6 100644 --- a/stdlib/3/ast.pyi +++ b/stdlib/3/ast.pyi @@ -1,15 +1,16 @@ -import sys # Rename typing to _typing, as not to conflict with typing imported # from _ast below when loaded in an unorthodox way by the Dropbox # internal Bazel integration. -import typing as _typing -from typing import Any, Iterator, Optional, TypeVar, Union, overload -from typing_extensions import Literal # The same unorthodox Bazel integration causes issues with sys, which # is imported in both modules. unfortunately we can't just rename sys, # since mypy only supports version checks with a sys that is named # sys. +import sys +import typing as _typing +from typing import Any, Iterator, Optional, TypeVar, Union, overload +from typing_extensions import Literal + from _ast import * # type: ignore if sys.version_info >= (3, 8): diff --git a/stdlib/3/asyncio/events.pyi b/stdlib/3/asyncio/events.pyi index cceb38872..9fc466ae5 100644 --- a/stdlib/3/asyncio/events.pyi +++ b/stdlib/3/asyncio/events.pyi @@ -8,11 +8,11 @@ from asyncio.protocols import BaseProtocol from asyncio.tasks import Task from asyncio.transports import BaseTransport from asyncio.unix_events import AbstractChildWatcher +from _typeshed import FileDescriptorLike + if sys.version_info >= (3, 7): from contextvars import Context -from _typeshed import FileDescriptorLike - _T = TypeVar('_T') _Context = Dict[str, Any] _ExceptionHandler = Callable[[AbstractEventLoop, _Context], Any] diff --git a/stdlib/3/os/__init__.pyi b/stdlib/3/os/__init__.pyi index e97b2b6b8..643d79394 100644 --- a/stdlib/3/os/__init__.pyi +++ b/stdlib/3/os/__init__.pyi @@ -7,7 +7,6 @@ from typing import ( ) from _typeshed import AnyPath -# Re-exported names from other modules. from builtins import OSError as error from . import path as path diff --git a/third_party/2/six/__init__.pyi b/third_party/2/six/__init__.pyi index 72596a8d7..bc4631efa 100644 --- a/third_party/2/six/__init__.pyi +++ b/third_party/2/six/__init__.pyi @@ -1,5 +1,3 @@ -# Stubs for six (Python 2.7) - from __future__ import print_function import types @@ -10,7 +8,6 @@ from typing import ( import typing import unittest -# Exports from __builtin__ import unichr as unichr from StringIO import StringIO as StringIO, StringIO as BytesIO from functools import wraps as wraps diff --git a/third_party/2and3/bleach/__init__.pyi b/third_party/2and3/bleach/__init__.pyi index 3a1ad2c4e..e48d68ca8 100644 --- a/third_party/2and3/bleach/__init__.pyi +++ b/third_party/2and3/bleach/__init__.pyi @@ -1,6 +1,6 @@ from typing import Any, Container, Iterable, Optional, Text -from bleach.linkifier import DEFAULT_CALLBACKS as DEFAULT_CALLBACKS, Linker as Linker +from bleach.linkifier import DEFAULT_CALLBACKS as DEFAULT_CALLBACKS, Linker as Linker, _Callback from bleach.sanitizer import ( ALLOWED_ATTRIBUTES as ALLOWED_ATTRIBUTES, ALLOWED_PROTOCOLS as ALLOWED_PROTOCOLS, @@ -9,7 +9,6 @@ from bleach.sanitizer import ( Cleaner as Cleaner, ) -from .linkifier import _Callback __releasedate__: Text __version__: Text diff --git a/third_party/2and3/bleach/utils.pyi b/third_party/2and3/bleach/utils.pyi index 984c554bd..9f48db6bb 100644 --- a/third_party/2and3/bleach/utils.pyi +++ b/third_party/2and3/bleach/utils.pyi @@ -1,8 +1,8 @@ from collections import OrderedDict from typing import overload, Mapping, Any, Text +def force_unicode(text: Text) -> Text: ... @overload def alphabetize_attributes(attrs: None) -> None: ... @overload def alphabetize_attributes(attrs: Mapping[Any, Text]) -> OrderedDict[Any, Text]: ... -def force_unicode(text: Text) -> Text: ... diff --git a/third_party/2and3/boto/compat.pyi b/third_party/2and3/boto/compat.pyi index 070c75fe8..d6a5a14ad 100644 --- a/third_party/2and3/boto/compat.pyi +++ b/third_party/2and3/boto/compat.pyi @@ -1,13 +1,14 @@ import sys from typing import Any + +from six.moves import http_client + if sys.version_info >= (3,): from base64 import encodebytes as encodebytes else: from base64 import encodestring as encodebytes -from six.moves import http_client - expanduser: Any if sys.version_info >= (3, 0): diff --git a/third_party/2and3/click/__init__.pyi b/third_party/2and3/click/__init__.pyi index 11eaa8707..2868016fd 100644 --- a/third_party/2and3/click/__init__.pyi +++ b/third_party/2and3/click/__init__.pyi @@ -14,7 +14,6 @@ :license: BSD, see LICENSE for more details. """ -# Core classes from .core import ( Context as Context, BaseCommand as BaseCommand, @@ -26,11 +25,7 @@ from .core import ( Option as Option, Argument as Argument, ) - -# Globals from .globals import get_current_context as get_current_context - -# Decorators from .decorators import ( pass_context as pass_context, pass_obj as pass_obj, @@ -44,8 +39,6 @@ from .decorators import ( version_option as version_option, help_option as help_option, ) - -# Types from .types import ( ParamType as ParamType, File as File, @@ -62,8 +55,6 @@ from .types import ( UUID as UUID, UNPROCESSED as UNPROCESSED, ) - -# Utilities from .utils import ( echo as echo, get_binary_stream as get_binary_stream, @@ -73,8 +64,6 @@ from .utils import ( get_app_dir as get_app_dir, get_os_args as get_os_args, ) - -# Terminal functions from .termui import ( prompt as prompt, confirm as confirm, @@ -90,8 +79,6 @@ from .termui import ( getchar as getchar, pause as pause, ) - -# Exceptions from .exceptions import ( ClickException as ClickException, UsageError as UsageError, @@ -103,11 +90,7 @@ from .exceptions import ( BadArgumentUsage as BadArgumentUsage, MissingParameter as MissingParameter, ) - -# Formatting from .formatting import HelpFormatter as HelpFormatter, wrap_text as wrap_text - -# Parsing from .parser import OptionParser as OptionParser # Controls if click should emit the warning about the use of unicode diff --git a/third_party/3/six/__init__.pyi b/third_party/3/six/__init__.pyi index 021922522..9bb5af59c 100644 --- a/third_party/3/six/__init__.pyi +++ b/third_party/3/six/__init__.pyi @@ -1,5 +1,3 @@ -# Stubs for six (Python 3.5) - from __future__ import print_function from typing import ( @@ -26,7 +24,6 @@ import types import typing import unittest -# Exports from io import StringIO as StringIO, BytesIO as BytesIO from builtins import next as next from functools import wraps as wraps