Skip to content

Instantly share code, notes, and snippets.

@eliorc
eliorc / fsspec_open_any_file.py
Created February 20, 2024 13:18
Open any file
CLOUD_PROTOCOLS = ("s3", "s3n", "s3a", "gcs", "gs", "adl", "abfs", "abfss", "gdrive")
HTTP_PROTOCOLS = ("http", "https")
S3_PROTOCOLS = ("s3", "s3a", "s3n")
PROTOCOL_DELIMITER = "://"
def _parse_filepath(filepath: str) -> dict[str, str]:
"""
Split filepath on protocol and path. Based on `fsspec.utils.infer_storage_options`.