From 19601efa364fe3c294d8010effe11e025cbc230e Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Sun, 24 Sep 2023 15:07:23 +0100 Subject: [PATCH] gh-109653: Remove unused imports in the `Lib/` directory (#109803) --- Lib/asyncio/tasks.py | 1 - Lib/test/mapping_tests.py | 1 - Lib/test/support/interpreters.py | 2 +- Lib/test/test_asyncio/test_eager_task_factory.py | 1 - Lib/test/test_capi/test_abstract.py | 3 --- Lib/test/test_capi/test_dict.py | 3 --- Lib/test/test_capi/test_misc.py | 2 +- Lib/test/test_csv.py | 2 +- Lib/test/test_decimal.py | 1 - Lib/test/test_dictviews.py | 1 - Lib/test/test_gdb.py | 1 - Lib/test/test_importlib/import_/test_packages.py | 1 - Lib/test/test_peg_generator/__init__.py | 1 - Lib/test/test_pyexpat.py | 3 +-- Lib/test/test_sqlite3/test_dump.py | 1 - Lib/test/test_sqlite3/test_userfunctions.py | 2 +- Lib/test/test_sqlite3/util.py | 1 - Lib/test/test_tkinter/support.py | 1 - Lib/test/test_unittest/testmock/testthreadingmock.py | 2 +- Lib/test/test_zlib.py | 1 - 20 files changed, 6 insertions(+), 25 deletions(-) diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index edc64fda2a6a..21a1b24194bc 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -17,7 +17,6 @@ import inspect import itertools import math import types -import warnings import weakref from types import GenericAlias diff --git a/Lib/test/mapping_tests.py b/Lib/test/mapping_tests.py index b3e4192e65d9..b4cfce19a717 100644 --- a/Lib/test/mapping_tests.py +++ b/Lib/test/mapping_tests.py @@ -1,7 +1,6 @@ # tests common to dict and UserDict import unittest import collections -import sys from test.support import Py_C_RECURSION_LIMIT diff --git a/Lib/test/support/interpreters.py b/Lib/test/support/interpreters.py index 5c484d1170d1..eeff3abe0324 100644 --- a/Lib/test/support/interpreters.py +++ b/Lib/test/support/interpreters.py @@ -5,7 +5,7 @@ import _xxsubinterpreters as _interpreters import _xxinterpchannels as _channels # aliases: -from _xxsubinterpreters import is_shareable, RunFailedError +from _xxsubinterpreters import is_shareable from _xxinterpchannels import ( ChannelError, ChannelNotFoundError, ChannelEmptyError, ) diff --git a/Lib/test/test_asyncio/test_eager_task_factory.py b/Lib/test/test_asyncio/test_eager_task_factory.py index fc9ad8eb43bb..0f8212dbec47 100644 --- a/Lib/test/test_asyncio/test_eager_task_factory.py +++ b/Lib/test/test_asyncio/test_eager_task_factory.py @@ -7,7 +7,6 @@ import unittest from unittest import mock from asyncio import tasks from test.test_asyncio import utils as test_utils -import test.support from test.support.script_helper import assert_python_ok MOCK_ANY = mock.ANY diff --git a/Lib/test/test_capi/test_abstract.py b/Lib/test/test_capi/test_abstract.py index 7fad853ff54f..eeaef60a8b47 100644 --- a/Lib/test/test_capi/test_abstract.py +++ b/Lib/test/test_capi/test_abstract.py @@ -1,8 +1,5 @@ import unittest -import sys from collections import OrderedDict -from test import support -from test.support import import_helper import _testcapi diff --git a/Lib/test/test_capi/test_dict.py b/Lib/test/test_capi/test_dict.py index b22fa20e14df..11b2ca910707 100644 --- a/Lib/test/test_capi/test_dict.py +++ b/Lib/test/test_capi/test_dict.py @@ -1,9 +1,6 @@ import unittest -import sys from collections import OrderedDict, UserDict from types import MappingProxyType -from test import support -from test.support import import_helper import _testcapi diff --git a/Lib/test/test_capi/test_misc.py b/Lib/test/test_capi/test_misc.py index cf1cba3e693e..5ece213e7b23 100644 --- a/Lib/test/test_capi/test_misc.py +++ b/Lib/test/test_capi/test_misc.py @@ -2,7 +2,7 @@ # these are all functions _testcapi exports whose name begins with 'test_'. import _thread -from collections import OrderedDict, deque +from collections import deque import contextlib import importlib.machinery import importlib.util diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py index 27f4978ca66a..97b9bba24bcb 100644 --- a/Lib/test/test_csv.py +++ b/Lib/test/test_csv.py @@ -10,7 +10,7 @@ import csv import gc import pickle from test import support -from test.support import warnings_helper, import_helper, check_disallow_instantiation +from test.support import import_helper, check_disallow_instantiation from itertools import permutations from textwrap import dedent from collections import OrderedDict diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index d806eeac25fb..bd299483e7b0 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -41,7 +41,6 @@ from test.support import (TestFailed, darwin_malloc_err_warning, is_emscripten) from test.support.import_helper import import_fresh_module from test.support import threading_helper -from test.support import warnings_helper import random import inspect import threading diff --git a/Lib/test/test_dictviews.py b/Lib/test/test_dictviews.py index 349185855138..cad568b6ac4c 100644 --- a/Lib/test/test_dictviews.py +++ b/Lib/test/test_dictviews.py @@ -1,7 +1,6 @@ import collections.abc import copy import pickle -import sys import unittest from test.support import Py_C_RECURSION_LIMIT diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py index 914ef942feab..5a4394a0993c 100644 --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -4,7 +4,6 @@ # Lib/test/test_jit_gdb.py import os -import platform import re import subprocess import sys diff --git a/Lib/test/test_importlib/import_/test_packages.py b/Lib/test/test_importlib/import_/test_packages.py index eb0831f7d6d5..0c29d6083265 100644 --- a/Lib/test/test_importlib/import_/test_packages.py +++ b/Lib/test/test_importlib/import_/test_packages.py @@ -1,7 +1,6 @@ from test.test_importlib import util import sys import unittest -from test import support from test.support import import_helper diff --git a/Lib/test/test_peg_generator/__init__.py b/Lib/test/test_peg_generator/__init__.py index c23542e254c9..b32db4426f25 100644 --- a/Lib/test/test_peg_generator/__init__.py +++ b/Lib/test/test_peg_generator/__init__.py @@ -1,5 +1,4 @@ import os.path -import unittest from test import support from test.support import load_package_tests diff --git a/Lib/test/test_pyexpat.py b/Lib/test/test_pyexpat.py index 41f4d172f8d0..a542abaf1f35 100644 --- a/Lib/test/test_pyexpat.py +++ b/Lib/test/test_pyexpat.py @@ -2,7 +2,6 @@ # handler, are obscure and unhelpful. import os -import platform import sys import sysconfig import unittest @@ -14,7 +13,7 @@ from test.support import os_helper from xml.parsers import expat from xml.parsers.expat import errors -from test.support import sortdict, is_emscripten, is_wasi +from test.support import sortdict class SetAttributeTest(unittest.TestCase): diff --git a/Lib/test/test_sqlite3/test_dump.py b/Lib/test/test_sqlite3/test_dump.py index 3107e1b165d9..14a18c1ad371 100644 --- a/Lib/test/test_sqlite3/test_dump.py +++ b/Lib/test/test_sqlite3/test_dump.py @@ -1,7 +1,6 @@ # Author: Paul Kippes import unittest -import sqlite3 as sqlite from .util import memory_database from .util import MemoryDatabaseMixin diff --git a/Lib/test/test_sqlite3/test_userfunctions.py b/Lib/test/test_sqlite3/test_userfunctions.py index 09019498fd56..c6c3db159add 100644 --- a/Lib/test/test_sqlite3/test_userfunctions.py +++ b/Lib/test/test_sqlite3/test_userfunctions.py @@ -29,7 +29,7 @@ from unittest.mock import Mock, patch from test.support import bigmemtest, gc_collect from .util import cx_limit, memory_database -from .util import with_tracebacks, check_tracebacks +from .util import with_tracebacks def func_returntext(): diff --git a/Lib/test/test_sqlite3/util.py b/Lib/test/test_sqlite3/util.py index 505406c437b6..5599823838be 100644 --- a/Lib/test/test_sqlite3/util.py +++ b/Lib/test/test_sqlite3/util.py @@ -4,7 +4,6 @@ import io import re import sqlite3 import test.support -import unittest # Helper for temporary memory databases diff --git a/Lib/test/test_tkinter/support.py b/Lib/test/test_tkinter/support.py index 10e64bf40a4a..a37705f0ae6f 100644 --- a/Lib/test/test_tkinter/support.py +++ b/Lib/test/test_tkinter/support.py @@ -1,6 +1,5 @@ import functools import tkinter -import unittest class AbstractTkTest: diff --git a/Lib/test/test_unittest/testmock/testthreadingmock.py b/Lib/test/test_unittest/testmock/testthreadingmock.py index 94e71921d9bc..a02b532ed447 100644 --- a/Lib/test/test_unittest/testmock/testthreadingmock.py +++ b/Lib/test/test_unittest/testmock/testthreadingmock.py @@ -3,7 +3,7 @@ import unittest import concurrent.futures from test.support import threading_helper -from unittest.mock import patch, ThreadingMock, call +from unittest.mock import patch, ThreadingMock threading_helper.requires_working_threading(module=True) diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py index 55306c63cd4e..9a099adc74f4 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -3,7 +3,6 @@ from test import support from test.support import import_helper import binascii import copy -import os import pickle import random import sys -- 2.47.3