in summarize_from_feedback/utils/blobs.py [0:0]
def parse_url(url):
"""
Given a GCS or Azure path, returns either:
('gs', bucket, path)
or ('az', account, path)
"""
result = urlparse(url.rstrip("/"))
if result.scheme == "gs":
return 'gs', result.netloc, unquote(result.path.lstrip("/"))
elif result.scheme == "https" and result.netloc == "storage.googleapis.com":
bucket, rest = result.path.lstrip("/").split("/", 1)
return 'gs', bucket, unquote(rest)
elif result.scheme == "https" and result.netloc.endswith(".blob.core.windows.net"):
account = result.netloc[:-len(".blob.core.windows.net")]
return 'az', account, unquote(result.path.lstrip("/"))
else:
raise NotBlobPathException(f"Could not parse {url} as blob storage url")