def _normalize_databricks_dbfs_url()

in petastorm/spark/spark_dataset_converter.py [0:0]


def _normalize_databricks_dbfs_url(url, err_msg):
    if not (
        url.startswith("file:/dbfs/") or
        url.startswith("file:///dbfs/") or
        url.startswith("dbfs:///") or
        (url.startswith("dbfs:/") and not url.startswith("dbfs://"))
    ):
        raise ValueError(err_msg)
    if url.startswith("dbfs:///"):
        # convert it to a dbfs fuse path
        url = "file:/dbfs/" + url[len("dbfs:///"):]
    elif url.startswith("dbfs:/"):
        url = "file:/dbfs/" + url[len("dbfs:/"):]
    return url