From 1e8ee9b3808cd6c1a7a29c75115d1060a8ee877b Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Sun, 24 Apr 2016 07:31:42 +0300 Subject: Issue #23277: Remove unused sys and os imports Patch by Jon Dufresne. --- Lib/ctypes/test/test_objects.py | 2 +- Lib/ctypes/test/test_parameters.py | 2 +- Lib/ctypes/test/test_returnfuncptrs.py | 1 - Lib/ctypes/test/test_sizes.py | 1 - Lib/test/audiotests.py | 2 +- Lib/test/make_ssl_certs.py | 1 - Lib/test/test_aifc.py | 1 - Lib/test/test_binhex.py | 1 - Lib/test/test_csv.py | 1 - Lib/test/test_dbm.py | 1 - Lib/test/test_dbm_ndbm.py | 1 - Lib/test/test_devpoll.py | 1 - Lib/test/test_eintr.py | 1 - Lib/test/test_email/__init__.py | 1 - Lib/test/test_heapq.py | 1 - Lib/test/test_importlib/extension/test_case_sensitivity.py | 1 - Lib/test/test_importlib/extension/test_path_hook.py | 1 - Lib/test/test_importlib/frozen/test_loader.py | 2 -- Lib/test/test_importlib/import_/test_relative_imports.py | 1 - Lib/test/test_importlib/source/test_case_sensitivity.py | 1 - Lib/test/test_json/__init__.py | 1 - Lib/test/test_kqueue.py | 1 - Lib/test/test_msilib.py | 1 - Lib/test/test_multibytecodec.py | 2 +- Lib/test/test_nis.py | 1 - Lib/test/test_normalization.py | 1 - Lib/test/test_parser.py | 1 - Lib/test/test_pep3151.py | 1 - Lib/test/test_posixpath.py | 1 - Lib/test/test_pulldom.py | 1 - Lib/test/test_quopri.py | 2 +- Lib/test/test_sort.py | 1 - Lib/test/test_strptime.py | 1 - Lib/test/test_tools/test_md5sum.py | 1 - Lib/test/test_tools/test_pdeps.py | 1 - Lib/test/test_ttk_guionly.py | 1 - Lib/test/test_ttk_textonly.py | 1 - Lib/test/test_unpack_ex.py | 1 - Lib/test/test_urllibnet.py | 1 - Lib/test/test_weakset.py | 2 -- Lib/test/test_xml_etree_c.py | 2 +- Lib/test/test_xmlrpc_net.py | 1 - Lib/test/test_zipfile.py | 1 - Lib/tkinter/test/runtktests.py | 1 - Lib/unittest/test/testmock/support.py | 2 -- 45 files changed, 6 insertions(+), 48 deletions(-) diff --git a/Lib/ctypes/test/test_objects.py b/Lib/ctypes/test/test_objects.py index ef7b20b..19e3dc1 100644 --- a/Lib/ctypes/test/test_objects.py +++ b/Lib/ctypes/test/test_objects.py @@ -54,7 +54,7 @@ of 'x' ('_b_base_' is either None, or the root object owning the memory block): ''' -import unittest, doctest, sys +import unittest, doctest import ctypes.test.test_objects diff --git a/Lib/ctypes/test/test_parameters.py b/Lib/ctypes/test/test_parameters.py index e56bccf..5c8d703 100644 --- a/Lib/ctypes/test/test_parameters.py +++ b/Lib/ctypes/test/test_parameters.py @@ -1,4 +1,4 @@ -import unittest, sys +import unittest from ctypes.test import need_symbol class SimpleTypesTestCase(unittest.TestCase): diff --git a/Lib/ctypes/test/test_returnfuncptrs.py b/Lib/ctypes/test/test_returnfuncptrs.py index 93eba6b..1974f40 100644 --- a/Lib/ctypes/test/test_returnfuncptrs.py +++ b/Lib/ctypes/test/test_returnfuncptrs.py @@ -1,6 +1,5 @@ import unittest from ctypes import * -import os import _ctypes_test diff --git a/Lib/ctypes/test/test_sizes.py b/Lib/ctypes/test/test_sizes.py index f9b5e97..4ceacbc 100644 --- a/Lib/ctypes/test/test_sizes.py +++ b/Lib/ctypes/test/test_sizes.py @@ -2,7 +2,6 @@ from ctypes import * -import sys import unittest diff --git a/Lib/test/audiotests.py b/Lib/test/audiotests.py index 0ae2242..e52c423 100644 --- a/Lib/test/audiotests.py +++ b/Lib/test/audiotests.py @@ -3,7 +3,7 @@ import unittest import array import io import pickle -import sys + class UnseekableIO(io.FileIO): def tell(self): diff --git a/Lib/test/make_ssl_certs.py b/Lib/test/make_ssl_certs.py index 81d04f8..e4326d7 100644 --- a/Lib/test/make_ssl_certs.py +++ b/Lib/test/make_ssl_certs.py @@ -3,7 +3,6 @@ and friends.""" import os import shutil -import sys import tempfile from subprocess import * diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py index ab51437..1bd1f89 100644 --- a/Lib/test/test_aifc.py +++ b/Lib/test/test_aifc.py @@ -2,7 +2,6 @@ from test.support import findfile, TESTFN, unlink import unittest from test import audiotests from audioop import byteswap -import os import io import sys import struct diff --git a/Lib/test/test_binhex.py b/Lib/test/test_binhex.py index 9d4c85a..21f4463 100644 --- a/Lib/test/test_binhex.py +++ b/Lib/test/test_binhex.py @@ -4,7 +4,6 @@ Based on an original test by Roger E. Masse. """ import binhex -import os import unittest from test import support diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py index 921fd4a..9095f72 100644 --- a/Lib/test/test_csv.py +++ b/Lib/test/test_csv.py @@ -4,7 +4,6 @@ import copy import io import sys -import os import unittest from io import StringIO from tempfile import TemporaryFile diff --git a/Lib/test/test_dbm.py b/Lib/test/test_dbm.py index 623d992..f0a428d 100644 --- a/Lib/test/test_dbm.py +++ b/Lib/test/test_dbm.py @@ -1,6 +1,5 @@ """Test script for the dbm.open function based on testdumbdbm.py""" -import os import unittest import glob import test.support diff --git a/Lib/test/test_dbm_ndbm.py b/Lib/test/test_dbm_ndbm.py index 2291561..13e31f2 100644 --- a/Lib/test/test_dbm_ndbm.py +++ b/Lib/test/test_dbm_ndbm.py @@ -1,7 +1,6 @@ from test import support support.import_module("dbm.ndbm") #skip if not supported import unittest -import os import random import dbm.ndbm from dbm.ndbm import error diff --git a/Lib/test/test_devpoll.py b/Lib/test/test_devpoll.py index 955618a..d1933e2 100644 --- a/Lib/test/test_devpoll.py +++ b/Lib/test/test_devpoll.py @@ -5,7 +5,6 @@ import os import random import select -import sys import unittest from test.support import TESTFN, run_unittest, cpython_only diff --git a/Lib/test/test_eintr.py b/Lib/test/test_eintr.py index 75452f2..1c9b84f 100644 --- a/Lib/test/test_eintr.py +++ b/Lib/test/test_eintr.py @@ -1,7 +1,6 @@ import os import signal import subprocess -import sys import unittest from test import support diff --git a/Lib/test/test_email/__init__.py b/Lib/test/test_email/__init__.py index d2f7d31..1600159 100644 --- a/Lib/test/test_email/__init__.py +++ b/Lib/test/test_email/__init__.py @@ -1,5 +1,4 @@ import os -import sys import unittest import collections import email diff --git a/Lib/test/test_heapq.py b/Lib/test/test_heapq.py index b7e8259..2f8c648 100644 --- a/Lib/test/test_heapq.py +++ b/Lib/test/test_heapq.py @@ -1,6 +1,5 @@ """Unittests for heapq.""" -import sys import random import unittest diff --git a/Lib/test/test_importlib/extension/test_case_sensitivity.py b/Lib/test/test_importlib/extension/test_case_sensitivity.py index 706c3e4..42ddb3d 100644 --- a/Lib/test/test_importlib/extension/test_case_sensitivity.py +++ b/Lib/test/test_importlib/extension/test_case_sensitivity.py @@ -1,5 +1,4 @@ from importlib import _bootstrap_external -import sys from test import support import unittest diff --git a/Lib/test/test_importlib/extension/test_path_hook.py b/Lib/test/test_importlib/extension/test_path_hook.py index 8f4b8bb..8829de3 100644 --- a/Lib/test/test_importlib/extension/test_path_hook.py +++ b/Lib/test/test_importlib/extension/test_path_hook.py @@ -3,7 +3,6 @@ from .. import util machinery = util.import_importlib('importlib.machinery') import collections -import sys import unittest diff --git a/Lib/test/test_importlib/frozen/test_loader.py b/Lib/test/test_importlib/frozen/test_loader.py index 603c7d7..29ecff1 100644 --- a/Lib/test/test_importlib/frozen/test_loader.py +++ b/Lib/test/test_importlib/frozen/test_loader.py @@ -3,8 +3,6 @@ from .. import util machinery = util.import_importlib('importlib.machinery') - -import sys from test.support import captured_stdout import types import unittest diff --git a/Lib/test/test_importlib/import_/test_relative_imports.py b/Lib/test/test_importlib/import_/test_relative_imports.py index 42edc78..8a95a32 100644 --- a/Lib/test/test_importlib/import_/test_relative_imports.py +++ b/Lib/test/test_importlib/import_/test_relative_imports.py @@ -1,6 +1,5 @@ """Test relative imports (PEP 328).""" from .. import util -import sys import unittest import warnings diff --git a/Lib/test/test_importlib/source/test_case_sensitivity.py b/Lib/test/test_importlib/source/test_case_sensitivity.py index c274b38..0d6c388 100644 --- a/Lib/test/test_importlib/source/test_case_sensitivity.py +++ b/Lib/test/test_importlib/source/test_case_sensitivity.py @@ -5,7 +5,6 @@ importlib = util.import_importlib('importlib') machinery = util.import_importlib('importlib.machinery') import os -import sys from test import support as test_support import unittest diff --git a/Lib/test/test_json/__init__.py b/Lib/test/test_json/__init__.py index 0807e6f..bac370d 100644 --- a/Lib/test/test_json/__init__.py +++ b/Lib/test/test_json/__init__.py @@ -1,5 +1,4 @@ import os -import sys import json import doctest import unittest diff --git a/Lib/test/test_kqueue.py b/Lib/test/test_kqueue.py index f822024..9f49886 100644 --- a/Lib/test/test_kqueue.py +++ b/Lib/test/test_kqueue.py @@ -5,7 +5,6 @@ import errno import os import select import socket -import sys import time import unittest diff --git a/Lib/test/test_msilib.py b/Lib/test/test_msilib.py index 8ef334f..f656f72 100644 --- a/Lib/test/test_msilib.py +++ b/Lib/test/test_msilib.py @@ -1,6 +1,5 @@ """ Test suite for the code in msilib """ import unittest -import os from test.support import import_module msilib = import_module('msilib') diff --git a/Lib/test/test_multibytecodec.py b/Lib/test/test_multibytecodec.py index 8d7a213..01a1cd3 100644 --- a/Lib/test/test_multibytecodec.py +++ b/Lib/test/test_multibytecodec.py @@ -5,7 +5,7 @@ from test import support from test.support import TESTFN -import unittest, io, codecs, sys, os +import unittest, io, codecs, sys import _multibytecodec ALL_CJKENCODINGS = [ diff --git a/Lib/test/test_nis.py b/Lib/test/test_nis.py index 387a4e7..21074c6 100644 --- a/Lib/test/test_nis.py +++ b/Lib/test/test_nis.py @@ -1,6 +1,5 @@ from test import support import unittest -import sys # Skip test if nis module does not exist. nis = support.import_module('nis') diff --git a/Lib/test/test_normalization.py b/Lib/test/test_normalization.py index 30fa612..5b590e1 100644 --- a/Lib/test/test_normalization.py +++ b/Lib/test/test_normalization.py @@ -3,7 +3,6 @@ import unittest from http.client import HTTPException import sys -import os from unicodedata import normalize, unidata_version TESTDATAFILE = "NormalizationTest.txt" diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py index 3d301b4..7269206 100644 --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -1,6 +1,5 @@ import parser import unittest -import sys import operator import struct from test import support diff --git a/Lib/test/test_pep3151.py b/Lib/test/test_pep3151.py index 8d560cd..c57c3dc 100644 --- a/Lib/test/test_pep3151.py +++ b/Lib/test/test_pep3151.py @@ -2,7 +2,6 @@ import builtins import os import select import socket -import sys import unittest import errno from errno import EEXIST diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py index 9d20471..8b3ce70 100644 --- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -1,7 +1,6 @@ import itertools import os import posixpath -import sys import unittest import warnings from posixpath import realpath, abspath, dirname, basename diff --git a/Lib/test/test_pulldom.py b/Lib/test/test_pulldom.py index 1932c6b..3d89e3a 100644 --- a/Lib/test/test_pulldom.py +++ b/Lib/test/test_pulldom.py @@ -1,6 +1,5 @@ import io import unittest -import sys import xml.sax from xml.sax.xmlreader import AttributesImpl diff --git a/Lib/test/test_quopri.py b/Lib/test/test_quopri.py index 7cac013..715544c 100644 --- a/Lib/test/test_quopri.py +++ b/Lib/test/test_quopri.py @@ -1,6 +1,6 @@ import unittest -import sys, os, io, subprocess +import sys, io, subprocess import quopri diff --git a/Lib/test/test_sort.py b/Lib/test/test_sort.py index a5d0ebf..98ccab5 100644 --- a/Lib/test/test_sort.py +++ b/Lib/test/test_sort.py @@ -1,6 +1,5 @@ from test import support import random -import sys import unittest from functools import cmp_to_key diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py index 1cc8b42..8c8f97b 100644 --- a/Lib/test/test_strptime.py +++ b/Lib/test/test_strptime.py @@ -5,7 +5,6 @@ import time import locale import re import os -import sys from test import support from datetime import date as datetime_date diff --git a/Lib/test/test_tools/test_md5sum.py b/Lib/test/test_tools/test_md5sum.py index 1305295..e6c83fb 100644 --- a/Lib/test/test_tools/test_md5sum.py +++ b/Lib/test/test_tools/test_md5sum.py @@ -1,7 +1,6 @@ """Tests for the md5sum script in the Tools directory.""" import os -import sys import unittest from test import support from test.support.script_helper import assert_python_ok, assert_python_failure diff --git a/Lib/test/test_tools/test_pdeps.py b/Lib/test/test_tools/test_pdeps.py index 091fa6a..6b5d5c8 100644 --- a/Lib/test/test_tools/test_pdeps.py +++ b/Lib/test/test_tools/test_pdeps.py @@ -1,7 +1,6 @@ """Tests for the pdeps script in the Tools directory.""" import os -import sys import unittest import tempfile from test import support diff --git a/Lib/test/test_ttk_guionly.py b/Lib/test/test_ttk_guionly.py index 490e723..462665d 100644 --- a/Lib/test/test_ttk_guionly.py +++ b/Lib/test/test_ttk_guionly.py @@ -1,4 +1,3 @@ -import os import unittest from test import support diff --git a/Lib/test/test_ttk_textonly.py b/Lib/test/test_ttk_textonly.py index 566fc9d..7540a431 100644 --- a/Lib/test/test_ttk_textonly.py +++ b/Lib/test/test_ttk_textonly.py @@ -1,4 +1,3 @@ -import os from test import support # Skip this test if _tkinter does not exist. diff --git a/Lib/test/test_unpack_ex.py b/Lib/test/test_unpack_ex.py index d27eef0..f426e5a 100644 --- a/Lib/test/test_unpack_ex.py +++ b/Lib/test/test_unpack_ex.py @@ -352,7 +352,6 @@ Some size constraints (all fail.) __test__ = {'doctests' : doctests} def test_main(verbose=False): - import sys from test import support from test import test_unpack_ex support.run_doctest(test_unpack_ex, verbose) diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py index f6df54e..c318ef3 100644 --- a/Lib/test/test_urllibnet.py +++ b/Lib/test/test_urllibnet.py @@ -4,7 +4,6 @@ from test import support import contextlib import socket import urllib.request -import sys import os import email.message import time diff --git a/Lib/test/test_weakset.py b/Lib/test/test_weakset.py index 9ce672b..3e1f4c8 100644 --- a/Lib/test/test_weakset.py +++ b/Lib/test/test_weakset.py @@ -3,9 +3,7 @@ from weakref import proxy, ref, WeakSet import operator import copy import string -import os from random import randrange, shuffle -import sys import warnings import collections from collections import UserString as ustr diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py index 96b446e..cd5fd6c 100644 --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -1,5 +1,5 @@ # xml.etree test for cElementTree -import sys, struct +import struct from test import support from test.support import import_fresh_module import types diff --git a/Lib/test/test_xmlrpc_net.py b/Lib/test/test_xmlrpc_net.py index b60b82f..1771db5 100644 --- a/Lib/test/test_xmlrpc_net.py +++ b/Lib/test/test_xmlrpc_net.py @@ -1,7 +1,6 @@ import collections.abc import errno import socket -import sys import unittest from test import support diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index 8589342..61f561b 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -1,7 +1,6 @@ import contextlib import io import os -import sys import importlib.util import posixpath import time diff --git a/Lib/tkinter/test/runtktests.py b/Lib/tkinter/test/runtktests.py index dbe5e88..1ca8bde 100644 --- a/Lib/tkinter/test/runtktests.py +++ b/Lib/tkinter/test/runtktests.py @@ -7,7 +7,6 @@ Extensions also should live in packages following the same rule as above. """ import os -import sys import unittest import importlib import test.support diff --git a/Lib/unittest/test/testmock/support.py b/Lib/unittest/test/testmock/support.py index f473879..205431a 100644 --- a/Lib/unittest/test/testmock/support.py +++ b/Lib/unittest/test/testmock/support.py @@ -1,5 +1,3 @@ -import sys - def is_instance(obj, klass): """Version of is_instance that doesn't access __class__""" return issubclass(type(obj), klass) -- cgit v0.12