feat: tqdm for S3-list
This commit is contained in:
4
main.py
4
main.py
@@ -22,7 +22,9 @@ s3_config_data = json.loads(open(expanduser("~/.mc/config.json")).read())["alias
|
|||||||
def get_files(s3, bucket, prefix) -> Mapping[str, Tuple[int, str]]:
|
def get_files(s3, bucket, prefix) -> Mapping[str, Tuple[int, str]]:
|
||||||
res = {}
|
res = {}
|
||||||
prefix_len = len(prefix)
|
prefix_len = len(prefix)
|
||||||
for obj in s3.list_objects(bucket, prefix=prefix, recursive=True):
|
for obj in tqdm.tqdm(
|
||||||
|
s3.list_objects(bucket, prefix=prefix, recursive=True), desc="S3 list objects"
|
||||||
|
):
|
||||||
if obj.is_dir:
|
if obj.is_dir:
|
||||||
continue
|
continue
|
||||||
res[obj.object_name[prefix_len:].lstrip("/")] = (obj.size, obj.etag)
|
res[obj.object_name[prefix_len:].lstrip("/")] = (obj.size, obj.etag)
|
||||||
|
|||||||
Reference in New Issue
Block a user