Skip to content

Commit

Permalink
Black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
allegroai committed Apr 27, 2024
1 parent 4d88163 commit 7a4154f
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions clearml/task_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 7a4154f

Please sign in to comment.