def resolve_path(folder: str | Path, root: str | Path | None = None) -> Path:
    """Combine root and folder paths into absolute path.

    Args:
        folder: Folder location containing image or mask data
        root: Optional root directory for the dataset

    Returns:
        Absolute path combining root and folder

    Example:
        >>> path = resolve_path("subdir", "/root")
        >>> path.is_absolute()
        True
    """
    folder = Path(folder)
    if folder.is_absolute():
        path = folder
    # path is relative.
    elif root is None:
        # no root provided; return absolute path
        path = folder.resolve()
    else:
        # root provided; prepend root and return absolute path
        path = (Path(root) / folder).resolve()
    return path
Combine root and folder paths into absolute path.

    Args:
        folder: Folder location containing image or mask data
        root: Optional root directory for the dataset

    Returns:
        Absolute path combining root and folder

    Example:
        >>> path = resolve_path("subdir", "/root")
        >>> path.is_absolute()
        True
    
src/anomalib/data/utils/path.py