gh-84623: Remove unused imports (#94132)

This commit is contained in:
Victor Stinner 2022-06-22 19:14:27 +02:00 committed by GitHub
parent 8661c5053f
commit 47e35625ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 9 additions and 43 deletions

View File

@ -1,5 +1,6 @@
# Import the email modules we'll need # 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 from email.policy import default
# If the e-mail headers are in a file, uncomment these two lines: # If the e-mail headers are in a file, uncomment these two lines:

View File

@ -1,4 +1,3 @@
import os
import sys import sys
from pathlib import Path from pathlib import Path
@ -6,7 +5,7 @@ CPYTHON_ROOT = Path(__file__).resolve().parent.parent.parent.parent
sys.path.append(str(CPYTHON_ROOT / "Parser")) sys.path.append(str(CPYTHON_ROOT / "Parser"))
from pygments.lexer import RegexLexer, bygroups, include, words 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) Punctuation, Text)
from asdl import builtin_types from asdl import builtin_types

View File

@ -1,5 +1,5 @@
from pygments.lexer import RegexLexer, bygroups, include 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 from sphinx.highlighting import lexers

View File

@ -30,7 +30,6 @@ from sphinx.locale import translators
from sphinx.util import status_iterator, logging from sphinx.util import status_iterator, logging
from sphinx.util.nodes import split_explicit_title from sphinx.util.nodes import split_explicit_title
from sphinx.writers.text import TextWriter, TextTranslator from sphinx.writers.text import TextWriter, TextTranslator
from sphinx.writers.latex import LaTeXTranslator
try: try:
from sphinx.domains.python import PyFunction, PyMethod from sphinx.domains.python import PyFunction, PyMethod

View File

@ -50,7 +50,7 @@ from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin 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 math import tau as TWOPI, floor as _floor, isfinite as _isfinite
from os import urandom as _urandom 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 operator import index as _index
from itertools import accumulate as _accumulate, repeat as _repeat from itertools import accumulate as _accumulate, repeat as _repeat
from bisect import bisect as _bisect from bisect import bisect as _bisect

View File

@ -9,7 +9,6 @@ import signal
import socket import socket
import stat import stat
import sys import sys
import tempfile
import threading import threading
import unittest import unittest
from unittest import mock from unittest import mock

View File

@ -5,7 +5,6 @@ import test.support
class SimpleTypesTestCase(unittest.TestCase): class SimpleTypesTestCase(unittest.TestCase):
def setUp(self): def setUp(self):
import ctypes
try: try:
from _ctypes import set_conversion_mode from _ctypes import set_conversion_mode
except ImportError: except ImportError:

View File

@ -20,7 +20,7 @@
# misrepresented as being the original software. # misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source distribution. # 3. This notice may not be removed or altered from any source distribution.
import os, unittest import unittest
import sqlite3 as sqlite import sqlite3 as sqlite
from test.support import LOOPBACK_TIMEOUT from test.support import LOOPBACK_TIMEOUT

View File

@ -1,5 +1,3 @@
import io
import os import os
import sys import sys
import subprocess import subprocess

View File

@ -2,7 +2,7 @@ import io
import sys import sys
import textwrap import textwrap
from test.support import warnings_helper, captured_stdout, captured_stderr from test.support import warnings_helper, captured_stdout
import traceback import traceback
import unittest import unittest

View File

@ -1,5 +1,4 @@
import functools import functools
import re
import tkinter import tkinter
import unittest import unittest

View File

@ -1,6 +1,5 @@
# Common tests for test_tkinter/test_widgets.py and test_ttk/test_widgets.py # Common tests for test_tkinter/test_widgets.py and test_ttk/test_widgets.py
import unittest
import tkinter import tkinter
from tkinter.test.support import (AbstractTkTest, tcl_version, from tkinter.test.support import (AbstractTkTest, tcl_version,
pixels_conv, tcl_obj_eq) pixels_conv, tcl_obj_eq)

View File

@ -8,11 +8,8 @@ __author__ = "Steve Dower <steve.dower@python.org>"
__version__ = "3.8" __version__ = "3.8"
import argparse import argparse
import functools
import os import os
import re
import shutil import shutil
import subprocess
import sys import sys
import tempfile import tempfile
import zipfile import zipfile

View File

