Skip to content

Commit 5912f82

Browse files
authored
Add a break to lead 0 count (#33)
Fix issue with range containing zeroes that are leading, for example "host[1-10,1001-1003]" would add two leading zeroes to host1 to host10 while there are supposed to be none.
1 parent 8ace7a6 commit 5912f82

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

hostlist/hostlist.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ def expand(nodelist):
105105
if digit == '0':
106106
lead_zeros = lead_zeros + 1
107107
lead_zeros_str = lead_zeros_str + '0'
108+
else:
109+
break
108110

109111
rng_list = range(int(tmp_list[0]), int(tmp_list[1]) + 1)
110112
final_list.extend(rng_list)

0 commit comments

Comments
 (0)