paidiverpy.utils.object_store#
This module contains utility functions for interacting with object storage.
Functions#
|
Define storage options for reading metadata file. |
|
Get a file from an object store bucket. |
|
Create a boto3 client for S3. |
|
Check if a bucket exists. |
|
Upload an in-memory file to an object store bucket. |
|
Check if the path is a remote path. |
Module Contents#
- paidiverpy.utils.object_store.define_storage_options(path: str | pathlib.Path) dict[str, str][source]#
Define storage options for reading metadata file.
- paidiverpy.utils.object_store.get_file_from_bucket(file_path: str, storage_options: dict[str, str] | None = None) bytes[source]#
Get a file from an object store bucket.
- paidiverpy.utils.object_store.create_client() boto3.client[source]#
Create a boto3 client for S3.
- Returns:
A boto3 client for S3.
- Return type:
boto3.client
- paidiverpy.utils.object_store.check_create_bucket_exists(bucket_name: str, client: boto3.client) None[source]#
Check if a bucket exists.
- Parameters:
bucket_name (str) – The name of the bucket.
client (boto3.client) – The boto3 client for S3.
- paidiverpy.utils.object_store.upload_file_to_bucket(file_obj: io.BytesIO, output_path: str, client: boto3.client) None[source]#
Upload an in-memory file to an object store bucket.
- Parameters:
file_obj (io.BytesIO) – In-memory file object.
output_path (str) – Full S3 path (e.g., “s3://my-bucket/path/to/image.png”).
client (boto3.client) – The boto3 client for S3.