def test_namespace_to_path(is_external: bool, test_output_dirs: TestOutputDirectories) -> None:
    """
    A test to check conversion between path to namespace for InnerEye and external namespaces
    """
    if is_external:
        folder_name = "logs"
        full_folder = Path(test_output_dirs.root_dir) / folder_name
        assert namespace_to_path(folder_name, root=test_output_dirs.root_dir) == full_folder
    else:
        from Tests.ML import test_data
        assert namespace_to_path(test_data.__name__, root=tests_root_directory().parent) == full_ml_test_data_path()
def find_models() -> List[str]:
    """
    Lists all Python files in the configs folder. Each of them is assumed to contain one model config.
    :return: list of models
    """
    path = namespace_to_path(ModelConfigLoader.get_default_search_module())
    folders = [path / "segmentation", path / "classification", path / "regression"]
    names = [str(f.stem) for folder in folders for f in folder.glob("*.py") if folder.exists()]
    return [name for name in names if not name.endswith("Base") and not name.startswith("__")]
Beispiel #3
0
def _get_init_py_path(namespace: str) -> Path:
    return namespace_to_path(namespace) / "__init__.py"