Skip to content

Commit

Permalink
馃 Updates from OwlBot post-processor
Browse files Browse the repository at this point in the history
  • Loading branch information
gcf-owl-bot[bot] committed Jun 7, 2023
1 parent 221a369 commit 3dbf6cb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scripts/readme-gen/readme_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,37 +33,37 @@
autoescape=True,
)

README_TMPL = jinja_env.get_template("README.tmpl.rst")
README_TMPL = jinja_env.get_template('README.tmpl.rst')


def get_help(file):
return subprocess.check_output(["python", file, "--help"]).decode()
return subprocess.check_output(['python', file, '--help']).decode()


def main():
parser = argparse.ArgumentParser()
parser.add_argument("source")
parser.add_argument("--destination", default="README.rst")
parser.add_argument('source')
parser.add_argument('--destination', default='README.rst')

args = parser.parse_args()

source = os.path.abspath(args.source)
root = os.path.dirname(source)
destination = os.path.join(root, args.destination)

jinja_env.globals["get_help"] = get_help
jinja_env.globals['get_help'] = get_help

with io.open(source, "r") as f:
with io.open(source, 'r') as f:
config = yaml.load(f)

# This allows get_help to execute in the right directory.
os.chdir(root)

output = README_TMPL.render(config)

with io.open(destination, "w") as f:
with io.open(destination, 'w') as f:
f.write(output)


if __name__ == "__main__":
if __name__ == '__main__':
main()

0 comments on commit 3dbf6cb

Please sign in to comment.