Skip to content
Snippets Groups Projects
Commit facbbd89 authored by Theophile GENTILHOMME's avatar Theophile GENTILHOMME
Browse files

[script][common_options] Modification of criterion_option

Correct display of available criteria
parent 18c8385d
Branches
Tags
1 merge request!65Modification of criterion_option
Pipeline #
...@@ -310,9 +310,9 @@ def criterion_option(lcriteria=['eer', 'min-hter', 'far'], **kwargs): ...@@ -310,9 +310,9 @@ def criterion_option(lcriteria=['eer', 'min-hter', 'far'], **kwargs):
List of possible criteria List of possible criteria
""" """
def custom_criterion_option(func): def custom_criterion_option(func):
def callback(ctx, param, value):
list_accepted_crit = lcriteria if lcriteria is not None else \ list_accepted_crit = lcriteria if lcriteria is not None else \
['eer', 'min-hter', 'far'] ['eer', 'min-hter', 'far']
def callback(ctx, param, value):
if value not in list_accepted_crit: if value not in list_accepted_crit:
raise click.BadParameter('Incorrect value for `--criterion`. ' raise click.BadParameter('Incorrect value for `--criterion`. '
'Must be one of [`%s`]' % 'Must be one of [`%s`]' %
...@@ -322,7 +322,7 @@ def criterion_option(lcriteria=['eer', 'min-hter', 'far'], **kwargs): ...@@ -322,7 +322,7 @@ def criterion_option(lcriteria=['eer', 'min-hter', 'far'], **kwargs):
return click.option( return click.option(
'-c', '--criterion', default='eer', '-c', '--criterion', default='eer',
help='Criterion to compute plots and ' help='Criterion to compute plots and '
'metrics: `eer`, `min-hter` or `far`', 'metrics: %s)' % ', '.join(list_accepted_crit),
callback=callback, is_eager=True, **kwargs)(func) callback=callback, is_eager=True, **kwargs)(func)
return custom_criterion_option return custom_criterion_option
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment