Skip to content

Commit b919c09

Browse files
committed
Add checks to public Range class
1 parent 4daf153 commit b919c09

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

dataikuapi/dss/ml.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,13 @@ def range(self):
891891

892892
class Range(object):
893893

894-
def __init__(self, min, max, nb_values=3):
894+
def _check_input(self, value):
895+
assert isinstance(value, (int, float)), "Invalid input type for Range: {}".format(type(value))
896+
897+
def __init__(self, min, max, nb_values=None):
898+
self._check_input(min)
899+
self._check_input(max)
900+
assert min <= max, "Invalid Range: min must be lower than max"
895901
self.min = min
896902
self.max = max
897903
self.nb_values = nb_values

0 commit comments

Comments
 (0)