diff --git a/.travis.yml b/.travis.yml index 87c453a0a387..02794ae56e69 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,6 @@ jobs: - name: "black" install: pip install $(grep black requirements-tests-py3.txt) script: black --check --diff stdlib third_party - allow_failures: - name: "isort" install: pip install $(grep isort requirements-tests-py3.txt) script: isort --check-only --diff --recursive stdlib third_party diff --git a/pyproject.toml b/pyproject.toml index 3ae4966f6f11..c9b6b9b0d557 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,3 +9,5 @@ force_grid_wrap = 0 use_parentheses = true combine_as_imports = true line_length = 130 +default_section = "THIRDPARTY" +known_standard_library = ["typing_extensions", "_typeshed", "_compression", "_markupbase", "opcode"] diff --git a/stdlib/2/ConfigParser.pyi b/stdlib/2/ConfigParser.pyi index 6cdcb55009a8..08812848d14d 100644 --- a/stdlib/2/ConfigParser.pyi +++ b/stdlib/2/ConfigParser.pyi @@ -1,6 +1,5 @@ -from typing import IO, Any, Dict, List, Optional, Sequence, Tuple, Union - from _typeshed import SupportsReadline +from typing import IO, Any, Dict, List, Optional, Sequence, Tuple, Union DEFAULTSECT: str MAX_INTERPOLATION_DEPTH: int diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index 4bef6d121cd9..24c93a18e857 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -2,6 +2,16 @@ # Python 3, and stub files conform to Python 3 syntax. import sys +from _typeshed import ( + AnyPath, + OpenBinaryMode, + OpenBinaryModeReading, + OpenBinaryModeUpdating, + OpenBinaryModeWriting, + OpenTextMode, + ReadableBuffer, + SupportsWrite, +) from abc import ABCMeta from ast import AST, mod from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper @@ -46,20 +56,8 @@ from typing import ( ValuesView, overload, ) - from typing_extensions import Literal -from _typeshed import ( - AnyPath, - OpenBinaryMode, - OpenBinaryModeReading, - OpenBinaryModeUpdating, - OpenBinaryModeWriting, - OpenTextMode, - ReadableBuffer, - SupportsWrite, -) - if sys.version_info >= (3,): from typing import SupportsBytes, SupportsRound diff --git a/stdlib/2/compileall.pyi b/stdlib/2/compileall.pyi index cb7d663d0256..22662f46023d 100644 --- a/stdlib/2/compileall.pyi +++ b/stdlib/2/compileall.pyi @@ -1,6 +1,5 @@ -from typing import Any, Optional, Pattern - from _typeshed import AnyPath +from typing import Any, Optional, Pattern # rx can be any object with a 'search' method; once we have Protocols we can change the type def compile_dir( diff --git a/stdlib/2/fcntl.pyi b/stdlib/2/fcntl.pyi index a09d8a86a830..200e2249280c 100644 --- a/stdlib/2/fcntl.pyi +++ b/stdlib/2/fcntl.pyi @@ -1,6 +1,5 @@ -from typing import Any, Union - from _typeshed import FileDescriptorLike +from typing import Any, Union FASYNC: int FD_CLOEXEC: int diff --git a/stdlib/2/json.pyi b/stdlib/2/json.pyi index cb4c3f99d127..1584ed803b0b 100644 --- a/stdlib/2/json.pyi +++ b/stdlib/2/json.pyi @@ -1,6 +1,5 @@ -from typing import IO, Any, Callable, Dict, List, Optional, Text, Tuple, Type, Union - from _typeshed import SupportsRead +from typing import IO, Any, Callable, Dict, List, Optional, Text, Tuple, Type, Union class JSONDecodeError(ValueError): def dumps(self, obj: Any) -> str: ... diff --git a/stdlib/2/os/__init__.pyi b/stdlib/2/os/__init__.pyi index 31d205bb1ac8..35614d835eb1 100644 --- a/stdlib/2/os/__init__.pyi +++ b/stdlib/2/os/__init__.pyi @@ -1,4 +1,5 @@ import sys +from _typeshed import AnyPath from builtins import OSError as error 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 @@ -25,8 +26,6 @@ from typing import ( overload, ) -from _typeshed import AnyPath - from . import path as path # We need to use something from path, or flake8 and pytype get unhappy diff --git a/stdlib/2/os/path.pyi b/stdlib/2/os/path.pyi index 6d5bfd0581d1..2fe03bb1b840 100644 --- a/stdlib/2/os/path.pyi +++ b/stdlib/2/os/path.pyi @@ -1,11 +1,10 @@ # NB: path.pyi and stdlib/2 and stdlib/3 must remain consistent! import os import sys +from _typeshed import AnyPath, BytesPath, StrPath from genericpath import exists as exists from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, overload -from _typeshed import AnyPath, BytesPath, StrPath - _T = TypeVar("_T") if sys.version_info >= (3, 6): diff --git a/stdlib/2/os2emxpath.pyi b/stdlib/2/os2emxpath.pyi index 6d5bfd0581d1..2fe03bb1b840 100644 --- a/stdlib/2/os2emxpath.pyi +++ b/stdlib/2/os2emxpath.pyi @@ -1,11 +1,10 @@ # NB: path.pyi and stdlib/2 and stdlib/3 must remain consistent! import os import sys +from _typeshed import AnyPath, BytesPath, StrPath from genericpath import exists as exists from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, overload -from _typeshed import AnyPath, BytesPath, StrPath - _T = TypeVar("_T") if sys.version_info >= (3, 6): diff --git a/stdlib/2and3/_typeshed/__init__.pyi b/stdlib/2and3/_typeshed/__init__.pyi index aae0826cc3ba..b2368a980784 100644 --- a/stdlib/2and3/_typeshed/__init__.pyi +++ b/stdlib/2and3/_typeshed/__init__.pyi @@ -16,7 +16,6 @@ import array import mmap import sys from typing import Protocol, Text, TypeVar, Union - from typing_extensions import Literal _T_co = TypeVar("_T_co", covariant=True) diff --git a/stdlib/2and3/aifc.pyi b/stdlib/2and3/aifc.pyi index 391fbb0d004d..f812ac593e97 100644 --- a/stdlib/2and3/aifc.pyi +++ b/stdlib/2and3/aifc.pyi @@ -1,7 +1,6 @@ import sys from types import TracebackType from typing import IO, Any, List, NamedTuple, Optional, Text, Tuple, Type, Union, overload - from typing_extensions import Literal class Error(Exception): ... diff --git a/stdlib/2and3/array.pyi b/stdlib/2and3/array.pyi index da2f7145ae64..b47b778e6977 100644 --- a/stdlib/2and3/array.pyi +++ b/stdlib/2and3/array.pyi @@ -4,7 +4,6 @@ import sys from typing import Any, BinaryIO, Generic, Iterable, Iterator, List, MutableSequence, Text, Tuple, TypeVar, Union, overload - from typing_extensions import Literal _IntTypeCode = Literal["b", "B", "h", "H", "i", "I", "l", "L", "q", "Q"] diff --git a/stdlib/2and3/asyncore.pyi b/stdlib/2and3/asyncore.pyi index 4845b7aa7464..a05a205115f3 100644 --- a/stdlib/2and3/asyncore.pyi +++ b/stdlib/2and3/asyncore.pyi @@ -1,9 +1,8 @@ import sys +from _typeshed import FileDescriptorLike from socket import SocketType from typing import Any, Dict, Optional, Tuple, Union, overload -from _typeshed import FileDescriptorLike - # cyclic dependence with asynchat _maptype = Dict[int, Any] diff --git a/stdlib/2and3/builtins.pyi b/stdlib/2and3/builtins.pyi index 4bef6d121cd9..24c93a18e857 100644 --- a/stdlib/2and3/builtins.pyi +++ b/stdlib/2and3/builtins.pyi @@ -2,6 +2,16 @@ # Python 3, and stub files conform to Python 3 syntax. import sys +from _typeshed import ( + AnyPath, + OpenBinaryMode, + OpenBinaryModeReading, + OpenBinaryModeUpdating, + OpenBinaryModeWriting, + OpenTextMode, + ReadableBuffer, + SupportsWrite, +) from abc import ABCMeta from ast import AST, mod from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper @@ -46,20 +56,8 @@ from typing import ( ValuesView, overload, ) - from typing_extensions import Literal -from _typeshed import ( - AnyPath, - OpenBinaryMode, - OpenBinaryModeReading, - OpenBinaryModeUpdating, - OpenBinaryModeWriting, - OpenTextMode, - ReadableBuffer, - SupportsWrite, -) - if sys.version_info >= (3,): from typing import SupportsBytes, SupportsRound diff --git a/stdlib/2and3/bz2.pyi b/stdlib/2and3/bz2.pyi index 89e347780e1f..b67d00cc7be1 100644 --- a/stdlib/2and3/bz2.pyi +++ b/stdlib/2and3/bz2.pyi @@ -1,11 +1,9 @@ import io import sys +from _typeshed import AnyPath from typing import IO, Any, Optional, TextIO, TypeVar, Union, overload - from typing_extensions import Literal -from _typeshed import AnyPath - _PathOrFile = Union[AnyPath, IO[bytes]] _T = TypeVar("_T") diff --git a/stdlib/2and3/cProfile.pyi b/stdlib/2and3/cProfile.pyi index 69bbba24d3a3..e5399beac9c4 100644 --- a/stdlib/2and3/cProfile.pyi +++ b/stdlib/2and3/cProfile.pyi @@ -1,7 +1,6 @@ import sys -from typing import Any, Callable, Dict, Optional, TypeVar, Union - from _typeshed import AnyPath +from typing import Any, Callable, Dict, Optional, TypeVar, Union def run(statement: str, filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ... def runctx( diff --git a/stdlib/2and3/cgitb.pyi b/stdlib/2and3/cgitb.pyi index 0d90dc8f831f..7603ecd9afbe 100644 --- a/stdlib/2and3/cgitb.pyi +++ b/stdlib/2and3/cgitb.pyi @@ -1,8 +1,7 @@ +from _typeshed import AnyPath from types import FrameType, TracebackType from typing import IO, Any, Callable, Dict, List, Optional, Tuple, Type -from _typeshed import AnyPath - _ExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] def reset() -> str: ... # undocumented diff --git a/stdlib/2and3/codecs.pyi b/stdlib/2and3/codecs.pyi index d026f5d34b94..9a96c45198a4 100644 --- a/stdlib/2and3/codecs.pyi +++ b/stdlib/2and3/codecs.pyi @@ -20,7 +20,6 @@ from typing import ( Union, overload, ) - from typing_extensions import Literal # TODO: this only satisfies the most common interface, where diff --git a/stdlib/2and3/fileinput.pyi b/stdlib/2and3/fileinput.pyi index 6a0e2c643e3b..fbb602b3bf45 100644 --- a/stdlib/2and3/fileinput.pyi +++ b/stdlib/2and3/fileinput.pyi @@ -1,7 +1,6 @@ import sys -from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Optional, Union - from _typeshed import AnyPath +from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Optional, Union if sys.version_info >= (3, 8): def input( diff --git a/stdlib/2and3/ftplib.pyi b/stdlib/2and3/ftplib.pyi index 8150c20afaeb..16f9549f3519 100644 --- a/stdlib/2and3/ftplib.pyi +++ b/stdlib/2and3/ftplib.pyi @@ -1,4 +1,5 @@ import sys +from _typeshed import SupportsRead, SupportsReadline from socket import socket from ssl import SSLContext from types import TracebackType @@ -20,8 +21,6 @@ from typing import ( Union, ) -from _typeshed import SupportsRead, SupportsReadline - _T = TypeVar("_T") _IntOrStr = Union[int, Text] diff --git a/stdlib/2and3/hmac.pyi b/stdlib/2and3/hmac.pyi index c3874ec04c3c..bac39182b74e 100644 --- a/stdlib/2and3/hmac.pyi +++ b/stdlib/2and3/hmac.pyi @@ -1,11 +1,10 @@ # Stubs for hmac import sys +from _typeshed import ReadableBuffer from types import ModuleType from typing import Any, AnyStr, Callable, Optional, Union, overload -from _typeshed import ReadableBuffer - _B = Union[bytes, bytearray] # TODO more precise type for object of hashlib diff --git a/stdlib/2and3/imaplib.pyi b/stdlib/2and3/imaplib.pyi index eaf4befa1cf0..034943b613e2 100644 --- a/stdlib/2and3/imaplib.pyi +++ b/stdlib/2and3/imaplib.pyi @@ -4,7 +4,6 @@ import time from socket import socket as _socket from ssl import SSLContext, SSLSocket from typing import IO, Any, Callable, Dict, List, Optional, Pattern, Text, Tuple, Type, Union - from typing_extensions import Literal # TODO: Commands should use their actual return types, not this type alias. diff --git a/stdlib/2and3/lib2to3/pgen2/driver.pyi b/stdlib/2and3/lib2to3/pgen2/driver.pyi index 69e4337c6b63..841b0e4b1cb3 100644 --- a/stdlib/2and3/lib2to3/pgen2/driver.pyi +++ b/stdlib/2and3/lib2to3/pgen2/driver.pyi @@ -1,10 +1,9 @@ +from _typeshed import StrPath from lib2to3.pgen2.grammar import Grammar from lib2to3.pytree import _NL, _Convert from logging import Logger from typing import IO, Any, Iterable, Optional, Text -from _typeshed import StrPath - class Driver: grammar: Grammar logger: Logger diff --git a/stdlib/2and3/lib2to3/pgen2/grammar.pyi b/stdlib/2and3/lib2to3/pgen2/grammar.pyi index e42cc2f2daa2..6ec97ce849d2 100644 --- a/stdlib/2and3/lib2to3/pgen2/grammar.pyi +++ b/stdlib/2and3/lib2to3/pgen2/grammar.pyi @@ -1,6 +1,5 @@ -from typing import Dict, List, Optional, Text, Tuple, TypeVar - from _typeshed import StrPath +from typing import Dict, List, Optional, Text, Tuple, TypeVar _P = TypeVar("_P") _Label = Tuple[int, Optional[Text]] diff --git a/stdlib/2and3/lib2to3/pgen2/pgen.pyi b/stdlib/2and3/lib2to3/pgen2/pgen.pyi index 7c9ec48f00ee..7920262f4f04 100644 --- a/stdlib/2and3/lib2to3/pgen2/pgen.pyi +++ b/stdlib/2and3/lib2to3/pgen2/pgen.pyi @@ -1,9 +1,8 @@ +from _typeshed import StrPath from lib2to3.pgen2 import grammar from lib2to3.pgen2.tokenize import _TokenInfo from typing import IO, Any, Dict, Iterable, Iterator, List, NoReturn, Optional, Text, Tuple -from _typeshed import StrPath - class PgenGrammar(grammar.Grammar): ... class ParserGenerator: diff --git a/stdlib/2and3/logging/__init__.pyi b/stdlib/2and3/logging/__init__.pyi index 62fd519c91d1..e5468e6c316a 100644 --- a/stdlib/2and3/logging/__init__.pyi +++ b/stdlib/2and3/logging/__init__.pyi @@ -1,5 +1,6 @@ import sys import threading +from _typeshed import StrPath from string import Template from time import struct_time from types import FrameType, TracebackType @@ -20,8 +21,6 @@ from typing import ( overload, ) -from _typeshed import StrPath - _SysExcInfoType = Union[Tuple[type, BaseException, Optional[TracebackType]], Tuple[None, None, None]] if sys.version_info >= (3, 5): _ExcInfoType = Union[None, bool, _SysExcInfoType, BaseException] diff --git a/stdlib/2and3/logging/config.pyi b/stdlib/2and3/logging/config.pyi index 35d0b0c8be20..535d583d759a 100644 --- a/stdlib/2and3/logging/config.pyi +++ b/stdlib/2and3/logging/config.pyi @@ -1,9 +1,8 @@ import sys +from _typeshed import AnyPath, StrPath from threading import Thread from typing import IO, Any, Callable, Dict, Optional, Union -from _typeshed import AnyPath, StrPath - if sys.version_info >= (3,): from configparser import RawConfigParser else: diff --git a/stdlib/2and3/logging/handlers.pyi b/stdlib/2and3/logging/handlers.pyi index 79eafea47cea..bade71cf1138 100644 --- a/stdlib/2and3/logging/handlers.pyi +++ b/stdlib/2and3/logging/handlers.pyi @@ -1,12 +1,11 @@ import datetime import ssl import sys +from _typeshed import StrPath from logging import FileHandler, Handler, LogRecord from socket import SocketType from typing import Any, Callable, Dict, List, Optional, Tuple, Union, overload -from _typeshed import StrPath - if sys.version_info >= (3, 7): from queue import SimpleQueue, Queue elif sys.version_info >= (3,): diff --git a/stdlib/2and3/macpath.pyi b/stdlib/2and3/macpath.pyi index 04167b173635..550c9542c402 100644 --- a/stdlib/2and3/macpath.pyi +++ b/stdlib/2and3/macpath.pyi @@ -3,9 +3,8 @@ import os import sys -from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, Union, overload - from _typeshed import AnyPath, BytesPath, StrPath +from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, Union, overload if sys.version_info < (3, 8): _T = TypeVar("_T") diff --git a/stdlib/2and3/mailbox.pyi b/stdlib/2and3/mailbox.pyi index 8b751e3bfe09..3742b75c7ad7 100644 --- a/stdlib/2and3/mailbox.pyi +++ b/stdlib/2and3/mailbox.pyi @@ -1,4 +1,5 @@ import email +from _typeshed import AnyPath from types import TracebackType from typing import ( IO, @@ -21,11 +22,8 @@ from typing import ( Union, overload, ) - from typing_extensions import Literal -from _typeshed import AnyPath - _T = TypeVar("_T") _MessageType = TypeVar("_MessageType", bound=Message) _MessageData = Union[email.message.Message, bytes, str, IO[str], IO[bytes]] diff --git a/stdlib/2and3/mmap.pyi b/stdlib/2and3/mmap.pyi index 48f1c94039b1..7039e3da9870 100644 --- a/stdlib/2and3/mmap.pyi +++ b/stdlib/2and3/mmap.pyi @@ -1,7 +1,6 @@ import sys -from typing import AnyStr, ContextManager, Generic, Iterable, Iterator, Optional, Sequence, Sized, Union, overload - from _typeshed import ReadableBuffer +from typing import AnyStr, ContextManager, Generic, Iterable, Iterator, Optional, Sequence, Sized, Union, overload ACCESS_DEFAULT: int ACCESS_READ: int diff --git a/stdlib/2and3/msilib/__init__.pyi b/stdlib/2and3/msilib/__init__.pyi index dc28258c529b..0442ffaaec83 100644 --- a/stdlib/2and3/msilib/__init__.pyi +++ b/stdlib/2and3/msilib/__init__.pyi @@ -1,7 +1,6 @@ import sys from types import ModuleType from typing import Any, Container, Dict, Iterable, List, Optional, Sequence, Set, Tuple, Type, Union - from typing_extensions import Literal if sys.platform == "win32": diff --git a/stdlib/2and3/ntpath.pyi b/stdlib/2and3/ntpath.pyi index 6d5bfd0581d1..2fe03bb1b840 100644 --- a/stdlib/2and3/ntpath.pyi +++ b/stdlib/2and3/ntpath.pyi @@ -1,11 +1,10 @@ # NB: path.pyi and stdlib/2 and stdlib/3 must remain consistent! import os import sys +from _typeshed import AnyPath, BytesPath, StrPath from genericpath import exists as exists from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, overload -from _typeshed import AnyPath, BytesPath, StrPath - _T = TypeVar("_T") if sys.version_info >= (3, 6): diff --git a/stdlib/2and3/parser.pyi b/stdlib/2and3/parser.pyi index e09ae01105a7..799f25cf6a48 100644 --- a/stdlib/2and3/parser.pyi +++ b/stdlib/2and3/parser.pyi @@ -1,8 +1,7 @@ +from _typeshed import AnyPath from types import CodeType from typing import Any, List, Sequence, Text, Tuple -from _typeshed import AnyPath - def expr(source: Text) -> STType: ... def suite(source: Text) -> STType: ... def sequence2st(sequence: Sequence[Any]) -> STType: ... diff --git a/stdlib/2and3/posixpath.pyi b/stdlib/2and3/posixpath.pyi index 6d5bfd0581d1..2fe03bb1b840 100644 --- a/stdlib/2and3/posixpath.pyi +++ b/stdlib/2and3/posixpath.pyi @@ -1,11 +1,10 @@ # NB: path.pyi and stdlib/2 and stdlib/3 must remain consistent! import os import sys +from _typeshed import AnyPath, BytesPath, StrPath from genericpath import exists as exists from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, overload -from _typeshed import AnyPath, BytesPath, StrPath - _T = TypeVar("_T") if sys.version_info >= (3, 6): diff --git a/stdlib/2and3/profile.pyi b/stdlib/2and3/profile.pyi index 86d8d10039ae..d5f4bd4d5271 100644 --- a/stdlib/2and3/profile.pyi +++ b/stdlib/2and3/profile.pyi @@ -1,6 +1,5 @@ -from typing import Any, Callable, Dict, Optional, TypeVar, Union - from _typeshed import AnyPath +from typing import Any, Callable, Dict, Optional, TypeVar, Union def run(statement: str, filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ... def runctx( diff --git a/stdlib/2and3/pstats.pyi b/stdlib/2and3/pstats.pyi index 33ff7fc96983..ee5c0dd1ca14 100644 --- a/stdlib/2and3/pstats.pyi +++ b/stdlib/2and3/pstats.pyi @@ -1,9 +1,8 @@ +from _typeshed import AnyPath from cProfile import Profile as _cProfile from profile import Profile from typing import IO, Any, Dict, Iterable, List, Optional, Text, Tuple, TypeVar, Union, overload -from _typeshed import AnyPath - _Selector = Union[str, float, int] _T = TypeVar("_T", bound=Stats) diff --git a/stdlib/2and3/pydoc.pyi b/stdlib/2and3/pydoc.pyi index 79e46acf5dc4..39aad5e74a4d 100644 --- a/stdlib/2and3/pydoc.pyi +++ b/stdlib/2and3/pydoc.pyi @@ -1,4 +1,5 @@ import sys +from _typeshed import SupportsWrite from types import FunctionType, MethodType, ModuleType, TracebackType from typing import ( IO, @@ -18,8 +19,6 @@ from typing import ( Union, ) -from _typeshed import SupportsWrite - if sys.version_info >= (3,): from reprlib import Repr else: diff --git a/stdlib/2and3/pyexpat/__init__.pyi b/stdlib/2and3/pyexpat/__init__.pyi index ac21a548839c..c8305567e92e 100644 --- a/stdlib/2and3/pyexpat/__init__.pyi +++ b/stdlib/2and3/pyexpat/__init__.pyi @@ -1,8 +1,7 @@ import pyexpat.errors as errors import pyexpat.model as model -from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Union - from _typeshed import SupportsRead +from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Union EXPAT_VERSION: str # undocumented version_info: Tuple[int, int, int] # undocumented diff --git a/stdlib/2and3/select.pyi b/stdlib/2and3/select.pyi index f9a725cf6197..e0cf3bdd4d75 100644 --- a/stdlib/2and3/select.pyi +++ b/stdlib/2and3/select.pyi @@ -1,9 +1,8 @@ import sys +from _typeshed import FileDescriptorLike from types import TracebackType from typing import Any, Iterable, List, Optional, Tuple, Type -from _typeshed import FileDescriptorLike - if sys.platform != "win32": PIPE_BUF: int POLLERR: int diff --git a/stdlib/2and3/shutil.pyi b/stdlib/2and3/shutil.pyi index 4c6cb6ac7b0a..bfe4b2b06c0e 100644 --- a/stdlib/2and3/shutil.pyi +++ b/stdlib/2and3/shutil.pyi @@ -1,5 +1,6 @@ import os import sys +from _typeshed import StrPath, SupportsRead, SupportsWrite from typing import ( Any, AnyStr, @@ -18,8 +19,6 @@ from typing import ( overload, ) -from _typeshed import StrPath, SupportsRead, SupportsWrite - if sys.version_info >= (3, 6): _AnyStr = str _AnyPath = TypeVar("_AnyPath", str, os.PathLike[str]) diff --git a/stdlib/2and3/sndhdr.pyi b/stdlib/2and3/sndhdr.pyi index 0e6aea6fd0d3..ef025ac571a7 100644 --- a/stdlib/2and3/sndhdr.pyi +++ b/stdlib/2and3/sndhdr.pyi @@ -1,7 +1,6 @@ import sys -from typing import NamedTuple, Optional, Tuple, Union - from _typeshed import AnyPath +from typing import NamedTuple, Optional, Tuple, Union if sys.version_info >= (3, 5): class SndHeaders(NamedTuple): diff --git a/stdlib/2and3/socket.pyi b/stdlib/2and3/socket.pyi index 9e9ccf43b0d1..aa4fde1eebf1 100644 --- a/stdlib/2and3/socket.pyi +++ b/stdlib/2and3/socket.pyi @@ -16,7 +16,6 @@ CPython C source: https://github.com/python/cpython/blob/master/Modules/socketmo # adapted for Python 2.7 by Michal Pokorny import sys from typing import Any, BinaryIO, Iterable, List, Optional, Text, TextIO, Tuple, TypeVar, Union, overload - from typing_extensions import Literal # ----- Constants ----- diff --git a/stdlib/2and3/ssl.pyi b/stdlib/2and3/ssl.pyi index e54928f85905..c0500d686d4b 100644 --- a/stdlib/2and3/ssl.pyi +++ b/stdlib/2and3/ssl.pyi @@ -1,12 +1,10 @@ import enum import socket import sys +from _typeshed import StrPath from typing import Any, Callable, ClassVar, Dict, Iterable, List, NamedTuple, Optional, Set, Text, Tuple, Type, Union, overload - from typing_extensions import Literal -from _typeshed import StrPath - _PCTRTT = Tuple[Tuple[str, str], ...] _PCTRTTT = Tuple[_PCTRTT, ...] _PeerCertRetDictType = Dict[str, Union[str, _PCTRTTT, _PCTRTT]] diff --git a/stdlib/2and3/tabnanny.pyi b/stdlib/2and3/tabnanny.pyi index b6703e6659fa..7784c9fc8d1b 100644 --- a/stdlib/2and3/tabnanny.pyi +++ b/stdlib/2and3/tabnanny.pyi @@ -1,6 +1,5 @@ -from typing import Iterable, Tuple - from _typeshed import AnyPath +from typing import Iterable, Tuple verbose: int filename_only: int diff --git a/stdlib/2and3/tarfile.pyi b/stdlib/2and3/tarfile.pyi index b310f4ce35a4..bc64a2223c65 100644 --- a/stdlib/2and3/tarfile.pyi +++ b/stdlib/2and3/tarfile.pyi @@ -1,9 +1,8 @@ import sys +from _typeshed import AnyPath from types import TracebackType from typing import IO, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Set, Tuple, Type, Union -from _typeshed import AnyPath - # tar constants NUL: bytes BLOCKSIZE: int diff --git a/stdlib/2and3/termios.pyi b/stdlib/2and3/termios.pyi index 429dcc4e8a50..779b92626006 100644 --- a/stdlib/2and3/termios.pyi +++ b/stdlib/2and3/termios.pyi @@ -1,6 +1,5 @@ -from typing import List, Union - from _typeshed import FileDescriptorLike +from typing import List, Union _Attr = List[Union[int, List[bytes]]] diff --git a/stdlib/2and3/trace.pyi b/stdlib/2and3/trace.pyi index 50d19a0bf334..6cdb537baa7c 100644 --- a/stdlib/2and3/trace.pyi +++ b/stdlib/2and3/trace.pyi @@ -1,7 +1,6 @@ import types -from typing import Any, Callable, Mapping, Optional, Sequence, Tuple, TypeVar, Union - from _typeshed import StrPath +from typing import Any, Callable, Mapping, Optional, Sequence, Tuple, TypeVar, Union _T = TypeVar("_T") _localtrace = Callable[[types.FrameType, str, Any], Callable[..., Any]] diff --git a/stdlib/2and3/traceback.pyi b/stdlib/2and3/traceback.pyi index 97cb27de6bf6..3972ca875fa8 100644 --- a/stdlib/2and3/traceback.pyi +++ b/stdlib/2and3/traceback.pyi @@ -1,9 +1,8 @@ import sys +from _typeshed import SupportsWrite from types import FrameType, TracebackType from typing import IO, Any, Dict, Generator, Iterable, Iterator, List, Mapping, Optional, Tuple, Type -from _typeshed import SupportsWrite - _PT = Tuple[str, int, str, Optional[str]] def print_tb(tb: Optional[TracebackType], limit: Optional[int] = ..., file: Optional[IO[str]] = ...) -> None: ... diff --git a/stdlib/2and3/warnings.pyi b/stdlib/2and3/warnings.pyi index af1ffd8aeba4..e15c03e98e4a 100644 --- a/stdlib/2and3/warnings.pyi +++ b/stdlib/2and3/warnings.pyi @@ -1,7 +1,6 @@ import sys from types import ModuleType, TracebackType from typing import Any, List, NamedTuple, Optional, TextIO, Type, Union, overload - from typing_extensions import Literal from _warnings import warn as warn, warn_explicit as warn_explicit diff --git a/stdlib/2and3/winsound.pyi b/stdlib/2and3/winsound.pyi index ff4da6fff2a5..be9a8c660781 100644 --- a/stdlib/2and3/winsound.pyi +++ b/stdlib/2and3/winsound.pyi @@ -1,6 +1,5 @@ import sys from typing import Optional, Union, overload - from typing_extensions import Literal if sys.platform == "win32": diff --git a/stdlib/2and3/wsgiref/validate.pyi b/stdlib/2and3/wsgiref/validate.pyi index 0612fc86685f..570546e6545d 100644 --- a/stdlib/2and3/wsgiref/validate.pyi +++ b/stdlib/2and3/wsgiref/validate.pyi @@ -1,7 +1,6 @@ import sys -from typing import Any, Callable, Iterable, Iterator, NoReturn, Optional - from _typeshed.wsgi import ErrorStream, InputStream, WSGIApplication +from typing import Any, Callable, Iterable, Iterator, NoReturn, Optional class WSGIWarning(Warning): ... diff --git a/stdlib/2and3/xml/etree/ElementTree.pyi b/stdlib/2and3/xml/etree/ElementTree.pyi index 0ef6bb5baea9..0d1eafc7d3bb 100644 --- a/stdlib/2and3/xml/etree/ElementTree.pyi +++ b/stdlib/2and3/xml/etree/ElementTree.pyi @@ -1,4 +1,5 @@ import sys +from _typeshed import AnyPath, FileDescriptor, SupportsWrite from typing import ( IO, Any, @@ -19,11 +20,8 @@ from typing import ( Union, overload, ) - from typing_extensions import Literal -from _typeshed import AnyPath, FileDescriptor, SupportsWrite - VERSION: str class ParseError(SyntaxError): diff --git a/stdlib/2and3/xml/sax/saxutils.pyi b/stdlib/2and3/xml/sax/saxutils.pyi index ccb79e96dbdf..c7cb16072f89 100644 --- a/stdlib/2and3/xml/sax/saxutils.pyi +++ b/stdlib/2and3/xml/sax/saxutils.pyi @@ -1,11 +1,10 @@ import sys +from _typeshed import SupportsWrite from codecs import StreamReaderWriter, StreamWriter from io import RawIOBase, TextIOBase from typing import Mapping, Optional, Text, TextIO, Union from xml.sax import handler, xmlreader -from _typeshed import SupportsWrite - def escape(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ... def unescape(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ... def quoteattr(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ... diff --git a/stdlib/2and3/zipfile.pyi b/stdlib/2and3/zipfile.pyi index b122f2b2bff4..e002aa2c1e80 100644 --- a/stdlib/2and3/zipfile.pyi +++ b/stdlib/2and3/zipfile.pyi @@ -1,5 +1,6 @@ import io import sys +from _typeshed import StrPath from types import TracebackType from typing import ( IO, @@ -19,8 +20,6 @@ from typing import ( Union, ) -from _typeshed import StrPath - _SZI = Union[Text, ZipInfo] _DT = Tuple[int, int, int, int, int, int] diff --git a/stdlib/3/_sitebuiltins.pyi b/stdlib/3/_sitebuiltins.pyi index 18da4729c8da..e0e9316aa290 100644 --- a/stdlib/3/_sitebuiltins.pyi +++ b/stdlib/3/_sitebuiltins.pyi @@ -1,5 +1,4 @@ from typing import ClassVar, Iterable, NoReturn, Optional - from typing_extensions import Literal class Quitter: diff --git a/stdlib/3/_winapi.pyi b/stdlib/3/_winapi.pyi index 2054b710b2e3..09245b5218c1 100644 --- a/stdlib/3/_winapi.pyi +++ b/stdlib/3/_winapi.pyi @@ -1,6 +1,5 @@ import sys from typing import Any, Dict, NoReturn, Optional, Sequence, Tuple, Union, overload - from typing_extensions import Literal CREATE_NEW_CONSOLE: int diff --git a/stdlib/3/ast.pyi b/stdlib/3/ast.pyi index 9d0013e2873b..7efd2b226ebc 100644 --- a/stdlib/3/ast.pyi +++ b/stdlib/3/ast.pyi @@ -9,7 +9,6 @@ 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 diff --git a/stdlib/3/asyncio/base_events.pyi b/stdlib/3/asyncio/base_events.pyi index d9aeb87fb338..ddecc99bc300 100644 --- a/stdlib/3/asyncio/base_events.pyi +++ b/stdlib/3/asyncio/base_events.pyi @@ -1,5 +1,6 @@ import ssl import sys +from _typeshed import FileDescriptorLike from abc import ABCMeta from asyncio.events import AbstractEventLoop, AbstractServer, Handle, TimerHandle from asyncio.futures import Future @@ -8,11 +9,8 @@ from asyncio.tasks import Task from asyncio.transports import BaseTransport from socket import _Address, _RetAddress, socket from typing import IO, Any, Awaitable, Callable, Dict, Generator, List, Optional, Sequence, Tuple, TypeVar, Union, overload - from typing_extensions import Literal -from _typeshed import FileDescriptorLike - if sys.version_info >= (3, 7): from contextvars import Context diff --git a/stdlib/3/asyncio/base_futures.pyi b/stdlib/3/asyncio/base_futures.pyi index ca49b4de0937..ae6ded094a05 100644 --- a/stdlib/3/asyncio/base_futures.pyi +++ b/stdlib/3/asyncio/base_futures.pyi @@ -1,6 +1,5 @@ import contextvars from typing import Callable, List, Sequence, Tuple - from typing_extensions import Literal from . import futures diff --git a/stdlib/3/asyncio/base_tasks.pyi b/stdlib/3/asyncio/base_tasks.pyi index e402531df1c5..79542d18c17a 100644 --- a/stdlib/3/asyncio/base_tasks.pyi +++ b/stdlib/3/asyncio/base_tasks.pyi @@ -1,8 +1,7 @@ +from _typeshed import AnyPath from types import FrameType from typing import List, Optional -from _typeshed import AnyPath - from . import tasks def _task_repr_info(task: tasks.Task) -> List[str]: ... # undocumented diff --git a/stdlib/3/asyncio/events.pyi b/stdlib/3/asyncio/events.pyi index ed4e54547ebb..31fdb7d8a7d8 100644 --- a/stdlib/3/asyncio/events.pyi +++ b/stdlib/3/asyncio/events.pyi @@ -1,5 +1,6 @@ import ssl import sys +from _typeshed import FileDescriptorLike from abc import ABCMeta, abstractmethod from asyncio.futures import Future from asyncio.protocols import BaseProtocol @@ -9,8 +10,6 @@ from asyncio.unix_events import AbstractChildWatcher from socket import _Address, _RetAddress, socket from typing import IO, Any, Awaitable, Callable, Dict, Generator, List, Optional, Sequence, Tuple, TypeVar, Union, overload -from _typeshed import FileDescriptorLike - if sys.version_info >= (3, 7): from contextvars import Context diff --git a/stdlib/3/asyncio/proactor_events.pyi b/stdlib/3/asyncio/proactor_events.pyi index 18edbe8f17f1..e3ebeb502f3c 100644 --- a/stdlib/3/asyncio/proactor_events.pyi +++ b/stdlib/3/asyncio/proactor_events.pyi @@ -1,6 +1,5 @@ from socket import socket from typing import Any, Mapping, Optional - from typing_extensions import Literal from . import base_events, constants, events, futures, streams, transports diff --git a/stdlib/3/asyncio/sslproto.pyi b/stdlib/3/asyncio/sslproto.pyi index 35dcba808fc9..0b921df93023 100644 --- a/stdlib/3/asyncio/sslproto.pyi +++ b/stdlib/3/asyncio/sslproto.pyi @@ -1,7 +1,6 @@ import ssl import sys from typing import Any, Callable, ClassVar, Deque, Dict, List, Optional, Tuple - from typing_extensions import Literal from . import constants, events, futures, protocols, transports diff --git a/stdlib/3/asyncio/tasks.pyi b/stdlib/3/asyncio/tasks.pyi index 8814d129b7f1..33302b722776 100644 --- a/stdlib/3/asyncio/tasks.pyi +++ b/stdlib/3/asyncio/tasks.pyi @@ -17,7 +17,6 @@ from typing import ( Union, overload, ) - from typing_extensions import Literal from .events import AbstractEventLoop diff --git a/stdlib/3/compileall.pyi b/stdlib/3/compileall.pyi index 5f9232f3f402..4d6fda9fafe9 100644 --- a/stdlib/3/compileall.pyi +++ b/stdlib/3/compileall.pyi @@ -1,7 +1,6 @@ import sys -from typing import Any, Optional, Pattern - from _typeshed import AnyPath +from typing import Any, Optional, Pattern if sys.version_info < (3, 6): _SuccessType = bool diff --git a/stdlib/3/configparser.pyi b/stdlib/3/configparser.pyi index 7155800dfa2a..d46b8552a382 100644 --- a/stdlib/3/configparser.pyi +++ b/stdlib/3/configparser.pyi @@ -1,4 +1,5 @@ import sys +from _typeshed import AnyPath, StrPath from typing import ( IO, AbstractSet, @@ -21,8 +22,6 @@ from typing import ( overload, ) -from _typeshed import AnyPath, StrPath - # Internal type aliases _section = Mapping[str, str] _parser = MutableMapping[str, _section] diff --git a/stdlib/3/dbm/__init__.pyi b/stdlib/3/dbm/__init__.pyi index a04aa8c582db..6177664bfbfa 100644 --- a/stdlib/3/dbm/__init__.pyi +++ b/stdlib/3/dbm/__init__.pyi @@ -1,7 +1,6 @@ import sys from types import TracebackType from typing import Iterator, MutableMapping, Optional, Type, Union - from typing_extensions import Literal _KeyType = Union[str, bytes] diff --git a/stdlib/3/faulthandler.pyi b/stdlib/3/faulthandler.pyi index 0e06283a8aab..7b42b8ec8444 100644 --- a/stdlib/3/faulthandler.pyi +++ b/stdlib/3/faulthandler.pyi @@ -1,5 +1,4 @@ import sys - from _typeshed import FileDescriptorLike def cancel_dump_traceback_later() -> None: ... diff --git a/stdlib/3/fcntl.pyi b/stdlib/3/fcntl.pyi index 4f76a7c6622b..acd48176ceaf 100644 --- a/stdlib/3/fcntl.pyi +++ b/stdlib/3/fcntl.pyi @@ -1,10 +1,8 @@ +from _typeshed import FileDescriptorLike from array import array from typing import Any, Union, overload - from typing_extensions import Literal -from _typeshed import FileDescriptorLike - FASYNC: int FD_CLOEXEC: int DN_ACCESS: int diff --git a/stdlib/3/gettext.pyi b/stdlib/3/gettext.pyi index fac2a1b32fdc..bb9610731f63 100644 --- a/stdlib/3/gettext.pyi +++ b/stdlib/3/gettext.pyi @@ -1,10 +1,8 @@ import sys +from _typeshed import StrPath from typing import IO, Any, Container, Iterable, Optional, Sequence, Type, TypeVar, Union, overload - from typing_extensions import Literal -from _typeshed import StrPath - class NullTranslations: def __init__(self, fp: Optional[IO[str]] = ...) -> None: ... def _parse(self, fp: IO[str]) -> None: ... diff --git a/stdlib/3/gzip.pyi b/stdlib/3/gzip.pyi index d0c542ce0da8..2d389cfc3ad0 100644 --- a/stdlib/3/gzip.pyi +++ b/stdlib/3/gzip.pyi @@ -1,12 +1,10 @@ import _compression import sys import zlib +from _typeshed import AnyPath, ReadableBuffer from typing import IO, Optional, TextIO, Union, overload - from typing_extensions import Literal -from _typeshed import AnyPath, ReadableBuffer - _OpenBinaryMode = Literal["r", "rb", "a", "ab", "w", "wb", "x", "xb"] _OpenTextMode = Literal["rt", "at", "wt", "xt"] @overload diff --git a/stdlib/3/hashlib.pyi b/stdlib/3/hashlib.pyi index 75da095b3482..de8b27880e0a 100644 --- a/stdlib/3/hashlib.pyi +++ b/stdlib/3/hashlib.pyi @@ -1,9 +1,8 @@ # Stubs for hashlib import sys -from typing import AbstractSet, Optional, Union - from _typeshed import ReadableBuffer +from typing import AbstractSet, Optional, Union class _Hash(object): digest_size: int diff --git a/stdlib/3/http/__init__.pyi b/stdlib/3/http/__init__.pyi index 124f265f7488..93895549cb2a 100644 --- a/stdlib/3/http/__init__.pyi +++ b/stdlib/3/http/__init__.pyi @@ -1,6 +1,5 @@ import sys from enum import IntEnum - from typing_extensions import Literal class HTTPStatus(IntEnum): diff --git a/stdlib/3/imp.pyi b/stdlib/3/imp.pyi index e24f59f50183..76e60741be51 100644 --- a/stdlib/3/imp.pyi +++ b/stdlib/3/imp.pyi @@ -1,6 +1,7 @@ import os import sys import types +from _typeshed import StrPath from typing import IO, Any, List, Optional, Tuple, TypeVar, Union from _imp import ( @@ -14,7 +15,6 @@ from _imp import ( lock_held as lock_held, release_lock as release_lock, ) -from _typeshed import StrPath _T = TypeVar("_T") diff --git a/stdlib/3/io.pyi b/stdlib/3/io.pyi index 0449b28c7592..6294d6db9618 100644 --- a/stdlib/3/io.pyi +++ b/stdlib/3/io.pyi @@ -1,12 +1,11 @@ import builtins import codecs import sys +from _typeshed import ReadableBuffer, WriteableBuffer from mmap import mmap from types import TracebackType from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, List, Optional, TextIO, Tuple, Type, TypeVar, Union -from _typeshed import ReadableBuffer, WriteableBuffer - DEFAULT_BUFFER_SIZE: int SEEK_SET: int diff --git a/stdlib/3/json/__init__.pyi b/stdlib/3/json/__init__.pyi index 09c752fecf65..9abde5ddf36d 100644 --- a/stdlib/3/json/__init__.pyi +++ b/stdlib/3/json/__init__.pyi @@ -1,7 +1,6 @@ import sys -from typing import IO, Any, Callable, Dict, List, Optional, Tuple, Type, Union - from _typeshed import SupportsRead +from typing import IO, Any, Callable, Dict, List, Optional, Tuple, Type, Union from .decoder import JSONDecodeError as JSONDecodeError, JSONDecoder as JSONDecoder from .encoder import JSONEncoder as JSONEncoder diff --git a/stdlib/3/lzma.pyi b/stdlib/3/lzma.pyi index f754b26a0fe4..b39b5ecc77d3 100644 --- a/stdlib/3/lzma.pyi +++ b/stdlib/3/lzma.pyi @@ -1,10 +1,8 @@ import io +from _typeshed import AnyPath, ReadableBuffer from typing import IO, Any, Mapping, Optional, Sequence, TextIO, TypeVar, Union, overload - from typing_extensions import Literal -from _typeshed import AnyPath, ReadableBuffer - _OpenBinaryWritingMode = Literal["w", "wb", "x", "xb", "a", "ab"] _OpenTextWritingMode = Literal["wt", "xt", "at"] diff --git a/stdlib/3/multiprocessing/__init__.pyi b/stdlib/3/multiprocessing/__init__.pyi index f7c35b56ffea..01b04d03f09f 100644 --- a/stdlib/3/multiprocessing/__init__.pyi +++ b/stdlib/3/multiprocessing/__init__.pyi @@ -1,7 +1,7 @@ import sys from ctypes import _CData from logging import Logger -from multiprocessing import connection, pool, sharedctypes, spawn, synchronize, queues +from multiprocessing import connection, pool, queues, sharedctypes, spawn, synchronize from multiprocessing.context import ( AuthenticationError as AuthenticationError, BaseContext, @@ -16,7 +16,6 @@ from multiprocessing.managers import SyncManager from multiprocessing.process import active_children as active_children, current_process as current_process from multiprocessing.spawn import freeze_support as freeze_support from typing import Any, Callable, Iterable, List, Optional, Sequence, Tuple, Type, Union, overload - from typing_extensions import Literal if sys.version_info >= (3, 8): diff --git a/stdlib/3/multiprocessing/context.pyi b/stdlib/3/multiprocessing/context.pyi index 962d9f82991a..5f39d45dc32a 100644 --- a/stdlib/3/multiprocessing/context.pyi +++ b/stdlib/3/multiprocessing/context.pyi @@ -4,7 +4,6 @@ from logging import Logger from multiprocessing import queues, sharedctypes, synchronize from multiprocessing.process import BaseProcess from typing import Any, Callable, Iterable, List, Optional, Sequence, Type, Union, overload - from typing_extensions import Literal _LockLike = Union[synchronize.Lock, synchronize.RLock] diff --git a/stdlib/3/os/__init__.pyi b/stdlib/3/os/__init__.pyi index ad4a9da15fe5..98a3f9b9e5ea 100644 --- a/stdlib/3/os/__init__.pyi +++ b/stdlib/3/os/__init__.pyi @@ -1,4 +1,5 @@ import sys +from _typeshed import AnyPath from builtins import OSError as error from io import TextIOWrapper as _TextIOWrapper from posix import listdir as listdir, times_result @@ -25,8 +26,6 @@ from typing import ( overload, ) -from _typeshed import AnyPath - from . import path as path # We need to use something from path, or flake8 and pytype get unhappy diff --git a/stdlib/3/os/path.pyi b/stdlib/3/os/path.pyi index 6d5bfd0581d1..2fe03bb1b840 100644 --- a/stdlib/3/os/path.pyi +++ b/stdlib/3/os/path.pyi @@ -1,11 +1,10 @@ # NB: path.pyi and stdlib/2 and stdlib/3 must remain consistent! import os import sys +from _typeshed import AnyPath, BytesPath, StrPath from genericpath import exists as exists from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, overload -from _typeshed import AnyPath, BytesPath, StrPath - _T = TypeVar("_T") if sys.version_info >= (3, 6): diff --git a/stdlib/3/pathlib.pyi b/stdlib/3/pathlib.pyi index faaf5cd7c07d..beb973e856f3 100644 --- a/stdlib/3/pathlib.pyi +++ b/stdlib/3/pathlib.pyi @@ -1,10 +1,9 @@ import os import sys +from _typeshed import OpenBinaryMode, OpenTextMode from types import TracebackType from typing import IO, Any, BinaryIO, Generator, List, Optional, Sequence, TextIO, Tuple, Type, TypeVar, Union, overload -from _typeshed import OpenBinaryMode, OpenTextMode - _P = TypeVar("_P", bound=PurePath) if sys.version_info >= (3, 6): diff --git a/stdlib/3/selectors.pyi b/stdlib/3/selectors.pyi index 39b29acc54f7..b019c4f9c442 100644 --- a/stdlib/3/selectors.pyi +++ b/stdlib/3/selectors.pyi @@ -1,9 +1,8 @@ import sys +from _typeshed import FileDescriptor, FileDescriptorLike from abc import ABCMeta, abstractmethod from typing import Any, List, Mapping, NamedTuple, Optional, Tuple -from _typeshed import FileDescriptor, FileDescriptorLike - _EventMask = int EVENT_READ: _EventMask diff --git a/stdlib/3/subprocess.pyi b/stdlib/3/subprocess.pyi index 5e018897b23d..77b29f59c2db 100644 --- a/stdlib/3/subprocess.pyi +++ b/stdlib/3/subprocess.pyi @@ -1,11 +1,9 @@ import sys +from _typeshed import AnyPath from types import TracebackType from typing import IO, Any, AnyStr, Callable, Generic, Mapping, Optional, Sequence, Tuple, Type, TypeVar, Union, overload - from typing_extensions import Literal -from _typeshed import AnyPath - # We prefer to annotate inputs to methods (eg subprocess.check_call) with these # union types. # For outputs we use laborious literal based overloads to try to determine diff --git a/stdlib/3/tempfile.pyi b/stdlib/3/tempfile.pyi index 0f17eaf78f30..3c46be28483a 100644 --- a/stdlib/3/tempfile.pyi +++ b/stdlib/3/tempfile.pyi @@ -2,7 +2,6 @@ import os import sys from types import TracebackType from typing import IO, Any, AnyStr, Generic, Iterable, Iterator, List, Optional, Tuple, Type, TypeVar, Union, overload - from typing_extensions import Literal # global variables diff --git a/stdlib/3/venv/__init__.pyi b/stdlib/3/venv/__init__.pyi index ea3449b073b8..2919aab2addc 100644 --- a/stdlib/3/venv/__init__.pyi +++ b/stdlib/3/venv/__init__.pyi @@ -1,9 +1,8 @@ import sys +from _typeshed import AnyPath from types import SimpleNamespace from typing import Optional, Sequence -from _typeshed import AnyPath - class EnvBuilder: system_site_packages: bool clear: bool diff --git a/stdlib/3/xmlrpc/client.pyi b/stdlib/3/xmlrpc/client.pyi index ef8498a94836..2ffad6d269d6 100644 --- a/stdlib/3/xmlrpc/client.pyi +++ b/stdlib/3/xmlrpc/client.pyi @@ -3,14 +3,12 @@ import http.client import io import sys import time +from _typeshed import SupportsRead, SupportsWrite from datetime import datetime from types import TracebackType from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Protocol, Tuple, Type, Union, overload - from typing_extensions import Literal -from _typeshed import SupportsRead, SupportsWrite - class _SupportsTimeTuple(Protocol): def timetuple(self) -> time.struct_time: ... diff --git a/third_party/2/pathlib2.pyi b/third_party/2/pathlib2.pyi index faaf5cd7c07d..beb973e856f3 100644 --- a/third_party/2/pathlib2.pyi +++ b/third_party/2/pathlib2.pyi @@ -1,10 +1,9 @@ import os import sys +from _typeshed import OpenBinaryMode, OpenTextMode from types import TracebackType from typing import IO, Any, BinaryIO, Generator, List, Optional, Sequence, TextIO, Tuple, Type, TypeVar, Union, overload -from _typeshed import OpenBinaryMode, OpenTextMode - _P = TypeVar("_P", bound=PurePath) if sys.version_info >= (3, 6): diff --git a/third_party/2and3/atomicwrites/__init__.pyi b/third_party/2and3/atomicwrites/__init__.pyi index 675e25ea6464..c2e7274226aa 100644 --- a/third_party/2and3/atomicwrites/__init__.pyi +++ b/third_party/2and3/atomicwrites/__init__.pyi @@ -1,7 +1,6 @@ import sys -from typing import IO, Any, AnyStr, Callable, ContextManager, Generic, Optional, Text, Type, Union - from _typeshed import AnyPath +from typing import IO, Any, AnyStr, Callable, ContextManager, Generic, Optional, Text, Type, Union def replace_atomic(src: AnyStr, dst: AnyStr) -> None: ... def move_atomic(src: AnyStr, dst: AnyStr) -> None: ... diff --git a/third_party/2and3/chardet/universaldetector.pyi b/third_party/2and3/chardet/universaldetector.pyi index 097ab4a838e2..464cfddc5d56 100644 --- a/third_party/2and3/chardet/universaldetector.pyi +++ b/third_party/2and3/chardet/universaldetector.pyi @@ -1,7 +1,6 @@ import sys from logging import Logger from typing import Dict, Optional, Pattern - from typing_extensions import TypedDict class _FinalResultType(TypedDict): diff --git a/third_party/2and3/dateutil/easter.pyi b/third_party/2and3/dateutil/easter.pyi index d6dfbdbbd137..33e366d476ae 100644 --- a/third_party/2and3/dateutil/easter.pyi +++ b/third_party/2and3/dateutil/easter.pyi @@ -1,5 +1,4 @@ from datetime import date - from typing_extensions import Literal EASTER_JULIAN: Literal[1] diff --git a/third_party/2and3/flask/testing.pyi b/third_party/2and3/flask/testing.pyi index fe6869a9bf31..504c722c4de3 100644 --- a/third_party/2and3/flask/testing.pyi +++ b/third_party/2and3/flask/testing.pyi @@ -6,7 +6,6 @@ from typing import IO, Any, Iterable, Mapping, Optional, Text, TypeVar, Union from click import BaseCommand from click.testing import CliRunner, Result - from werkzeug.test import Client def make_test_environ_builder( diff --git a/third_party/2and3/jinja2/utils.pyi b/third_party/2and3/jinja2/utils.pyi index bf972f14f99b..3d1b1cccf2d1 100644 --- a/third_party/2and3/jinja2/utils.pyi +++ b/third_party/2and3/jinja2/utils.pyi @@ -1,8 +1,7 @@ +from _typeshed import AnyPath from typing import IO, Any, Callable, Iterable, Optional, Protocol, Text, TypeVar, Union - from typing_extensions import Literal -from _typeshed import AnyPath from markupsafe import Markup as Markup, escape as escape, soft_unicode as soft_unicode missing: Any diff --git a/third_party/2and3/toml.pyi b/third_party/2and3/toml.pyi index 0555f1319c2d..8e8858a6c99e 100644 --- a/third_party/2and3/toml.pyi +++ b/third_party/2and3/toml.pyi @@ -1,8 +1,7 @@ import datetime import sys -from typing import IO, Any, List, Mapping, MutableMapping, Optional, Text, Type, Union - from _typeshed import StrPath, SupportsWrite +from typing import IO, Any, List, Mapping, MutableMapping, Optional, Text, Type, Union if sys.version_info >= (3, 6): _PathLike = StrPath diff --git a/third_party/2and3/werkzeug/contrib/fixers.pyi b/third_party/2and3/werkzeug/contrib/fixers.pyi index 3276d431ff25..9d47aed11fbb 100644 --- a/third_party/2and3/werkzeug/contrib/fixers.pyi +++ b/third_party/2and3/werkzeug/contrib/fixers.pyi @@ -1,6 +1,5 @@ -from typing import Any, Iterable, List, Mapping, Optional, Sequence, Set, Text - from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment +from typing import Any, Iterable, List, Mapping, Optional, Sequence, Set, Text from ..middleware.proxy_fix import ProxyFix as ProxyFix diff --git a/third_party/2and3/werkzeug/contrib/profiler.pyi b/third_party/2and3/werkzeug/contrib/profiler.pyi index 8c4c468a6931..eb32ea461c17 100644 --- a/third_party/2and3/werkzeug/contrib/profiler.pyi +++ b/third_party/2and3/werkzeug/contrib/profiler.pyi @@ -1,6 +1,5 @@ -from typing import AnyStr, Generic, Tuple - from _typeshed import SupportsWrite +from typing import AnyStr, Generic, Tuple from ..middleware.profiler import * diff --git a/third_party/2and3/werkzeug/datastructures.pyi b/third_party/2and3/werkzeug/datastructures.pyi index 8cfbaaa3d398..858d465e6e39 100644 --- a/third_party/2and3/werkzeug/datastructures.pyi +++ b/third_party/2and3/werkzeug/datastructures.pyi @@ -1,4 +1,5 @@ import collections +from _typeshed import SupportsWrite from typing import ( IO, Any, @@ -21,8 +22,6 @@ from typing import ( overload, ) -from _typeshed import SupportsWrite - _K = TypeVar("_K") _V = TypeVar("_V") _R = TypeVar("_R") diff --git a/third_party/2and3/werkzeug/exceptions.pyi b/third_party/2and3/werkzeug/exceptions.pyi index 7a13c5fac50b..e7d72c721a2f 100644 --- a/third_party/2and3/werkzeug/exceptions.pyi +++ b/third_party/2and3/werkzeug/exceptions.pyi @@ -1,7 +1,7 @@ import datetime +from _typeshed.wsgi import StartResponse, WSGIEnvironment from typing import Any, Dict, Iterable, List, NoReturn, Optional, Protocol, Text, Tuple, Type, Union -from _typeshed.wsgi import StartResponse, WSGIEnvironment from werkzeug.wrappers import Response class _EnvironContainer(Protocol): diff --git a/third_party/2and3/werkzeug/formparser.pyi b/third_party/2and3/werkzeug/formparser.pyi index a8ad07438abc..3f1160d0c726 100644 --- a/third_party/2and3/werkzeug/formparser.pyi +++ b/third_party/2and3/werkzeug/formparser.pyi @@ -1,3 +1,4 @@ +from _typeshed.wsgi import WSGIEnvironment from typing import ( IO, Any, @@ -15,8 +16,6 @@ from typing import ( Union, ) -from _typeshed.wsgi import WSGIEnvironment - from .datastructures import Headers _Dict = Any diff --git a/third_party/2and3/werkzeug/http.pyi b/third_party/2and3/werkzeug/http.pyi index 4af3fe8045f6..e124c3bfc97a 100644 --- a/third_party/2and3/werkzeug/http.pyi +++ b/third_party/2and3/werkzeug/http.pyi @@ -1,4 +1,5 @@ import sys +from _typeshed.wsgi import WSGIEnvironment from datetime import datetime, timedelta from typing import ( Any, @@ -17,8 +18,6 @@ from typing import ( overload, ) -from _typeshed.wsgi import WSGIEnvironment - from .datastructures import ( Accept, Authorization, diff --git a/third_party/2and3/werkzeug/middleware/dispatcher.pyi b/third_party/2and3/werkzeug/middleware/dispatcher.pyi index 095436652499..875880c61358 100644 --- a/third_party/2and3/werkzeug/middleware/dispatcher.pyi +++ b/third_party/2and3/werkzeug/middleware/dispatcher.pyi @@ -1,6 +1,5 @@ -from typing import Any, Iterable, Mapping, Optional, Text - from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment +from typing import Any, Iterable, Mapping, Optional, Text class DispatcherMiddleware(object): app: WSGIApplication diff --git a/third_party/2and3/werkzeug/middleware/http_proxy.pyi b/third_party/2and3/werkzeug/middleware/http_proxy.pyi index 8ff7ad2d9292..0c4795de28c9 100644 --- a/third_party/2and3/werkzeug/middleware/http_proxy.pyi +++ b/third_party/2and3/werkzeug/middleware/http_proxy.pyi @@ -1,6 +1,5 @@ -from typing import Any, Dict, Iterable, Mapping, MutableMapping, Text - from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment +from typing import Any, Dict, Iterable, Mapping, MutableMapping, Text _Opts = Mapping[Text, Any] _MutableOpts = MutableMapping[Text, Any] diff --git a/third_party/2and3/werkzeug/middleware/lint.pyi b/third_party/2and3/werkzeug/middleware/lint.pyi index e92a0b9320e8..3ecd80d706e2 100644 --- a/third_party/2and3/werkzeug/middleware/lint.pyi +++ b/third_party/2and3/werkzeug/middleware/lint.pyi @@ -1,8 +1,7 @@ import sys -from typing import Any, Iterable, Iterator, List, Mapping, Optional, Protocol, Tuple - from _typeshed import SupportsWrite from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment +from typing import Any, Iterable, Iterator, List, Mapping, Optional, Protocol, Tuple from ..datastructures import Headers diff --git a/third_party/2and3/werkzeug/middleware/profiler.pyi b/third_party/2and3/werkzeug/middleware/profiler.pyi index 0aa6f40adc89..f309605b946e 100644 --- a/third_party/2and3/werkzeug/middleware/profiler.pyi +++ b/third_party/2and3/werkzeug/middleware/profiler.pyi @@ -1,6 +1,5 @@ -from typing import IO, Iterable, List, Optional, Text, Tuple, Union - from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment +from typing import IO, Iterable, List, Optional, Text, Tuple, Union class ProfilerMiddleware(object): def __init__( diff --git a/third_party/2and3/werkzeug/middleware/proxy_fix.pyi b/third_party/2and3/werkzeug/middleware/proxy_fix.pyi index 3b9f6c5ed71d..0522e2beb121 100644 --- a/third_party/2and3/werkzeug/middleware/proxy_fix.pyi +++ b/third_party/2and3/werkzeug/middleware/proxy_fix.pyi @@ -1,6 +1,5 @@ -from typing import Iterable, Optional - from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment +from typing import Iterable, Optional class ProxyFix(object): app: WSGIApplication diff --git a/third_party/2and3/werkzeug/middleware/shared_data.pyi b/third_party/2and3/werkzeug/middleware/shared_data.pyi index 2d87a56d3330..af0842d6977a 100644 --- a/third_party/2and3/werkzeug/middleware/shared_data.pyi +++ b/third_party/2and3/werkzeug/middleware/shared_data.pyi @@ -1,7 +1,6 @@ import datetime -from typing import IO, Callable, Iterable, List, Mapping, Optional, Text, Tuple, Union - from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment +from typing import IO, Callable, Iterable, List, Mapping, Optional, Text, Tuple, Union _V = Union[Tuple[Text, Text], Text] diff --git a/third_party/2and3/werkzeug/test.pyi b/third_party/2and3/werkzeug/test.pyi index 4c2209179629..c8425b8ceacc 100644 --- a/third_party/2and3/werkzeug/test.pyi +++ b/third_party/2and3/werkzeug/test.pyi @@ -1,10 +1,8 @@ import sys +from _typeshed.wsgi import WSGIEnvironment from typing import Any, Generic, Optional, Text, Tuple, Type, TypeVar, overload - from typing_extensions import Literal -from _typeshed.wsgi import WSGIEnvironment - if sys.version_info < (3,): from urllib2 import Request as U2Request from cookielib import CookieJar diff --git a/third_party/2and3/werkzeug/wrappers.pyi b/third_party/2and3/werkzeug/wrappers.pyi index 54256c8ba45c..5df032cf4d3f 100644 --- a/third_party/2and3/werkzeug/wrappers.pyi +++ b/third_party/2and3/werkzeug/wrappers.pyi @@ -1,4 +1,5 @@ import sys +from _typeshed.wsgi import InputStream, WSGIEnvironment from datetime import datetime from typing import ( Any, @@ -16,11 +17,8 @@ from typing import ( Union, overload, ) - from typing_extensions import Literal -from _typeshed.wsgi import InputStream, WSGIEnvironment - from .datastructures import ( Accept, Authorization, diff --git a/third_party/2and3/werkzeug/wsgi.pyi b/third_party/2and3/werkzeug/wsgi.pyi index c9623ed44c67..ea6bb85cd875 100644 --- a/third_party/2and3/werkzeug/wsgi.pyi +++ b/third_party/2and3/werkzeug/wsgi.pyi @@ -1,7 +1,6 @@ -from typing import Any, Iterable, Optional, Text - from _typeshed import SupportsRead from _typeshed.wsgi import InputStream, WSGIEnvironment +from typing import Any, Iterable, Optional, Text from .middleware.dispatcher import DispatcherMiddleware as DispatcherMiddleware from .middleware.http_proxy import ProxyMiddleware as ProxyMiddleware diff --git a/third_party/2and3/yaml/cyaml.pyi b/third_party/2and3/yaml/cyaml.pyi index edebf001095e..50f7af2f178c 100644 --- a/third_party/2and3/yaml/cyaml.pyi +++ b/third_party/2and3/yaml/cyaml.pyi @@ -1,6 +1,6 @@ +from _typeshed import SupportsRead from typing import IO, Any, Mapping, Optional, Sequence, Text, Union -from _typeshed import SupportsRead from yaml.constructor import BaseConstructor, Constructor, SafeConstructor from yaml.representer import BaseRepresenter, Representer, SafeRepresenter from yaml.resolver import BaseResolver, Resolver diff --git a/third_party/3/waitress/trigger.pyi b/third_party/3/waitress/trigger.pyi index 6635c466c6c5..1638972ed160 100644 --- a/third_party/3/waitress/trigger.pyi +++ b/third_party/3/waitress/trigger.pyi @@ -2,7 +2,6 @@ import sys from socket import SocketType from threading import Lock from typing import Callable, Mapping, Optional - from typing_extensions import Literal from . import wasyncore as wasyncore