Improve range parsing

This commit is contained in:
Loic Guegan 2022-09-10 20:14:28 +02:00
parent c73fc04ddb
commit 5264b28126

View file

@ -6,14 +6,15 @@ class UnitsParser:
def range(r,limit):
if r == "all":
return(range(0,limit))
elt=r.replace("@",str(limit-1)).split("-")
r=r.replace("@",str(limit-1))
elt=r.split("-")
if len(elt) == 2:
min = int(elt[0])
max = int(elt[1])
# TODO: Check min/max
return(range(min,max))
else:
return([int(elt[0])])
return(list(map(int, r.split(","))))
def bandwidth(bw):
for i,c in enumerate(bw):