diff options
43 files changed, 11 insertions, 64 deletions
diff --git a/Lib/_strptime.py b/Lib/_strptime.py index d101c6de05d..53bd34be806 100644 --- a/Lib/_strptime.py +++ b/Lib/_strptime.py @@ -14,7 +14,7 @@ import time import locale import calendar from re import compile as re_compile -from re import IGNORECASE, ASCII +from re import IGNORECASE from re import escape as re_escape from datetime import (date as datetime_date, timedelta as datetime_timedelta, diff --git a/Lib/asynchat.py b/Lib/asynchat.py index 0378fa70697..f1a5731bae8 100644 --- a/Lib/asynchat.py +++ b/Lib/asynchat.py @@ -45,7 +45,6 @@ command will be accumulated (using your own 'collect_incoming_data' method) up to the terminator, and then control will be returned to you - by calling your self.found_terminator() method. """ -import socket import asyncore from collections import deque diff --git a/Lib/compileall.py b/Lib/compileall.py index 07f50aa3a3f..d957ee53571 100644 --- a/Lib/compileall.py +++ b/Lib/compileall.py @@ -12,7 +12,6 @@ See module py_compile for details of the actual byte-compilation. """ import os import sys -import errno import importlib.util import py_compile import struct diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py index 0cf20766cca..595113bffde 100644 --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py @@ -85,7 +85,7 @@ if os.name == "posix" and sys.platform == "darwin": elif os.name == "posix": # Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump - import re, tempfile, errno + import re, tempfile def _findLib_gcc(name): expr = r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name) diff --git a/Lib/decimal.py b/Lib/decimal.py index 7bc1c943b5b..5b984731b21 100644 --- a/Lib/decimal.py +++ b/Lib/decimal.py @@ -142,7 +142,6 @@ __version__ = '1.70' # Highest version of the spec this complies with # See http://speleotrove.com/decimal/ __libmpdec_version__ = "2.4.0" # compatible libmpdec version -import copy as _copy import math as _math import numbers as _numbers import sys diff --git a/Lib/difflib.py b/Lib/difflib.py index cc573f98277..48d7e579395 100644 --- a/Lib/difflib.py +++ b/Lib/difflib.py @@ -30,7 +30,6 @@ __all__ = ['get_close_matches', 'ndiff', 'restore', 'SequenceMatcher', 'Differ','IS_CHARACTER_JUNK', 'IS_LINE_JUNK', 'context_diff', 'unified_diff', 'HtmlDiff', 'Match'] -import warnings import heapq from collections import namedtuple as _namedtuple diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py index 04ab84c82b8..3dc550232f5 100644 --- a/Lib/email/_header_value_parser.py +++ b/Lib/email/_header_value_parser.py @@ -70,7 +70,7 @@ XXX: provide complete list of token types. import re import urllib # For urllib.parse.unquote from string import hexdigits -from collections import namedtuple, OrderedDict +from collections import OrderedDict from email import _encoded_words as _ew from email import errors from email import utils diff --git a/Lib/email/generator.py b/Lib/email/generator.py index e4a86d49d83..15352101b57 100644 --- a/Lib/email/generator.py +++ b/Lib/email/generator.py @@ -10,14 +10,10 @@ import re import sys import time import random -import warnings from copy import deepcopy from io import StringIO, BytesIO -from email._policybase import compat32 -from email.header import Header from email.utils import _has_surrogates -import email.charset as _charset UNDERSCORE = '_' NL = '\n' # XXX: no longer used by the code below. diff --git a/Lib/email/header.py b/Lib/email/header.py index 5bd06380cee..9c89589e6eb 100644 --- a/Lib/email/header.py +++ b/Lib/email/header.py @@ -100,7 +100,6 @@ def decode_header(header): words.append((encoded, encoding, charset)) # Now loop over words and remove words that consist of whitespace # between two encoded strings. - import sys droplist = [] for n, w in enumerate(words): if n>1 and w[1] and words[n-2][1] and words[n-1][0].isspace(): @@ -362,7 +361,6 @@ class Header: for string, charset in self._chunks: if hasspace is not None: hasspace = string and self._nonctext(string[0]) - import sys if lastcs not in (None, 'us-ascii'): if not hasspace or charset not in (None, 'us-ascii'): formatter.add_transition() diff --git a/Lib/email/mime/text.py b/Lib/email/mime/text.py index 3b5b09f1907..ec18b8594dd 100644 --- a/Lib/email/mime/text.py +++ b/Lib/email/mime/text.py @@ -6,7 +6,6 @@ __all__ = ['MIMEText'] -from email.encoders import encode_7or8bit from email.mime.nonmultipart import MIMENonMultipart diff --git a/Lib/email/parser.py b/Lib/email/parser.py index ed512b114f2..9f5f95dfba4 100644 --- a/Lib/email/parser.py +++ b/Lib/email/parser.py @@ -7,11 +7,9 @@ __all__ = ['Parser', 'HeaderParser', 'BytesParser', 'BytesHeaderParser', 'FeedParser', 'BytesFeedParser'] -import warnings from io import StringIO, TextIOWrapper from email.feedparser import FeedParser, BytesFeedParser -from email.message import Message from email._policybase import compat32 diff --git a/Lib/email/quoprimime.py b/Lib/email/quoprimime.py index 30bf9162014..c1fe2b46940 100644 --- a/Lib/email/quoprimime.py +++ b/Lib/email/quoprimime.py @@ -40,7 +40,6 @@ __all__ = [ ] import re -import io from string import ascii_letters, digits, hexdigits diff --git a/Lib/email/utils.py b/Lib/email/utils.py index 95855d81bd7..17f01bc1064 100644 --- a/Lib/email/utils.py +++ b/Lib/email/utils.py @@ -25,13 +25,10 @@ __all__ = [ import os import re import time -import base64 import random import socket import datetime import urllib.parse -import warnings -from io import StringIO from email._parseaddr import quote from email._parseaddr import AddressList as _AddressList diff --git a/Lib/functools.py b/Lib/functools.py index 2b77f7866a5..b8463ad2452 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -19,7 +19,7 @@ except ImportError: pass from abc import get_cache_token from collections import namedtuple -from types import MappingProxyType, MethodType +from types import MappingProxyType from weakref import WeakKeyDictionary try: from _thread import RLock diff --git a/Lib/http/client.py b/Lib/http/client.py index 8ee2101708d..58b9c3e83bb 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -73,7 +73,6 @@ import os import socket import collections from urllib.parse import urlsplit -import warnings __all__ = ["HTTPResponse", "HTTPConnection", "HTTPException", "NotConnected", "UnknownProtocol", diff --git a/Lib/http/server.py b/Lib/http/server.py index f019bd9fc3c..6ce6bdab358 100644 --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -85,8 +85,6 @@ __version__ = "0.6" __all__ = ["HTTPServer", "BaseHTTPRequestHandler"] import html -import email.message -import email.parser import http.client import io import mimetypes diff --git a/Lib/logging/config.py b/Lib/logging/config.py index b882a62ab3e..10187e817f2 100644 --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -24,7 +24,7 @@ Copyright (C) 2001-2013 Vinay Sajip. All Rights Reserved. To use, simply 'import logging' and log away! """ -import sys, logging, logging.handlers, socket, struct, traceback, re +import sys, logging, logging.handlers, struct, traceback, re import io try: diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index b2e7d445cf9..f547d17ca20 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -23,8 +23,7 @@ Copyright (C) 2001-2013 Vinay Sajip. All Rights Reserved. To use, simply 'import logging.handlers' and log away! """ -import errno, logging, socket, os, pickle, struct, time, re -from codecs import BOM_UTF8 +import logging, socket, os, pickle, struct, time, re from stat import ST_DEV, ST_INO, ST_MTIME import queue try: diff --git a/Lib/mailbox.py b/Lib/mailbox.py index dde597c0f4f..8a25a19efce 100644 --- a/Lib/mailbox.py +++ b/Lib/mailbox.py @@ -6,7 +6,6 @@ # or returning from a flush() method. See functions _sync_flush() and # _sync_close(). -import sys import os import time import calendar diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py index 9b11a695990..b4f81ba984e 100644 --- a/Lib/multiprocessing/connection.py +++ b/Lib/multiprocessing/connection.py @@ -14,7 +14,6 @@ import os import sys import socket import struct -import errno import time import tempfile import itertools diff --git a/Lib/multiprocessing/heap.py b/Lib/multiprocessing/heap.py index 98bfdc8ee19..344a45f89db 100644 --- a/Lib/multiprocessing/heap.py +++ b/Lib/multiprocessing/heap.py @@ -8,13 +8,11 @@ # import bisect -import itertools import mmap import os import sys import tempfile import threading -import _multiprocessing from . import context from . import reduction diff --git a/Lib/multiprocessing/pool.py b/Lib/multiprocessing/pool.py index 1cb2d956788..74d08756ed5 100644 --- a/Lib/multiprocessing/pool.py +++ b/Lib/multiprocessing/pool.py @@ -24,7 +24,7 @@ import traceback # If threading is available then ThreadPool should be provided. Therefore # we avoid top-level imports which are liable to fail on some systems. from . import util -from . import get_context, cpu_count, TimeoutError +from . import get_context, TimeoutError # # Constants representing the state of a pool diff --git a/Lib/multiprocessing/popen_spawn_posix.py b/Lib/multiprocessing/popen_spawn_posix.py index 8b5dc42aa11..6b0a8d635fe 100644 --- a/Lib/multiprocessing/popen_spawn_posix.py +++ b/Lib/multiprocessing/popen_spawn_posix.py @@ -1,4 +1,3 @@ -import fcntl import io import os @@ -8,8 +7,6 @@ from . import reduction from . import spawn from . import util -from . import current_process - __all__ = ['Popen'] diff --git a/Lib/multiprocessing/reduction.py b/Lib/multiprocessing/reduction.py index 01e6de2f96b..8f209b47dab 100644 --- a/Lib/multiprocessing/reduction.py +++ b/Lib/multiprocessing/reduction.py @@ -16,7 +16,6 @@ import socket import sys from . import context -from . import util __all__ = ['send_handle', 'recv_handle', 'ForkingPickler', 'register', 'dump'] diff --git a/Lib/multiprocessing/semaphore_tracker.py b/Lib/multiprocessing/semaphore_tracker.py index ddb2b520f56..de7738eeee8 100644 --- a/Lib/multiprocessing/semaphore_tracker.py +++ b/Lib/multiprocessing/semaphore_tracker.py @@ -11,7 +11,6 @@ # python" would probably leave unlinked semaphores. # -import errno import os import signal import sys @@ -21,7 +20,6 @@ import _multiprocessing from . import spawn from . import util -from . import current_process __all__ = ['ensure_running', 'register', 'unregister'] diff --git a/Lib/multiprocessing/synchronize.py b/Lib/multiprocessing/synchronize.py index 9d8e2824772..0e3f6ec2e94 100644 --- a/Lib/multiprocessing/synchronize.py +++ b/Lib/multiprocessing/synchronize.py @@ -11,10 +11,8 @@ __all__ = [ 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', 'Event' ] -import os import threading import sys -import itertools import tempfile import _multiprocessing diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py index e476e853823..0b695e46e59 100644 --- a/Lib/multiprocessing/util.py +++ b/Lib/multiprocessing/util.py @@ -7,8 +7,6 @@ # Licensed to PSF under a Contributor Agreement. # -import sys -import functools import os import itertools import weakref diff --git a/Lib/nntplib.py b/Lib/nntplib.py index fcb01d319b4..e2c6579b673 100644 --- a/Lib/nntplib.py +++ b/Lib/nntplib.py @@ -1085,7 +1085,6 @@ if _have_ssl: # Test retrieval when run as a script. if __name__ == '__main__': import argparse - from email.utils import parsedate parser = argparse.ArgumentParser(description="""\ nntplib built-in demo - display the latest articles in a newsgroup""") diff --git a/Lib/pickle.py b/Lib/pickle.py index 9cd0132a188..3fc2596e675 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -23,7 +23,7 @@ Misc variables: """ -from types import FunctionType, ModuleType +from types import FunctionType from copyreg import dispatch_table from copyreg import _extension_registry, _inverted_registry, _extension_cache from itertools import islice diff --git a/Lib/platform.py b/Lib/platform.py index 11b501e7d73..c4ffe95bca3 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -503,7 +503,6 @@ def win32_ver(release='', version='', csd='', ptype=''): # Import the needed APIs try: - import win32api from win32api import RegQueryValueEx, RegOpenKeyEx, \ RegCloseKey, GetVersionEx from win32con import HKEY_LOCAL_MACHINE, VER_PLATFORM_WIN32_NT, \ diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 505b7cbd58d..006212b32e5 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -66,7 +66,7 @@ import tokenize import warnings from collections import deque from reprlib import Repr -from traceback import extract_tb, format_exception_only +from traceback import format_exception_only # --------------------------------------------------------- common routines diff --git a/Lib/runpy.py b/Lib/runpy.py index 577deb29b86..0bb57d76cef 100644 --- a/Lib/runpy.py +++ b/Lib/runpy.py @@ -10,7 +10,6 @@ importers when locating support scripts as well as when importing modules. # to implement PEP 338 (Executing Modules as Scripts) -import os import sys import importlib.machinery # importlib first so we can test #15386 via -m import importlib.util diff --git a/Lib/socketserver.py b/Lib/socketserver.py index e9e4e4e4add..46ee7c54ef9 100644 --- a/Lib/socketserver.py +++ b/Lib/socketserver.py @@ -131,7 +131,6 @@ __version__ = "0.4" import socket import select -import sys import os import errno try: diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py index 3a5083fde87..c6860b5bda5 100644 --- a/Lib/sre_compile.py +++ b/Lib/sre_compile.py @@ -10,7 +10,7 @@ """Internal support module for sre""" -import _sre, sys +import _sre import sre_parse from sre_constants import * from _sre import MAXREPEAT diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index 6583ef6c4a7..399e7b7f3f2 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -12,8 +12,6 @@ # XXX: show string offset and offending character for all errors -import sys - from sre_constants import * from _sre import MAXREPEAT diff --git a/Lib/ssl.py b/Lib/ssl.py index 4408e7b7436..87b70fac713 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -147,12 +147,9 @@ else: if sys.platform == "win32": from _ssl import enum_certificates, enum_crls -from socket import getnameinfo as _getnameinfo -from socket import SHUT_RDWR as _SHUT_RDWR from socket import socket, AF_INET, SOCK_STREAM, create_connection from socket import SOL_SOCKET, SO_TYPE import base64 # for DER-to-PEM translation -import traceback import errno diff --git a/Lib/subprocess.py b/Lib/subprocess.py index d629bdfc93e..38f0f185e8f 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -350,8 +350,6 @@ mswindows = (sys.platform == "win32") import io import os import time -import traceback -import gc import signal import builtins import warnings diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 3409efea03e..0a9025774d7 100755 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -65,8 +65,6 @@ except NameError: # from tarfile import * __all__ = ["TarFile", "TarInfo", "is_tarfile", "TarError"] -from builtins import open as _open # Since 'open' is TarFile.open - #--------------------------------------------------------- # tar constants #--------------------------------------------------------- diff --git a/Lib/threading.py b/Lib/threading.py index 5d68a9e513b..34070830e78 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -3,7 +3,6 @@ import sys as _sys import _thread -from time import sleep as _sleep try: from time import monotonic as _time except ImportError: diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index 5d6f31b48de..4ac4e57ad25 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -35,8 +35,6 @@ if sys.platform == "win32": # Attempt to configure Tcl/Tk without requiring PATH from tkinter import _fix -import warnings - import _tkinter # If this fails your Python may not be configured for Tk TclError = _tkinter.TclError from tkinter.constants import * diff --git a/Lib/tkinter/tix.py b/Lib/tkinter/tix.py index 131aa062a55..c1cdfa7c033 100644 --- a/Lib/tkinter/tix.py +++ b/Lib/tkinter/tix.py @@ -27,7 +27,7 @@ # from tkinter import * -from tkinter import _flatten, _cnfmerge, _default_root +from tkinter import _cnfmerge, _default_root # WARNING - TkVersion is a limited precision floating point number if TkVersion < 3.999: diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py index 3b5f5fab81e..bbdd9113387 100644 --- a/Lib/venv/__init__.py +++ b/Lib/venv/__init__.py @@ -32,7 +32,6 @@ import os import shutil import subprocess import sys -import sysconfig import types logger = logging.getLogger(__name__) diff --git a/Lib/xmlrpc/client.py b/Lib/xmlrpc/client.py index 1238b9bf375..c2ae7070f9a 100644 --- a/Lib/xmlrpc/client.py +++ b/Lib/xmlrpc/client.py @@ -134,7 +134,6 @@ from datetime import datetime import http.client import urllib.parse from xml.parsers import expat -import socket import errno from io import BytesIO try: |