Total Complexity | 3 |
Total Lines | 10 |
Duplicated Lines | 0 % |
1 | import re |
||
29 | class RangeArgumentTemplate(ArgumentTemplate): |
||
30 | def __init__(self): |
||
31 | self.regex = "\[(\d+):(\d+)(?::(\d+))?\]" |
||
32 | |||
33 | def unfold(self, match): |
||
34 | groups = re.search(self.regex, match).groups() |
||
35 | start = int(groups[0]) |
||
36 | end = int(groups[1]) |
||
37 | step = 1 if groups[2] is None else int(groups[2]) |
||
38 | return map(str, range(start, end, step)) |
||
39 | |||
42 |