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-84623: Remove unused imports #94132

Merged
merged 1 commit into from
Jun 22, 2022
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
3 changes: 2 additions & 1 deletion Doc/includes/email-headers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Import the email modules we'll need
from email.parser import BytesParser, Parser
#from email.parser import BytesParser
from email.parser import Parser
from email.policy import default

# If the e-mail headers are in a file, uncomment these two lines:
Expand Down
3 changes: 1 addition & 2 deletions Doc/tools/extensions/asdl_highlight.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import os
import sys
from pathlib import Path

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

from pygments.lexer import RegexLexer, bygroups, include, words
from pygments.token import (Comment, Generic, Keyword, Name, Operator,
from pygments.token import (Comment, Keyword, Name, Operator,
Punctuation, Text)

from asdl import builtin_types
Expand Down
2 changes: 1 addition & 1 deletion Doc/tools/extensions/peg_highlight.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pygments.lexer import RegexLexer, bygroups, include
from pygments.token import Comment, Generic, Keyword, Name, Operator, Punctuation, Text
from pygments.token import Comment, Keyword, Name, Operator, Punctuation, Text

from sphinx.highlighting import lexers

Expand Down
1 change: 0 additions & 1 deletion Doc/tools/extensions/pyspecific.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from sphinx.util import status_iterator, logging
from sphinx.util.nodes import split_explicit_title
from sphinx.writers.text import TextWriter, TextTranslator
from sphinx.writers.latex import LaTeXTranslator

try:
from sphinx.domains.python import PyFunction, PyMethod
Expand Down
2 changes: 1 addition & 1 deletion Lib/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin
from math import tau as TWOPI, floor as _floor, isfinite as _isfinite
from os import urandom as _urandom
from _collections_abc import Set as _Set, Sequence as _Sequence
from _collections_abc import Sequence as _Sequence
from operator import index as _index
from itertools import accumulate as _accumulate, repeat as _repeat
from bisect import bisect as _bisect
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_asyncio/test_unix_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import socket
import stat
import sys
import tempfile
import threading
import unittest
from unittest import mock
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_ctypes/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
class SimpleTypesTestCase(unittest.TestCase):

def setUp(self):
import ctypes
try:
from _ctypes import set_conversion_mode
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_sqlite3/test_transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source distribution.

import os, unittest
import unittest
import sqlite3 as sqlite

from test.support import LOOPBACK_TIMEOUT
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_unittest/test_program.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import io

import os
import sys
import subprocess
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_unittest/test_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys
import textwrap

from test.support import warnings_helper, captured_stdout, captured_stderr
from test.support import warnings_helper, captured_stdout

import traceback
import unittest
Expand Down
1 change: 0 additions & 1 deletion Lib/tkinter/test/support.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import functools
import re
import tkinter
import unittest

Expand Down
1 change: 0 additions & 1 deletion Lib/tkinter/test/widget_tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Common tests for test_tkinter/test_widgets.py and test_ttk/test_widgets.py

import unittest
import tkinter
from tkinter.test.support import (AbstractTkTest, tcl_version,
pixels_conv, tcl_obj_eq)
Expand Down
3 changes: 0 additions & 3 deletions PC/layout/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@
__version__ = "3.8"

import argparse
import functools
import os
import re
import shutil
import subprocess
import sys
import tempfile
import zipfile
Expand Down
4 changes: 1 addition & 3 deletions PC/layout/support/appxmanifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
__version__ = "3.8"


import collections
import ctypes
import io
import os
import sys

from pathlib import Path, PureWindowsPath
from pathlib import PureWindowsPath
from xml.etree import ElementTree as ET

from .constants import *
Expand Down
2 changes: 0 additions & 2 deletions PC/layout/support/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
__version__ = "3.8"


import sys

__all__ = ["PYTHON_CAT_NAME", "PYTHON_CDF_NAME"]


Expand Down
1 change: 0 additions & 1 deletion PC/layout/support/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
__version__ = "3.8"

import os
import re
import struct
import sys

Expand Down
1 change: 0 additions & 1 deletion Parser/asdl_c.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#! /usr/bin/env python
"""Generate C code from an ASDL description."""

import os
import sys
import textwrap
import types
Expand Down
1 change: 0 additions & 1 deletion Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import shlex
import string
import sys
import tempfile
import textwrap
import traceback
import types
Expand Down
7 changes: 0 additions & 7 deletions Tools/peg_generator/pegen/grammar.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
from __future__ import annotations

from abc import abstractmethod
from typing import (
TYPE_CHECKING,
AbstractSet,
Any,
Dict,
Iterable,
Iterator,
List,
Optional,
Set,
Tuple,
Union,
)

if TYPE_CHECKING:
from pegen.parser_generator import ParserGenerator


class GrammarError(Exception):
pass
Expand Down
1 change: 0 additions & 1 deletion Tools/peg_generator/scripts/grammar_grapher.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
Alt,
Cut,
Forced,
Grammar,
Group,
Leaf,
Lookahead,
Expand Down
2 changes: 0 additions & 2 deletions Tools/peg_generator/scripts/test_parse_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
import os
import sys
import time
import traceback
import tokenize
from glob import glob, escape
from pathlib import PurePath

from typing import List, Optional, Any, Tuple

sys.path.insert(0, os.getcwd())
from pegen.ast_dump import ast_dump
from pegen.testutil import print_memstats

SUCCESS = "\033[92m"
Expand Down
3 changes: 1 addition & 2 deletions Tools/peg_generator/scripts/test_pypi_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
import pathlib
import sys

from typing import Generator, Any
from typing import Generator

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

from pegen import build
from scripts import test_parse_directory

HERE = pathlib.Path(__file__).resolve().parent
Expand Down
1 change: 0 additions & 1 deletion Tools/scripts/freeze_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import os
import ntpath
import posixpath
import sys
import argparse
from update_file import updating_file_with_tmpfile

Expand Down
1 change: 0 additions & 1 deletion Tools/scripts/generate_re_casefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# This script generates Lib/re/_casefix.py.

import collections
import re
import sys
import unicodedata

Expand Down
1 change: 0 additions & 1 deletion Tools/scripts/pathfix.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
# into a program for a different change to Python programs...

import sys
import re
import os
from stat import *
import getopt
Expand Down
1 change: 0 additions & 1 deletion Tools/scripts/stable_abi.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import textwrap
import tomllib
import difflib
import shutil
import pprint
import sys
import os
Expand Down
1 change: 0 additions & 1 deletion Tools/scripts/summarize_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import opcode
from datetime import date
import itertools
import argparse
import sys

if os.name == "nt":
Expand Down
1 change: 0 additions & 1 deletion Tools/ssl/multissltests.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
from urllib2 import urlopen, HTTPError
import re
import shutil
import string
import subprocess
import sys
import tarfile
Expand Down