Commit ea35dd2e authored by Theophile GENTILHOMME's avatar Theophile GENTILHOMME

Help parameter customization

parent 6e2065e9
Pipeline #21462 passed with stage
in 14 minutes and 57 seconds
...@@ -11,7 +11,7 @@ from bob.extension.scripts.click_helper import ( ...@@ -11,7 +11,7 @@ from bob.extension.scripts.click_helper import (
bool_option, list_float_option, verbosity_option, open_file_mode_option) bool_option, list_float_option, verbosity_option, open_file_mode_option)
LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__)
CONTEXT_SETTINGS = dict(help_option_names=['-?', '-h', '--help'])
def scores_argument(min_arg=1, force_eval=False, **kwargs): def scores_argument(min_arg=1, force_eval=False, **kwargs):
"""Get the argument for scores, and add `dev-scores` and `eval-scores` in """Get the argument for scores, and add `dev-scores` and `eval-scores` in
...@@ -589,7 +589,7 @@ def metrics_command(docstring, criteria=('eer', 'min-hter', 'far')): ...@@ -589,7 +589,7 @@ def metrics_command(docstring, criteria=('eer', 'min-hter', 'far')):
def custom_metrics_command(func): def custom_metrics_command(func):
func.__doc__ = docstring func.__doc__ = docstring
@click.command() @click.command(context_settings=CONTEXT_SETTINGS)
@scores_argument(nargs=-1) @scores_argument(nargs=-1)
@eval_option() @eval_option()
@table_option() @table_option()
...@@ -636,7 +636,7 @@ def roc_command(docstring): ...@@ -636,7 +636,7 @@ def roc_command(docstring):
def custom_roc_command(func): def custom_roc_command(func):
func.__doc__ = docstring func.__doc__ = docstring
@click.command() @click.command(context_settings=CONTEXT_SETTINGS)
@scores_argument(nargs=-1) @scores_argument(nargs=-1)
@titles_option() @titles_option()
@legends_option() @legends_option()
...@@ -691,7 +691,7 @@ def det_command(docstring): ...@@ -691,7 +691,7 @@ def det_command(docstring):
def custom_det_command(func): def custom_det_command(func):
func.__doc__ = docstring func.__doc__ = docstring
@click.command() @click.command(context_settings=CONTEXT_SETTINGS)
@scores_argument(nargs=-1) @scores_argument(nargs=-1)
@output_plot_file_option(default_out='det.pdf') @output_plot_file_option(default_out='det.pdf')
@titles_option() @titles_option()
...@@ -744,7 +744,7 @@ def epc_command(docstring): ...@@ -744,7 +744,7 @@ def epc_command(docstring):
def custom_epc_command(func): def custom_epc_command(func):
func.__doc__ = docstring func.__doc__ = docstring
@click.command() @click.command(context_settings=CONTEXT_SETTINGS)
@scores_argument(min_arg=1, force_eval=True, nargs=-1) @scores_argument(min_arg=1, force_eval=True, nargs=-1)
@output_plot_file_option(default_out='epc.pdf') @output_plot_file_option(default_out='epc.pdf')
@titles_option() @titles_option()
...@@ -789,7 +789,7 @@ def hist_command(docstring): ...@@ -789,7 +789,7 @@ def hist_command(docstring):
def custom_hist_command(func): def custom_hist_command(func):
func.__doc__ = docstring func.__doc__ = docstring
@click.command() @click.command(context_settings=CONTEXT_SETTINGS)
@scores_argument(nargs=-1) @scores_argument(nargs=-1)
@output_plot_file_option(default_out='hist.pdf') @output_plot_file_option(default_out='hist.pdf')
@eval_option() @eval_option()
...@@ -845,7 +845,7 @@ def evaluate_command(docstring, criteria=('eer', 'min-hter', 'far')): ...@@ -845,7 +845,7 @@ def evaluate_command(docstring, criteria=('eer', 'min-hter', 'far')):
def custom_evaluate_command(func): def custom_evaluate_command(func):
func.__doc__ = docstring func.__doc__ = docstring
@click.command() @click.command(context_settings=CONTEXT_SETTINGS)
@scores_argument(nargs=-1) @scores_argument(nargs=-1)
@legends_option() @legends_option()
@sep_dev_eval_option() @sep_dev_eval_option()
...@@ -959,7 +959,7 @@ def multi_metrics_command(docstring, criteria=('eer', 'min-hter', 'far')): ...@@ -959,7 +959,7 @@ def multi_metrics_command(docstring, criteria=('eer', 'min-hter', 'far')):
def custom_metrics_command(func): def custom_metrics_command(func):
func.__doc__ = docstring func.__doc__ = docstring
@click.command('multi-metrics') @click.command('multi-metrics', context_settings=CONTEXT_SETTINGS)
@scores_argument(nargs=-1) @scores_argument(nargs=-1)
@eval_option() @eval_option()
@n_protocols_option() @n_protocols_option()
......
...@@ -8,6 +8,7 @@ from click.types import FLOAT ...@@ -8,6 +8,7 @@ from click.types import FLOAT
from bob.extension.scripts.click_helper import verbosity_option from bob.extension.scripts.click_helper import verbosity_option
from bob.core import random from bob.core import random
from bob.io.base import create_directories_safe from bob.io.base import create_directories_safe
from . import common_options
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -73,7 +74,7 @@ def write_scores_to_file(neg, pos, filename): ...@@ -73,7 +74,7 @@ def write_scores_to_file(neg, pos, filename):
f.write(text) f.write(text)
@click.command() @click.command(context_settings=common_options.CONTEXT_SETTINGS)
@click.argument('outdir') @click.argument('outdir')
@click.option('--mean-neg', default=-1, type=FLOAT, show_default=True) @click.option('--mean-neg', default=-1, type=FLOAT, show_default=True)
@click.option('--mean-pos', default=1, type=FLOAT, show_default=True) @click.option('--mean-pos', default=1, type=FLOAT, show_default=True)
......
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