Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-102515: Remove unused imports in the Lib/ directory #102516

Merged
merged 4 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Lib/_pylong.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
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

Expand Down
2 changes: 2 additions & 0 deletions Lib/concurrent/futures/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
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
gvanrossum marked this conversation as resolved.
Show resolved Hide resolved
from multiprocessing.queues import Queue
import threading
Expand Down
1 change: 0 additions & 1 deletion Lib/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import types
import inspect
import keyword
import builtins
import functools
import itertools
import abc
Expand Down
1 change: 0 additions & 1 deletion Lib/importlib/_abc.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
2 changes: 1 addition & 1 deletion Lib/sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 0 additions & 1 deletion Lib/test/_test_venv_multiprocessing.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import multiprocessing
import random
import sys
import time

def fill_queue(queue, code):
queue.put(code)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/fork_wait.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test__xxinterpchannels.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from collections import namedtuple
import contextlib
import os
import sys
from textwrap import dedent
import threading
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test__xxsubinterpreters.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from collections import namedtuple
import contextlib
import itertools
import os
import pickle
import sys
from textwrap import dedent
import threading
import time
import unittest

import _testcapi
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_asyncgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
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
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_asyncio/test_ssl.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import asyncio
import asyncio.sslproto
gvanrossum marked this conversation as resolved.
Show resolved Hide resolved
import contextlib
import gc
import logging
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_asyncio/test_subprocess.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import shutil
import signal
import sys
import unittest
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_ctypes/test_callbacks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
import functools
import unittest
from test import support
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -2261,7 +2261,6 @@ def test_base_has_init(self):
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,
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
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]
Expand Down Expand Up @@ -1187,7 +1186,6 @@ class MyEnum(HexInt, enum.Enum):
#
class SillyInt(HexInt):
__qualname__ = 'SillyInt'
pass
class MyOtherEnum(SillyInt, enum.Enum):
__qualname__ = 'MyOtherEnum'
D = 4
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -15,7 +14,6 @@
# with import machinery
import test.ann_module as ann_module
import typing
from collections import ChainMap
from test import ann_module2
import test

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_hashlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
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


Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_httplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import re
import socket
import threading
import warnings

import unittest
from unittest import mock
Expand All @@ -17,7 +16,6 @@
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)

Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_imaplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
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
Expand Down Expand Up @@ -751,7 +750,6 @@ class NonUTF8Server(SimpleIMAPHandler):
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):
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_isinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# testing of error conditions uncovered when using extension types.

import unittest
import sys
import typing
from test import support

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_minidom.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from test import support
import unittest

import pyexpat
import xml.dom.minidom

from xml.dom.minidom import parse, Attr, Node, Document, parseString
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_peg_generator/test_c_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
generate_parser_c_extension,
generate_c_parser_source,
)
from pegen.ast_dump import ast_dump
gvanrossum marked this conversation as resolved.
Show resolved Hide resolved


TEST_TEMPLATE = """
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_shlex.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import shlex
import string
import unittest
from unittest import mock


# The original test data set was from shellwords, by Hartmut Goebel.
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_sys_setprofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import pprint
import sys
import unittest
from test import support


class TestGetProfile(unittest.TestCase):
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_sys_settrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from test import support
import unittest
from unittest.mock import MagicMock
import sys
import difflib
import gc
Expand Down
3 changes: 1 addition & 2 deletions Lib/test/test_tkinter/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
AbstractDefaultRootTest)
from test.test_tkinter.widget_tests import (
add_standard_options,
AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests,
setUpModule)
AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests)

requires('gui')

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_tools/test_sundry.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""

import os
import sys
import unittest
from test.support import import_helper

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_traceback.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import sys
import types
import inspect
import importlib
import builtins
import unittest
import re
Expand Down
4 changes: 1 addition & 3 deletions Lib/test/test_ttk/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
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')

Expand Down Expand Up @@ -50,7 +49,6 @@ def test_configure_style(self):
widget2 = self.create(class_='Foo')
self.assertEqual(widget2['class'], 'Foo')
# XXX
pass


class WidgetTest(AbstractTkTest, unittest.TestCase):
Expand Down
3 changes: 1 addition & 2 deletions Lib/test/test_unicodedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
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):
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_unittest/test_loader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import functools
import sys
import types
import warnings

import unittest

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_wmi.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_zipfile64.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'test requires loads of disk-space bytes and a long time to run'
)

import zipfile, os, unittest
import zipfile, unittest
import time
import sys

Expand Down