Fix some scripts in the peg generator folder (GH-19853)

This commit is contained in:
Pablo Galindo 2020-05-02 05:23:06 +01:00 committed by GitHub
parent 02047265eb
commit 9dbaa8d9f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 16064 additions and 31 deletions

View file

@ -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}"