Commit facbbd89 authored by Theophile GENTILHOMME's avatar Theophile GENTILHOMME

[script][common_options] Modification of criterion_option

Correct display of available criteria
parent 18c8385d
Pipeline #20512 passed with stage
in 39 minutes and 46 seconds
......@@ -310,9 +310,9 @@ def criterion_option(lcriteria=['eer', 'min-hter', 'far'], **kwargs):
List of possible criteria
"""
def custom_criterion_option(func):
list_accepted_crit = lcriteria if lcriteria is not None else \
['eer', 'min-hter', 'far']
def callback(ctx, param, value):
list_accepted_crit = lcriteria if lcriteria is not None else \
['eer', 'min-hter', 'far']
if value not in list_accepted_crit:
raise click.BadParameter('Incorrect value for `--criterion`. '
'Must be one of [`%s`]' %
......@@ -322,7 +322,7 @@ def criterion_option(lcriteria=['eer', 'min-hter', 'far'], **kwargs):
return click.option(
'-c', '--criterion', default='eer',
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)
return custom_criterion_option
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment