Patch #2167 from calvin: Remove unused imports
diff --git a/Lib/SimpleHTTPServer.py b/Lib/SimpleHTTPServer.py
index 249e237..7b6e867 100644
--- a/Lib/SimpleHTTPServer.py
+++ b/Lib/SimpleHTTPServer.py
@@ -14,7 +14,6 @@
 import posixpath
 import BaseHTTPServer
 import urllib
-import urlparse
 import cgi
 import shutil
 import mimetypes
diff --git a/Lib/bsddb/test/test_basics.py b/Lib/bsddb/test/test_basics.py
index c027ada..6d0fff1 100644
--- a/Lib/bsddb/test/test_basics.py
+++ b/Lib/bsddb/test/test_basics.py
@@ -4,7 +4,6 @@
 """
 
 import os
-import sys
 import errno
 import shutil
 import string
diff --git a/Lib/bsddb/test/test_compat.py b/Lib/bsddb/test/test_compat.py
index b108db4..bc165cf 100644
--- a/Lib/bsddb/test/test_compat.py
+++ b/Lib/bsddb/test/test_compat.py
@@ -3,7 +3,7 @@
 regression test suite.
 """
 
-import sys, os, string
+import os, string
 import unittest
 import tempfile
 
diff --git a/Lib/bsddb/test/test_cursor_pget_bug.py b/Lib/bsddb/test/test_cursor_pget_bug.py
index 2f72b11..2e83a6c 100644
--- a/Lib/bsddb/test/test_cursor_pget_bug.py
+++ b/Lib/bsddb/test/test_cursor_pget_bug.py
@@ -1,6 +1,6 @@
 import unittest
 import tempfile
-import sys, os, glob
+import os, glob
 
 try:
     # For Pythons w/distutils pybsddb
diff --git a/Lib/bsddb/test/test_dbobj.py b/Lib/bsddb/test/test_dbobj.py
index 6086d77..dd9909d 100644
--- a/Lib/bsddb/test/test_dbobj.py
+++ b/Lib/bsddb/test/test_dbobj.py
@@ -1,5 +1,5 @@
 
-import sys, os, string
+import os, string
 import unittest
 import glob
 import tempfile
diff --git a/Lib/bsddb/test/test_dbshelve.py b/Lib/bsddb/test/test_dbshelve.py
index ddc05d5..bd399a4 100644
--- a/Lib/bsddb/test/test_dbshelve.py
+++ b/Lib/bsddb/test/test_dbshelve.py
@@ -2,9 +2,8 @@
 TestCases for checking dbShelve objects.
 """
 
-import sys, os, string
+import os, string
 import tempfile, random
-from pprint import pprint
 from types import *
 import unittest
 
diff --git a/Lib/bsddb/test/test_dbtables.py b/Lib/bsddb/test/test_dbtables.py
index 3a401e3..0c9cf5f 100644
--- a/Lib/bsddb/test/test_dbtables.py
+++ b/Lib/bsddb/test/test_dbtables.py
@@ -20,7 +20,7 @@
 #
 # $Id$
 
-import sys, os, re
+import os, re
 import tempfile
 import shutil
 try:
diff --git a/Lib/bsddb/test/test_env_close.py b/Lib/bsddb/test/test_env_close.py
index 5738feb..efc3460 100644
--- a/Lib/bsddb/test/test_env_close.py
+++ b/Lib/bsddb/test/test_env_close.py
@@ -3,7 +3,6 @@
 """
 
 import os
-import sys
 import tempfile
 import glob
 import unittest
diff --git a/Lib/bsddb/test/test_get_none.py b/Lib/bsddb/test/test_get_none.py
index 5f09cec..d6454cc 100644
--- a/Lib/bsddb/test/test_get_none.py
+++ b/Lib/bsddb/test/test_get_none.py
@@ -2,9 +2,8 @@
 TestCases for checking set_get_returns_none.
 """
 
-import sys, os, string
+import os, string
 import tempfile
-from pprint import pprint
 import unittest
 
 try:
diff --git a/Lib/bsddb/test/test_join.py b/Lib/bsddb/test/test_join.py
index 731f33a..26c2912 100644
--- a/Lib/bsddb/test/test_join.py
+++ b/Lib/bsddb/test/test_join.py
@@ -1,10 +1,8 @@
 """TestCases for using the DB.join and DBCursor.join_item methods.
 """
 
-import sys, os, string
+import os
 import tempfile
-import time
-from pprint import pprint
 
 try:
     from threading import Thread, currentThread
diff --git a/Lib/bsddb/test/test_lock.py b/Lib/bsddb/test/test_lock.py
index e0d831f..18469a1 100644
--- a/Lib/bsddb/test/test_lock.py
+++ b/Lib/bsddb/test/test_lock.py
@@ -2,10 +2,7 @@
 TestCases for testing the locking sub-system.
 """
 
-import os
-from pprint import pprint
 import shutil
-import sys
 import tempfile
 import time
 
diff --git a/Lib/bsddb/test/test_misc.py b/Lib/bsddb/test/test_misc.py
index ef9c0aa..3d566f1 100644
--- a/Lib/bsddb/test/test_misc.py
+++ b/Lib/bsddb/test/test_misc.py
@@ -2,7 +2,6 @@
 """
 
 import os
-import sys
 import unittest
 import tempfile
 
diff --git a/Lib/bsddb/test/test_pickle.py b/Lib/bsddb/test/test_pickle.py
index ef84a40..b87cc68 100644
--- a/Lib/bsddb/test/test_pickle.py
+++ b/Lib/bsddb/test/test_pickle.py
@@ -1,5 +1,5 @@
 
-import sys, os, string
+import os
 import pickle
 try:
     import cPickle
diff --git a/Lib/bsddb/test/test_queue.py b/Lib/bsddb/test/test_queue.py
index 95cf20d..1acf35a 100644
--- a/Lib/bsddb/test/test_queue.py
+++ b/Lib/bsddb/test/test_queue.py
@@ -2,7 +2,7 @@
 TestCases for exercising a Queue DB.
 """
 
-import sys, os, string
+import os, string
 import tempfile
 from pprint import pprint
 import unittest
diff --git a/Lib/bsddb/test/test_recno.py b/Lib/bsddb/test/test_recno.py
index 4b36a40..9630db1 100644
--- a/Lib/bsddb/test/test_recno.py
+++ b/Lib/bsddb/test/test_recno.py
@@ -2,7 +2,6 @@
 """
 
 import os
-import sys
 import errno
 import tempfile
 from pprint import pprint
diff --git a/Lib/bsddb/test/test_sequence.py b/Lib/bsddb/test/test_sequence.py
index 239e8ee..d7029e5 100644
--- a/Lib/bsddb/test/test_sequence.py
+++ b/Lib/bsddb/test/test_sequence.py
@@ -1,6 +1,5 @@
 import unittest
 import os
-import sys
 import tempfile
 import glob
 
@@ -10,8 +9,6 @@
 except ImportError:
     from bsddb import db
 
-from test_all import verbose
-
 
 class DBSequenceTest(unittest.TestCase):
     def setUp(self):
diff --git a/Lib/bsddb/test/test_thread.py b/Lib/bsddb/test/test_thread.py
index 9c87db4..d14f6da 100644
--- a/Lib/bsddb/test/test_thread.py
+++ b/Lib/bsddb/test/test_thread.py
@@ -7,7 +7,6 @@
 import errno
 import shutil
 import tempfile
-from pprint import pprint
 from random import random
 
 try:
diff --git a/Lib/compiler/transformer.py b/Lib/compiler/transformer.py
index 77ac776..56cc1ef 100644
--- a/Lib/compiler/transformer.py
+++ b/Lib/compiler/transformer.py
@@ -29,7 +29,6 @@
 import parser
 import symbol
 import token
-import sys
 
 class WalkerError(StandardError):
     pass
diff --git a/Lib/ctypes/test/__init__.py b/Lib/ctypes/test/__init__.py
index 2b745c2..339ec8b 100644
--- a/Lib/ctypes/test/__init__.py
+++ b/Lib/ctypes/test/__init__.py
@@ -1,4 +1,4 @@
-import glob, os, sys, unittest, getopt, time
+import os, sys, unittest, getopt, time
 
 use_resources = []
 
diff --git a/Lib/ctypes/test/test_checkretval.py b/Lib/ctypes/test/test_checkretval.py
index 28be6c6..d15bd2e 100644
--- a/Lib/ctypes/test/test_checkretval.py
+++ b/Lib/ctypes/test/test_checkretval.py
@@ -1,5 +1,4 @@
 import unittest
-import sys
 
 from ctypes import *
 
diff --git a/Lib/ctypes/test/test_find.py b/Lib/ctypes/test/test_find.py
index 0cfe82e..ed1297d 100644
--- a/Lib/ctypes/test/test_find.py
+++ b/Lib/ctypes/test/test_find.py
@@ -1,5 +1,5 @@
 import unittest
-import os, sys
+import sys
 from ctypes import *
 from ctypes.util import find_library
 from ctypes.test import is_resource_enabled
diff --git a/Lib/ctypes/test/test_libc.py b/Lib/ctypes/test/test_libc.py
index c39f350..8d59f90 100644
--- a/Lib/ctypes/test/test_libc.py
+++ b/Lib/ctypes/test/test_libc.py
@@ -1,4 +1,3 @@
-import sys, os
 import unittest
 
 from ctypes import *
diff --git a/Lib/ctypes/test/test_loading.py b/Lib/ctypes/test/test_loading.py
index 291fcca..4b95029 100644
--- a/Lib/ctypes/test/test_loading.py
+++ b/Lib/ctypes/test/test_loading.py
@@ -1,6 +1,6 @@
 from ctypes import *
 import sys, unittest
-import os, StringIO
+import os
 from ctypes.util import find_library
 from ctypes.test import is_resource_enabled
 
diff --git a/Lib/ctypes/test/test_numbers.py b/Lib/ctypes/test/test_numbers.py
index 5845741..dfd84ee 100644
--- a/Lib/ctypes/test/test_numbers.py
+++ b/Lib/ctypes/test/test_numbers.py
@@ -1,6 +1,6 @@
 from ctypes import *
 import unittest
-import sys, struct
+import struct
 
 def valid_ranges(*types):
     # given a sequence of numeric types, collect their _type_
diff --git a/Lib/curses/wrapper.py b/Lib/curses/wrapper.py
index 5335204..9f1d867 100644
--- a/Lib/curses/wrapper.py
+++ b/Lib/curses/wrapper.py
@@ -7,7 +7,7 @@
 
 """
 
-import sys, curses
+import curses
 
 def wrapper(func, *args, **kwds):
     """Wrapper function that initializes curses and calls another function,
diff --git a/Lib/distutils/bcppcompiler.py b/Lib/distutils/bcppcompiler.py
index ca524a5..d4fc533 100644
--- a/Lib/distutils/bcppcompiler.py
+++ b/Lib/distutils/bcppcompiler.py
@@ -16,7 +16,7 @@
 __revision__ = "$Id$"
 
 
-import sys, os
+import os
 from distutils.errors import \
      DistutilsExecError, DistutilsPlatformError, \
      CompileError, LibError, LinkError, UnknownFileError
diff --git a/Lib/distutils/command/bdist.py b/Lib/distutils/command/bdist.py
index 23c25a5..d6897d2 100644
--- a/Lib/distutils/command/bdist.py
+++ b/Lib/distutils/command/bdist.py
@@ -7,7 +7,7 @@
 
 __revision__ = "$Id$"
 
-import os, string
+import os
 from types import *
 from distutils.core import Command
 from distutils.errors import *
diff --git a/Lib/distutils/command/bdist_dumb.py b/Lib/distutils/command/bdist_dumb.py
index ccba009..f740c46 100644
--- a/Lib/distutils/command/bdist_dumb.py
+++ b/Lib/distutils/command/bdist_dumb.py
@@ -11,7 +11,7 @@
 import os
 from distutils.core import Command
 from distutils.util import get_platform
-from distutils.dir_util import create_tree, remove_tree, ensure_relative
+from distutils.dir_util import remove_tree, ensure_relative
 from distutils.errors import *
 from distutils.sysconfig import get_python_version
 from distutils import log
diff --git a/Lib/distutils/command/bdist_msi.py b/Lib/distutils/command/bdist_msi.py
index a1c0df4..a401452 100644
--- a/Lib/distutils/command/bdist_msi.py
+++ b/Lib/distutils/command/bdist_msi.py
@@ -7,7 +7,7 @@
 Implements the bdist_msi command.
 """
 
-import sys, os, string
+import sys, os
 from distutils.core import Command
 from distutils.util import get_platform
 from distutils.dir_util import remove_tree
diff --git a/Lib/distutils/command/bdist_rpm.py b/Lib/distutils/command/bdist_rpm.py
index 6f0e0d8..9aa7030 100644
--- a/Lib/distutils/command/bdist_rpm.py
+++ b/Lib/distutils/command/bdist_rpm.py
@@ -8,7 +8,6 @@
 __revision__ = "$Id$"
 
 import sys, os, string
-import glob
 from types import *
 from distutils.core import Command
 from distutils.debug import DEBUG
diff --git a/Lib/distutils/command/build_py.py b/Lib/distutils/command/build_py.py
index b9f39ba..be6d2c5 100644
--- a/Lib/distutils/command/build_py.py
+++ b/Lib/distutils/command/build_py.py
@@ -6,7 +6,7 @@
 
 __revision__ = "$Id$"
 
-import sys, string, os
+import string, os
 from types import *
 from glob import glob
 
diff --git a/Lib/distutils/command/build_scripts.py b/Lib/distutils/command/build_scripts.py
index 6af363b..104be0b 100644
--- a/Lib/distutils/command/build_scripts.py
+++ b/Lib/distutils/command/build_scripts.py
@@ -6,7 +6,7 @@
 
 __revision__ = "$Id$"
 
-import sys, os, re
+import os, re
 from stat import ST_MODE
 from distutils import sysconfig
 from distutils.core import Command
diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
index c621210..0d39b91 100644
--- a/Lib/distutils/command/install.py
+++ b/Lib/distutils/command/install.py
@@ -17,7 +17,6 @@
 from distutils.file_util import write_file
 from distutils.util import convert_path, subst_vars, change_root
 from distutils.errors import DistutilsOptionError
-from glob import glob
 
 if sys.version < "2.2":
     WINDOWS_SCHEME = {
diff --git a/Lib/distutils/command/install_headers.py b/Lib/distutils/command/install_headers.py
index 2bd1b04..4895240 100644
--- a/Lib/distutils/command/install_headers.py
+++ b/Lib/distutils/command/install_headers.py
@@ -7,7 +7,6 @@
 
 __revision__ = "$Id$"
 
-import os
 from distutils.core import Command
 
 
diff --git a/Lib/distutils/command/install_lib.py b/Lib/distutils/command/install_lib.py
index 08ff543..81107a8 100644
--- a/Lib/distutils/command/install_lib.py
+++ b/Lib/distutils/command/install_lib.py
@@ -2,7 +2,7 @@
 
 __revision__ = "$Id$"
 
-import sys, os, string
+import os
 from types import IntType
 from distutils.core import Command
 from distutils.errors import DistutilsOptionError
diff --git a/Lib/distutils/command/register.py b/Lib/distutils/command/register.py
index d1a9100..5c588ef 100644
--- a/Lib/distutils/command/register.py
+++ b/Lib/distutils/command/register.py
@@ -7,7 +7,7 @@
 
 __revision__ = "$Id$"
 
-import sys, os, string, urllib2, getpass, urlparse
+import os, string, urllib2, getpass, urlparse
 import StringIO, ConfigParser
 
 from distutils.core import Command
diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py
index a06b195..9b37f78 100644
--- a/Lib/distutils/command/sdist.py
+++ b/Lib/distutils/command/sdist.py
@@ -6,7 +6,7 @@
 
 __revision__ = "$Id$"
 
-import sys, os, string
+import os, string
 from types import *
 from glob import glob
 from distutils.core import Command
diff --git a/Lib/distutils/filelist.py b/Lib/distutils/filelist.py
index 43f9aaa..6d27cce 100644
--- a/Lib/distutils/filelist.py
+++ b/Lib/distutils/filelist.py
@@ -11,7 +11,6 @@
 import os, string, re
 import fnmatch
 from types import *
-from glob import glob
 from distutils.util import convert_path
 from distutils.errors import DistutilsTemplateError, DistutilsInternalError
 from distutils import log
diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py
index 4d2a7cd..5ae7933 100644
--- a/Lib/distutils/tests/test_dist.py
+++ b/Lib/distutils/tests/test_dist.py
@@ -3,10 +3,8 @@
 import distutils.cmd
 import distutils.dist
 import os
-import shutil
 import StringIO
 import sys
-import tempfile
 import unittest
 
 from test.test_support import TESTFN
diff --git a/Lib/distutils/tests/test_sysconfig.py b/Lib/distutils/tests/test_sysconfig.py
index 770b7c3..d56f7e9 100644
--- a/Lib/distutils/tests/test_sysconfig.py
+++ b/Lib/distutils/tests/test_sysconfig.py
@@ -2,7 +2,6 @@
 
 from distutils import sysconfig
 import os
-import sys
 import unittest
 
 from test.test_support import TESTFN
diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
index 75e8a53..dc759ee 100644
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -17,7 +17,6 @@
 
 import os, sys
 from types import StringType, NoneType
-from copy import copy
 
 from distutils import sysconfig
 from distutils.dep_util import newer
diff --git a/Lib/email/base64mime.py b/Lib/email/base64mime.py
index 0129d9d..8e76e43 100644
--- a/Lib/email/base64mime.py
+++ b/Lib/email/base64mime.py
@@ -35,7 +35,6 @@
     'header_encode',
     ]
 
-import re
 
 from binascii import b2a_base64, a2b_base64
 from email.utils import fix_eols
diff --git a/Lib/email/utils.py b/Lib/email/utils.py
index ee952d3..50010e6 100644
--- a/Lib/email/utils.py
+++ b/Lib/email/utils.py
@@ -27,7 +27,6 @@
 import socket
 import urllib
 import warnings
-from cStringIO import StringIO
 
 from email._parseaddr import quote
 from email._parseaddr import AddressList as _AddressList
diff --git a/Lib/hotshot/log.py b/Lib/hotshot/log.py
index 7d6d91d..99d0729 100644
--- a/Lib/hotshot/log.py
+++ b/Lib/hotshot/log.py
@@ -2,7 +2,6 @@
 import os.path
 import parser
 import symbol
-import sys
 
 from _hotshot import \
      WHAT_ENTER, \
diff --git a/Lib/hotshot/stones.py b/Lib/hotshot/stones.py
index cd4c51d..fb88d58 100644
--- a/Lib/hotshot/stones.py
+++ b/Lib/hotshot/stones.py
@@ -1,7 +1,6 @@
 import errno
 import hotshot
 import hotshot.stats
-import os
 import sys
 import test.pystone
 
diff --git a/Lib/httplib.py b/Lib/httplib.py
index 6d27d24..c7d8e78 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -66,7 +66,6 @@
 Req-sent-unread-response       _CS_REQ_SENT       <response_class>
 """
 
-import errno
 import mimetools
 import socket
 from urlparse import urlsplit
diff --git a/Lib/idlelib/MultiCall.py b/Lib/idlelib/MultiCall.py
index 547df13..51de639 100644
--- a/Lib/idlelib/MultiCall.py
+++ b/Lib/idlelib/MultiCall.py
@@ -30,7 +30,6 @@
 """
 
 import sys
-import os
 import string
 import re
 import Tkinter
diff --git a/Lib/idlelib/RemoteDebugger.py b/Lib/idlelib/RemoteDebugger.py
index 74085c3..fa234d1 100644
--- a/Lib/idlelib/RemoteDebugger.py
+++ b/Lib/idlelib/RemoteDebugger.py
@@ -20,7 +20,6 @@
 
 """
 
-import sys
 import types
 import rpc
 import Debugger
diff --git a/Lib/idlelib/TreeWidget.py b/Lib/idlelib/TreeWidget.py
index c5c171f..5299e0e 100644
--- a/Lib/idlelib/TreeWidget.py
+++ b/Lib/idlelib/TreeWidget.py
@@ -15,7 +15,6 @@
 # - optimize tree redraw after expand of subnode
 
 import os
-import sys
 from Tkinter import *
 import imp
 
diff --git a/Lib/idlelib/UndoDelegator.py b/Lib/idlelib/UndoDelegator.py
index 182a117..5896bd5 100644
--- a/Lib/idlelib/UndoDelegator.py
+++ b/Lib/idlelib/UndoDelegator.py
@@ -1,4 +1,3 @@
-import sys
 import string
 from Tkinter import *
 from Delegator import Delegator
diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py
index 010ab2c..acab053 100644
--- a/Lib/idlelib/configDialog.py
+++ b/Lib/idlelib/configDialog.py
@@ -11,7 +11,7 @@
 """
 from Tkinter import *
 import tkMessageBox, tkColorChooser, tkFont
-import string, copy
+import string
 
 from configHandler import idleConf
 from dynOptionMenuWidget import DynOptionMenu
diff --git a/Lib/idlelib/keybindingDialog.py b/Lib/idlelib/keybindingDialog.py
index aff9cac..1ce7ff4 100644
--- a/Lib/idlelib/keybindingDialog.py
+++ b/Lib/idlelib/keybindingDialog.py
@@ -3,7 +3,7 @@
 """
 from Tkinter import *
 import tkMessageBox
-import string, os
+import string
 
 class GetKeysDialog(Toplevel):
     def __init__(self,parent,title,action,currentKeySequences):
diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py
index 6e91982..7827c74 100644
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -1,5 +1,4 @@
 import sys
-import os
 import linecache
 import time
 import socket
diff --git a/Lib/lib-tk/tkSimpleDialog.py b/Lib/lib-tk/tkSimpleDialog.py
index 03475f4..6948a49 100644
--- a/Lib/lib-tk/tkSimpleDialog.py
+++ b/Lib/lib-tk/tkSimpleDialog.py
@@ -26,7 +26,6 @@
 '''
 
 from Tkinter import *
-import os
 
 class Dialog(Toplevel):
 
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index e8081d6..a974e83 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -27,7 +27,7 @@
 To use, simply 'import logging' and log away!
 """
 
-import sys, logging, socket, types, os, string, cPickle, struct, time, glob
+import logging, socket, types, os, string, cPickle, struct, time, glob
 from stat import ST_DEV, ST_INO
 
 try:
diff --git a/Lib/ntpath.py b/Lib/ntpath.py
index c4a4ac5..59f1402 100644
--- a/Lib/ntpath.py
+++ b/Lib/ntpath.py
@@ -6,8 +6,8 @@
 """
 
 import os
-import stat
 import sys
+import stat
 import genericpath
 from genericpath import *
 
diff --git a/Lib/plat-mac/MiniAEFrame.py b/Lib/plat-mac/MiniAEFrame.py
index 98247cb..6a08dc9 100644
--- a/Lib/plat-mac/MiniAEFrame.py
+++ b/Lib/plat-mac/MiniAEFrame.py
@@ -6,7 +6,6 @@
         only suitable for the simplest of AppleEvent servers.
 """
 
-import sys
 import traceback
 import MacOS
 from Carbon import AE
diff --git a/Lib/plat-mac/aepack.py b/Lib/plat-mac/aepack.py
index 529a0a4..9ad9c44 100644
--- a/Lib/plat-mac/aepack.py
+++ b/Lib/plat-mac/aepack.py
@@ -13,18 +13,14 @@
 #
 
 import struct
-import string
 import types
-from string import strip
 from types import *
 from Carbon import AE
 from Carbon.AppleEvents import *
 import MacOS
 import Carbon.File
-import StringIO
 import aetypes
 from aetypes import mkenum, ObjectSpecifier
-import os
 
 # These ones seem to be missing from AppleEvents
 # (they're in AERegistry.h)
diff --git a/Lib/plat-mac/bgenlocations.py b/Lib/plat-mac/bgenlocations.py
index e7fa354..271eb3e 100644
--- a/Lib/plat-mac/bgenlocations.py
+++ b/Lib/plat-mac/bgenlocations.py
@@ -5,7 +5,7 @@
 # but mac-style for MacPython, whether running on OS9 or OSX.
 #
 
-import sys, os
+import os
 
 Error = "bgenlocations.Error"
 #
diff --git a/Lib/plat-mac/macostools.py b/Lib/plat-mac/macostools.py
index fc4861e..217f9e8 100644
--- a/Lib/plat-mac/macostools.py
+++ b/Lib/plat-mac/macostools.py
@@ -7,9 +7,7 @@
 from Carbon import Res
 from Carbon import File, Files
 import os
-import sys
 import MacOS
-import time
 try:
     openrf = MacOS.openrf
 except AttributeError:
diff --git a/Lib/plat-riscos/rourl2path.py b/Lib/plat-riscos/rourl2path.py
index 7a8badf..5d5386e 100644
--- a/Lib/plat-riscos/rourl2path.py
+++ b/Lib/plat-riscos/rourl2path.py
@@ -4,7 +4,6 @@
 
 import string
 import urllib
-import os
 
 __all__ = ["url2pathname","pathname2url"]
 
diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py
index 761bdaa..cb0a621 100644
--- a/Lib/sqlite3/test/hooks.py
+++ b/Lib/sqlite3/test/hooks.py
@@ -21,7 +21,7 @@
 #    misrepresented as being the original software.
 # 3. This notice may not be removed or altered from any source distribution.
 
-import os, unittest
+import unittest
 import sqlite3 as sqlite
 
 class CollationTests(unittest.TestCase):
diff --git a/Lib/ssl.py b/Lib/ssl.py
index 9288144..24502e4 100644
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -55,7 +55,7 @@
 PROTOCOL_TLSv1
 """
 
-import os, sys, textwrap
+import textwrap
 
 import _ssl             # if we can't import it, let the error propagate
 
diff --git a/Lib/test/fork_wait.py b/Lib/test/fork_wait.py
index 7eb55f6..3c75de3 100644
--- a/Lib/test/fork_wait.py
+++ b/Lib/test/fork_wait.py
@@ -13,7 +13,6 @@
 """
 
 import os, sys, time, thread, unittest
-from test.test_support import TestSkipped
 
 LONGSLEEP = 2
 SHORTSLEEP = 0.5
diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py
index 88bc49d..b3f24d3 100644
--- a/Lib/test/list_tests.py
+++ b/Lib/test/list_tests.py
@@ -5,7 +5,6 @@
 import sys
 import os
 
-import unittest
 from test import test_support, seq_tests
 
 class CommonTest(seq_tests.CommonTest):
diff --git a/Lib/test/seq_tests.py b/Lib/test/seq_tests.py
index 2ea5094..d9b2d29 100644
--- a/Lib/test/seq_tests.py
+++ b/Lib/test/seq_tests.py
@@ -3,7 +3,6 @@
 """
 
 import unittest
-from test import test_support
 import sys
 
 # Various iterables
diff --git a/Lib/test/test_MimeWriter.py b/Lib/test/test_MimeWriter.py
index 5a20bf2..6a32cb6 100644
--- a/Lib/test/test_MimeWriter.py
+++ b/Lib/test/test_MimeWriter.py
@@ -7,7 +7,7 @@
 
 """
 
-import unittest, sys, StringIO
+import unittest, StringIO
 from test.test_support import run_unittest
 
 import warnings
diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py
index 26ed012..571e391 100644
--- a/Lib/test/test___all__.py
+++ b/Lib/test/test___all__.py
@@ -1,5 +1,5 @@
 import unittest
-from test.test_support import verbose, run_unittest
+from test.test_support import run_unittest
 import sys
 import warnings
 
diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py
index ac5f7ee..c53dcea 100644
--- a/Lib/test/test_abc.py
+++ b/Lib/test/test_abc.py
@@ -3,7 +3,6 @@
 
 """Unit tests for abc.py."""
 
-import sys
 import unittest
 from test import test_support
 
diff --git a/Lib/test/test_applesingle.py b/Lib/test/test_applesingle.py
index d533f1a..e915028 100644
--- a/Lib/test/test_applesingle.py
+++ b/Lib/test/test_applesingle.py
@@ -5,7 +5,6 @@
 import Carbon.File
 import MacOS
 import os
-import sys
 from test import test_support
 import struct
 import applesingle
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
index 0bb7e53..a54594a 100755
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -6,7 +6,7 @@
 import unittest
 from test import test_support
 from weakref import proxy
-import array, cStringIO, math
+import array, cStringIO
 from cPickle import loads, dumps
 
 class ArraySubclass(array.array):
diff --git a/Lib/test/test_bsddb185.py b/Lib/test/test_bsddb185.py
index df1ece0..51e1a7e 100644
--- a/Lib/test/test_bsddb185.py
+++ b/Lib/test/test_bsddb185.py
@@ -4,7 +4,7 @@
 testing suite.
 
 """
-from test.test_support import verbose, run_unittest, findfile
+from test.test_support import run_unittest, findfile
 import unittest
 import bsddb185
 import anydbm
diff --git a/Lib/test/test_class.py b/Lib/test/test_class.py
index 9cf3331..fc61d21 100644
--- a/Lib/test/test_class.py
+++ b/Lib/test/test_class.py
@@ -1,7 +1,6 @@
 "Test the functionality of Python classes implementing operators."
 
 import unittest
-import sys
 
 from test import test_support
 
diff --git a/Lib/test/test_cmd.py b/Lib/test/test_cmd.py
index 5aa1c40..c08df0b 100644
--- a/Lib/test/test_cmd.py
+++ b/Lib/test/test_cmd.py
@@ -5,7 +5,6 @@
 """
 
 
-from test import test_support
 import cmd
 import sys
 
@@ -170,7 +169,7 @@
     from test import test_support, test_cmd
     test_support.run_doctest(test_cmd, verbose)
 
-import trace, sys,re,StringIO
+import trace, sys
 def test_coverage(coverdir):
     tracer=trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,],
                         trace=0, count=1)
diff --git a/Lib/test/test_coercion.py b/Lib/test/test_coercion.py
index d704e4b..e3a7e43 100644
--- a/Lib/test/test_coercion.py
+++ b/Lib/test/test_coercion.py
@@ -1,5 +1,4 @@
 import copy
-import sys
 import warnings
 import unittest
 from test.test_support import run_unittest, TestFailed
diff --git a/Lib/test/test_compare.py b/Lib/test/test_compare.py
index 2fde614..13da80d 100644
--- a/Lib/test/test_compare.py
+++ b/Lib/test/test_compare.py
@@ -1,4 +1,3 @@
-import sys
 import unittest
 from test import test_support
 
diff --git a/Lib/test/test_compiler.py b/Lib/test/test_compiler.py
index 606ed70..7d5ec7c 100644
--- a/Lib/test/test_compiler.py
+++ b/Lib/test/test_compiler.py
@@ -52,7 +52,8 @@
                         compiler.compile(buf, basename, "exec")
                     except Exception, e:
                         args = list(e.args)
-                        args[0] += "[in file %s]" % basename
+                        args.append("in file %s]" % basename)
+                        #args[0] += "[in file %s]" % basename
                         e.args = tuple(args)
                         raise
 
diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py
index ff4c987..d2899bd 100644
--- a/Lib/test/test_copy.py
+++ b/Lib/test/test_copy.py
@@ -1,6 +1,5 @@
 """Unit tests for the copy module."""
 
-import sys
 import copy
 import copy_reg
 
diff --git a/Lib/test/test_cpickle.py b/Lib/test/test_cpickle.py
index 78beda7..d6e703a 100644
--- a/Lib/test/test_cpickle.py
+++ b/Lib/test/test_cpickle.py
@@ -1,5 +1,4 @@
 import cPickle
-import unittest
 from cStringIO import StringIO
 from test.pickletester import AbstractPickleTests, AbstractPickleModuleTests
 from test import test_support
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py
index cb639b4..ee104e4 100644
--- a/Lib/test/test_datetime.py
+++ b/Lib/test/test_datetime.py
@@ -4,7 +4,6 @@
 """
 
 import os
-import sys
 import pickle
 import cPickle
 import unittest
diff --git a/Lib/test/test_dbm.py b/Lib/test/test_dbm.py
index b93e72e..4da0932 100755
--- a/Lib/test/test_dbm.py
+++ b/Lib/test/test_dbm.py
@@ -3,7 +3,6 @@
    Roger E. Masse
 """
 import os
-import random
 import dbm
 from dbm import error
 from test.test_support import verbose, verify, TestSkipped, TESTFN
diff --git a/Lib/test/test_deque.py b/Lib/test/test_deque.py
index e0ca746..b69110d 100644
--- a/Lib/test/test_deque.py
+++ b/Lib/test/test_deque.py
@@ -4,7 +4,6 @@
 from weakref import proxy
 import copy
 import cPickle as pickle
-from cStringIO import StringIO
 import random
 import os
 
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py
index 4ed76ea..7dd5f06 100644
--- a/Lib/test/test_dict.py
+++ b/Lib/test/test_dict.py
@@ -1,7 +1,7 @@
 import unittest
 from test import test_support
 
-import sys, UserDict, cStringIO, random, string
+import UserDict, random, string
 
 
 class DictTest(unittest.TestCase):
diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py
index d0e1c7e..fd508a9 100644
--- a/Lib/test/test_dis.py
+++ b/Lib/test/test_dis.py
@@ -1,6 +1,6 @@
 # Minimal tests for dis module
 
-from test.test_support import verbose, run_unittest
+from test.test_support import run_unittest
 import unittest
 import sys
 import dis
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index 8c8786a..943fb82 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -2418,7 +2418,7 @@
     from test import test_doctest
     test_support.run_doctest(test_doctest, verbosity=True)
 
-import trace, sys, re, StringIO
+import trace, sys
 def test_coverage(coverdir):
     tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,],
                          trace=0, count=1)
diff --git a/Lib/test/test_dummy_threading.py b/Lib/test/test_dummy_threading.py
index 3724f1e..dcb9729 100644
--- a/Lib/test/test_dummy_threading.py
+++ b/Lib/test/test_dummy_threading.py
@@ -3,7 +3,6 @@
 # Create a bunch of threads, let each do some work, wait until all are done
 
 from test.test_support import verbose
