Skip to content

Commit 5adc28c

Browse files
committed
validate
1 parent 4fb4ac0 commit 5adc28c

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -671,9 +671,13 @@ def copy_images(
671671

672672
project_name, source_folder_name = extract_project_folder(source_project)
673673

674-
to_project_name, destination_folder_name = extract_project_folder(destination_project)
674+
to_project_name, destination_folder_name = extract_project_folder(
675+
destination_project
676+
)
675677
if project_name != to_project_name:
676-
raise AppException("Source and destination projects should be the same for copy_images")
678+
raise AppException(
679+
"Source and destination projects should be the same for copy_images"
680+
)
677681
if not image_names:
678682
images = controller.search_images(
679683
project_name=project_name, folder_path=source_folder_name
@@ -735,10 +739,14 @@ def move_images(
735739
]:
736740
raise AppException(LIMITED_FUNCTIONS[project["project"].project_type])
737741

738-
to_project_name, destination_folder_name = extract_project_folder(destination_project)
742+
to_project_name, destination_folder_name = extract_project_folder(
743+
destination_project
744+
)
739745

740746
if project_name != to_project_name:
741-
raise AppException("Source and destination projects should be the same for move_images")
747+
raise AppException(
748+
"Source and destination projects should be the same for move_images"
749+
)
742750

743751
if not image_names:
744752
images = controller.search_images(

src/superannotate/lib/core/usecases/images.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,8 +1916,10 @@ def validate_limitations(self):
19161916
raise AppValidationException(constances.ATTACH_USER_LIMIT_ERROR_MESSAGE)
19171917

19181918
def validate_upload_state(self):
1919-
if (self._upload_state_code and self._upload_state_code != self._project.upload_state) \
1920-
or self._project.upload_state == constances.UploadState.BASIC.value:
1919+
if (
1920+
self._upload_state_code
1921+
and self._upload_state_code != self._project.upload_state
1922+
) or self._project.upload_state == constances.UploadState.BASIC.value:
19211923
raise AppValidationException(constances.ATTACHING_UPLOAD_STATE_ERROR)
19221924

19231925
@property
@@ -2798,7 +2800,6 @@ def upload_to_s3(
27982800
self._response.report = f"Couldn't upload annotation {image_id_name_map[image_id].name} - {str(e)}"
27992801
return image_id_name_map[image_id], False
28002802

2801-
28022803
def report_missing_data(self):
28032804
if self.missing_classes:
28042805
logger.warning(f"Couldn't find classes [{', '.join(self.missing_classes)}]")
@@ -3599,7 +3600,9 @@ def limit(self):
35993600
self._limitation_response.data.project_limit.remaining_image_count,
36003601
]
36013602
if self._limitation_response.data.user_limit:
3602-
limits.append(self._limitation_response.data.user_limit.remaining_image_count)
3603+
limits.append(
3604+
self._limitation_response.data.user_limit.remaining_image_count
3605+
)
36033606
return min(limits)
36043607

36053608
def validate_project_type(self):

0 commit comments

Comments
 (0)