]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-102515: Remove unused imports in the `Lib/` directory (#102516)
authorAlex Waygood <Alex.Waygood@Gmail.com>
Wed, 8 Mar 2023 11:45:38 +0000 (11:45 +0000)
committerGitHub <noreply@github.com>
Wed, 8 Mar 2023 11:45:38 +0000 (11:45 +0000)
33 files changed:
Lib/_pylong.py
Lib/concurrent/futures/process.py
Lib/dataclasses.py
Lib/importlib/_abc.py
Lib/sysconfig.py
Lib/test/_test_venv_multiprocessing.py
Lib/test/fork_wait.py
Lib/test/test__xxinterpchannels.py
Lib/test/test__xxsubinterpreters.py
Lib/test/test_asyncgen.py
Lib/test/test_asyncio/test_ssl.py
Lib/test/test_asyncio/test_subprocess.py
Lib/test/test_ctypes/test_callbacks.py
Lib/test/test_dataclasses.py
Lib/test/test_enum.py
Lib/test/test_grammar.py
Lib/test/test_hashlib.py
Lib/test/test_httplib.py
Lib/test/test_imaplib.py
Lib/test/test_isinstance.py
Lib/test/test_minidom.py
Lib/test/test_peg_generator/test_c_parser.py
Lib/test/test_shlex.py
Lib/test/test_sys_setprofile.py
Lib/test/test_sys_settrace.py
Lib/test/test_tkinter/test_widgets.py
Lib/test/test_tools/test_sundry.py
Lib/test/test_traceback.py
Lib/test/test_ttk/test_widgets.py
Lib/test/test_unicodedata.py
Lib/test/test_unittest/test_loader.py
Lib/test/test_wmi.py
Lib/test/test_zipfile64.py

index d14c1d938363279ad077060c12e09036144d9d2a..936346e187ff69956cf6730b35937b36b47371ea 100644 (file)
@@ -12,7 +12,6 @@ integers with a huge number of digits.  Saving a few microseconds with
 tricky or non-obvious code is not worth it.  For people looking for
 maximum performance, they should use something like gmpy2."""
 
-import sys
 import re
 import decimal
 
index bee162430a6f8e17fc394d6b17475c3c76551845..3a8637b6fa1b47fcfe99c24fb12b4223a3ca4fff 100644 (file)
@@ -49,6 +49,8 @@ import os
 from concurrent.futures import _base
 import queue
 import multiprocessing as mp
+# This import is required to load the multiprocessing.connection submodule
+# so that it can be accessed later as `mp.connection`
 import multiprocessing.connection
 from multiprocessing.queues import Queue
 import threading
index 5c0257eba186d15b349775a7fb5e0e0a3a0e9dc3..8bc8594d674bc0d81cc2bd63ef85a8715b97cbc9 100644 (file)
@@ -4,7 +4,6 @@ import copy
 import types
 import inspect
 import keyword
-import builtins
 import functools
 import itertools
 import abc
index 083205638965215e8a9022b3c754147d0fc57f84..693b466112638f52c8b8822daf1973dd288209c2 100644 (file)
@@ -1,7 +1,6 @@
 """Subset of importlib.abc used to reduce importlib.util imports."""
 from . import _bootstrap
 import abc
-import warnings
 
 
 class Loader(metaclass=abc.ABCMeta):
index c61100a6da8503310dd09866bfc9a6c8d508f538..122d441bd19f5e803975ff7c42040f489fd5bdf8 100644 (file)
@@ -3,7 +3,7 @@
 import os
 import sys
 import threading
-from os.path import pardir, realpath
+from os.path import realpath
 
 __all__ = [
     'get_config_h_filename',
index 044a0c6cd3f5ca0a46622f29de270b958803604d..ad985dd8d56bb4b009e6b40cf6dae21360af41a4 100644 (file)
@@ -1,7 +1,6 @@
 import multiprocessing
 import random
 import sys
-import time
 
 def fill_queue(queue, code):
     queue.put(code)
index c26c7aaaeb43061b62fc37cb817df017b68d3149..8c32895f5e09e5d71a3e9a5a9e0ab16a219807b4 100644 (file)
@@ -9,7 +9,7 @@ On some systems (e.g. Solaris without posix threads) we find that all
 active threads survive in the child after a fork(); this is an error.
 """
 
-import os, sys, time, unittest
+import os, time, unittest
 import threading
 from test import support
 from test.support import threading_helper
index 03bb5c80b8dac92e07383523c7031765a31951a3..69bda89a1688f57e88aec31f75010668a8c03efa 100644 (file)
@@ -1,6 +1,5 @@
 from collections import namedtuple
 import contextlib
-import os
 import sys
 from textwrap import dedent
 import threading
index 687fcf3b770522af1c5faed52b22591aa9df4291..965967e3f2734b4f0115d781937246b3eade5b88 100644 (file)
@@ -1,4 +1,3 @@
-from collections import namedtuple
 import contextlib
 import itertools
 import os
@@ -6,7 +5,6 @@ import pickle
 import sys
 from textwrap import dedent
 import threading
-import time
 import unittest
 
 import _testcapi
index 0421efdbf9dac9ae30ad556ba662e4e39964387a..09e4010b0e53d6fdd291d8f878de6d8c07dee194 100644 (file)
@@ -2,7 +2,6 @@ import inspect
 import types
 import unittest
 import contextlib
-import warnings
 
 from test.support.import_helper import import_module
 from test.support import gc_collect, requires_working_socket
index aaf3c37101f52a66a9cc477c551ded5ae0ede1b9..e9cc735613fb8e1603de9cb2dde9e382a0327bd5 100644 (file)
@@ -1,5 +1,4 @@
 import asyncio
-import asyncio.sslproto
 import contextlib
 import gc
 import logging
index f1ad10a9903fe8626663d872a1be5d0fadf9d97b..eba6e2d1f28f3ec4207f59ff794c49266d7ee843 100644 (file)
@@ -1,5 +1,4 @@
 import os
-import shutil
 import signal
 import sys
 import unittest
index e8fa3e6f7aca514aea069e60204632265bbb3735..b185e388ab1527d4f5ff095bd51273c5aab1383f 100644 (file)
@@ -1,4 +1,3 @@
-import sys
 import functools
 import unittest
 from test import support
index 81a36aa241acf76944462e702ab9e0f52909a130..589f229f4623594fa80ab3cadf33eba92f85ee2a 100644 (file)
@@ -2261,7 +2261,6 @@ class TestInit(unittest.TestCase):
         class B:
             def __init__(self):
                 self.z = 100
-                pass
 
         # Make sure that declaring this class doesn't raise an error.
         #  The issue is that we can't override __init__ in our class,
index 0a2e0c14d268af14e64aca0c0ad7f5a19657a0d9..2b14590b2c21af54e0bf3c832234205fb5ce67e0 100644 (file)
@@ -20,7 +20,6 @@ from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL
 from test import support
 from test.support import ALWAYS_EQ
 from test.support import threading_helper
-from textwrap import dedent
 from datetime import timedelta
 
 python_version = sys.version_info[:2]
@@ -1187,7 +1186,6 @@ class TestSpecial(unittest.TestCase):
         #
         class SillyInt(HexInt):
             __qualname__ = 'SillyInt'
-            pass
         class MyOtherEnum(SillyInt, enum.Enum):
             __qualname__ = 'MyOtherEnum'
             D = 4
index 5b946020994e31ec3af68597a1d9d544d55cc7bf..ced9000f75f2e57cf8ba5ba3e76edf7b51476091 100644 (file)
@@ -3,7 +3,6 @@
 
 from test.support import check_syntax_error
 from test.support import import_helper
-from test.support.warnings_helper import check_syntax_warning
 import inspect
 import unittest
 import sys
@@ -15,7 +14,6 @@ from sys import *
 # with import machinery
 import test.ann_module as ann_module
 import typing
-from collections import ChainMap
 from test import ann_module2
 import test
 
index 5ead8857943592da7d1da1eba368d14847215679..08cb5eb0c2bbab8567b770ee0a63f2c2b8a24e33 100644 (file)
@@ -22,7 +22,6 @@ from test.support.import_helper import import_fresh_module
 from test.support import os_helper
 from test.support import requires_resource
 from test.support import threading_helper
-from test.support import warnings_helper
 from http.client import HTTPException
 
 
index 620a5b19109a8c1c88df63b2fd30e1177253e05e..9ff6afcbadec54c2e2d4f0616aa85c2ab5a21361 100644 (file)
@@ -8,7 +8,6 @@ import array
 import re
 import socket
 import threading
-import warnings
 
 import unittest
 from unittest import mock
@@ -17,7 +16,6 @@ TestCase = unittest.TestCase
 from test import support
 from test.support import os_helper
 from test.support import socket_helper
-from test.support import warnings_helper
 
 support.requires_working_socket(module=True)
 
index 7626d9572e1e96935c26595bc51b578c6de9dbdd..60f5b671b1da485756985208733da153c4c34597 100644 (file)
@@ -13,7 +13,6 @@ import socket
 from test.support import verbose, run_with_tz, run_with_locale, cpython_only
 from test.support import hashlib_helper
 from test.support import threading_helper
-from test.support import warnings_helper
 import unittest
 from unittest import mock
 from datetime import datetime, timezone, timedelta
@@ -751,7 +750,6 @@ class ThreadedNetworkedTests(unittest.TestCase):
                 typ, data = client.login('user', 'pass')
                 self.assertEqual(typ, 'OK')
                 client.enable('UTF8=ACCEPT')
-                pass
 
     @threading_helper.reap_threads
     def test_enable_UTF8_True_append(self):
index 2fcf6ebbee7e346a3a8557c503b2ffc23cf1782d..bf9332e40aeaf2eb8bffaf4ab59598024a9b6b6d 100644 (file)
@@ -3,7 +3,6 @@
 # testing of error conditions uncovered when using extension types.
 
 import unittest
-import sys
 import typing
 from test import support
 
index 2ca3908bd1caac184d68e06354dc201628bac286..699265ccadc7f9c5d11d3d8d4ea70365065a5b2a 100644 (file)
@@ -6,7 +6,6 @@ import io
 from test import support
 import unittest
 
-import pyexpat
 import xml.dom.minidom
 
 from xml.dom.minidom import parse, Attr, Node, Document, parseString
index 1b3fcbb92f829231232d5f9d1bc3a6ede3c7d391..d34ffef0dbc5ecc9afbd051bc86a6ac46f00f986 100644 (file)
@@ -24,7 +24,6 @@ with test_tools.imports_under_tool("peg_generator"):
         generate_parser_c_extension,
         generate_c_parser_source,
     )
-    from pegen.ast_dump import ast_dump
 
 
 TEST_TEMPLATE = """
index 92598dbbd5f293c46bca64026e7968030df55af1..797c91ee7effdfda9a694a6616257ce52a7a4f03 100644 (file)
@@ -3,7 +3,6 @@ import itertools
 import shlex
 import string
 import unittest
-from unittest import mock
 
 
 # The original test data set was from shellwords, by Hartmut Goebel.
index acae433cd0a549d5e0687b95a8a05a4c3830c188..49e076c77d167ae347753dac11115a4e93e7e471 100644 (file)
@@ -2,7 +2,6 @@ import gc
 import pprint
 import sys
 import unittest
-from test import support
 
 
 class TestGetProfile(unittest.TestCase):
index a251b2272e95eb0c85d2e1d699407850f1f08750..4907c930e143d502fdd719185f077f2b8807f6c5 100644 (file)
@@ -2,7 +2,6 @@
 
 from test import support
 import unittest
-from unittest.mock import MagicMock
 import sys
 import difflib
 import gc
index 6fde93cbecc73ff1e222a24bdffe8b012d280f26..64c9472706549bb045771ee52bbe39cf745d9df2 100644 (file)
@@ -9,8 +9,7 @@ from test.test_tkinter.support import (requires_tcl,
                                   AbstractDefaultRootTest)
 from test.test_tkinter.widget_tests import (
     add_standard_options,
-    AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests,
-    setUpModule)
+    AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests)
 
 requires('gui')
 
index 81f06763980a325050e6c5acc368fae0e85fa998..6a3dc12781b2b6b294e518bb2d101f5afcdf764f 100644 (file)
@@ -6,7 +6,6 @@ tests of their own.
 """
 
 import os
-import sys
 import unittest
 from test.support import import_helper
 
index 95b1bae4f60850b4b77025b21dfdcf1f67ce02b8..92c5a000585855ea7a3ee3b32a8509ecd1e640e6 100644 (file)
@@ -6,7 +6,6 @@ import linecache
 import sys
 import types
 import inspect
-import importlib
 import builtins
 import unittest
 import re
index 6f47ccb8e8b3dedc36bc2a2bdcc693db0f6e1c43..79d65b496abdc640b9a85d00dce42639724f307f 100644 (file)
@@ -8,8 +8,7 @@ from test.test_ttk_textonly import MockTclObj
 from test.test_tkinter.support import (AbstractTkTest, tcl_version, get_tk_patchlevel,
                                   simulate_mouse_click, AbstractDefaultRootTest)
 from test.test_tkinter.widget_tests import (add_standard_options,
-    AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests,
-    setUpModule)
+    AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests)
 
 requires('gui')
 
@@ -50,7 +49,6 @@ class StandardTtkOptionsTests(StandardOptionsTests):
         widget2 = self.create(class_='Foo')
         self.assertEqual(widget2['class'], 'Foo')
         # XXX
-        pass
 
 
 class WidgetTest(AbstractTkTest, unittest.TestCase):
index 74503c89e559a04f4794c7856d1b506758432970..3dc0790ca15b416b1cf286b3f8094c5fb294705c 100644 (file)
@@ -12,8 +12,7 @@ import sys
 import unicodedata
 import unittest
 from test.support import (open_urlresource, requires_resource, script_helper,
-                          cpython_only, check_disallow_instantiation,
-                          ResourceDenied)
+                          cpython_only, check_disallow_instantiation)
 
 
 class UnicodeMethodsTest(unittest.TestCase):
index bbdfb247ebaada4a6f9f65f456611a4cc4b8aa78..a203145a791b1a011d6b388507d536009891c444 100644 (file)
@@ -1,7 +1,6 @@
 import functools
 import sys
 import types
-import warnings
 
 import unittest
 
index 3f5795952905244aecf4cbff75f605f9fc31ff22..3445702846d8a044cac8a54e96def03f75ee31cc 100644 (file)
@@ -1,7 +1,6 @@
 # Test the internal _wmi module on Windows
 # This is used by the platform module, and potentially others
 
-import sys
 import unittest
 from test.support import import_helper, requires_resource
 
index be654a8478b04b7e01d1bcf9b70be8ad784aaaaa..2e1affe025285814ccd15d8c1de88765cda8bd75 100644 (file)
@@ -11,7 +11,7 @@ support.requires(
         'test requires loads of disk-space bytes and a long time to run'
     )
 
-import zipfile, os, unittest
+import zipfile, unittest
 import time
 import sys