using enum choice actoin instead of the previous

thing we were using
This commit is contained in:
Karma Riuk
2025-06-03 10:10:36 +02:00
parent 66d046cbaa
commit 45a8122408

View File

@ -3,6 +3,8 @@ from enum import Enum
from typing import Any, Dict, List, Optional, Union from typing import Any, Dict, List, Optional, Union
import json, argparse, os, uuid import json, argparse, os, uuid
from utils import EnumChoicesAction
class OutputType(Enum): class OutputType(Enum):
FULL = "full" FULL = "full"
@ -235,8 +237,9 @@ if __name__ == "__main__":
parser.add_argument( parser.add_argument(
"-t", "-t",
"--output_type", "--output_type",
choices=[mode.value for mode in OutputType], type=OutputType,
default=OutputType.FULL.value, default=OutputType.FULL,
action=EnumChoicesAction,
help="Type of output to generate. webapp is just to keep what's necessary for the webapp to run, i.e. the metadata and the comments.", help="Type of output to generate. webapp is just to keep what's necessary for the webapp to run, i.e. the metadata and the comments.",
) )
parser.add_argument( parser.add_argument(
@ -256,5 +259,5 @@ if __name__ == "__main__":
print("Exiting without saving.") print("Exiting without saving.")
exit(0) exit(0)
print(f"Saving dataset to {args.output},", end=" ", flush=True) print(f"Saving dataset to {args.output},", end=" ", flush=True)
dataset.to_json(args.output, OutputType(args.output_type), args.remove_non_suggesting) dataset.to_json(args.output, args.output_type, args.remove_non_suggesting)
print("Done") print("Done")