Skip to content
Snippets Groups Projects
Commit 2e64748e authored by Yoann Schneider's avatar Yoann Schneider :tennis:
Browse files

Merge branch 'remove-validate-uuid' into 'main'

Remove useless `validate_uuid` function

Closes #233

See merge request !323
parents 5f99f175 42765c91
No related branches found
No related tags found
1 merge request!323Remove useless `validate_uuid` function
......@@ -5,6 +5,7 @@ Extract dataset from Arkindex using a corpus export.
import argparse
import pathlib
from typing import Union
from uuid import UUID
from dan.datasets.extract.arkindex import run
......@@ -12,18 +13,15 @@ from dan.datasets.extract.arkindex import run
MANUAL_SOURCE = "manual"
def validate_uuid(arg_uuid):
try:
return UUID(arg_uuid)
except ValueError:
raise argparse.ArgumentTypeError(f"`{arg_uuid}` is not a valid UUID.")
def parse_worker_version(worker_version_id):
def parse_worker_version(worker_version_id) -> Union[str, bool]:
if worker_version_id == MANUAL_SOURCE:
return False
validate_uuid(worker_version_id)
try:
UUID(worker_version_id)
except ValueError:
raise argparse.ArgumentTypeError(f"`{worker_version_id}` is not a valid UUID.")
return worker_version_id
......@@ -79,19 +77,19 @@ def add_extract_parser(subcommands) -> None:
parser.add_argument(
"--train-folder",
type=validate_uuid,
type=UUID,
help="ID of the training folder to extract from Arkindex.",
required=True,
)
parser.add_argument(
"--val-folder",
type=validate_uuid,
type=UUID,
help="ID of the validation folder to extract from Arkindex.",
required=True,
)
parser.add_argument(
"--test-folder",
type=validate_uuid,
type=UUID,
help="ID of the testing folder to extract from Arkindex.",
required=True,
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment