(url: str)
return bucket_name, s3_path
Split a full s3 path into the bucket name and path.
Split a full s3 path into the bucket name and path.
Split a full s3 path into the bucket name and path .
def split_s3_path(url: str) -> Tuple[str, str]:
    """Split a full s3 path into the bucket name and path."""
    parsed = urlparse(url)
    if not parsed.netloc or not parsed.path:
        raise ValueError("bad s3 path {}".format(url))
    bucket_name = parsed.netloc
    s3_path = parsed.path
    # Remove '/' at beginning of path.
    if s3_path.startswith("/"):
        s3_path = s3_path[1:]
    return bucket_name, s3_path
def split_s3_path ( url : str ) -> Tuple [ str , str ] : parsed = urlparse ( url ) if not parsed . netloc or not parsed . path : raise ValueError ( "bad s3 path {}" . format ( url ) ) bucket_name = parsed . netloc s3_path = parsed . path # Remove '/' at beginning of path. if s3_path . startswith ( "/" ) : s3_path = s3_path [ 1 : ] return bucket_name , s3_path