in python/pipelines/pipeline_ops.py [0:0]
def get_bucket_name_and_path(uri):
"""
This function takes a Google Cloud Storage URI and returns the bucket name and path.
Args:
uri: The Google Cloud Storage URI.
Returns:
A tuple containing the bucket name and path.
Raises:
ValueError: If the URI is not a valid Google Cloud Storage URI.
"""
if not uri.startswith("gs://"):
raise ValueError("URI must start with gs://")
no_prefix_uri = uri[len("gs://"):]
splits = no_prefix_uri.split("/")
return splits[0], "/".join(splits[1:])