def setRange(x=0.0, oldmin=0.0, oldmax=1.0, newmin=0.0, newmax=1.0) :
    """ Resets x range from x linear interpolation of oldmin to oldmax to x linear interpolation from newmin to newmax

    :rtype: float
    """
    if oldmin<oldmax :
        realoldmin=oldmin
        realoldmax=oldmax
        realnewmin=newmin
        realnewmax=newmax
    elif oldmin>oldmax :
        realoldmin=oldmax
        realoldmax=oldmin
        realnewmin=newmax
        realnewmax=newmin
    else :
        return x
    if x<realoldmin :
        result = realnewmin
    elif x>realoldmax :
        result = realnewmax
    else :
        result = (realnewmin+(realnewmax-realnewmin)*(x-oldmin)/(oldmax-oldmin))
    return result
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/util/mathutils.py/setRange/original