gigl.common.types.uri.GcsUri#
- class gigl.common.types.uri.gcs_uri.GcsUri(uri: str | Path | GcsUri)#
Bases:
Uri
Represents a Google Cloud Storage (GCS) URI.
- Args:
uri (Union[str, Path, GcsUri]): The URI string or path to initialize the GcsUri object.
Methods
The base name is the final component of the path, effectively extracting the file or directory name from a full path string.
Check if the given URI is valid.
Joins multiple URI tokens together and returns a new GcsUri object.
- __eq__(other: Any) bool #
Return self==value.
- __hash__() int #
Return hash(self).
- __repr__() str #
Return repr(self).
- __weakref__#
list of weak references to the object (if defined)
- get_basename() str #
The base name is the final component of the path, effectively extracting the file or directory name from a full path string. i.e. get_basename(“/foo/bar.txt”) -> bar.txt get_basename(“gs://bucket/foo”) -> foo
- classmethod is_valid(uri: str | Path | Uri, raise_exception: bool | None = False) bool #
Check if the given URI is valid.
- Args:
uri (Union[str, Path, Uri]): The URI to be validated. raise_exception (Optiona[bool]): Whether to raise an exception if the URI is invalid.
Defaults to False.
- Returns:
bool: True if the URI is valid, False otherwise.
- classmethod join(token: str | Path | Uri, *tokens: str | Path | Uri) GcsUri #
Joins multiple URI tokens together and returns a new GcsUri object.
- Args:
token (Union[str, Path, Uri]): The first URI token to join. *tokens (Union[str, Path, Uri]): Additional URI tokens to join.
- Returns:
GcsUri: A new GcsUri object representing the joined URI.