Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
refresh_modules.py: avoid the eval() call
Browse files Browse the repository at this point in the history
  • Loading branch information
goneri committed Dec 22, 2022
1 parent 62a332c commit 5b6082c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions gouttelette/cmd/refresh_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,6 @@ def main():
if not generator:
raise Exception("gouttelette.yaml is missing generator value")

generator_coll = re.sub("(.*)_code_generator", r"\1", generator["name"])
parser = argparse.ArgumentParser(
description=f"Build the {generator['name']} modules."
)
Expand All @@ -1320,8 +1319,12 @@ def main():
help="location where to store the collected schemas (default: ./gouttelette/api_specifications/amazon_cloud)",
)
args = parser.parse_args()
func = "generate_" + generator_coll + "(args)"
eval(func)

func = {
"vmware_rest_code_generator": generate_vmware_rest,
"amazon_cloud_code_generator": generate_amazon_cloud,
}[generator["name"]]
func(args)

info = VersionInfo(generator["name"])
dev_md = args.target_dir / "dev.md"
Expand Down

0 comments on commit 5b6082c

Please sign in to comment.