diff --git a/clearml/task_parameters.py b/clearml/task_parameters.py index f39b873f..e611a883 100644 --- a/clearml/task_parameters.py +++ b/clearml/task_parameters.py @@ -3,7 +3,7 @@ from attr import validators -__all__ = ['range_validator', 'param', 'percent_param', 'TaskParameters'] +__all__ = ["range_validator", "param", "percent_param", "TaskParameters"] def _canonize_validator(current_validator): @@ -35,23 +35,15 @@ def range_validator(min_value, max_value): :param max_value: The maximum limit of the range, inclusive. None for no maximum limit. :return: A new range validator. """ + def _range_validator(instance, attribute, value): - if ((min_value is not None) and (value < min_value)) or \ - ((max_value is not None) and (value > max_value)): + if ((min_value is not None) and (value < min_value)) or ((max_value is not None) and (value > max_value)): raise ValueError("{} must be in range [{}, {}]".format(attribute.name, min_value, max_value)) return _range_validator -def param( - validator=None, - range=None, - type=None, - desc=None, - metadata=None, - *args, - **kwargs -): +def param(validator=None, range=None, type=None, desc=None, metadata=None, *args, **kwargs): """ A parameter inside a TaskParameters class.