def getRunList(myrange): """ Take a string like '1,2,5-8' and return a list of integers [1,2,5,6,7,8]. """ myrange = myrange.replace(' ','') if not myrange: return [] try: jobrange(myrange) except AssertionError, ex: raise ConfigurationException("Invalid runRange: %s" % myrange)
def getRunList(myrange): """ Take a string like '1,2,5-8' and return a list of integers [1,2,5,6,7,8]. """ myrange = myrange.replace(' ','') if not myrange: return [] try: jobrange(myrange) except AssertionError, ex: raise ConfigurationException("Invalid runRange: %s" % myrange)
def _expandRange(myrange): """ Used to expand the runRange parameter Take a string like '1,2,5-8' and return a list of integers [1,2,5,6,7,8] """ myrange = myrange.replace(' ','') if not myrange: return [] try: jobrange(myrange) except AssertionError, ex: raise ConfigurationException("Invalid runRange: %s" % myrange)
def _expandRange(myrange): """ Used to expand the runRange parameter Take a string like '1,2,5-8' and return a list of integers [1,2,5,6,7,8] """ myrange = myrange.replace(' ','') if not myrange: return [] try: jobrange(myrange) except AssertionError, ex: raise ConfigurationException("Invalid runRange: %s" % myrange)
def getRunList(myrange): """ Take a string like '1,2,5-8' and return a list of integers [1,2,5,6,7,8]. """ myrange = myrange.replace(' ','') if not myrange: return [] try: jobrange(myrange) except AssertionError: raise ConfigurationException("Invalid runRange: %s" % myrange) myrange = myrange.split(',') result = [] for element in myrange: if element.count('-') > 0: mySubRange = element.split('-') subInterval = range( int(mySubRange[0]), int(mySubRange[1])+1) result.extend(subInterval) else: result.append(int(element)) return result
def getRunList(myrange): """ Take a string like '1,2,5-8' and return a list of integers [1,2,5,6,7,8]. """ myrange = myrange.replace(' ','') if not myrange: return [] try: jobrange(myrange) except AssertionError as ex: raise ConfigurationException("Invalid runRange: %s" % myrange) myrange = myrange.split(',') result = [] for element in myrange: if element.count('-') > 0: mySubRange = element.split('-') subInterval = range( int(mySubRange[0]), int(mySubRange[1])+1) result.extend(subInterval) else: result.append(int(element)) return result