mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +00:00
Fix some scripts in the peg generator folder (GH-19853)
This commit is contained in:
parent
02047265eb
commit
9dbaa8d9f0
10 changed files with 16064 additions and 31 deletions
|
|
@ -32,6 +32,9 @@
|
|||
|
||||
from typing import List
|
||||
|
||||
sys.path.insert(0, os.getcwd())
|
||||
from pegen.ast_dump import ast_dump
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"-d", "--diff", action="store_true", help="show diff between grammar and ast (requires -g)"
|
||||
|
|
@ -49,7 +52,7 @@
|
|||
|
||||
def format_tree(tree: ast.AST, verbose: bool = False) -> str:
|
||||
with tempfile.NamedTemporaryFile("w+") as tf:
|
||||
tf.write(ast.dump(tree, include_attributes=verbose))
|
||||
tf.write(ast_dump(tree, include_attributes=verbose))
|
||||
tf.write("\n")
|
||||
tf.flush()
|
||||
cmd = f"black -q {tf.name}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue