Skip to content

Commit 16fd3c5

Browse files
authored
Merge pull request #217 from superannotateai/sdk-301
Sdk 301
2 parents dfcafef + 81f5938 commit 16fd3c5

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

src/superannotate/lib/app/interface/sdk_interface.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,7 +2366,12 @@ def attach_image_urls_to_project(
23662366
images_to_upload, duplicate_images = get_paths_and_duplicated_from_csv(attachments)
23672367
list_of_uploaded = []
23682368

2369-
logger.info("Attaching %s images to project.", len(images_to_upload))
2369+
if len(duplicate_images):
2370+
logger.warning(
2371+
constances.ALREADY_EXISTING_FILES_WARNING.format(len(duplicate_images))
2372+
)
2373+
2374+
logger.info(constances.ATTACHING_FILES_MESSAGE.format(len(images_to_upload)))
23702375

23712376
with tqdm(total=len(images_to_upload), desc="Attaching urls") as progress_bar:
23722377
for i in range(0, len(images_to_upload), 500):
@@ -2418,7 +2423,12 @@ def attach_video_urls_to_project(
24182423
images_to_upload, duplicate_images = get_paths_and_duplicated_from_csv(attachments)
24192424
list_of_uploaded = []
24202425

2421-
logger.info("Attaching %s images to project.", len(images_to_upload))
2426+
if len(duplicate_images):
2427+
logger.warning(
2428+
constances.ALREADY_EXISTING_FILES_WARNING.format(len(duplicate_images))
2429+
)
2430+
2431+
logger.info(constances.ATTACHING_FILES_MESSAGE.format(len(images_to_upload)))
24222432

24232433
with tqdm(total=len(images_to_upload), desc="Attaching urls") as progress_bar:
24242434
for i in range(0, len(images_to_upload), 500):
@@ -3648,7 +3658,12 @@ def attach_document_urls_to_project(
36483658
images_to_upload, duplicate_images = get_paths_and_duplicated_from_csv(attachments)
36493659
list_of_uploaded = []
36503660

3651-
logger.info("Attaching %s images to project.", len(images_to_upload))
3661+
if len(duplicate_images):
3662+
logger.warning(
3663+
constances.ALREADY_EXISTING_FILES_WARNING.format(len(duplicate_images))
3664+
)
3665+
3666+
logger.info(constances.ATTACHING_FILES_MESSAGE.format(len(images_to_upload)))
36523667

36533668
with tqdm(total=len(images_to_upload), desc="Attaching urls") as progress_bar:
36543669
for i in range(0, len(images_to_upload), 500):

src/superannotate/lib/core/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
MAX_IMAGE_SIZE = 100 * 1024 * 1024 # 100 MB limit
5555
TOKEN_UUID = "token"
5656

57+
ALREADY_EXISTING_FILES_WARNING = (
58+
"{} already existing file(s) found that won't be uploaded."
59+
)
60+
ATTACHING_FILES_MESSAGE = "Attaching {} file(s) to project."
5761

5862
DEPRECATED_VIDEO_PROJECTS_MESSAGE = (
5963
"The function does not support projects containing videos attached with URLs"

0 commit comments

Comments
 (0)