-import random
 import dummy_threading as _threading
 import time
 
diff --git a/Lib/test/test_email.py b/Lib/test/test_email.py
index f609968..cb4ee60 100644
--- a/Lib/test/test_email.py
+++ b/Lib/test/test_email.py
@@ -1,7 +1,6 @@
 # Copyright (C) 2001,2002 Python Software Foundation
 # email package unit tests
 
-import unittest
 # The specific tests now live in Lib/email/test
 from email.test.test_email import suite
 from test import test_support
diff --git a/Lib/test/test_email_renamed.py b/Lib/test/test_email_renamed.py
index 163e791..2c814df 100644
--- a/Lib/test/test_email_renamed.py
+++ b/Lib/test/test_email_renamed.py
@@ -1,7 +1,6 @@
 # Copyright (C) 2001-2006 Python Software Foundation
 # email package unit tests
 
-import unittest
 # The specific tests now live in Lib/email/test
 from email.test.test_email_renamed import suite
 from test import test_support
diff --git a/Lib/test/test_eof.py b/Lib/test/test_eof.py
index aae3518..4d4c03b 100644
--- a/Lib/test/test_eof.py
+++ b/Lib/test/test_eof.py
@@ -1,7 +1,6 @@
 #! /usr/bin/env python
 """test script for a few new invalid token catches"""
 
-import os
 import unittest
 from test import test_support
 
diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py
index 96d1bc1..bdf8e03 100644
--- a/Lib/test/test_extcall.py
+++ b/Lib/test/test_extcall.py
@@ -1,4 +1,4 @@
-from test.test_support import verify, verbose, TestFailed, sortdict
+from test.test_support import verify, TestFailed, sortdict
 from UserList import UserList
 from UserDict import UserDict
 
diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py
index f6589b7..9fb3ea7 100644
--- a/Lib/test/test_fileinput.py
+++ b/Lib/test/test_fileinput.py
@@ -6,7 +6,7 @@
 import unittest
 from test.test_support import verbose, TESTFN, run_unittest
 from test.test_support import unlink as safe_unlink
-import sys, os, re
+import sys, re
 from StringIO import StringIO
 from fileinput import FileInput, hook_encoded
 
diff --git a/Lib/test/test_fractions.py b/Lib/test/test_fractions.py
index 654456a..743f094 100644
--- a/Lib/test/test_fractions.py
+++ b/Lib/test/test_fractions.py
@@ -1,7 +1,7 @@
 """Tests for Lib/fractions.py."""
 
 from decimal import Decimal
-from test.test_support import run_unittest, verbose
+from test.test_support import run_unittest
 import math
 import operator
 import fractions
diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py
index 90ca303..fa76fbc 100644
--- a/Lib/test/test_getargs2.py
+++ b/Lib/test/test_getargs2.py
@@ -1,8 +1,7 @@
 import unittest
 from test import test_support
-import sys
 
