From 3fa3717c293d93264bc6d137bdcebab8ae6ec417 Mon Sep 17 00:00:00 2001 From: Stepan Klymonchuk Date: Mon, 15 Sep 2025 18:40:04 +0200 Subject: [PATCH] Update list_objects docs Co-authored-by: Albert Co-authored-by: Enrique Co-authored-by: Octavio --- lithops/storage/storage.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lithops/storage/storage.py b/lithops/storage/storage.py index 9852a261..c1480064 100644 --- a/lithops/storage/storage.py +++ b/lithops/storage/storage.py @@ -20,7 +20,7 @@ import logging import itertools import importlib -from typing import Optional, List, Union, Tuple, Dict, TextIO, BinaryIO, Any +from typing import Optional, List, Union, Dict, TextIO, BinaryIO, Any from lithops.constants import CACHE_DIR, RUNTIMES_PREFIX, JOBS_PREFIX, TEMP_PREFIX from lithops.utils import is_lithops_worker @@ -219,16 +219,17 @@ def head_bucket(self, bucket: str) -> Dict: def list_objects(self, bucket: str, prefix: Optional[str] = None, - match_pattern: Optional[str] = None) -> List[Tuple[str, - int]]: + match_pattern: Optional[str] = None) -> List[Dict[str, + Any]]: """ - Returns all of the object keys in a bucket. For each object, the list contains the name - of the object (key) and the size. + Returns all of the object keys in a bucket. For each object, the list contains a dictionary + with at least the object key ('Key') and the size in bytes ('Size'). Additional fields may be + present, depending on the backend implementation. :param bucket: Name of the bucket :param prefix: Key prefix for filtering - :return: List of tuples containing the object key and size in bytes + :return: List of dictionaries containing at least 'Key' and 'Size' for each object """ return self.storage_handler.list_objects(bucket, prefix, match_pattern)