Skip to content
Snippets Groups Projects
Commit 086a8c08 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

[click] make threshold criteria checking optional

parent 23475f4f
No related branches found
No related tags found
No related merge requests found
Pipeline #36781 passed
...@@ -498,7 +498,7 @@ def no_line_option(**kwargs): ...@@ -498,7 +498,7 @@ def no_line_option(**kwargs):
return custom_no_line_option return custom_no_line_option
def criterion_option(lcriteria=["eer", "min-hter", "far"], **kwargs): def criterion_option(lcriteria=["eer", "min-hter", "far"], check=True, **kwargs):
"""Get option flag to tell which criteriom is used (default:eer) """Get option flag to tell which criteriom is used (default:eer)
Parameters Parameters
...@@ -513,7 +513,7 @@ def criterion_option(lcriteria=["eer", "min-hter", "far"], **kwargs): ...@@ -513,7 +513,7 @@ def criterion_option(lcriteria=["eer", "min-hter", "far"], **kwargs):
) )
def callback(ctx, param, value): def callback(ctx, param, value):
if value not in list_accepted_crit: if value not in list_accepted_crit and check:
raise click.BadParameter( raise click.BadParameter(
"Incorrect value for `--criterion`. " "Incorrect value for `--criterion`. "
"Must be one of [`%s`]" % "`, `".join(list_accepted_crit) "Must be one of [`%s`]" % "`, `".join(list_accepted_crit)
...@@ -536,7 +536,7 @@ def criterion_option(lcriteria=["eer", "min-hter", "far"], **kwargs): ...@@ -536,7 +536,7 @@ def criterion_option(lcriteria=["eer", "min-hter", "far"], **kwargs):
return custom_criterion_option return custom_criterion_option
def decimal_option(dflt=1, **kwargs): def decimal_option(dflt=1, short="-d", **kwargs):
"""Get option to get decimal value""" """Get option to get decimal value"""
def custom_decimal_option(func): def custom_decimal_option(func):
...@@ -545,7 +545,7 @@ def decimal_option(dflt=1, **kwargs): ...@@ -545,7 +545,7 @@ def decimal_option(dflt=1, **kwargs):
return value return value
return click.option( return click.option(
"-d", short,
"--decimal", "--decimal",
type=click.INT, type=click.INT,
default=dflt, default=dflt,
...@@ -865,7 +865,11 @@ def style_option(**kwargs): ...@@ -865,7 +865,11 @@ def style_option(**kwargs):
def metrics_command( def metrics_command(
docstring, criteria=("eer", "min-hter", "far"), far_name="FAR", **kwarg docstring,
criteria=("eer", "min-hter", "far"),
far_name="FAR",
check_criteria=True,
**kwarg
): ):
def custom_metrics_command(func): def custom_metrics_command(func):
func.__doc__ = docstring func.__doc__ = docstring
...@@ -875,7 +879,7 @@ def metrics_command( ...@@ -875,7 +879,7 @@ def metrics_command(
@eval_option() @eval_option()
@table_option() @table_option()
@output_log_metric_option() @output_log_metric_option()
@criterion_option(criteria) @criterion_option(criteria, check=check_criteria)
@thresholds_option() @thresholds_option()
@far_option(far_name=far_name) @far_option(far_name=far_name)
@legends_option() @legends_option()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment