mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
gh-102515: Remove unused imports in the Lib/ directory (#102516)
This commit is contained in:
parent
7d801f245e
commit
401d7a7f00
33 changed files with 8 additions and 41 deletions
|
|
@ -12,7 +12,6 @@
|
||||||
tricky or non-obvious code is not worth it. For people looking for
|
tricky or non-obvious code is not worth it. For people looking for
|
||||||
maximum performance, they should use something like gmpy2."""
|
maximum performance, they should use something like gmpy2."""
|
||||||
|
|
||||||
import sys
|
|
||||||
import re
|
import re
|
||||||
import decimal
|
import decimal
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,8 @@
|
||||||
from concurrent.futures import _base
|
from concurrent.futures import _base
|
||||||
import queue
|
import queue
|
||||||
import multiprocessing as mp
|
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
|
import multiprocessing.connection
|
||||||
from multiprocessing.queues import Queue
|
from multiprocessing.queues import Queue
|
||||||
import threading
|
import threading
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
import types
|
import types
|
||||||
import inspect
|
import inspect
|
||||||
import keyword
|
import keyword
|
||||||
import builtins
|
|
||||||
import functools
|
import functools
|
||||||
import itertools
|
import itertools
|
||||||
import abc
|
import abc
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
"""Subset of importlib.abc used to reduce importlib.util imports."""
|
"""Subset of importlib.abc used to reduce importlib.util imports."""
|
||||||
from . import _bootstrap
|
from . import _bootstrap
|
||||||
import abc
|
import abc
|
||||||
import warnings
|
|
||||||
|
|
||||||
|
|
||||||
class Loader(metaclass=abc.ABCMeta):
|
class Loader(metaclass=abc.ABCMeta):
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
from os.path import pardir, realpath
|
from os.path import realpath
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'get_config_h_filename',
|
'get_config_h_filename',
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
import time
|
|
||||||
|
|
||||||
def fill_queue(queue, code):
|
def fill_queue(queue, code):
|
||||||
queue.put(code)
|
queue.put(code)
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
active threads survive in the child after a fork(); this is an error.
|
active threads survive in the child after a fork(); this is an error.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os, sys, time, unittest
|
import os, time, unittest
|
||||||
import threading
|
import threading
|
||||||
from test import support
|
from test import support
|
||||||
from test.support import threading_helper
|
from test.support import threading_helper
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
import contextlib
|
import contextlib
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
import threading
|
import threading
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
from collections import namedtuple
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import itertools
|
import itertools
|
||||||
import os
|
import os
|
||||||
|
|
@ -6,7 +5,6 @@
|
||||||
import sys
|
import sys
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
import threading
|
import threading
|
||||||
import time
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import _testcapi
|
import _testcapi
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
import types
|
import types
|
||||||
import unittest
|
import unittest
|
||||||
import contextlib
|
import contextlib
|
||||||
import warnings
|
|
||||||
|
|
||||||
from test.support.import_helper import import_module
|
from test.support.import_helper import import_module
|
||||||
from test.support import gc_collect, requires_working_socket
|
from test.support import gc_collect, requires_working_socket
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import asyncio.sslproto
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import gc
|
import gc
|
||||||
import logging
|
import logging
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import os
|
import os
|
||||||
import shutil
|
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import sys
|
|
||||||
import functools
|
import functools
|
||||||
import unittest
|
import unittest
|
||||||
from test import support
|
from test import support
|
||||||
|
|
|
||||||
|
|
@ -2261,7 +2261,6 @@ def test_base_has_init(self):
|
||||||
class B:
|
class B:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.z = 100
|
self.z = 100
|
||||||
pass
|
|
||||||
|
|
||||||
# Make sure that declaring this class doesn't raise an error.
|
# Make sure that declaring this class doesn't raise an error.
|
||||||
# The issue is that we can't override __init__ in our class,
|
# The issue is that we can't override __init__ in our class,
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
from test import support
|
from test import support
|
||||||
from test.support import ALWAYS_EQ
|
from test.support import ALWAYS_EQ
|
||||||
from test.support import threading_helper
|
from test.support import threading_helper
|
||||||
from textwrap import dedent
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
python_version = sys.version_info[:2]
|
python_version = sys.version_info[:2]
|
||||||
|
|
@ -1187,7 +1186,6 @@ class MyEnum(HexInt, enum.Enum):
|
||||||
#
|
#
|
||||||
class SillyInt(HexInt):
|
class SillyInt(HexInt):
|
||||||
__qualname__ = 'SillyInt'
|
__qualname__ = 'SillyInt'
|
||||||
pass
|
|
||||||
class MyOtherEnum(SillyInt, enum.Enum):
|
class MyOtherEnum(SillyInt, enum.Enum):
|
||||||
__qualname__ = 'MyOtherEnum'
|
__qualname__ = 'MyOtherEnum'
|
||||||
D = 4
|
D = 4
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
from test.support import check_syntax_error
|
from test.support import check_syntax_error
|
||||||
from test.support import import_helper
|
from test.support import import_helper
|
||||||
from test.support.warnings_helper import check_syntax_warning
|
|
||||||
import inspect
|
import inspect
|
||||||
import unittest
|
import unittest
|
||||||
import sys
|
import sys
|
||||||
|
|
@ -15,7 +14,6 @@
|
||||||
# with import machinery
|
# with import machinery
|
||||||
import test.ann_module as ann_module
|
import test.ann_module as ann_module
|
||||||
import typing
|
import typing
|
||||||
from collections import ChainMap
|
|
||||||
from test import ann_module2
|
from test import ann_module2
|
||||||
import test
|
import test
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
from test.support import os_helper
|
from test.support import os_helper
|
||||||
from test.support import requires_resource
|
from test.support import requires_resource
|
||||||
from test.support import threading_helper
|
from test.support import threading_helper
|
||||||
from test.support import warnings_helper
|
|
||||||
from http.client import HTTPException
|
from http.client import HTTPException
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
import threading
|
import threading
|
||||||
import warnings
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
@ -17,7 +16,6 @@
|
||||||
from test import support
|
from test import support
|
||||||
from test.support import os_helper
|
from test.support import os_helper
|
||||||
from test.support import socket_helper
|
from test.support import socket_helper
|
||||||
from test.support import warnings_helper
|
|
||||||
|
|
||||||
support.requires_working_socket(module=True)
|
support.requires_working_socket(module=True)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
from test.support import verbose, run_with_tz, run_with_locale, cpython_only
|
from test.support import verbose, run_with_tz, run_with_locale, cpython_only
|
||||||
from test.support import hashlib_helper
|
from test.support import hashlib_helper
|
||||||
from test.support import threading_helper
|
from test.support import threading_helper
|
||||||
from test.support import warnings_helper
|
|
||||||
import unittest
|
import unittest
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
from datetime import datetime, timezone, timedelta
|
from datetime import datetime, timezone, timedelta
|
||||||
|
|
@ -751,7 +750,6 @@ class NonUTF8Server(SimpleIMAPHandler):
|
||||||
typ, data = client.login('user', 'pass')
|
typ, data = client.login('user', 'pass')
|
||||||
self.assertEqual(typ, 'OK')
|
self.assertEqual(typ, 'OK')
|
||||||
client.enable('UTF8=ACCEPT')
|
client.enable('UTF8=ACCEPT')
|
||||||
pass
|
|
||||||
|
|
||||||
@threading_helper.reap_threads
|
@threading_helper.reap_threads
|
||||||
def test_enable_UTF8_True_append(self):
|
def test_enable_UTF8_True_append(self):
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
# testing of error conditions uncovered when using extension types.
|
# testing of error conditions uncovered when using extension types.
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
import sys
|
|
||||||
import typing
|
import typing
|
||||||
from test import support
|
from test import support
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
from test import support
|
from test import support
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import pyexpat
|
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
|
|
||||||
from xml.dom.minidom import parse, Attr, Node, Document, parseString
|
from xml.dom.minidom import parse, Attr, Node, Document, parseString
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
generate_parser_c_extension,
|
generate_parser_c_extension,
|
||||||
generate_c_parser_source,
|
generate_c_parser_source,
|
||||||
)
|
)
|
||||||
from pegen.ast_dump import ast_dump
|
|
||||||
|
|
||||||
|
|
||||||
TEST_TEMPLATE = """
|
TEST_TEMPLATE = """
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
import shlex
|
import shlex
|
||||||
import string
|
import string
|
||||||
import unittest
|
import unittest
|
||||||
from unittest import mock
|
|
||||||
|
|
||||||
|
|
||||||
# The original test data set was from shellwords, by Hartmut Goebel.
|
# The original test data set was from shellwords, by Hartmut Goebel.
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
import pprint
|
import pprint
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
from test import support
|
|
||||||
|
|
||||||
|
|
||||||
class TestGetProfile(unittest.TestCase):
|
class TestGetProfile(unittest.TestCase):
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
from test import support
|
from test import support
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import MagicMock
|
|
||||||
import sys
|
import sys
|
||||||
import difflib
|
import difflib
|
||||||
import gc
|
import gc
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,7 @@
|
||||||
AbstractDefaultRootTest)
|
AbstractDefaultRootTest)
|
||||||
from test.test_tkinter.widget_tests import (
|
from test.test_tkinter.widget_tests import (
|
||||||
add_standard_options,
|
add_standard_options,
|
||||||
AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests,
|
AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests)
|
||||||
setUpModule)
|
|
||||||
|
|
||||||
requires('gui')
|
requires('gui')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import import_helper
|
from test.support import import_helper
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
import sys
|
import sys
|
||||||
import types
|
import types
|
||||||
import inspect
|
import inspect
|
||||||
import importlib
|
|
||||||
import builtins
|
import builtins
|
||||||
import unittest
|
import unittest
|
||||||
import re
|
import re
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,7 @@
|
||||||
from test.test_tkinter.support import (AbstractTkTest, tcl_version, get_tk_patchlevel,
|
from test.test_tkinter.support import (AbstractTkTest, tcl_version, get_tk_patchlevel,
|
||||||
simulate_mouse_click, AbstractDefaultRootTest)
|
simulate_mouse_click, AbstractDefaultRootTest)
|
||||||
from test.test_tkinter.widget_tests import (add_standard_options,
|
from test.test_tkinter.widget_tests import (add_standard_options,
|
||||||
AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests,
|
AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests)
|
||||||
setUpModule)
|
|
||||||
|
|
||||||
requires('gui')
|
requires('gui')
|
||||||
|
|
||||||
|
|
@ -50,7 +49,6 @@ def test_configure_style(self):
|
||||||
widget2 = self.create(class_='Foo')
|
widget2 = self.create(class_='Foo')
|
||||||
self.assertEqual(widget2['class'], 'Foo')
|
self.assertEqual(widget2['class'], 'Foo')
|
||||||
# XXX
|
# XXX
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class WidgetTest(AbstractTkTest, unittest.TestCase):
|
class WidgetTest(AbstractTkTest, unittest.TestCase):
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,7 @@
|
||||||
import unicodedata
|
import unicodedata
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import (open_urlresource, requires_resource, script_helper,
|
from test.support import (open_urlresource, requires_resource, script_helper,
|
||||||
cpython_only, check_disallow_instantiation,
|
cpython_only, check_disallow_instantiation)
|
||||||
ResourceDenied)
|
|
||||||
|
|
||||||
|
|
||||||
class UnicodeMethodsTest(unittest.TestCase):
|
class UnicodeMethodsTest(unittest.TestCase):
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import functools
|
import functools
|
||||||
import sys
|
import sys
|
||||||
import types
|
import types
|
||||||
import warnings
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
# Test the internal _wmi module on Windows
|
# Test the internal _wmi module on Windows
|
||||||
# This is used by the platform module, and potentially others
|
# This is used by the platform module, and potentially others
|
||||||
|
|
||||||
import sys
|
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import import_helper, requires_resource
|
from test.support import import_helper, requires_resource
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
'test requires loads of disk-space bytes and a long time to run'
|
'test requires loads of disk-space bytes and a long time to run'
|
||||||
)
|
)
|
||||||
|
|
||||||
import zipfile, os, unittest
|
import zipfile, unittest
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue