Verbosity indicator in blob listing

This commit is contained in:
Dan Morris 2021-08-23 16:05:58 -07:00
Родитель d2ee2dba54
Коммит 889e39e9f7
2 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -177,9 +177,12 @@ def enumerate_blobs_to_file(
container_uri = sas_blob_utils.build_azure_storage_uri(
account=account_name, container=container_name, sas_token=sas_token)
matched_blobs = sas_blob_utils.list_blobs_in_container(
container_uri=container_uri, blob_prefix=blob_prefix,
blob_suffix=blob_suffix, rsearch=rsearch, limit=limit, verbose=verbose)
if output_file is not None:
write_list_to_file(output_file, matched_blobs)
return matched_blobs

Просмотреть файл

@ -381,7 +381,9 @@ def list_blobs_in_container(
sorted list of blob names, of length limit or shorter.
"""
print('listing blobs...')
if verbose:
print('Listing blobs')
if (get_sas_token_from_uri(container_uri) is not None
and get_resource_type_from_uri(container_uri) != 'container'):
raise ValueError('The SAS token provided is not for a container.')
@ -400,7 +402,7 @@ def list_blobs_in_container(
name_starts_with=blob_prefix)
if blob_suffix is None and rsearch is None:
list_blobs = [blob.name for blob in tqdm(generator)]
list_blobs = [blob.name for blob in tqdm(generator,disable=(not verbose))]
i = len(list_blobs)
else:
i = 0