From 81f59380bba37c20f923e280875005617ec661e4 Mon Sep 17 00:00:00 2001 From: shab Date: Sat, 25 Sep 2021 15:57:54 +0400 Subject: [PATCH] Fix message --- .../lib/app/interface/sdk_interface.py | 21 ++++++++++++++++--- src/superannotate/lib/core/__init__.py | 4 ++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/superannotate/lib/app/interface/sdk_interface.py b/src/superannotate/lib/app/interface/sdk_interface.py index ea78d4cd6..520798dd0 100644 --- a/src/superannotate/lib/app/interface/sdk_interface.py +++ b/src/superannotate/lib/app/interface/sdk_interface.py @@ -2356,7 +2356,12 @@ def attach_image_urls_to_project( images_to_upload, duplicate_images = get_paths_and_duplicated_from_csv(attachments) list_of_uploaded = [] - logger.info("Attaching %s images to project.", len(images_to_upload)) + if len(duplicate_images): + logger.warning( + constances.ALREADY_EXISTING_FILES_WARNING.format(len(duplicate_images)) + ) + + logger.info(constances.ATTACHING_FILES_MESSAGE.format(len(images_to_upload))) with tqdm(total=len(images_to_upload), desc="Attaching urls") as progress_bar: for i in range(0, len(images_to_upload), 500): @@ -2408,7 +2413,12 @@ def attach_video_urls_to_project( images_to_upload, duplicate_images = get_paths_and_duplicated_from_csv(attachments) list_of_uploaded = [] - logger.info("Attaching %s images to project.", len(images_to_upload)) + if len(duplicate_images): + logger.warning( + constances.ALREADY_EXISTING_FILES_WARNING.format(len(duplicate_images)) + ) + + logger.info(constances.ATTACHING_FILES_MESSAGE.format(len(images_to_upload))) with tqdm(total=len(images_to_upload), desc="Attaching urls") as progress_bar: for i in range(0, len(images_to_upload), 500): @@ -3636,7 +3646,12 @@ def attach_document_urls_to_project( images_to_upload, duplicate_images = get_paths_and_duplicated_from_csv(attachments) list_of_uploaded = [] - logger.info("Attaching %s images to project.", len(images_to_upload)) + if len(duplicate_images): + logger.warning( + constances.ALREADY_EXISTING_FILES_WARNING.format(len(duplicate_images)) + ) + + logger.info(constances.ATTACHING_FILES_MESSAGE.format(len(images_to_upload))) with tqdm(total=len(images_to_upload), desc="Attaching urls") as progress_bar: for i in range(0, len(images_to_upload), 500): diff --git a/src/superannotate/lib/core/__init__.py b/src/superannotate/lib/core/__init__.py index 2eefb411c..de292f6a4 100644 --- a/src/superannotate/lib/core/__init__.py +++ b/src/superannotate/lib/core/__init__.py @@ -54,6 +54,10 @@ MAX_IMAGE_SIZE = 100 * 1024 * 1024 # 100 MB limit TOKEN_UUID = "token" +ALREADY_EXISTING_FILES_WARNING = ( + "{} already existing file(s) found that won't be uploaded." +) +ATTACHING_FILES_MESSAGE = "Attaching {} file(s) to project." DEPRECATED_VIDEO_PROJECTS_MESSAGE = ( "The function does not support projects containing videos attached with URLs"