

def styleFromList(styleName, specArray, spacing, showAllLevels):
    bullet = ''
    numPrefix = ''
    numSuffix = ''
    numberFormat = ''
    cssLengthNum = 0
    cssLengthUnits = ''
    numbered = False
    displayLevels = 0
    listStyle = ListStyle(name=styleName)
    numFormatPattern = re.compile('([1IiAa])')
    cssLengthPattern = re.compile('([^a-z]+)\\s*([a-z]+)?')
    m = cssLengthPattern.search(spacing)
    if (m != None):
        cssLengthNum = float(m.group(1))
        if (m.lastindex == 2):
            cssLengthUnits = m.group(2)
    i = 0
    while (i < len(specArray)):
        specification = specArray[i]
        m = numFormatPattern.search(specification)
        if (m != None):
            numberFormat = m.group(1)
            numPrefix = specification[0:m.start(1)]
            numSuffix = specification[m.end(1):]
            bullet = ''
            numbered = True
            if showAllLevels:
                displayLevels = (i + 1)
            else:
                displayLevels = 1
        else:
            bullet = specification
            numPrefix = ''
            numSuffix = ''
            numberFormat = ''
            displayLevels = 1
            numbered = False
        if numbered:
            lls = ListLevelStyleNumber(level=(i + 1))
            if (numPrefix != ''):
                lls.setAttribute('numprefix', numPrefix)
            if (numSuffix != ''):
                lls.setAttribute('numsuffix', numSuffix)
            lls.setAttribute('displaylevels', lls)
        else:
            lls = ListLevelStyleBullet(level=(i + 1), bulletchar=bullet[0])
        llp = ListLevelProperties()
        llp.setAttribute('spacebefore', (str((cssLengthNum * (i + 1))) + cssLengthUnits))
        llp.setAttribute('minlabelwidth', (str(cssLengthNum) + cssLengthUnits))
        lls.addElement(llp)
        listStyle.addElement(lls)
        i += 1
    return listStyle

dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/tablib-0.10.0/tablib/packages/odf/easyliststyle.py styleFromList/VarMisuse@327/454 `displayLevels`->`lls`