mirror of
https://github.com/karma-riuk/crab.git
synced 2025-07-05 05:28:13 +02:00
using enum choice actoin instead of the previous
thing we were using
This commit is contained in:
@ -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")
|
||||||
|
Reference in New Issue
Block a user