Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DAN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Automatic Text Recognition
DAN
Commits
2e64748e
Commit
2e64748e
authored
1 year ago
by
Yoann Schneider
Browse files
Options
Downloads
Plain Diff
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
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!323
Remove useless `validate_uuid` function
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dan/datasets/extract/__init__.py
+10
-12
10 additions, 12 deletions
dan/datasets/extract/__init__.py
with
10 additions
and
12 deletions
dan/datasets/extract/__init__.py
+
10
−
12
View file @
2e64748e
...
...
@@ -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
,
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment