def _load_versions():
    d_name = os.path.dirname(__file__)
    m_template = 'sahara.plugins.mapr.versions.%s.version_handler'

    def predicate(v_dir):
        if v_dir != "__pycache__":
            v_dir = os.path.join(d_name, v_dir)
            return os.path.isdir(v_dir) and os.listdir(v_dir)

        return False

    def mapper(v_dir):
        return m_template % v_dir

    v_dirs = filter(predicate, os.listdir(d_name))
    m_names = map(mapper, v_dirs)
    versions = {}
    for m_name in m_names:
        m = __import__(m_name, fromlist=['sahara'])
        versions[m.version] = getattr(m, 'VersionHandler')()
    return versions
dataset/ETHPy150Open openstack/sahara/sahara/plugins/mapr/versions/version_handler_factory.py/_load_versions/original