From 04c74640f049a658f0099f4785452f5f46ec518b Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Wed, 5 Aug 2020 22:49:17 -0700 Subject: [PATCH] Removed imported symbols that are not accessed or re-exported (#4387) Co-authored-by: Eric Traut --- stdlib/2and3/_dummy_threading.pyi | 2 +- stdlib/2and3/array.pyi | 2 +- stdlib/2and3/audioop.pyi | 2 +- stdlib/2and3/base64.pyi | 2 +- stdlib/2and3/cmd.pyi | 2 +- stdlib/2and3/contextlib.pyi | 1 - stdlib/2and3/csv.pyi | 2 +- stdlib/2and3/ctypes/__init__.pyi | 1 - stdlib/2and3/curses/ascii.pyi | 2 +- stdlib/2and3/distutils/command/config.pyi | 2 +- stdlib/2and3/distutils/fancy_getopt.pyi | 2 +- stdlib/2and3/distutils/version.pyi | 2 +- stdlib/2and3/errno.pyi | 1 - stdlib/2and3/fractions.pyi | 2 +- stdlib/2and3/ftplib.pyi | 18 +----------------- stdlib/2and3/keyword.pyi | 2 +- stdlib/2and3/lib2to3/pgen2/parse.pyi | 2 +- stdlib/2and3/lib2to3/pygram.pyi | 1 - stdlib/2and3/logging/handlers.pyi | 2 +- stdlib/2and3/mimetypes.pyi | 2 +- stdlib/2and3/netrc.pyi | 2 +- stdlib/2and3/poplib.pyi | 2 +- stdlib/2and3/pydoc.pyi | 2 +- stdlib/2and3/shutil.pyi | 1 - stdlib/2and3/sre_compile.pyi | 2 +- stdlib/2and3/sysconfig.pyi | 2 +- stdlib/2and3/threading.pyi | 2 +- stdlib/2and3/warnings.pyi | 2 +- stdlib/2and3/webbrowser.pyi | 2 +- stdlib/2and3/wsgiref/handlers.pyi | 2 +- stdlib/2and3/xml/sax/__init__.pyi | 21 ++++++--------------- stdlib/2and3/xml/sax/saxutils.pyi | 2 +- stdlib/3.7/_py_abc.pyi | 2 +- stdlib/3.9/zoneinfo/__init__.pyi | 2 +- stdlib/3/asyncio/locks.pyi | 3 +-- stdlib/3/asyncio/protocols.pyi | 2 +- stdlib/3/collections/__init__.pyi | 4 ---- stdlib/3/dbm/__init__.pyi | 1 - stdlib/3/dbm/dumb.pyi | 6 ------ stdlib/3/dbm/gnu.pyi | 2 +- stdlib/3/dbm/ndbm.pyi | 2 +- stdlib/3/email/message.pyi | 1 - stdlib/3/gettext.pyi | 2 +- stdlib/3/hashlib.pyi | 2 +- stdlib/3/http/server.pyi | 2 +- stdlib/3/importlib/machinery.pyi | 2 +- stdlib/3/io.pyi | 1 - stdlib/3/multiprocessing/__init__.pyi | 5 ++--- stdlib/3/tkinter/ttk.pyi | 2 +- stdlib/3/unittest/case.pyi | 6 +++--- stdlib/3/urllib/error.pyi | 2 +- stdlib/3/urllib/response.pyi | 2 +- stdlib/3/xmlrpc/client.pyi | 4 ++-- 53 files changed, 52 insertions(+), 97 deletions(-) diff --git a/stdlib/2and3/_dummy_threading.pyi b/stdlib/2and3/_dummy_threading.pyi index c20067545..26204a29b 100644 --- a/stdlib/2and3/_dummy_threading.pyi +++ b/stdlib/2and3/_dummy_threading.pyi @@ -1,6 +1,6 @@ import sys from types import FrameType, TracebackType -from typing import Any, Callable, Iterable, List, Mapping, Optional, Text, Tuple, Type, TypeVar, Union +from typing import Any, Callable, Iterable, List, Mapping, Optional, Text, Type, TypeVar, Union # TODO recursive type _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] diff --git a/stdlib/2and3/array.pyi b/stdlib/2and3/array.pyi index b47b778e6..2fe01dc9a 100644 --- a/stdlib/2and3/array.pyi +++ b/stdlib/2and3/array.pyi @@ -3,7 +3,7 @@ # Based on http://docs.python.org/3.6/library/array.html import sys -from typing import Any, BinaryIO, Generic, Iterable, Iterator, List, MutableSequence, Text, Tuple, TypeVar, Union, overload +from typing import Any, BinaryIO, Generic, Iterable, 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/audioop.pyi b/stdlib/2and3/audioop.pyi index a6885d277..606f4b9f5 100644 --- a/stdlib/2and3/audioop.pyi +++ b/stdlib/2and3/audioop.pyi @@ -1,4 +1,4 @@ -from typing import Any, Optional, Tuple +from typing import Optional, Tuple AdpcmState = Tuple[int, int] RatecvState = Tuple[int, Tuple[Tuple[int, int], ...]] diff --git a/stdlib/2and3/base64.pyi b/stdlib/2and3/base64.pyi index 68127b6e7..c1bac36c5 100644 --- a/stdlib/2and3/base64.pyi +++ b/stdlib/2and3/base64.pyi @@ -1,7 +1,7 @@ # Stubs for base64 import sys -from typing import IO, Optional, Text, Union +from typing import IO, Optional, Union if sys.version_info < (3,): _encodable = Union[bytes, unicode] diff --git a/stdlib/2and3/cmd.pyi b/stdlib/2and3/cmd.pyi index 02c9853f5..e7d35af70 100644 --- a/stdlib/2and3/cmd.pyi +++ b/stdlib/2and3/cmd.pyi @@ -1,6 +1,6 @@ # Stubs for cmd (Python 2/3) -from typing import IO, Any, Callable, List, Optional, Text, Tuple +from typing import IO, Any, Callable, List, Optional, Tuple class Cmd: prompt: str diff --git a/stdlib/2and3/contextlib.pyi b/stdlib/2and3/contextlib.pyi index f173a4ac0..404c7f0a3 100644 --- a/stdlib/2and3/contextlib.pyi +++ b/stdlib/2and3/contextlib.pyi @@ -6,7 +6,6 @@ from typing import ( Any, Callable, ContextManager as ContextManager, - Generator, Generic, Iterable, Iterator, diff --git a/stdlib/2and3/csv.pyi b/stdlib/2and3/csv.pyi index 1181f231c..606694dca 100644 --- a/stdlib/2and3/csv.pyi +++ b/stdlib/2and3/csv.pyi @@ -18,7 +18,7 @@ from _csv import ( writer as writer, ) from collections import OrderedDict -from typing import Any, Dict, Iterable, Iterator, List, Mapping, Optional, Sequence, Text, Type, Union +from typing import Any, Dict, Iterable, Iterator, List, Mapping, Optional, Sequence, Text, Type _DictRow = Mapping[str, Any] diff --git a/stdlib/2and3/ctypes/__init__.pyi b/stdlib/2and3/ctypes/__init__.pyi index 04ed34c35..40646f6db 100644 --- a/stdlib/2and3/ctypes/__init__.pyi +++ b/stdlib/2and3/ctypes/__init__.pyi @@ -13,7 +13,6 @@ from typing import ( Mapping, Optional, Sequence, - Sized, Text, Tuple, Type, diff --git a/stdlib/2and3/curses/ascii.pyi b/stdlib/2and3/curses/ascii.pyi index 00ee4008f..2a076601c 100644 --- a/stdlib/2and3/curses/ascii.pyi +++ b/stdlib/2and3/curses/ascii.pyi @@ -1,4 +1,4 @@ -from typing import List, TypeVar, Union, overload +from typing import List, TypeVar, Union _Ch = TypeVar("_Ch", str, int) diff --git a/stdlib/2and3/distutils/command/config.pyi b/stdlib/2and3/distutils/command/config.pyi index 94e97355e..6b57a64b4 100644 --- a/stdlib/2and3/distutils/command/config.pyi +++ b/stdlib/2and3/distutils/command/config.pyi @@ -3,7 +3,7 @@ from distutils.ccompiler import CCompiler from distutils.core import Command as Command from distutils.errors import DistutilsExecError as DistutilsExecError from distutils.sysconfig import customize_compiler as customize_compiler -from typing import Any, Dict, List, Match, Optional, Pattern, Sequence, Tuple, Union +from typing import Dict, List, Optional, Pattern, Sequence, Tuple, Union LANG_EXT: Dict[str, str] diff --git a/stdlib/2and3/distutils/fancy_getopt.pyi b/stdlib/2and3/distutils/fancy_getopt.pyi index 2386fcc4d..02e4f93a1 100644 --- a/stdlib/2and3/distutils/fancy_getopt.pyi +++ b/stdlib/2and3/distutils/fancy_getopt.pyi @@ -1,6 +1,6 @@ # Stubs for distutils.fancy_getopt -from typing import Any, List, Mapping, Optional, Tuple, TypeVar, Union, overload +from typing import Any, List, Mapping, Optional, Tuple, Union, overload _Option = Tuple[str, Optional[str], str] _GR = Tuple[List[str], OptionDummy] diff --git a/stdlib/2and3/distutils/version.pyi b/stdlib/2and3/distutils/version.pyi index 3e8c78820..7b342f6fe 100644 --- a/stdlib/2and3/distutils/version.pyi +++ b/stdlib/2and3/distutils/version.pyi @@ -1,6 +1,6 @@ import sys from abc import abstractmethod -from typing import Any, Optional, Pattern, Text, Tuple, TypeVar, Union +from typing import Optional, Pattern, Text, Tuple, TypeVar, Union _T = TypeVar("_T", bound=Version) diff --git a/stdlib/2and3/errno.pyi b/stdlib/2and3/errno.pyi index 15e7a629e..26f4b089e 100644 --- a/stdlib/2and3/errno.pyi +++ b/stdlib/2and3/errno.pyi @@ -1,6 +1,5 @@ # Stubs for errno -import sys from typing import Mapping errorcode: Mapping[int, str] diff --git a/stdlib/2and3/fractions.pyi b/stdlib/2and3/fractions.pyi index 3384a7094..56df92447 100644 --- a/stdlib/2and3/fractions.pyi +++ b/stdlib/2and3/fractions.pyi @@ -7,7 +7,7 @@ import sys from decimal import Decimal from numbers import Integral, Rational, Real -from typing import Any, Optional, Tuple, TypeVar, Union, overload +from typing import Any, Optional, Tuple, Union, overload _ComparableNum = Union[int, float, Decimal, Real] diff --git a/stdlib/2and3/ftplib.pyi b/stdlib/2and3/ftplib.pyi index 16f9549f3..17bfaccfc 100644 --- a/stdlib/2and3/ftplib.pyi +++ b/stdlib/2and3/ftplib.pyi @@ -3,23 +3,7 @@ from _typeshed import SupportsRead, SupportsReadline from socket import socket from ssl import SSLContext from types import TracebackType -from typing import ( - Any, - BinaryIO, - Callable, - Dict, - Generic, - Iterable, - Iterator, - List, - Optional, - Text, - TextIO, - Tuple, - Type, - TypeVar, - Union, -) +from typing import Any, BinaryIO, Callable, Dict, Iterable, Iterator, List, Optional, Text, TextIO, Tuple, Type, TypeVar, Union _T = TypeVar("_T") _IntOrStr = Union[int, Text] diff --git a/stdlib/2and3/keyword.pyi b/stdlib/2and3/keyword.pyi index ffc2894ae..3e095ed5f 100644 --- a/stdlib/2and3/keyword.pyi +++ b/stdlib/2and3/keyword.pyi @@ -1,5 +1,5 @@ import sys -from typing import Sequence, Text, Union +from typing import Sequence, Text def iskeyword(s: Text) -> bool: ... diff --git a/stdlib/2and3/lib2to3/pgen2/parse.pyi b/stdlib/2and3/lib2to3/pgen2/parse.pyi index 4b141fd5c..a2e433c75 100644 --- a/stdlib/2and3/lib2to3/pgen2/parse.pyi +++ b/stdlib/2and3/lib2to3/pgen2/parse.pyi @@ -2,7 +2,7 @@ from lib2to3.pgen2.grammar import _DFAS, Grammar from lib2to3.pytree import _NL, _Convert, _RawNode -from typing import Any, Dict, List, Optional, Sequence, Set, Text, Tuple +from typing import Any, List, Optional, Sequence, Set, Text, Tuple _Context = Sequence[Any] diff --git a/stdlib/2and3/lib2to3/pygram.pyi b/stdlib/2and3/lib2to3/pygram.pyi index 6bdbfe182..680c73d82 100644 --- a/stdlib/2and3/lib2to3/pygram.pyi +++ b/stdlib/2and3/lib2to3/pygram.pyi @@ -1,7 +1,6 @@ # Stubs for lib2to3.pygram (Python 3.6) from lib2to3.pgen2.grammar import Grammar -from typing import Any class Symbols: def __init__(self, grammar: Grammar) -> None: ... diff --git a/stdlib/2and3/logging/handlers.pyi b/stdlib/2and3/logging/handlers.pyi index 3c92d1cab..c58d13752 100644 --- a/stdlib/2and3/logging/handlers.pyi +++ b/stdlib/2and3/logging/handlers.pyi @@ -4,7 +4,7 @@ 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 typing import Any, Callable, Dict, List, Optional, Tuple, Union if sys.version_info >= (3, 7): from queue import Queue, SimpleQueue diff --git a/stdlib/2and3/mimetypes.pyi b/stdlib/2and3/mimetypes.pyi index 928b34272..9e5ba6dfd 100644 --- a/stdlib/2and3/mimetypes.pyi +++ b/stdlib/2and3/mimetypes.pyi @@ -1,7 +1,7 @@ # Stubs for mimetypes import sys -from typing import IO, AnyStr, Dict, List, Optional, Sequence, Text, Tuple, Union +from typing import IO, Dict, List, Optional, Sequence, Text, Tuple, Union if sys.version_info >= (3, 8): from os import PathLike diff --git a/stdlib/2and3/netrc.pyi b/stdlib/2and3/netrc.pyi index 758a0457c..50fe3c0e0 100644 --- a/stdlib/2and3/netrc.pyi +++ b/stdlib/2and3/netrc.pyi @@ -1,4 +1,4 @@ -from typing import AnyStr, Dict, List, Optional, Tuple, overload +from typing import Dict, List, Optional, Tuple class NetrcParseError(Exception): filename: Optional[str] diff --git a/stdlib/2and3/poplib.pyi b/stdlib/2and3/poplib.pyi index 1c5a43a95..2cf628533 100644 --- a/stdlib/2and3/poplib.pyi +++ b/stdlib/2and3/poplib.pyi @@ -3,7 +3,7 @@ import socket import ssl import sys -from typing import Any, BinaryIO, Dict, List, NoReturn, Optional, Pattern, Text, Tuple, overload +from typing import Any, BinaryIO, Dict, List, Optional, Pattern, Text, Tuple, overload _LongResp = Tuple[bytes, List[bytes], int] diff --git a/stdlib/2and3/pydoc.pyi b/stdlib/2and3/pydoc.pyi index 39aad5e74..5dae110fa 100644 --- a/stdlib/2and3/pydoc.pyi +++ b/stdlib/2and3/pydoc.pyi @@ -1,6 +1,6 @@ import sys from _typeshed import SupportsWrite -from types import FunctionType, MethodType, ModuleType, TracebackType +from types import MethodType, ModuleType, TracebackType from typing import ( IO, Any, diff --git a/stdlib/2and3/shutil.pyi b/stdlib/2and3/shutil.pyi index d96ef8160..b814112a1 100644 --- a/stdlib/2and3/shutil.pyi +++ b/stdlib/2and3/shutil.pyi @@ -11,7 +11,6 @@ from typing import ( Optional, Sequence, Set, - Text, Tuple, Type, TypeVar, diff --git a/stdlib/2and3/sre_compile.pyi b/stdlib/2and3/sre_compile.pyi index e6036e205..86621c3da 100644 --- a/stdlib/2and3/sre_compile.pyi +++ b/stdlib/2and3/sre_compile.pyi @@ -3,7 +3,7 @@ import sys from sre_parse import SubPattern -from typing import Any, List, Pattern, Tuple, Type, TypeVar, Union +from typing import Any, List, Pattern, Tuple, Type, Union MAXCODE: int if sys.version_info < (3, 0): diff --git a/stdlib/2and3/sysconfig.pyi b/stdlib/2and3/sysconfig.pyi index cc1eb93d8..ed0aa6d5b 100644 --- a/stdlib/2and3/sysconfig.pyi +++ b/stdlib/2and3/sysconfig.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, Dict, List, Optional, Tuple, Union, overload +from typing import IO, Any, Dict, List, Optional, Tuple, overload def get_config_var(name: str) -> Optional[str]: ... @overload diff --git a/stdlib/2and3/threading.pyi b/stdlib/2and3/threading.pyi index c20067545..26204a29b 100644 --- a/stdlib/2and3/threading.pyi +++ b/stdlib/2and3/threading.pyi @@ -1,6 +1,6 @@ import sys from types import FrameType, TracebackType -from typing import Any, Callable, Iterable, List, Mapping, Optional, Text, Tuple, Type, TypeVar, Union +from typing import Any, Callable, Iterable, List, Mapping, Optional, Text, Type, TypeVar, Union # TODO recursive type _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] diff --git a/stdlib/2and3/warnings.pyi b/stdlib/2and3/warnings.pyi index e15c03e98..0e64ec574 100644 --- a/stdlib/2and3/warnings.pyi +++ b/stdlib/2and3/warnings.pyi @@ -1,6 +1,6 @@ import sys from types import ModuleType, TracebackType -from typing import Any, List, NamedTuple, Optional, TextIO, Type, Union, overload +from typing import Any, List, 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/webbrowser.pyi b/stdlib/2and3/webbrowser.pyi index dccdf4af6..e29238ee0 100644 --- a/stdlib/2and3/webbrowser.pyi +++ b/stdlib/2and3/webbrowser.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, Callable, List, Optional, Sequence, Text, Union +from typing import Callable, List, Optional, Sequence, Text, Union class Error(Exception): ... diff --git a/stdlib/2and3/wsgiref/handlers.pyi b/stdlib/2and3/wsgiref/handlers.pyi index 16e2ae263..ff764e434 100644 --- a/stdlib/2and3/wsgiref/handlers.pyi +++ b/stdlib/2and3/wsgiref/handlers.pyi @@ -5,7 +5,7 @@ from typing import IO, Callable, Dict, List, MutableMapping, Optional, Text, Tup from .headers import Headers from .types import ErrorStream, InputStream, StartResponse, WSGIApplication, WSGIEnvironment -from .util import FileWrapper, guess_scheme +from .util import FileWrapper _exc_info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] diff --git a/stdlib/2and3/xml/sax/__init__.pyi b/stdlib/2and3/xml/sax/__init__.pyi index c721dde6c..01f8a35f9 100644 --- a/stdlib/2and3/xml/sax/__init__.pyi +++ b/stdlib/2and3/xml/sax/__init__.pyi @@ -1,8 +1,7 @@ import sys -import xml.sax from typing import IO, Any, Iterable, List, NoReturn, Optional, Text, Union from xml.sax.handler import ContentHandler, ErrorHandler -from xml.sax.xmlreader import InputSource, Locator +from xml.sax.xmlreader import Locator, XMLReader class SAXException(Exception): def __init__(self, msg: str, exception: Optional[Exception] = ...) -> None: ... @@ -24,19 +23,11 @@ class SAXReaderNotAvailable(SAXNotSupportedException): ... default_parser_list: List[str] if sys.version_info >= (3, 8): - def make_parser(parser_list: Iterable[str] = ...) -> xml.sax.xmlreader.XMLReader: ... + def make_parser(parser_list: Iterable[str] = ...) -> XMLReader: ... else: - def make_parser(parser_list: List[str] = ...) -> xml.sax.xmlreader.XMLReader: ... + def make_parser(parser_list: List[str] = ...) -> XMLReader: ... -def parse( - source: Union[str, IO[str], IO[bytes]], - handler: xml.sax.handler.ContentHandler, - errorHandler: xml.sax.handler.ErrorHandler = ..., -) -> None: ... -def parseString( - string: Union[bytes, Text], - handler: xml.sax.handler.ContentHandler, - errorHandler: Optional[xml.sax.handler.ErrorHandler] = ..., -) -> None: ... -def _create_parser(parser_name: str) -> xml.sax.xmlreader.XMLReader: ... +def parse(source: Union[str, IO[str], IO[bytes]], handler: ContentHandler, errorHandler: ErrorHandler = ...,) -> None: ... +def parseString(string: Union[bytes, Text], handler: ContentHandler, errorHandler: Optional[ErrorHandler] = ...,) -> None: ... +def _create_parser(parser_name: str) -> XMLReader: ... diff --git a/stdlib/2and3/xml/sax/saxutils.pyi b/stdlib/2and3/xml/sax/saxutils.pyi index c7cb16072..8ae2b80d2 100644 --- a/stdlib/2and3/xml/sax/saxutils.pyi +++ b/stdlib/2and3/xml/sax/saxutils.pyi @@ -2,7 +2,7 @@ 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 typing import Mapping, Optional, Text, Union from xml.sax import handler, xmlreader def escape(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ... diff --git a/stdlib/3.7/_py_abc.pyi b/stdlib/3.7/_py_abc.pyi index 5931a1bf7..89106b956 100644 --- a/stdlib/3.7/_py_abc.pyi +++ b/stdlib/3.7/_py_abc.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, NewType, Tuple, Type, TypeVar +from typing import Any, Dict, Tuple, Type, TypeVar _T = TypeVar("_T") diff --git a/stdlib/3.9/zoneinfo/__init__.pyi b/stdlib/3.9/zoneinfo/__init__.pyi index e144e4123..9fb0a37f8 100644 --- a/stdlib/3.9/zoneinfo/__init__.pyi +++ b/stdlib/3.9/zoneinfo/__init__.pyi @@ -1,6 +1,6 @@ import os import typing -from datetime import datetime, tzinfo +from datetime import tzinfo from typing import Any, Iterable, Optional, Protocol, Sequence, Set, Type, Union _T = typing.TypeVar("_T", bound="ZoneInfo") diff --git a/stdlib/3/asyncio/locks.pyi b/stdlib/3/asyncio/locks.pyi index 426098112..040b2c37e 100644 --- a/stdlib/3/asyncio/locks.pyi +++ b/stdlib/3/asyncio/locks.pyi @@ -1,9 +1,8 @@ import sys from types import TracebackType -from typing import Any, Awaitable, Callable, Generator, Iterable, Optional, Type, TypeVar, Union +from typing import Any, Awaitable, Callable, Generator, Optional, Type, TypeVar, Union from .events import AbstractEventLoop -from .futures import Future _T = TypeVar("_T") diff --git a/stdlib/3/asyncio/protocols.pyi b/stdlib/3/asyncio/protocols.pyi index 710fad75e..ec89a2999 100644 --- a/stdlib/3/asyncio/protocols.pyi +++ b/stdlib/3/asyncio/protocols.pyi @@ -1,6 +1,6 @@ import sys from asyncio import transports -from typing import Optional, Tuple, Union +from typing import Optional, Tuple class BaseProtocol: def connection_made(self, transport: transports.BaseTransport) -> None: ... diff --git a/stdlib/3/collections/__init__.pyi b/stdlib/3/collections/__init__.pyi index dae34a0a5..d68706ec4 100644 --- a/stdlib/3/collections/__init__.pyi +++ b/stdlib/3/collections/__init__.pyi @@ -1,4 +1,3 @@ -# These are not exported. import sys import typing from typing import ( @@ -37,9 +36,6 @@ from typing import ( overload, ) -# These are exported. -from . import abc - if sys.version_info >= (3, 6): from typing import AsyncGenerator as AsyncGenerator, Collection as Collection diff --git a/stdlib/3/dbm/__init__.pyi b/stdlib/3/dbm/__init__.pyi index 6177664bf..2b870b38e 100644 --- a/stdlib/3/dbm/__init__.pyi +++ b/stdlib/3/dbm/__init__.pyi @@ -1,4 +1,3 @@ -import sys from types import TracebackType from typing import Iterator, MutableMapping, Optional, Type, Union from typing_extensions import Literal diff --git a/stdlib/3/dbm/dumb.pyi b/stdlib/3/dbm/dumb.pyi index 2d957de6a..0b8ee50a7 100644 --- a/stdlib/3/dbm/dumb.pyi +++ b/stdlib/3/dbm/dumb.pyi @@ -1,12 +1,6 @@ -import sys from types import TracebackType from typing import Iterator, MutableMapping, Optional, Type, Union -if sys.version_info >= (3, 8): - from typing import Final -else: - from typing_extensions import Final - _KeyType = Union[str, bytes] _ValueType = Union[str, bytes] diff --git a/stdlib/3/dbm/gnu.pyi b/stdlib/3/dbm/gnu.pyi index b84265777..8f13a2988 100644 --- a/stdlib/3/dbm/gnu.pyi +++ b/stdlib/3/dbm/gnu.pyi @@ -1,5 +1,5 @@ from types import TracebackType -from typing import Generic, Iterator, List, Optional, Type, TypeVar, Union, overload +from typing import List, Optional, Type, TypeVar, Union, overload _T = TypeVar("_T") _KeyType = Union[str, bytes] diff --git a/stdlib/3/dbm/ndbm.pyi b/stdlib/3/dbm/ndbm.pyi index e678ddbeb..020131543 100644 --- a/stdlib/3/dbm/ndbm.pyi +++ b/stdlib/3/dbm/ndbm.pyi @@ -1,5 +1,5 @@ from types import TracebackType -from typing import Generic, Iterator, List, Optional, Type, TypeVar, Union, overload +from typing import List, Optional, Type, TypeVar, Union, overload _T = TypeVar("_T") _KeyType = Union[str, bytes] diff --git a/stdlib/3/email/message.pyi b/stdlib/3/email/message.pyi index ff6fc803e..32aed781b 100644 --- a/stdlib/3/email/message.pyi +++ b/stdlib/3/email/message.pyi @@ -3,7 +3,6 @@ from email.charset import Charset from email.contentmanager import ContentManager from email.errors import MessageDefect -from email.header import Header from email.policy import Policy from typing import Any, Generator, Iterator, List, Optional, Sequence, Tuple, TypeVar, Union diff --git a/stdlib/3/gettext.pyi b/stdlib/3/gettext.pyi index bb9610731..5624817b1 100644 --- a/stdlib/3/gettext.pyi +++ b/stdlib/3/gettext.pyi @@ -1,6 +1,6 @@ import sys from _typeshed import StrPath -from typing import IO, Any, Container, Iterable, Optional, Sequence, Type, TypeVar, Union, overload +from typing import IO, Any, Container, Iterable, Optional, Sequence, Type, TypeVar, overload from typing_extensions import Literal class NullTranslations: diff --git a/stdlib/3/hashlib.pyi b/stdlib/3/hashlib.pyi index de8b27880..80618d0a9 100644 --- a/stdlib/3/hashlib.pyi +++ b/stdlib/3/hashlib.pyi @@ -2,7 +2,7 @@ import sys from _typeshed import ReadableBuffer -from typing import AbstractSet, Optional, Union +from typing import AbstractSet, Optional class _Hash(object): digest_size: int diff --git a/stdlib/3/http/server.pyi b/stdlib/3/http/server.pyi index 3e1f5347c..f2f41644b 100644 --- a/stdlib/3/http/server.pyi +++ b/stdlib/3/http/server.pyi @@ -3,7 +3,7 @@ import email.message import socketserver import sys -from typing import Any, BinaryIO, Callable, ClassVar, Dict, List, Mapping, Optional, Sequence, Tuple, Union +from typing import Any, Callable, ClassVar, Dict, List, Mapping, Optional, Sequence, Tuple, Union if sys.version_info >= (3, 7): from builtins import _PathLike diff --git a/stdlib/3/importlib/machinery.pyi b/stdlib/3/importlib/machinery.pyi index baf46d333..9d0333a2b 100644 --- a/stdlib/3/importlib/machinery.pyi +++ b/stdlib/3/importlib/machinery.pyi @@ -1,6 +1,6 @@ import importlib.abc import types -from typing import Any, Callable, List, Optional, Sequence, Tuple, Union +from typing import Callable, List, Optional, Sequence, Tuple, Union # ModuleSpec is exported from this module, but for circular import # reasons exists in its own stub file (with Loader and ModuleType). diff --git a/stdlib/3/io.pyi b/stdlib/3/io.pyi index 6294d6db9..54dfc1e07 100644 --- a/stdlib/3/io.pyi +++ b/stdlib/3/io.pyi @@ -2,7 +2,6 @@ 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 diff --git a/stdlib/3/multiprocessing/__init__.pyi b/stdlib/3/multiprocessing/__init__.pyi index d86357d92..c7de0a2d0 100644 --- a/stdlib/3/multiprocessing/__init__.pyi +++ b/stdlib/3/multiprocessing/__init__.pyi @@ -1,7 +1,6 @@ import sys -from ctypes import _CData from logging import Logger -from multiprocessing import connection, pool, sharedctypes, spawn, synchronize +from multiprocessing import connection, pool, sharedctypes, synchronize from multiprocessing.context import ( AuthenticationError as AuthenticationError, BaseContext, @@ -18,7 +17,7 @@ from multiprocessing.process import active_children as active_children, current_ # These are technically functions that return instances of these Queue classes. See #4313 for discussion from multiprocessing.queues import JoinableQueue as JoinableQueue, Queue as Queue, SimpleQueue as SimpleQueue from multiprocessing.spawn import freeze_support as freeze_support -from typing import Any, Callable, Iterable, List, Optional, Sequence, Tuple, Type, Union, overload +from typing import Any, Callable, Iterable, List, Optional, Sequence, Tuple, Union, overload from typing_extensions import Literal if sys.version_info >= (3, 8): diff --git a/stdlib/3/tkinter/ttk.pyi b/stdlib/3/tkinter/ttk.pyi index 4cd08dfa0..39c3dc0dd 100644 --- a/stdlib/3/tkinter/ttk.pyi +++ b/stdlib/3/tkinter/ttk.pyi @@ -1,7 +1,7 @@ import sys import tkinter from tkinter import Event -from typing import Any, Callable, Dict, List, Optional, Tuple, Type, TypeVar, Union, overload +from typing import Any, Callable, List, Optional, overload from typing_extensions import Literal def tclobjs_to_py(adict): ... diff --git a/stdlib/3/unittest/case.pyi b/stdlib/3/unittest/case.pyi index 6a464d866..c1617be51 100644 --- a/stdlib/3/unittest/case.pyi +++ b/stdlib/3/unittest/case.pyi @@ -2,7 +2,6 @@ import datetime import logging import sys import unittest.result -import warnings from types import TracebackType from typing import ( Any, @@ -27,6 +26,7 @@ from typing import ( Union, overload, ) +from warnings import WarningMessage _E = TypeVar("_E", bound=BaseException) _FT = TypeVar("_FT", bound=Callable[..., Any]) @@ -260,10 +260,10 @@ class _AssertRaisesContext(Generic[_E]): ) -> bool: ... class _AssertWarnsContext: - warning: warnings.WarningMessage + warning: WarningMessage filename: str lineno: int - warnings: List[warnings.WarningMessage] + warnings: List[WarningMessage] def __enter__(self) -> _AssertWarnsContext: ... def __exit__( self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] diff --git a/stdlib/3/urllib/error.pyi b/stdlib/3/urllib/error.pyi index 1e71871bf..e727f4ded 100644 --- a/stdlib/3/urllib/error.pyi +++ b/stdlib/3/urllib/error.pyi @@ -1,4 +1,4 @@ -from typing import Dict, Union +from typing import Union from urllib.response import addinfourl # Stubs for urllib.error diff --git a/stdlib/3/urllib/response.pyi b/stdlib/3/urllib/response.pyi index e923a431d..4d7a2511b 100644 --- a/stdlib/3/urllib/response.pyi +++ b/stdlib/3/urllib/response.pyi @@ -2,7 +2,7 @@ from email.message import Message from types import TracebackType -from typing import IO, Any, BinaryIO, Callable, Iterable, List, Mapping, Optional, Tuple, Type, TypeVar +from typing import IO, Any, BinaryIO, Callable, Iterable, List, Optional, Tuple, Type, TypeVar _AIUT = TypeVar("_AIUT", bound=addbase) diff --git a/stdlib/3/xmlrpc/client.pyi b/stdlib/3/xmlrpc/client.pyi index 2ffad6d26..8ad5d7d70 100644 --- a/stdlib/3/xmlrpc/client.pyi +++ b/stdlib/3/xmlrpc/client.pyi @@ -1,10 +1,10 @@ import gzip import http.client -import io import sys import time from _typeshed import SupportsRead, SupportsWrite from datetime import datetime +from io import BytesIO from types import TracebackType from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Protocol, Tuple, Type, Union, overload from typing_extensions import Literal @@ -198,7 +198,7 @@ def gzip_decode(data: bytes, max_decode: int = ...) -> bytes: ... # undocumente class GzipDecodedResponse(gzip.GzipFile): # undocumented - io: io.BytesIO + io: BytesIO def __init__(self, response: SupportsRead[bytes]) -> None: ... def close(self) -> None: ...