From 4cf1312e9252ba1769f3e78ac4dcdc55783f3462 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 17 Jun 2024 21:58:56 +0200 Subject: [PATCH] gh-120417: Remove unused imports in cases_generator (#120622) --- Tools/cases_generator/analyzer.py | 2 +- Tools/cases_generator/generators_common.py | 4 +--- Tools/cases_generator/opcode_id_generator.py | 3 --- Tools/cases_generator/opcode_metadata_generator.py | 4 ---- Tools/cases_generator/optimizer_generator.py | 3 +-- Tools/cases_generator/parser.py | 2 +- Tools/cases_generator/py_metadata_generator.py | 1 - Tools/cases_generator/target_generator.py | 1 - Tools/cases_generator/tier1_generator.py | 8 ++------ Tools/cases_generator/tier2_generator.py | 6 +----- Tools/cases_generator/uop_id_generator.py | 3 --- 11 files changed, 7 insertions(+), 30 deletions(-) diff --git a/Tools/cases_generator/analyzer.py b/Tools/cases_generator/analyzer.py index e44bebd8f3c4a42..96e2fd57c745cbb 100644 --- a/Tools/cases_generator/analyzer.py +++ b/Tools/cases_generator/analyzer.py @@ -1,4 +1,4 @@ -from dataclasses import dataclass, field +from dataclasses import dataclass import lexer import parser import re diff --git a/Tools/cases_generator/generators_common.py b/Tools/cases_generator/generators_common.py index cc9eb8a0e90eeb6..efbfc94b4159764 100644 --- a/Tools/cases_generator/generators_common.py +++ b/Tools/cases_generator/generators_common.py @@ -4,14 +4,12 @@ from analyzer import ( Instruction, Uop, - analyze_files, Properties, - Skip, ) from cwriter import CWriter from typing import Callable, Mapping, TextIO, Iterator from lexer import Token -from stack import StackOffset, Stack +from stack import Stack ROOT = Path(__file__).parent.parent.parent diff --git a/Tools/cases_generator/opcode_id_generator.py b/Tools/cases_generator/opcode_id_generator.py index 5a3009a5c04c27b..7932379b02dbff6 100644 --- a/Tools/cases_generator/opcode_id_generator.py +++ b/Tools/cases_generator/opcode_id_generator.py @@ -4,12 +4,9 @@ """ import argparse -import os.path -import sys from analyzer import ( Analysis, - Instruction, analyze_files, ) from generators_common import ( diff --git a/Tools/cases_generator/opcode_metadata_generator.py b/Tools/cases_generator/opcode_metadata_generator.py index 2632eb89ce80cd6..0f5790dc4af40f0 100644 --- a/Tools/cases_generator/opcode_metadata_generator.py +++ b/Tools/cases_generator/opcode_metadata_generator.py @@ -4,15 +4,12 @@ """ import argparse -import os.path -import sys from analyzer import ( Analysis, Instruction, PseudoInstruction, analyze_files, - Skip, Uop, ) from generators_common import ( @@ -20,7 +17,6 @@ ROOT, write_header, cflags, - StackOffset, ) from cwriter import CWriter from typing import TextIO diff --git a/Tools/cases_generator/optimizer_generator.py b/Tools/cases_generator/optimizer_generator.py index d5592672a555149..fb3e577de7346ad 100644 --- a/Tools/cases_generator/optimizer_generator.py +++ b/Tools/cases_generator/optimizer_generator.py @@ -18,13 +18,12 @@ ROOT, write_header, emit_tokens, - emit_to, replace_sync_sp, ) from cwriter import CWriter from typing import TextIO, Iterator from lexer import Token -from stack import Stack, SizeMismatch, UNUSED +from stack import Stack, SizeMismatch DEFAULT_OUTPUT = ROOT / "Python/optimizer_cases.c.h" DEFAULT_ABSTRACT_INPUT = (ROOT / "Python/optimizer_bytecodes.c").absolute().as_posix() diff --git a/Tools/cases_generator/parser.py b/Tools/cases_generator/parser.py index 2b77d14d21143f7..db672ad5501f156 100644 --- a/Tools/cases_generator/parser.py +++ b/Tools/cases_generator/parser.py @@ -1,4 +1,4 @@ -from parsing import ( +from parsing import ( # noqa: F401 InstDef, Macro, Pseudo, diff --git a/Tools/cases_generator/py_metadata_generator.py b/Tools/cases_generator/py_metadata_generator.py index 0dbcd599f9d4d98..3f7ffbc5523fd0e 100644 --- a/Tools/cases_generator/py_metadata_generator.py +++ b/Tools/cases_generator/py_metadata_generator.py @@ -12,7 +12,6 @@ from generators_common import ( DEFAULT_INPUT, ROOT, - root_relative_path, write_header, ) from cwriter import CWriter diff --git a/Tools/cases_generator/target_generator.py b/Tools/cases_generator/target_generator.py index 44a699c92bbd226..7f610bff6290e2c 100644 --- a/Tools/cases_generator/target_generator.py +++ b/Tools/cases_generator/target_generator.py @@ -14,7 +14,6 @@ ROOT, ) from cwriter import CWriter -from typing import TextIO DEFAULT_OUTPUT = ROOT / "Python/opcode_targets.h" diff --git a/Tools/cases_generator/tier1_generator.py b/Tools/cases_generator/tier1_generator.py index fb2ab931b1c1080..5df4413e833d5a4 100644 --- a/Tools/cases_generator/tier1_generator.py +++ b/Tools/cases_generator/tier1_generator.py @@ -4,8 +4,6 @@ """ import argparse -import os.path -import sys from analyzer import ( Analysis, @@ -14,7 +12,6 @@ Part, analyze_files, Skip, - StackItem, analysis_error, ) from generators_common import ( @@ -24,9 +21,8 @@ emit_tokens, ) from cwriter import CWriter -from typing import TextIO, Iterator -from lexer import Token -from stack import StackOffset, Stack, SizeMismatch +from typing import TextIO +from stack import Stack, SizeMismatch DEFAULT_OUTPUT = ROOT / "Python/generated_cases.c.h" diff --git a/Tools/cases_generator/tier2_generator.py b/Tools/cases_generator/tier2_generator.py index 944d134f12a18ec..a091870489fbaf4 100644 --- a/Tools/cases_generator/tier2_generator.py +++ b/Tools/cases_generator/tier2_generator.py @@ -4,16 +4,12 @@ """ import argparse -import os.path -import sys from analyzer import ( Analysis, Instruction, Uop, - Part, analyze_files, - Skip, StackItem, analysis_error, ) @@ -28,7 +24,7 @@ from cwriter import CWriter from typing import TextIO, Iterator from lexer import Token -from stack import StackOffset, Stack, SizeMismatch +from stack import Stack, SizeMismatch DEFAULT_OUTPUT = ROOT / "Python/executor_cases.c.h" diff --git a/Tools/cases_generator/uop_id_generator.py b/Tools/cases_generator/uop_id_generator.py index eb5e3f4a324735e..aae89faaa928e1c 100644 --- a/Tools/cases_generator/uop_id_generator.py +++ b/Tools/cases_generator/uop_id_generator.py @@ -4,12 +4,9 @@ """ import argparse -import os.path -import sys from analyzer import ( Analysis, - Instruction, analyze_files, ) from generators_common import (