

def __defaultValueExtractor(plug, topLevelPlug, value):
    with IECore.IgnoredExceptions(AttributeError):
        value = value.value
    if plug.isSame(topLevelPlug):
        return value
    for name in plug.relativeName(topLevelPlug).split('.'):
        try:
            value = getattr(value, name)
        except AttributeError:
            accessor = getattr(value, (('get' + name[0].upper()) + name[1:]), None)
            if (accessor is not None):
                value = accessor()
            else:
                return None
    return value

dataset/ETHPy150Open ImageEngine/gaffer/python/Gaffer/PythonExpressionEngine.py __defaultValueExtractor/original