Fix number attribute for float numbers. (#258)

main
Nikita Manovich 7 years ago committed by GitHub
parent 3fbb5a52b4
commit ad76521ba0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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': # <prefix>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]:

Loading…
Cancel
Save