Skip to content

Commit

Permalink
Remove a bunch of unused imports (python#3323)
Browse files Browse the repository at this point in the history
  • Loading branch information
srittau authored and JelleZijlstra committed Oct 8, 2019
1 parent a6f146e commit 256b3ce
Show file tree
Hide file tree
Showing 47 changed files with 31 additions and 95 deletions.
5 changes: 1 addition & 4 deletions stdlib/2/os/path.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

import os
import sys
from typing import (
overload, List, Any, AnyStr, Sequence, Tuple, BinaryIO, TextIO,
TypeVar, Union, Text, Callable, Optional
)
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional

_T = TypeVar('_T')

Expand Down
5 changes: 1 addition & 4 deletions stdlib/2/os2emxpath.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

import os
import sys
from typing import (
overload, List, Any, AnyStr, Sequence, Tuple, BinaryIO, TextIO,
TypeVar, Union, Text, Callable, Optional
)
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional

_T = TypeVar('_T')

Expand Down
5 changes: 1 addition & 4 deletions stdlib/2and3/macpath.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

import os
import sys
from typing import (
overload, List, Any, AnyStr, Sequence, Tuple, BinaryIO, TextIO,
TypeVar, Union, Text, Callable, Optional
)
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional

_T = TypeVar('_T')

Expand Down
5 changes: 1 addition & 4 deletions stdlib/2and3/ntpath.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

import os
import sys
from typing import (
overload, List, Any, AnyStr, Sequence, Tuple, BinaryIO, TextIO,
TypeVar, Union, Text, Callable, Optional
)
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional

_T = TypeVar('_T')

Expand Down
5 changes: 1 addition & 4 deletions stdlib/2and3/posixpath.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

import os
import sys
from typing import (
overload, List, Any, AnyStr, Sequence, Tuple, BinaryIO, TextIO,
TypeVar, Union, Text, Callable, Optional
)
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional

_T = TypeVar('_T')

Expand Down
2 changes: 1 addition & 1 deletion stdlib/3.7/contextvars.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar, Union
from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar

_T = TypeVar('_T')

Expand Down
1 change: 0 additions & 1 deletion stdlib/3/_imp.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Stubs for _imp (Python 3.6)

import sys
import types
from typing import Any, List

Expand Down
1 change: 0 additions & 1 deletion stdlib/3/_importlib_modulespec.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
# _Loader is the PEP-451-defined interface for a loader type/object.

from abc import ABCMeta
import sys
from typing import Any, Dict, List, Optional, Protocol

class _Loader(Protocol):
Expand Down
1 change: 0 additions & 1 deletion stdlib/3/_operator.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Stubs for _operator (Python 3.5)

import sys
from typing import AnyStr

# In reality the import is the other way around, but this way we can keep the operator stub in 2and3
Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/asyncio/coroutines.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Callable, Generator, List, TypeVar
from typing import Any, Callable, List, TypeVar

__all__: List[str]

Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/asyncio/futures.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from typing import Any, Union, Callable, TypeVar, Type, List, Generic, Iterable, Generator, Awaitable, Optional, Tuple
from typing import Any, Union, Callable, TypeVar, Type, List, Iterable, Generator, Awaitable, Optional, Tuple
from .events import AbstractEventLoop
from concurrent.futures import (
CancelledError as CancelledError,
Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/asyncio/locks.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Callable, Generator, Iterable, Iterator, List, Type, TypeVar, Union, Optional, Awaitable
from typing import Any, Callable, Generator, List, Type, TypeVar, Union, Optional, Awaitable

from .coroutines import coroutine
from .events import AbstractEventLoop
Expand Down
2 changes: 0 additions & 2 deletions stdlib/3/asyncio/queues.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import sys
from asyncio.events import AbstractEventLoop
from .coroutines import coroutine
from .futures import Future
from typing import Any, Generator, Generic, List, TypeVar, Optional

__all__: List[str]
Expand Down
6 changes: 3 additions & 3 deletions stdlib/3/asyncio/tasks.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import concurrent.futures
import sys
from typing import (Any, TypeVar, Set, Dict, List, TextIO, Union, Tuple, Generic, Callable,
Coroutine, Generator, Iterable, Awaitable, overload, Sequence, Iterator,
Optional)
from typing import (
Any, TypeVar, Set, List, TextIO, Union, Tuple, Generic, Generator, Iterable, Awaitable, overload, Iterator, Optional,
)
from types import FrameType
from .events import AbstractEventLoop
from .futures import Future
Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/asyncio/transports.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from typing import Dict, Any, TypeVar, Mapping, List, Optional, Tuple
from typing import Any, Mapping, List, Optional, Tuple
from asyncio.protocols import BaseProtocol

__all__: List[str]
Expand Down
3 changes: 1 addition & 2 deletions stdlib/3/email/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Stubs for email (Python 3.4)

from typing import Callable, Optional, IO
import sys
from typing import Callable, IO
from email.message import Message
from email.policy import Policy

Expand Down
1 change: 0 additions & 1 deletion stdlib/3/email/feedparser.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Stubs for email.feedparser (Python 3.4)

from typing import Callable
import sys
from email.message import Message
from email.policy import Policy

Expand Down
1 change: 0 additions & 1 deletion stdlib/3/email/message.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import (
List, Optional, Union, Tuple, TypeVar, Generator, Sequence, Iterator, Any
)
import sys
from email.charset import Charset
from email.errors import MessageDefect
from email.header import Header
Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/email/parser.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import email.feedparser
from email.message import Message
from email.policy import Policy
from typing import BinaryIO, Callable, Optional, TextIO
from typing import BinaryIO, Callable, TextIO

FeedParser = email.feedparser.FeedParser
BytesFeedParser = email.feedparser.BytesFeedParser
Expand Down
1 change: 0 additions & 1 deletion stdlib/3/email/policy.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from abc import abstractmethod
from typing import Any, List, Optional, Tuple, Union, Callable
import sys
from email.message import Message
from email.errors import MessageDefect
from email.header import Header
Expand Down
5 changes: 1 addition & 4 deletions stdlib/3/encodings/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import codecs

import typing

def search_function(encoding: str) -> codecs.CodecInfo:
...
def search_function(encoding: str) -> codecs.CodecInfo: ...
1 change: 0 additions & 1 deletion stdlib/3/functools.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
from typing import Any, Callable, Generic, Dict, Iterable, Mapping, Optional, Sequence, Tuple, Type, TypeVar, NamedTuple, Union, overload

_AnyCallable = Callable[..., Any]
Expand Down
1 change: 0 additions & 1 deletion stdlib/3/heapq.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

# Based on http://docs.python.org/3.2/library/heapq.html

import sys
from typing import TypeVar, List, Iterable, Any, Callable, Optional

_T = TypeVar('_T')
Expand Down
1 change: 0 additions & 1 deletion stdlib/3/html/parser.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import List, Optional, Tuple
from _markupbase import ParserBase
import sys

class HTMLParser(ParserBase):
def __init__(self, *, convert_charrefs: bool = ...) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/http/cookies.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Stubs for http.cookies (Python 3.5)

from typing import Generic, Dict, List, Mapping, MutableMapping, Optional, TypeVar, Union, Any
from typing import Generic, Dict, List, Mapping, Optional, TypeVar, Union, Any

_DataType = Union[str, Mapping[str, Union[str, Morsel[Any]]]]
_T = TypeVar('_T')
Expand Down
1 change: 0 additions & 1 deletion stdlib/3/importlib/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from importlib.abc import Loader
import sys
import types
from typing import Any, Mapping, Optional, Sequence

Expand Down
3 changes: 1 addition & 2 deletions stdlib/3/importlib/machinery.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import importlib.abc
import sys
import types
from typing import Any, Callable, List, Optional, Sequence, Tuple, Union
from typing import Any, Callable, List, Optional, Sequence, Tuple

# ModuleSpec is exported from this module, but for circular import
# reasons exists in its own stub file (with Loader and ModuleType).
Expand Down
1 change: 0 additions & 1 deletion stdlib/3/io.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ from typing import (
import builtins
import codecs
from mmap import mmap
import sys
from types import TracebackType
from typing import TypeVar

Expand Down
1 change: 0 additions & 1 deletion stdlib/3/json/decoder.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
from typing import Any, Callable, Dict, List, Optional, Tuple

class JSONDecodeError(ValueError):
Expand Down
2 changes: 0 additions & 2 deletions stdlib/3/msvcrt.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@

# NOTE: These are incomplete!

from typing import overload, BinaryIO, TextIO

def get_osfhandle(file: int) -> int: ...
def open_osfhandle(handle: int, flags: int) -> int: ...
5 changes: 1 addition & 4 deletions stdlib/3/multiprocessing/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Stubs for multiprocessing

from typing import (
Any, Callable, ContextManager, Iterable, Mapping, Optional, Dict, List,
Union, Sequence, Tuple, Type, overload
)
from typing import Any, Callable, Iterable, Mapping, Optional, List, Union, Sequence, Tuple, Type, overload

from ctypes import _CData
from logging import Logger
Expand Down
5 changes: 1 addition & 4 deletions stdlib/3/multiprocessing/context.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import multiprocessing
from multiprocessing import synchronize
from multiprocessing import queues
import sys
from typing import (
Any, Callable, Iterable, Optional, List, Mapping, Sequence, Tuple, Type,
Union,
)
from typing import Any, Callable, Iterable, Optional, List, Mapping, Sequence, Type, Union

_LockLike = Union[synchronize.Lock, synchronize.RLock]

Expand Down
6 changes: 1 addition & 5 deletions stdlib/3/multiprocessing/dummy/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
from typing import Any, Optional, List, Type
from typing import Any, Optional, List

import array
import sys
import threading
import weakref

from .connection import Pipe
from threading import Lock, RLock, Semaphore, BoundedSemaphore
from threading import Event, Condition, Barrier
from queue import Queue

JoinableQueue = Queue
Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/multiprocessing/dummy/connection.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, List, Optional, Tuple, Type, TypeVar
from typing import Any, List, Optional, Tuple, TypeVar

from queue import Queue

Expand Down
6 changes: 1 addition & 5 deletions stdlib/3/multiprocessing/pool.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
from typing import (
Any, Callable, ContextManager, Iterable, Mapping, Optional, List,
Type, TypeVar, Generic, Iterator
)
from types import TracebackType
from typing import Any, Callable, ContextManager, Iterable, Mapping, Optional, List, TypeVar, Generic, Iterator

_PT = TypeVar('_PT', bound=Pool)
_S = TypeVar('_S')
Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/os/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ from io import TextIOWrapper as _TextIOWrapper
from posix import listdir as listdir, times_result
import sys
from typing import (
Mapping, MutableMapping, Dict, List, Any, Tuple, IO, Iterable, Iterator, NoReturn, overload, Union, AnyStr,
Mapping, MutableMapping, Dict, List, Any, Tuple, Iterable, Iterator, NoReturn, overload, Union, AnyStr,
Optional, Generic, Set, Callable, Text, Sequence, NamedTuple, TypeVar, ContextManager
)

Expand Down
5 changes: 1 addition & 4 deletions stdlib/3/os/path.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

import os
import sys
from typing import (
overload, List, Any, AnyStr, Sequence, Tuple, BinaryIO, TextIO,
TypeVar, Union, Text, Callable, Optional
)
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional

_T = TypeVar('_T')

Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/posix.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# NOTE: These are incomplete!

import sys
from typing import List, NamedTuple, Optional, overload, Tuple
from typing import List, NamedTuple, Optional, overload

from os import stat_result as stat_result

Expand Down
5 changes: 1 addition & 4 deletions stdlib/3/smtplib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ from email.message import Message as _Message
from socket import socket
from ssl import SSLContext
from types import TracebackType
from typing import (
Any, AnyStr, Dict, Generic, List, Optional, Sequence, Tuple, Union,
Pattern, Type, Callable, Protocol, overload)
import sys
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union, Pattern, Type, Protocol, overload

_Reply = Tuple[int, bytes]
_SendErrs = Dict[str, _Reply]
Expand Down
1 change: 0 additions & 1 deletion stdlib/3/stat.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Based on http://docs.python.org/3.2/library/stat.html

import sys
import typing

def S_ISDIR(mode: int) -> bool: ...
def S_ISCHR(mode: int) -> bool: ...
Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/string.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Based on http://docs.python.org/3.2/library/string.html

from typing import Mapping, Sequence, Any, Optional, Union, List, Tuple, Iterable
from typing import Mapping, Sequence, Any, Optional, Union, Tuple, Iterable

ascii_letters: str
ascii_lowercase: str
Expand Down
6 changes: 1 addition & 5 deletions stdlib/3/subprocess.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

# Based on http://docs.python.org/3.6/library/subprocess.html
import sys
from typing import (
Sequence, Any, Mapping, Callable, Tuple, IO, Optional, Union, List, Type, Text,
Generic, TypeVar, AnyStr,
overload,
)
from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Optional, Union, Type, Text, Generic, TypeVar, AnyStr, overload
from types import TracebackType

if sys.version_info >= (3, 8):
Expand Down
1 change: 0 additions & 1 deletion stdlib/3/unittest/loader.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
import unittest.case
import unittest.suite
import unittest.result
Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/unittest/result.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, List, Optional, Tuple, Type
from typing import List, Optional, Tuple, Type
from types import TracebackType
import unittest.case

Expand Down
1 change: 0 additions & 1 deletion stdlib/3/unittest/runner.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from typing import Callable, Optional, TextIO, Tuple, Type, Union
import sys
import unittest.case
import unittest.result
import unittest.suite
Expand Down
1 change: 0 additions & 1 deletion stdlib/3/urllib/parse.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Stubs for urllib.parse
from typing import Any, List, Dict, Tuple, AnyStr, Generic, overload, Sequence, Mapping, Union, NamedTuple, Callable, Optional
import sys

_Str = Union[bytes, str]

Expand Down
Loading

0 comments on commit 256b3ce

Please sign in to comment.