mirror of https://github.com/python/cpython
gh-102515: Remove unused imports in the `Lib/` directory (#102516)
This commit is contained in:
parent
7d801f245e
commit
401d7a7f00
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -4,7 +4,6 @@ import copy
|
|||
import types
|
||||
import inspect
|
||||
import keyword
|
||||
import builtins
|
||||
import functools
|
||||
import itertools
|
||||
import abc
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import multiprocessing
|
||||
import random
|
||||
import sys
|
||||
import time
|
||||
|
||||
def fill_queue(queue, code):
|
||||
queue.put(code)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from collections import namedtuple
|
||||
import contextlib
|
||||
import os
|
||||
import sys
|
||||
from textwrap import dedent
|
||||
import threading
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import asyncio
|
||||
import asyncio.sslproto
|
||||
import contextlib
|
||||
import gc
|
||||
import logging
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import os
|
||||
import shutil
|
||||
import signal
|
||||
import sys
|
||||
import unittest
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import sys
|
||||
import functools
|
||||
import unittest
|
||||
from test import support
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
# testing of error conditions uncovered when using extension types.
|
||||
|
||||
import unittest
|
||||
import sys
|
||||
import typing
|
||||
from test import support
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 = """
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -2,7 +2,6 @@ import gc
|
|||
import pprint
|
||||
import sys
|
||||
import unittest
|
||||
from test import support
|
||||
|
||||
|
||||
class TestGetProfile(unittest.TestCase):
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
from test import support
|
||||
import unittest
|
||||
from unittest.mock import MagicMock
|
||||
import sys
|
||||
import difflib
|
||||
import gc
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ tests of their own.
|
|||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from test.support import import_helper
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import linecache
|
|||
import sys
|
||||
import types
|
||||
import inspect
|
||||
import importlib
|
||||
import builtins
|
||||
import unittest
|
||||
import re
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import functools
|
||||
import sys
|
||||
import types
|
||||
import warnings
|
||||
|
||||
import unittest
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue