Fixed edge case where the sequence input list was 1.

modularize
Sofus Albert Høgsbro Rose 2016-08-23 12:40:30 -04:00
parent c575dd1ddd
commit 5a31a9fb2b
1 changed files with 1 additions and 1 deletions

View File

@ -28,7 +28,7 @@ import sys
def spSeq(seq, outLen) : def spSeq(seq, outLen) :
perfSep = (1/outLen) * len(seq) perfSep = (1/outLen) * len(seq)
return list(filter(len, [seq[round(perfSep * i):round(perfSep * (i + 1))] for i in range(len(seq))])) return list(filter(len, [seq[round(perfSep * i):round(perfSep * (i + 1))] for i in range(len(seq))])) if len(seq) > 1 else seq
def splitThreadRange(inNum, inThreads) : def splitThreadRange(inNum, inThreads) :
return [str(l[0]) + '-' + str(l[-1]) for l in spSeq(list(range(inNum)), inThreads)] return [str(l[0]) + '-' + str(l[-1]) for l in spSeq(list(range(inNum)), inThreads)]