@ -6,13 +6,11 @@ __author__ = "Steve Dower <steve.dower@python.org>"
__version__ = "3.8" __version__ = "3.8"
import collections
import ctypes import ctypes
import io import io
import os import os
import sys
from pathlib import Path, PureWindowsPath from pathlib import PureWindowsPath
from xml.etree import ElementTree as ET from xml.etree import ElementTree as ET
from .constants import * from .constants import *

View File

@ -6,8 +6,6 @@ __author__ = "Steve Dower <steve.dower@python.org>"
__version__ = "3.8" __version__ = "3.8"
import sys
__all__ = ["PYTHON_CAT_NAME", "PYTHON_CDF_NAME"] __all__ = ["PYTHON_CAT_NAME", "PYTHON_CDF_NAME"]

View File

@ -6,7 +6,6 @@ __author__ = "Steve Dower <steve.dower@python.org>"
__version__ = "3.8" __version__ = "3.8"
import os import os
import re
import struct import struct
import sys import sys

View File

@ -1,7 +1,6 @@
#! /usr/bin/env python #! /usr/bin/env python
"""Generate C code from an ASDL description.""" """Generate C code from an ASDL description."""
import os
import sys import sys
import textwrap import textwrap
import types import types

View File

@ -22,7 +22,6 @@ import re
import shlex import shlex
import string import string
import sys import sys
import tempfile
import textwrap import textwrap
import traceback import traceback
import types import types

View File

@ -1,23 +1,16 @@
from __future__ import annotations from __future__ import annotations
from abc import abstractmethod
from typing import ( from typing import (
TYPE_CHECKING,
AbstractSet, AbstractSet,
Any, Any,
Dict,
Iterable, Iterable,
Iterator, Iterator,
List, List,
Optional, Optional,
Set,
Tuple, Tuple,
Union, Union,
) )
if TYPE_CHECKING:
from pegen.parser_generator import ParserGenerator
class GrammarError(Exception): class GrammarError(Exception):
pass pass

View File

@ -30,7 +30,6 @@ from pegen.grammar import (
Alt, Alt,
Cut, Cut,
Forced, Forced,
Grammar,
Group, Group,
Leaf, Leaf,
Lookahead, Lookahead,

View File

@ -5,7 +5,6 @@ import ast
import os import os
import sys import sys
import time import time
import traceback
import tokenize import tokenize
from glob import glob, escape from glob import glob, escape
from pathlib import PurePath from pathlib import PurePath
@ -13,7 +12,6 @@ from pathlib import PurePath
from typing import List, Optional, Any, Tuple from typing import List, Optional, Any, Tuple
sys.path.insert(0, os.getcwd()) sys.path.insert(0, os.getcwd())
from pegen.ast_dump import ast_dump
from pegen.testutil import print_memstats from pegen.testutil import print_memstats
SUCCESS = "\033[92m" SUCCESS = "\033[92m"

View File

@ -9,11 +9,10 @@ import shutil
import pathlib import pathlib
import sys import sys
from typing import Generator, Any from typing import Generator
sys.path.insert(0, ".") sys.path.insert(0, ".")
from pegen import build
from scripts import test_parse_directory from scripts import test_parse_directory
HERE = pathlib.Path(__file__).resolve().parent HERE = pathlib.Path(__file__).resolve().parent

View File

@ -8,7 +8,6 @@ import hashlib
import os import os
import ntpath import ntpath
import posixpath import posixpath
import sys
import argparse import argparse
from update_file import updating_file_with_tmpfile from update_file import updating_file_with_tmpfile

View File

@ -2,7 +2,6 @@
# This script generates Lib/re/_casefix.py. # This script generates Lib/re/_casefix.py.
import collections import collections
import re
import sys import sys
import unicodedata import unicodedata

View File

@ -27,7 +27,6 @@
# into a program for a different change to Python programs... # into a program for a different change to Python programs...
import sys import sys
import re
import os import os
from stat import * from stat import *
import getopt import getopt

View File

@ -16,7 +16,6 @@ import argparse
import textwrap import textwrap
import tomllib import tomllib
import difflib import difflib
import shutil
import pprint import pprint
import sys import sys
import os import os

View File

@ -7,7 +7,6 @@ import os.path
import opcode import opcode
from datetime import date from datetime import date
import itertools import itertools
import argparse
import sys import sys
if os.name == "nt": if os.name == "nt":

View File

@ -35,7 +35,6 @@ except ImportError:
from urllib2 import urlopen, HTTPError from urllib2 import urlopen, HTTPError
import re import re
import shutil import shutil
import string
import subprocess import subprocess
import sys import sys
import tarfile import tarfile