def module_to_os_path()

in src/dma/utils.py [0:0]


def module_to_os_path(dotted_path: str = "dma") -> Path:
    """Find Module to OS Path.

    Return path to the base directory of the project or the module
    specified by `dotted_path`.
    """
    try:
        if (src := find_spec(dotted_path)) is None:  # pragma: no cover
            msg = f"Couldn't find the path for {dotted_path}"
            raise TypeError(msg)
    except ModuleNotFoundError as e:
        msg = f"Couldn't find the path for {dotted_path}"
        raise TypeError(msg) from e

    return Path(str(src.origin).rsplit(os.path.sep + "__init__.py", maxsplit=1)[0])