Skip to content

Commit b03c464

Browse files
author
rcmangasaryan
committed
Fix video upload to folder
2 parents 0a15902 + c6a60d8 commit b03c464

File tree

11 files changed

+22
-29
lines changed

11 files changed

+22
-29
lines changed

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[BASIC]
2-
good-names=df,f,e,i,j,k,im,pt,pr
2+
good-names=df,f,e,i,j,k,im,pt,pr,m
33

44
bad-functions=
55
apply,

superannotate/db/images.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ def get_image_bytes(project, image_name, variant='original'):
720720
raise SABaseException(
721721
0, "Image download variant should be either original or lores"
722722
)
723-
image = get_image_metadata(project, image_name)
723+
image = get_image_metadata((project, project_folder), image_name)
724724
team_id, project_id, image_id, folder_id = image["team_id"], image[
725725
"project_id"], image["id"], image['folder_id']
726726
params = {
@@ -1221,7 +1221,7 @@ def set_images_annotation_statuses(project, image_names, annotation_status):
12211221
data["image_names"] = image_names[start_index:start_index + NUM_TO_SEND]
12221222
response = _api.send_request(
12231223
req_type='PUT',
1224-
path=f'/image/updateAnnotationStatusBulk',
1224+
path='/image/updateAnnotationStatusBulk',
12251225
params=params,
12261226
json_req=data
12271227
)

superannotate/db/project_api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ def get_project_and_folder_metadata(project):
105105
:rtype: dict
106106
"""
107107
if isinstance(project, dict):
108-
project = project
109108
folder = None
110109
elif isinstance(project, tuple):
111110
if len(project) != 2:

superannotate/db/project_images.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,18 +381,15 @@ def copy_image(
381381
except SABaseException:
382382
break
383383
else:
384-
found_copied = False
385384
for m in p.finditer(new_name):
386385
if m.start() + len(m.group()
387386
) + len(extension) - 1 == len(new_name):
388387
num = int(m.group()[2:-2])
389-
found_copied = True
388+
new_name = new_name[:m.start() +
389+
2] + str(num + 1) + ")" + extension
390390
break
391-
if not found_copied:
392-
new_name = Path(new_name).stem + "_(1)" + extension
393391
else:
394-
new_name = new_name[:m.start() +
395-
2] + str(num + 1) + ")" + extension
392+
new_name = Path(new_name).stem + "_(1)" + extension
396393

397394
upload_image_to_project(
398395
(destination_project, destination_project_folder), img_b, new_name

superannotate/db/projects.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def upload_video_to_project(
339339
)
340340

341341
filenames = upload_images_from_folder_to_project(
342-
project,
342+
(project, project_folder),
343343
tempdir.name,
344344
extensions=["jpg"],
345345
annotation_status=annotation_status,
@@ -766,9 +766,6 @@ def __create_image(
766766
"team_id": str(team_id),
767767
"images": [],
768768
"annotation_status": annotation_status,
769-
"team_id": str(team_id),
770-
"images": [],
771-
"annotation_status": annotation_status,
772769
"meta": {},
773770
"upload_state": upload_state_code
774771
}
@@ -1226,7 +1223,7 @@ def upload_images_from_public_urls_to_project(
12261223
finish_event.set()
12271224
tqdm_thread.join()
12281225
images_uploaded_paths, images_not_uploaded_paths, duplicate_images_paths = upload_images_to_project(
1229-
project,
1226+
(project, project_folder),
12301227
images_to_upload,
12311228
annotation_status=annotation_status,
12321229
image_quality_in_editor=image_quality_in_editor
@@ -1312,7 +1309,7 @@ def upload_images_from_google_cloud_to_project(
13121309
path_to_url[str(image_save_pth)] = image_blob.name
13131310
images_to_upload.append(image_save_pth)
13141311
images_uploaded_paths, images_not_uploaded_paths, duplicate_images_paths = upload_images_to_project(
1315-
project,
1312+
(project, project_folder),
13161313
images_to_upload,
13171314
annotation_status=annotation_status,
13181315
image_quality_in_editor=image_quality_in_editor
@@ -1408,7 +1405,7 @@ def upload_images_from_azure_blob_to_project(
14081405
path_to_url[str(image_save_pth)] = image_blob.name
14091406
images_to_upload.append(image_save_pth)
14101407
images_uploaded_paths, images_not_uploaded_paths, duplicate_images_paths = upload_images_to_project(
1411-
project,
1408+
(project, project_folder),
14121409
images_to_upload,
14131410
annotation_status=annotation_status,
14141411
image_quality_in_editor=image_quality_in_editor

superannotate/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "4.1.1"
1+
__version__ = "4.1.2b3"

tests/test_ml_funcs.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
from pathlib import Path
32

43
import pytest
@@ -84,9 +83,7 @@ def test_run_segmentation():
8483

8584
image_names_pixel = sa.search_images(PROJECT_NAME_PIXEL_SEGMENTATION)
8685
with pytest.raises(SABaseException) as e:
87-
res = sa.run_segmentation(
88-
PROJECT_NAME_VECTOR, image_names_pixel, model_auto
89-
)
86+
sa.run_segmentation(PROJECT_NAME_VECTOR, image_names_pixel, model_auto)
9087
assert str(e) == "Operation not supported for given project type"
9188
with pytest.raises(SABaseException) as e:
9289
sa.run_segmentation(

tests/test_preannotation_upload.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
from pathlib import Path
32

43
import pytest

tests/test_preannotation_upload_cli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
import subprocess
32
import time
43
from pathlib import Path

tests/test_recursive_folder.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import json
22
from pathlib import Path
33
import time
4-
import os
5-
6-
import pytest
74

85
import superannotate as sa
96

0 commit comments

Comments
 (0)