From ad76521ba062d9eb4189b3f69af49d79f3808b10 Mon Sep 17 00:00:00 2001 From: Nikita Manovich <40690625+nmanovic@users.noreply.github.com> Date: Fri, 28 Dec 2018 12:24:17 +0300 Subject: [PATCH] Fix number attribute for float numbers. (#258) --- cvat/apps/engine/task.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cvat/apps/engine/task.py b/cvat/apps/engine/task.py index 786dfb03..00b11e66 100644 --- a/cvat/apps/engine/task.py +++ b/cvat/apps/engine/task.py @@ -401,10 +401,12 @@ def _parse_labels(labels): raise ValueError("labels string is not corect. " + "`{}` attribute has incorrect value.".format(attr['name'])) elif attr['type'] == 'number': # number=name:min,max,step - if not (len(values) == 3 and values[0].isdigit() and \ - values[1].isdigit() and values[2].isdigit() and \ - int(values[0]) < int(values[1])): - raise ValueError("labels string is not corect. " + + try: + if len(values) != 3 or float(values[2]) <= 0 or \ + float(values[0]) >= float(values[1]): + raise ValueError + except ValueError: + raise ValueError("labels string is not correct. " + "`{}` attribute has incorrect format.".format(attr['name'])) if attr['name'] in parsed_labels[last_label]: