]> granicus.if.org Git - python/commitdiff
Issue #20976: pyflakes: Remove unused imports
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 20 Mar 2014 08:16:38 +0000 (09:16 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 20 Mar 2014 08:16:38 +0000 (09:16 +0100)
43 files changed:
Lib/_strptime.py
Lib/asynchat.py
Lib/compileall.py
Lib/ctypes/util.py
Lib/decimal.py
Lib/difflib.py
Lib/email/_header_value_parser.py
Lib/email/generator.py
Lib/email/header.py
Lib/email/mime/text.py
Lib/email/parser.py
Lib/email/quoprimime.py
Lib/email/utils.py
Lib/functools.py
Lib/http/client.py
Lib/http/server.py
Lib/logging/config.py
Lib/logging/handlers.py
Lib/mailbox.py
Lib/multiprocessing/connection.py
Lib/multiprocessing/heap.py
Lib/multiprocessing/pool.py
Lib/multiprocessing/popen_spawn_posix.py
Lib/multiprocessing/reduction.py
Lib/multiprocessing/semaphore_tracker.py
Lib/multiprocessing/synchronize.py
Lib/multiprocessing/util.py
Lib/nntplib.py
Lib/pickle.py
Lib/platform.py
Lib/pydoc.py
Lib/runpy.py
Lib/socketserver.py
Lib/sre_compile.py
Lib/sre_parse.py
Lib/ssl.py
Lib/subprocess.py
Lib/tarfile.py
Lib/threading.py
Lib/tkinter/__init__.py
Lib/tkinter/tix.py
Lib/venv/__init__.py
Lib/xmlrpc/client.py

index d101c6de05db41bfe232044245169cc08b38b137..53bd34be806d21ca61735f8affdcd56c7a1fd2a1 100644 (file)
@@ -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,
index 0378fa70697af220c7692a14b6f3847c309f63c3..f1a5731bae802026920abb1ab46ada8882f2e2d7 100644 (file)
@@ -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
 
index 07f50aa3a3f504172283fda0491bd3108b53cd09..d957ee5357158aedc464c187a50394e7f053f3e2 100644 (file)
@@ -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
index 0cf20766ccace357d8edd469e48c5025d34b52ec..595113bffdec2219848476ef7a6d36e7b1fce13f 100644 (file)
@@ -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)
index 7bc1c943b5b0aefba2f5894a2ead464a7f8fc33b..5b984731b2107fe17caba4650ee91027bb04e65f 100644 (file)
@@ -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
index e8a36219d6ea86cd22f2f3a76ba4a5400adfd6f9..38dfef461913bd6d90f15c2b2d16ca255842c4ea 100644 (file)
@@ -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
 
index 04ab84c82b84057c49084c2540e531b1d17b3f39..3dc550232f5019a7610c5ba67946c9144393a2ee 100644 (file)
@@ -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
index e4a86d49d838842724f78015280564da0be7dd2c..15352101b57a67e61f2191678252226ed883cb19 100644 (file)
@@ -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.
index 5bd06380ceef89915f63dad1064aabfe94956fed..9c89589e6ebf9cd034a00af2ec38888de26a4fa3 100644 (file)
@@ -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()
index 3b5b09f1907f10f185d8e489149083ac9559c8e6..ec18b8594dd976a31cbdcec68c031605ae3c025a 100644 (file)
@@ -6,7 +6,6 @@
 
 __all__ = ['MIMEText']
 
-from email.encoders import encode_7or8bit
 from email.mime.nonmultipart import MIMENonMultipart
 
 
index ed512b114f2c187bc1413f8be99bdf61497763f9..9f5f95dfba4721f1737bc702d9fccd7bffbe4b97 100644 (file)
@@ -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
 
 
index 30bf9162014c3b81970dd9089d8dd277ba965fb9..c1fe2b469400204b5482ac5acaa9ddd9b9cb5615 100644 (file)
@@ -40,7 +40,6 @@ __all__ = [
     ]
 
 import re
-import io
 
 from string import ascii_letters, digits, hexdigits
 
index 95855d81bd787f46504fc8627e16c1c91b2a9577..17f01bc1064ca5c2bec0ff5f7816362876f25973 100644 (file)
@@ -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
index 2b77f7866a573fd566d987421e82d9cc2fd21145..b8463ad2452cbf726d7a30df221542fe56b34104 100644 (file)
@@ -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
index 763a903d42b64264b9f63923b2673146619664f6..12c1a5feddc2441c3ff6d010f30421ff679aebd8 100644 (file)
@@ -73,7 +73,6 @@ import os
 import socket
 import collections
 from urllib.parse import urlsplit
-import warnings
 
 __all__ = ["HTTPResponse", "HTTPConnection",
            "HTTPException", "NotConnected", "UnknownProtocol",
index f019bd9fc3ca357c15ff3056c5949e6841641e7f..6ce6bdab358adf3cdd819e96cbafdce55e6ce9aa 100644 (file)
@@ -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
index b882a62ab3e698c96e3f4c4d8457ad27db8aa197..10187e817f2f91c60d12a29b3e911fd4e174c3f2 100644 (file)
@@ -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:
index b2e7d445cf9a78b0a59f84d9c6468038aef3b0e1..f547d17ca20803d9c1f8c88f53476e2912dfdd99 100644 (file)
@@ -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:
index dde597c0f4f3a070a33210681a3522693f87e846..8a25a19efce91f765af346e567f8aa3ab82e9c8a 100644 (file)
@@ -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
index 9b11a69599004a2c030c11138dca6c1a62f162ef..b4f81ba984e12f58111d312079e4ac46de52c8b3 100644 (file)
@@ -14,7 +14,6 @@ import os
 import sys
 import socket
 import struct
-import errno
 import time
 import tempfile
 import itertools
index 98bfdc8ee195282bb912c49574d2d1e8660b0bb2..344a45f89db765a8e35a3d88e6f82a22702a1952 100644 (file)
@@ -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
index 1cb2d9567885d78b2672e08e3fb53fd29f70a345..74d08756ed5faca87ea1a8a4eae445884f25eed8 100644 (file)
@@ -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
index 8b5dc42aa11ae7a0d461c02a366966e572dc9ba6..6b0a8d635feadb5f90f6de12b3157469e54be25b 100644 (file)
@@ -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']
 
 
index 01e6de2f96ba5de007dd4090840e5298fcfb448d..8f209b47dab7985aa9b8433b0feab047dfd54341 100644 (file)
@@ -16,7 +16,6 @@ import socket
 import sys
 
 from . import context
-from . import util
 
 __all__ = ['send_handle', 'recv_handle', 'ForkingPickler', 'register', 'dump']
 
index ddb2b520f56fe1fdde03e881a7902179a2f795e2..de7738eeee8ab264ab059c99d749ee62372c3c39 100644 (file)
@@ -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']
 
index 9d8e2824772e31e713fe95c383efa793a0a55145..0e3f6ec2e949ba52776baa9d7c3b4403a9ef1c93 100644 (file)
@@ -11,10 +11,8 @@ __all__ = [
     'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', 'Event'
     ]
 
-import os
 import threading
 import sys
-import itertools
 import tempfile
 import _multiprocessing
 
index e476e853823e6173b58c1e5c19c76e75b4ab8486..0b695e46e596d9fede1d7b27afb10921243eb6fe 100644 (file)
@@ -7,8 +7,6 @@
 # Licensed to PSF under a Contributor Agreement.
 #
 
-import sys
-import functools
 import os
 import itertools
 import weakref
index fcb01d319b49ea0afe298ba08fdec275f603e7c4..e2c6579b673cc6927a8a35112c1618146b27c937 100644 (file)
@@ -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""")
index 9cd0132a188eb8d592d12c5aafff66afca4d96f5..3fc2596e675631b6cc906211ec6af0224e632873 100644 (file)
@@ -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
index 11b501e7d732e61f0b2060eae692291d2ca4c91e..c4ffe95bca3db601108ee1dc2e740c1d129df005 100755 (executable)
@@ -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, \
index 505b7cbd58da9ca20bf8be1f0a57be1e09a72359..006212b32e50598fa69c88c4299304d90697f334 100755 (executable)
@@ -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
index 577deb29b862d0e3526aa074ef0e0151dc0a97d3..0bb57d76cef402a7368ac50868593245a26e96e4 100644 (file)
@@ -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
index e9e4e4e4add0cdcbcea4bbd75409d833573646dd..46ee7c54ef9534566ca000b8ac1796fe32d6e024 100644 (file)
@@ -131,7 +131,6 @@ __version__ = "0.4"
 
 import socket
 import select
-import sys
 import os
 import errno
 try:
index 3a5083fde872de6dadea54e49929cb5ab6192f81..c6860b5bda56c5bae9cc7913a141308eceec981e 100644 (file)
@@ -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
index 6583ef6c4a7d76061037faaf70d901ebb448d22b..399e7b7f3f22142d7cf6d14c7b2670fcbc281839 100644 (file)
@@ -12,8 +12,6 @@
 
 # XXX: show string offset and offending character for all errors
 
-import sys
-
 from sre_constants import *
 from _sre import MAXREPEAT
 
index 4408e7b74364803d78bd54ff5e5a75b77ce12757..87b70fac7139b3351233cf5b8bfa2dff96a39f6d 100644 (file)
@@ -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
 
 
index d629bdfc93ea6ddc3987e4c8363d1959dbfebb5e..38f0f185e8f059273a3ab6fa65be92bcdc56375a 100644 (file)
@@ -350,8 +350,6 @@ mswindows = (sys.platform == "win32")
 import io
 import os
 import time
-import traceback
-import gc
 import signal
 import builtins
 import warnings
index 3409efea03e968a7d47937d2c78d4175daaead88..0a9025774d73306af467147590449785583b3e7b 100755 (executable)
@@ -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
 #---------------------------------------------------------
index 5d68a9e513b7de852ad6e6fa23b15a9ec7af38e5..34070830e78c82a29eacfe1ffc5b2c8f50b2db82 100644 (file)
@@ -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:
index 5d6f31b48de114999ca23d9ae2cbb1fa40192c31..4ac4e57ad2527e25e69fc5d5965db6ad69c34baa 100644 (file)
@@ -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 *
index 131aa062a550ec8edf490e4ec1674b1a9c777e7b..c1cdfa7c0337c844e182dc191b96994c5ed8e847 100644 (file)
@@ -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:
index 3b5f5fab81eed6b797cde6379951cebc62c86f92..bbdd91133878acda2275c00b213c5057f80cdbe5 100644 (file)
@@ -32,7 +32,6 @@ import os
 import shutil
 import subprocess
 import sys
-import sysconfig
 import types
 
 logger = logging.getLogger(__name__)
index 1238b9bf3752d143804e869b5a49896213559bc9..c2ae7070f9ac03985d6ceb50a36adb8651a481ed 100644 (file)
@@ -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: