From f6e324a745bf20547f062473727ac5f441189ce4 Mon Sep 17 00:00:00 2001 From: Theophile GENTILHOMME <tgentilhomme@jurasix08.idiap.ch> Date: Fri, 6 Apr 2018 11:33:38 +0200 Subject: [PATCH] Add rank click option --- bob/measure/script/common_options.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bob/measure/script/common_options.py b/bob/measure/script/common_options.py index 648f295..d9691f1 100644 --- a/bob/measure/script/common_options.py +++ b/bob/measure/script/common_options.py @@ -311,6 +311,18 @@ def threshold_option(**kwargs): callback=callback, show_default=True,**kwargs)(func) return custom_threshold_option +def rank_option(**kwargs): + '''Get option for rank parameter''' + def custom_rank_option(func): + def callback(ctx, param, value): + value = 1 if value < 0 else value + ctx.meta['rank'] = value + return value + return click.option( + '--rank', type=click.INT, default=1, + help='Given threshold for metrics computations', + callback=callback, show_default=True,**kwargs)(func) + return custom_rank_option def label_option(name_option='x_label', **kwargs): '''Get labels options based on the given name. -- GitLab