Clean up unused imports for the peg generator module (GH-19891)
https://github.com/python/cpython/commit/c95e691c904bb5ebd91825efa81b93cb9e3... commit: c95e691c904bb5ebd91825efa81b93cb9e354a85 branch: master author: Anthony Shaw <anthony.p.shaw@gmail.com> committer: GitHub <noreply@github.com> date: 2020-05-04T03:03:05+01:00 summary: Clean up unused imports for the peg generator module (GH-19891) files: M Tools/peg_generator/pegen/build.py M Tools/peg_generator/pegen/c_generator.py M Tools/peg_generator/pegen/first_sets.py M Tools/peg_generator/pegen/grammar.py M Tools/peg_generator/pegen/grammar_visualizer.py M Tools/peg_generator/scripts/ast_timings.py M Tools/peg_generator/scripts/benchmark.py M Tools/peg_generator/scripts/find_max_nesting.py M Tools/peg_generator/scripts/test_parse_directory.py diff --git a/Tools/peg_generator/pegen/build.py b/Tools/peg_generator/pegen/build.py index 8f9348ddf24ac..931ffc787523b 100644 --- a/Tools/peg_generator/pegen/build.py +++ b/Tools/peg_generator/pegen/build.py @@ -1,12 +1,11 @@ import pathlib import shutil import tokenize -import sys import sysconfig import tempfile import itertools -from typing import Optional, Tuple, List, IO, Iterator, Set, Dict +from typing import Optional, Tuple, List, IO, Set, Dict from pegen.c_generator import CParserGenerator from pegen.grammar import Grammar diff --git a/Tools/peg_generator/pegen/c_generator.py b/Tools/peg_generator/pegen/c_generator.py index c9c67067d4677..40004e7875278 100644 --- a/Tools/peg_generator/pegen/c_generator.py +++ b/Tools/peg_generator/pegen/c_generator.py @@ -1,7 +1,7 @@ import ast from dataclasses import dataclass, field import re -from typing import IO, Any, Dict, List, Optional, Set, Text, Tuple +from typing import Any, Dict, IO, Optional, List, Text, Tuple, Set from enum import Enum from pegen import grammar diff --git a/Tools/peg_generator/pegen/first_sets.py b/Tools/peg_generator/pegen/first_sets.py index da30eba99ce5a..71be5a2e7cbf4 100755 --- a/Tools/peg_generator/pegen/first_sets.py +++ b/Tools/peg_generator/pegen/first_sets.py @@ -1,10 +1,9 @@ #!/usr/bin/env python3.8 import argparse -import collections import pprint import sys -from typing import Optional, Set, Dict +from typing import Set, Dict from pegen.build import build_parser from pegen.grammar import ( diff --git a/Tools/peg_generator/pegen/grammar.py b/Tools/peg_generator/pegen/grammar.py index 67039d5a032ab..78edf412ea6e4 100644 --- a/Tools/peg_generator/pegen/grammar.py +++ b/Tools/peg_generator/pegen/grammar.py @@ -4,7 +4,6 @@ from typing import ( AbstractSet, Any, - Callable, Dict, Iterable, Iterator, @@ -13,11 +12,9 @@ Set, Tuple, TYPE_CHECKING, - TypeVar, Union, ) -from pegen.parser import memoize, Parser if TYPE_CHECKING: from pegen.parser_generator import ParserGenerator diff --git a/Tools/peg_generator/pegen/grammar_visualizer.py b/Tools/peg_generator/pegen/grammar_visualizer.py index b1d51d2cdb250..7362ec5fa0f4d 100644 --- a/Tools/peg_generator/pegen/grammar_visualizer.py +++ b/Tools/peg_generator/pegen/grammar_visualizer.py @@ -1,7 +1,7 @@ import argparse import sys -from typing import Any, Iterator, Iterable, Callable +from typing import Any, Iterator, Callable from pegen.build import build_parser from pegen.grammar import Grammar, Rule diff --git a/Tools/peg_generator/scripts/ast_timings.py b/Tools/peg_generator/scripts/ast_timings.py index 7ebd46fdac685..ca252208f283e 100644 --- a/Tools/peg_generator/scripts/ast_timings.py +++ b/Tools/peg_generator/scripts/ast_timings.py @@ -1,8 +1,6 @@ import ast import sys import time -import token -import tokenize from pegen.testutil import print_memstats diff --git a/Tools/peg_generator/scripts/benchmark.py b/Tools/peg_generator/scripts/benchmark.py index 0e9d5bd104813..d39ac3dca79e7 100644 --- a/Tools/peg_generator/scripts/benchmark.py +++ b/Tools/peg_generator/scripts/benchmark.py @@ -4,7 +4,6 @@ import ast import sys import os -import resource from time import time import memory_profiler diff --git a/Tools/peg_generator/scripts/find_max_nesting.py b/Tools/peg_generator/scripts/find_max_nesting.py index a2c41a821342a..f2fdd00bfb7cd 100755 --- a/Tools/peg_generator/scripts/find_max_nesting.py +++ b/Tools/peg_generator/scripts/find_max_nesting.py @@ -13,11 +13,7 @@ Usage: python -m scripts.find_max_nesting """ -import os import sys -from tempfile import TemporaryDirectory -from pathlib import Path -from typing import Any from _peg_parser import parse_string diff --git a/Tools/peg_generator/scripts/test_parse_directory.py b/Tools/peg_generator/scripts/test_parse_directory.py index a6078ef564061..aef9c74b52881 100755 --- a/Tools/peg_generator/scripts/test_parse_directory.py +++ b/Tools/peg_generator/scripts/test_parse_directory.py @@ -4,7 +4,6 @@ import ast import os import sys -import tempfile import time import traceback from glob import glob
participants (1)
-
Anthony Shaw