

def _get_class(typestring, subname, cache, lock):
    ' If not loaded, loads the specified class then returns an instance\n    of it.\n\n    Loaded classes are cached in the provided cache dict\n\n    Throws various exceptions if loading the msg class fails '
    cls = _get_from_cache(cache, lock, typestring)
    if (cls is not None):
        return cls
    (modname, classname) = _splittype(typestring)
    norm_typestring = ((modname + '/') + classname)
    cls = _get_from_cache(cache, lock, norm_typestring)
    if (cls is not None):
        return cls
    cls = _load_class(modname, subname, classname)
    _add_to_cache(cache, lock, typestring, cls)
    _add_to_cache(cache, lock, norm_typestring, cls)
    return cls

dataset/ETHPy150Open RobotWebTools/rosbridge_suite/rosbridge_library/src/rosbridge_library/internal/ros_loader.py _get_class/original