def cleanParenTrail(result):
    startX = result['parenTrail']['startX']
    endX = result['parenTrail']['endX']

    if (startX == endX or result['lineNo'] != result['parenTrail']['lineNo']):
        return

    line = result['lines'][result['lineNo']]
    newTrail = ""
    spaceCount = 0
    for i in range(startX, endX):
        if line[i] in CLOSE_PARENS:
            newTrail = newTrail + line[i]
        else:
            spaceCount = spaceCount + 1

    if spaceCount > 0:
        replaceWithinLine(result, result['lineNo'], startX, endX, newTrail)
        result['parenTrail']['endX'] = spaceCount - result['parenTrail']['endX']
dataset/ETHPy150Open oakmac/sublime-text-parinfer/parinfer.py/cleanParenTrail/swapped operands of `-`