Removed imported symbols that are not accessed or re-exported (#4387)

Co-authored-by: Eric Traut <erictr@microsoft.com>
This commit is contained in:
Eric Traut
2020-08-05 22:49:17 -07:00
committed by GitHub
parent e17c6a752e
commit 04c74640f0
53 changed files with 52 additions and 97 deletions

View File

@@ -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]]]

View File

@@ -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"]

View File

@@ -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], ...]]

View File

@@ -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]

View File

@@ -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

View File

@@ -6,7 +6,6 @@ from typing import (
Any,
Callable,
ContextManager as ContextManager,
Generator,
Generic,
Iterable,
Iterator,

View File

@@ -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]

View File

@@ -13,7 +13,6 @@ from typing import (
Mapping,
Optional,
Sequence,
Sized,
Text,
Tuple,
Type,

View File

@@ -1,4 +1,4 @@
from typing import List, TypeVar, Union, overload
from typing import List, TypeVar, Union
_Ch = TypeVar("_Ch", str, int)

View File

@@ -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]

View File

@@ -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]

View File

@@ -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)

View File

@@ -1,6 +1,5 @@
# Stubs for errno
import sys
from typing import Mapping
errorcode: Mapping[int, str]

View File

@@ -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]

View File

@@ -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]

View File

@@ -1,5 +1,5 @@
import sys
from typing import Sequence, Text, Union
from typing import Sequence, Text
def iskeyword(s: Text) -> bool: ...

View File

@@ -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]

View File

@@ -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: ...

View File

@@ -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

View File

@@ -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

View File

@@ -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]

View File

@@ -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]

View File

@@ -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,

View File

@@ -11,7 +11,6 @@ from typing import (
Optional,
Sequence,
Set,
Text,
Tuple,
Type,
TypeVar,

View File

@@ -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):

View File

@@ -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

View File

@@ -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]]]

View File

@@ -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

View File

@@ -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): ...

View File

@@ -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]]

View File

@@ -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: ...

View File

@@ -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: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, NewType, Tuple, Type, TypeVar
from typing import Any, Dict, Tuple, Type, TypeVar
_T = TypeVar("_T")

View File

@@ -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")

View File

@@ -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")

View File

@@ -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: ...

View File

@@ -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

View File

@@ -1,4 +1,3 @@
import sys
from types import TracebackType
from typing import Iterator, MutableMapping, Optional, Type, Union
from typing_extensions import Literal

View File

@@ -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]

View File

@@ -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]

View File

@@ -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]

View File

@@ -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

View File

@@ -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:

View File

@@ -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

View File

@@ -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

View File

@@ -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).

View File

@@ -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

View File

@@ -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):

View File

@@ -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): ...

View File

@@ -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]

View File

@@ -1,4 +1,4 @@
from typing import Dict, Union
from typing import Union
from urllib.response import addinfourl
# Stubs for urllib.error

View File

@@ -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)

View File

@@ -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: ...