Skip to content

Commit

Permalink
fix: make description optional
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnacioHeredia committed Aug 6, 2024
1 parent 05d7f06 commit 7717348
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions deepaas/cmd/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ def _fields_to_dict(fields_in):
param["default"] = val.missing

# infer 'help'
val_help = val.metadata["description"]
val_help = val.metadata.get("description", "")
# argparse hates % sign:
if "%" in val_help:
# replace single occurancies of '%' with '%%'
# since "%%"" is accepted by argparse
val_help = re.sub(r"(?<!%)%(?!%)", r"%%", val_help)

if "enum" in val.metadata.keys():
val_help = f"{val_help}. Choices: {val.metadata['enum']}"
val_help = f"{val_help} \n Choices: {val.metadata['enum']}"
param["help"] = val_help

dict_out[key] = param
Expand Down

0 comments on commit 7717348

Please sign in to comment.