-import warnings, re
+import warnings
 warnings.filterwarnings("ignore",
                         category=DeprecationWarning,
                         message=".*integer argument expected, got float",
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index 124a469..1704a60 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -4,7 +4,7 @@
 
 import unittest
 from test import test_support
-import sys, os
+import os
 import gzip
 
 
diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py
index 229bbed..810af6c 100755
--- a/Lib/test/test_htmlparser.py
+++ b/Lib/test/test_htmlparser.py
@@ -2,7 +2,6 @@
 
 import HTMLParser
 import pprint
-import sys
 import unittest
 from test import test_support
 
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index 6a20c6b..d312ae5 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -1,6 +1,5 @@
 import httplib
 import StringIO
-import sys
 import socket
 
 from unittest import TestCase
diff --git a/Lib/test/test_imgfile.py b/Lib/test/test_imgfile.py
index bdfd796..11311c4 100755
--- a/Lib/test/test_imgfile.py
+++ b/Lib/test/test_imgfile.py
@@ -6,7 +6,7 @@
 
 from test.test_support import verbose, unlink, findfile
 
-import imgfile, uu, os
+import imgfile, uu
 
 
 def main():
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
index 62b14e0..f597728 100644
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -1,5 +1,4 @@
 import imp
-import thread
 import unittest
 from test import test_support
 
diff --git a/Lib/test/test_index.py b/Lib/test/test_index.py
index 323b37b..75f2434 100644
--- a/Lib/test/test_index.py
+++ b/Lib/test/test_index.py
@@ -1,7 +1,6 @@
 import unittest
 from test import test_support
 import operator
-import sys
 from sys import maxint
 maxsize = test_support.MAX_Py_ssize_t
 minsize = -maxsize-1
diff --git a/Lib/test/test_linuxaudiodev.py b/Lib/test/test_linuxaudiodev.py
index 5d1d1ce..303490b 100644
--- a/Lib/test/test_linuxaudiodev.py
+++ b/Lib/test/test_linuxaudiodev.py
@@ -4,13 +4,9 @@
 from test.test_support import findfile, TestSkipped, run_unittest
 
 import errno
-import fcntl
 import linuxaudiodev
-import os
 import sys
-import select
 import sunaudio
-import time
 import audioop
 import unittest
 
diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py
index 3489529..37507fe 100644
--- a/Lib/test/test_list.py
+++ b/Lib/test/test_list.py
@@ -1,4 +1,3 @@
-import unittest
 import sys
 from test import test_support, list_tests
 
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 1ed6cb2..5a96664 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -1858,8 +1858,8 @@
 <BLANKLINE>
 """
 import select
-import os, sys, string, struct, types, cPickle, cStringIO
-import socket, tempfile, threading, time
+import os, sys, string, struct, cPickle, cStringIO
+import socket, threading
 import logging, logging.handlers, logging.config, test.test_support
 
 
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index fcc4c8f..97bca2c 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -3,7 +3,6 @@
 import os
 import sys
 import pickle
-import traceback
 from StringIO import StringIO
 from test.test_support import verbose, run_unittest, TestSkipped
 import unittest
diff --git a/Lib/test/test_module.py b/Lib/test/test_module.py
index cc8b192..e0c7ec3 100644
--- a/Lib/test/test_module.py
+++ b/Lib/test/test_module.py
@@ -1,6 +1,6 @@
 # Test the module type
 import unittest
-from test.test_support import verbose, run_unittest
+from test.test_support import run_unittest
 
 import sys
 ModuleType = type(sys)
diff --git a/Lib/test/test_modulefinder.py b/Lib/test/test_modulefinder.py
index 18cc322..b62758a 100644
--- a/Lib/test/test_modulefinder.py
+++ b/Lib/test/test_modulefinder.py
@@ -1,5 +1,5 @@
 import __future__
-import sys, os
+import os
 import unittest
 import distutils.dir_util
 import tempfile
diff --git a/Lib/test/test_multibytecodec_support.py b/Lib/test/test_multibytecodec_support.py
index 57a4751..6055764 100644
--- a/Lib/test/test_multibytecodec_support.py
+++ b/Lib/test/test_multibytecodec_support.py
@@ -4,7 +4,7 @@
 #   Common Unittest Routines for CJK codecs
 #
 
-import sys, codecs, os.path
+import sys, codecs
 import unittest, re
 from test import test_support
 from StringIO import StringIO
diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py
index 38d5207..7a917d8 100644
--- a/Lib/test/test_optparse.py
+++ b/Lib/test/test_optparse.py
@@ -16,7 +16,6 @@
 import unittest
 
 from StringIO import StringIO
-from pprint import pprint
 from test import test_support
 
 
diff --git a/Lib/test/test_ossaudiodev.py b/Lib/test/test_ossaudiodev.py
index 83cc344..f2ce67b 100644
--- a/Lib/test/test_ossaudiodev.py
+++ b/Lib/test/test_ossaudiodev.py
@@ -1,14 +1,11 @@
 from test import test_support
 test_support.requires('audio')
 
-from test.test_support import verbose, findfile, TestSkipped
+from test.test_support import findfile, TestSkipped
 
 import errno
-import fcntl
 import ossaudiodev
-import os
 import sys
-import select
 import sunaudio
 import time
 import audioop
diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py
index 585644e..fb10ffe 100644
--- a/Lib/test/test_pickle.py
+++ b/Lib/test/test_pickle.py
@@ -1,5 +1,4 @@
 import pickle
-import unittest
 from cStringIO import StringIO
 
 from test import test_support
diff --git a/Lib/test/test_pkg.py b/Lib/test/test_pkg.py
index 28f9943..4fa367f 100644
--- a/Lib/test/test_pkg.py
+++ b/Lib/test/test_pkg.py
@@ -4,7 +4,6 @@
 import os
 import tempfile
 import textwrap
-import traceback
 import unittest
 from test import test_support
 
diff --git a/Lib/test/test_plistlib.py b/Lib/test/test_plistlib.py
index 8e8d3e3..47630dc 100644
--- a/Lib/test/test_plistlib.py
+++ b/Lib/test/test_plistlib.py
@@ -3,7 +3,6 @@
 import unittest
 import plistlib
 import os
-import time
 import datetime
 from test import test_support
 
diff --git a/Lib/test/test_poll.py b/Lib/test/test_poll.py
index 60cd3f4..5dbfc2c 100644
--- a/Lib/test/test_poll.py
+++ b/Lib/test/test_poll.py
@@ -1,6 +1,6 @@
 # Test case for the os.poll() function
 
-import sys, os, select, random, unittest
+import os, select, random, unittest
 from test.test_support import TestSkipped, TESTFN, run_unittest
 
 try:
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 7207de5..1fb3c48 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -9,7 +9,6 @@
 
 import time
 import os
-import sys
 import unittest
 import warnings
 warnings.filterwarnings('ignore', '.* potential security risk .*',
diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py
index 56fb683..d1291a0 100644
--- a/Lib/test/test_pyclbr.py
+++ b/Lib/test/test_pyclbr.py
@@ -3,7 +3,7 @@
    Nick Mathewson
 '''
 from test.test_support import run_unittest
-import unittest, sys
+import sys
 from types import ClassType, FunctionType, MethodType, BuiltinFunctionType
 import pyclbr
 from unittest import TestCase
diff --git a/Lib/test/test_quopri.py b/Lib/test/test_quopri.py
index 631c974..24a2f44 100644
--- a/Lib/test/test_quopri.py
+++ b/Lib/test/test_quopri.py
@@ -1,7 +1,7 @@
 from test import test_support
 import unittest
 
-import sys, os, cStringIO, subprocess
+import sys, cStringIO, subprocess
 import quopri
 
 
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py
index 225f882..f354a1b 100644
--- a/Lib/test/test_resource.py
+++ b/Lib/test/test_resource.py
@@ -1,7 +1,6 @@
 import unittest
 from test import test_support
 
-import os
 import resource
 import time
 
diff --git a/Lib/test/test_rfc822.py b/Lib/test/test_rfc822.py
index 6d22825..197887d 100644
--- a/Lib/test/test_rfc822.py
+++ b/Lib/test/test_rfc822.py
@@ -1,5 +1,4 @@
 import rfc822
-import sys
 import unittest
 from test import test_support
 
diff --git a/Lib/test/test_scriptpackages.py b/Lib/test/test_scriptpackages.py
index a2e03f9..ee14be2 100644
--- a/Lib/test/test_scriptpackages.py
+++ b/Lib/test/test_scriptpackages.py
@@ -1,9 +1,6 @@
 # Copyright (C) 2003 Python Software Foundation
 
 import unittest
-import os
-import sys
-import tempfile
 from test import test_support
 import aetools
 
diff --git a/Lib/test/test_sgmllib.py b/Lib/test/test_sgmllib.py
index b698636..d9c9ddc 100644
--- a/Lib/test/test_sgmllib.py
+++ b/Lib/test/test_sgmllib.py
@@ -1,4 +1,3 @@
-import htmlentitydefs
 import pprint
 import re
 import sgmllib
@@ -116,7 +115,7 @@
         try:
             events = self.get_events(source)
         except:
-            import sys
+            #import sys
             #print >>sys.stderr, pprint.pformat(self.events)
             raise
         if events != expected_events:
diff --git a/Lib/test/test_shlex.py b/Lib/test/test_shlex.py
index 5c6572a..6c35f49 100644
--- a/Lib/test/test_shlex.py
+++ b/Lib/test/test_shlex.py
@@ -1,6 +1,5 @@
 # -*- coding: iso-8859-1 -*-
 import unittest
-import os, sys
 import shlex
 
 from test import test_support
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index 3a8b9d3..c9957df 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -5,12 +5,11 @@
 
 """
 import unittest
-from test.test_support import TestSkipped, TestFailed, run_unittest, TESTFN
+from test.test_support import TestSkipped, run_unittest, TESTFN
 import __builtin__
 import os
 import sys
 import encodings
-import tempfile
 # Need to make sure to not import 'site' if someone specified ``-S`` at the
 # command-line.  Detect this by just making sure 'site' has not been imported
 # already.
diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py
index 79f3038..07dd778 100644
--- a/Lib/test/test_socketserver.py
+++ b/Lib/test/test_socketserver.py
@@ -9,7 +9,6 @@
 import select
 import time
 import threading
-from functools import wraps
 import unittest
 import SocketServer
 
diff --git a/Lib/test/test_sqlite.py b/Lib/test/test_sqlite.py
index f033772..c1523e1 100644
--- a/Lib/test/test_sqlite.py
+++ b/Lib/test/test_sqlite.py
@@ -1,5 +1,4 @@
 from test.test_support import run_unittest, TestSkipped
-import unittest
 
 try:
     import _sqlite3
diff --git a/Lib/test/test_str.py b/Lib/test/test_str.py
index 7ea46bb..37db252 100644
--- a/Lib/test/test_str.py
+++ b/Lib/test/test_str.py
@@ -1,5 +1,4 @@
 
-import unittest
 import struct
 import sys
 from test import test_support, string_tests
diff --git a/Lib/test/test_strftime.py b/Lib/test/test_strftime.py
index e9d3826..1105c00 100755
--- a/Lib/test/test_strftime.py
+++ b/Lib/test/test_strftime.py
@@ -2,7 +2,7 @@
 
 # Sanity checker for time.strftime
 
-import time, calendar, sys, os, re
+import time, calendar, sys, re
 from test.test_support import verbose
 
 def main():
diff --git a/Lib/test/test_sunaudiodev.py b/Lib/test/test_sunaudiodev.py
index f203d9a..3750542 100644
--- a/Lib/test/test_sunaudiodev.py
+++ b/Lib/test/test_sunaudiodev.py
@@ -1,4 +1,4 @@
-from test.test_support import verbose, findfile, TestFailed, TestSkipped
+from test.test_support import findfile, TestFailed, TestSkipped
 import sunaudiodev
 import os
 
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 9b4372c..d36d81c 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -10,7 +10,6 @@
 import os
 import os.path
 import warnings
-import types
 import unittest
 
 class Error(Exception):
diff --git a/Lib/test/test_tuple.py b/Lib/test/test_tuple.py
index dddb03e..c413709 100644
--- a/Lib/test/test_tuple.py
+++ b/Lib/test/test_tuple.py
@@ -1,4 +1,3 @@
-import unittest
 from test import test_support, seq_tests
 
 class TupleTest(seq_tests.CommonTest):
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index ccb9411f..bdc7192 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -6,7 +6,7 @@
 (c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
 
 """#"
-import unittest, sys, struct, codecs, new
+import sys, struct, codecs
 from test import test_support, string_tests
 
 # Error handling (bad decoder return)
diff --git a/Lib/test/test_unpack.py b/Lib/test/test_unpack.py
index 76a4822..7ddbc62 100644
--- a/Lib/test/test_unpack.py
+++ b/Lib/test/test_unpack.py
@@ -122,7 +122,6 @@
 __test__ = {'doctests' : doctests}
 
 def test_main(verbose=False):
-    import sys
     from test import test_support
     from test import test_unpack
     test_support.run_doctest(test_unpack, verbose)
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 455e7fc..0c669d0 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -8,10 +8,6 @@
 import mimetools
 import tempfile
 import StringIO
-import ftplib
-import threading
-import socket
-import time
 
 def hexescape(char):
     """Escape char as RFC 2396 specifies"""
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index a35cbfa..5727f8a 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -1,7 +1,7 @@
 import unittest
 from test import test_support
 
-import os, socket
+import os
 import StringIO
 
 import urllib2
@@ -589,7 +589,7 @@
             self.assertEqual(int(headers["Content-length"]), len(data))
 
     def test_file(self):
-        import time, rfc822, socket
+        import rfc822, socket
         h = urllib2.FileHandler()
         o = h.parent = MockOpener()
 
@@ -993,7 +993,7 @@
     def _test_basic_auth(self, opener, auth_handler, auth_header,
                          realm, http_handler, password_manager,
                          request_url, protected_url):
-        import base64, httplib
+        import base64
         user, password = "wile", "coyote"
 
         # .add_password() fed through to password manager
diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py
index b347e82..54bf2d9 100644
--- a/Lib/test/test_urllib2_localnet.py
+++ b/Lib/test/test_urllib2_localnet.py
@@ -1,6 +1,5 @@
 #!/usr/bin/env python
 
-import sys
 import threading
 import urlparse
 import urllib2
diff --git a/Lib/test/test_userdict.py b/Lib/test/test_userdict.py
index 357c0f0..0818e98 100644
--- a/Lib/test/test_userdict.py
+++ b/Lib/test/test_userdict.py
@@ -1,6 +1,5 @@
 # Check every path through every method of UserDict
 
-import unittest
 from test import test_support, mapping_tests
 import UserDict
 
diff --git a/Lib/test/test_userlist.py b/Lib/test/test_userlist.py
index 8c7ef2e..ed3e559 100644
--- a/Lib/test/test_userlist.py
+++ b/Lib/test/test_userlist.py
@@ -1,7 +1,6 @@
 # Check every path through every method of UserList
 
 from UserList import UserList
-import unittest
 from test import test_support, list_tests
 
 class UserListTest(list_tests.CommonTest):
diff --git a/Lib/test/test_userstring.py b/Lib/test/test_userstring.py
index b66dffe..06636fc 100755
--- a/Lib/test/test_userstring.py
+++ b/Lib/test/test_userstring.py
@@ -2,7 +2,6 @@
 # UserString is a wrapper around the native builtin string type.
 # UserString instances should behave similar to builtin string objects.
 
-import unittest
 import string
 from test import test_support, string_tests
 
diff --git a/Lib/test/test_uu.py b/Lib/test/test_uu.py
index 27d0d89..9aad56e 100644
--- a/Lib/test/test_uu.py
+++ b/Lib/test/test_uu.py
@@ -8,7 +8,6 @@
 
 import sys, os, uu, cStringIO
 import uu
-from StringIO import StringIO
 
 plaintext = "The smooth-scaled python crept over the sleeping dog\n"
 
diff --git a/Lib/test/test_whichdb.py b/Lib/test/test_whichdb.py
index f2652c1..1ce816f 100644
--- a/Lib/test/test_whichdb.py
+++ b/Lib/test/test_whichdb.py
@@ -8,7 +8,6 @@
 import unittest
 import whichdb
 import anydbm
-import tempfile
 import glob
 
 _fname = test.test_support.TESTFN
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index 78adb42..65c99f1 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -2,7 +2,8 @@
 # all included components work as they should.  For a more extensive
 # test suite, see the selftest script in the ElementTree distribution.
 
-import doctest, sys
+import doctest
+import sys
 
 from test import test_support
 
diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py
index 250f791..7ddd44b 100644
--- a/Lib/test/test_xml_etree_c.py
+++ b/Lib/test/test_xml_etree_c.py
@@ -1,6 +1,7 @@
 # xml.etree test for cElementTree
 
-import doctest, sys
+import doctest
+import sys
 
 from test import test_support
 
diff --git a/Lib/test/test_xpickle.py b/Lib/test/test_xpickle.py
index 42cd0f4..3ffb744 100644
--- a/Lib/test/test_xpickle.py
+++ b/Lib/test/test_xpickle.py
@@ -5,7 +5,6 @@
 
 import pickle
 import cPickle
-import unittest
 
 from test import test_support
 from test.pickletester import AbstractPickleTests
diff --git a/Lib/test/test_zipfile64.py b/Lib/test/test_zipfile64.py
index 449cf39..6ce2ae5 100644
--- a/Lib/test/test_zipfile64.py
+++ b/Lib/test/test_zipfile64.py
@@ -20,7 +20,6 @@
 import time
 import sys
 
-from StringIO import StringIO
 from tempfile import TemporaryFile
 
 from test.test_support import TESTFN, run_unittest