Skip to content

Commit 47e3562

Browse files
authored
gh-84623: Remove unused imports (#94132)
1 parent 8661c50 commit 47e3562

28 files changed

+9
-43
lines changed

Doc/includes/email-headers.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Import the email modules we'll need
2-
from email.parser import BytesParser, Parser
2+
#from email.parser import BytesParser
3+
from email.parser import Parser
34
from email.policy import default
45

56
# If the e-mail headers are in a file, uncomment these two lines:

Doc/tools/extensions/asdl_highlight.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import os
21
import sys
32
from pathlib import Path
43

54
CPYTHON_ROOT = Path(__file__).resolve().parent.parent.parent.parent
65
sys.path.append(str(CPYTHON_ROOT / "Parser"))
76

87
from pygments.lexer import RegexLexer, bygroups, include, words
9-
from pygments.token import (Comment, Generic, Keyword, Name, Operator,
8+
from pygments.token import (Comment, Keyword, Name, Operator,
109
Punctuation, Text)
1110

1211
from asdl import builtin_types

Doc/tools/extensions/peg_highlight.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from pygments.lexer import RegexLexer, bygroups, include
2-
from pygments.token import Comment, Generic, Keyword, Name, Operator, Punctuation, Text
2+
from pygments.token import Comment, Keyword, Name, Operator, Punctuation, Text
33

44
from sphinx.highlighting import lexers
55

Doc/tools/extensions/pyspecific.py

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
from sphinx.util import status_iterator, logging
3131
from sphinx.util.nodes import split_explicit_title
3232
from sphinx.writers.text import TextWriter, TextTranslator
33-
from sphinx.writers.latex import LaTeXTranslator
3433

3534
try:
3635
from sphinx.domains.python import PyFunction, PyMethod

Lib/random.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin
5151
from math import tau as TWOPI, floor as _floor, isfinite as _isfinite
5252
from os import urandom as _urandom
53-
from _collections_abc import Set as _Set, Sequence as _Sequence
53+
from _collections_abc import Sequence as _Sequence
5454
from operator import index as _index
5555
from itertools import accumulate as _accumulate, repeat as _repeat
5656
from bisect import bisect as _bisect

Lib/test/test_asyncio/test_unix_events.py

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import socket
1010
import stat
1111
import sys
12-
import tempfile
1312
import threading
1413
import unittest
1514
from unittest import mock

Lib/test/test_ctypes/test_parameters.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
class SimpleTypesTestCase(unittest.TestCase):
66

77
def setUp(self):
8-
import ctypes
98
try:
109
from _ctypes import set_conversion_mode
1110
except ImportError:

Lib/test/test_sqlite3/test_transactions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# misrepresented as being the original software.
2121
# 3. This notice may not be removed or altered from any source distribution.
2222

23-
import os, unittest
23+
import unittest
2424
import sqlite3 as sqlite
2525

2626
from test.support import LOOPBACK_TIMEOUT

Lib/test/test_unittest/test_program.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import io
2-
31
import os
42
import sys
53
import subprocess

Lib/test/test_unittest/test_result.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sys
33
import textwrap
44

5-
from test.support import warnings_helper, captured_stdout, captured_stderr
5+
from test.support import warnings_helper, captured_stdout
66

77
import traceback
88
import unittest

Lib/tkinter/test/support.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import functools
2-
import re
32
import tkinter
43
import unittest
54

Lib/tkinter/test/widget_tests.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Common tests for test_tkinter/test_widgets.py and test_ttk/test_widgets.py
22

3-
import unittest
43
import tkinter
54
from tkinter.test.support import (AbstractTkTest, tcl_version,
65
pixels_conv, tcl_obj_eq)

PC/layout/main.py

-3
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@
88
__version__ = "3.8"
99

1010
import argparse
11-
import functools
1211
import os
13-
import re
1412
import shutil
15-
import subprocess
1613
import sys
1714
import tempfile
1815
import zipfile

PC/layout/support/appxmanifest.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
__version__ = "3.8"
77

88

9-
import collections
109
import ctypes
1110
import io
1211
import os
13-
import sys
1412

15-
from pathlib import Path, PureWindowsPath
13+
from pathlib import PureWindowsPath
1614
from xml.etree import ElementTree as ET
1715

1816
from .constants import *

PC/layout/support/catalog.py

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
__version__ = "3.8"
77

88

9-
import sys
10-
119
__all__ = ["PYTHON_CAT_NAME", "PYTHON_CDF_NAME"]
1210

1311

PC/layout/support/constants.py

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
__version__ = "3.8"
77

88
import os
9-
import re
109
import struct
1110
import sys
1211

Parser/asdl_c.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#! /usr/bin/env python
22
"""Generate C code from an ASDL description."""
33

4-
import os
54
import sys
65
import textwrap
76
import types

Tools/clinic/clinic.py

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import shlex
2323
import string
2424
import sys
25-
import tempfile
2625
import textwrap
2726
import traceback
2827
import types

Tools/peg_generator/pegen/grammar.py

-7
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
from __future__ import annotations
22

3-
from abc import abstractmethod
43
from typing import (
5-
TYPE_CHECKING,
64
AbstractSet,
75
Any,
8-
Dict,
96
Iterable,
107
Iterator,
118
List,
129
Optional,
13-
Set,
1410
Tuple,
1511
Union,
1612
)
1713

18-
if TYPE_CHECKING:
19-
from pegen.parser_generator import ParserGenerator
20-
2114

2215
class GrammarError(Exception):
2316
pass

Tools/peg_generator/scripts/grammar_grapher.py

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
Alt,
3131
Cut,
3232
Forced,
33-
Grammar,
3433
Group,
3534
Leaf,
3635
Lookahead,

Tools/peg_generator/scripts/test_parse_directory.py

-2
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
import os
66
import sys
77
import time
8-
import traceback
98
import tokenize
109
from glob import glob, escape
1110
from pathlib import PurePath
1211

1312
from typing import List, Optional, Any, Tuple
1413

1514
sys.path.insert(0, os.getcwd())
16-
from pegen.ast_dump import ast_dump
1715
from pegen.testutil import print_memstats
1816

1917
SUCCESS = "\033[92m"

Tools/peg_generator/scripts/test_pypi_packages.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
import pathlib
1010
import sys
1111

12-
from typing import Generator, Any
12+
from typing import Generator
1313

1414
sys.path.insert(0, ".")
1515

16-
from pegen import build
1716
from scripts import test_parse_directory
1817

1918
HERE = pathlib.Path(__file__).resolve().parent

Tools/scripts/freeze_modules.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import os
99
import ntpath
1010
import posixpath
11-
import sys
1211
import argparse
1312
from update_file import updating_file_with_tmpfile
1413

Tools/scripts/generate_re_casefix.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# This script generates Lib/re/_casefix.py.
33

44
import collections
5-
import re
65
import sys
76
import unicodedata
87

Tools/scripts/pathfix.py

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
# into a program for a different change to Python programs...
2828

2929
import sys
30-
import re
3130
import os
3231
from stat import *
3332
import getopt

Tools/scripts/stable_abi.py

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import textwrap
1717
import tomllib
1818
import difflib
19-
import shutil
2019
import pprint
2120
import sys
2221
import os

Tools/scripts/summarize_stats.py

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import opcode
88
from datetime import date
99
import itertools
10-
import argparse
1110
import sys
1211

1312
if os.name == "nt":

Tools/ssl/multissltests.py

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
from urllib2 import urlopen, HTTPError
3636
import re
3737
import shutil
38-
import string
3938
import subprocess
4039
import sys
4140
import tarfile

0 commit comments

Comments
 (0)