Ejemplo n.º 1
0
def create_search_path(search_path: List[str],
                       abspath: bool = False) -> ConfigSearchPathImpl:
    Plugins.register_config_sources()
    csp = ConfigSearchPathImpl()
    csp.append("hydra", "pkg://hydra.conf")
    for sp in search_path:
        csp.append("test", sp if not abspath else os.path.realpath(sp))
    return csp
Ejemplo n.º 2
0
def create_config_search_path(search_path_dir: Optional[str]) -> ConfigSearchPath:
    from hydra.core.plugins import Plugins
    from hydra.plugins.search_path_plugin import SearchPathPlugin

    search_path = ConfigSearchPathImpl()
    search_path.append("hydra", "pkg://hydra.conf")

    if search_path_dir is not None:
        search_path.append("main", search_path_dir)

    search_path_plugins = Plugins.instance().discover(SearchPathPlugin)
    for spp in search_path_plugins:
        plugin = spp()
        assert isinstance(plugin, SearchPathPlugin)
        plugin.manipulate_search_path(search_path)

    search_path.append("schema", "structured://")

    return search_path
Ejemplo n.º 3
0
def create_config_search_path(path: str) -> ConfigSearchPathImpl:
    csp = ConfigSearchPathImpl()
    csp.append(provider="test", path=path)
    return csp
Ejemplo n.º 4
0
def create_search_path(base_list: List[Tuple[str, str]]) -> ConfigSearchPathImpl:
    csp = ConfigSearchPathImpl()
    csp.config_search_path = [SearchPathElement(x[0], x[1]) for x in base_list]
    return csp
Ejemplo n.º 5
0
def create_repo() -> IConfigRepository:
    csp = ConfigSearchPathImpl()
    csp.append(provider="test", path="file://tests/defaults_list/data")
    csp.append("schema", "structured://")
    return ConfigRepository(config_search_path=csp)