@@ -183,7 +183,7 @@ def create_project(project_name: str, project_description: str, project_type: st
183183 name = project_name , description = project_description , project_type = project_type
184184 )
185185 if response .errors :
186- raise Exception (response .errors )
186+ raise AppException (response .errors )
187187
188188 return ProjectSerializer (response .data ).serialize ()
189189
@@ -208,7 +208,7 @@ def create_project_from_metadata(project_metadata: dict):
208208 workflows = project_metadata .get ("workflow" , []),
209209 )
210210 if response .errors :
211- raise Exception (response .errors )
211+ raise AppException (response .errors )
212212 return ProjectSerializer (response .data ).serialize ()
213213
214214
@@ -254,7 +254,7 @@ def clone_project(
254254 copy_contributors = copy_contributors ,
255255 )
256256 if response .errors :
257- raise AppValidationException (response .errors )
257+ raise AppException (response .errors )
258258 return ProjectSerializer (response .data ).serialize ()
259259
260260
@@ -292,7 +292,7 @@ def search_images(
292292 image_name_prefix = image_name_prefix ,
293293 )
294294 if response .errors :
295- raise AppValidationException (response .errors )
295+ raise AppException (response .errors )
296296
297297 if return_metadata :
298298 return [ImageSerializer (image ).serialize () for image in response .data ]
@@ -526,7 +526,7 @@ def copy_image(
526526
527527 project = controller .get_project_metadata (destination_project ).data
528528 if project ["project" ].project_type == constances .ProjectType .VIDEO .value :
529- raise AppValidationException (
529+ raise AppException (
530530 "The function does not support projects containing videos attached with URLs"
531531 )
532532
@@ -746,7 +746,7 @@ def copy_images(
746746 include_pin = copy_pin ,
747747 )
748748 if res .errors :
749- raise AppValidationException (res .errors )
749+ raise AppException (res .errors )
750750 skipped_images = res .data
751751 done_count = len (image_names ) - len (skipped_images )
752752 message_postfix = "{from_path} to {to_path}."
@@ -787,7 +787,7 @@ def move_images(
787787
788788 project = controller .get_project_metadata (project_name ).data
789789 if project ["project" ].project_type == constances .ProjectType .VIDEO .value :
790- raise AppValidationException (
790+ raise AppException (
791791 "The function does not support projects containing videos attached with URLs"
792792 )
793793
@@ -915,7 +915,7 @@ def get_project_workflow(project: Union[str, dict]):
915915 project_name , folder_name = extract_project_folder (project )
916916 workflow = controller .get_project_workflow (project_name = project_name )
917917 if workflow .errors :
918- raise AppValidationException (workflow .errors )
918+ raise AppException (workflow .errors )
919919 return workflow .data
920920
921921
@@ -999,7 +999,7 @@ def set_project_default_image_quality_in_editor(
999999 new_settings = [{"attribute" : "ImageQuality" , "value" : image_quality_in_editor }],
10001000 )
10011001 if response .errors :
1002- raise AppValidationException (response .errors )
1002+ raise AppException (response .errors )
10031003 return response .data
10041004
10051005
@@ -1057,7 +1057,7 @@ def get_image_metadata(project: Union[str, dict], image_name: str, *_, **__):
10571057 project_name , folder_name = extract_project_folder (project )
10581058 response = controller .get_image_metadata (project_name , folder_name , image_name )
10591059 if response .errors :
1060- raise AppValidationException (response .errors )
1060+ raise AppException (response .errors )
10611061
10621062 res_data = response .data
10631063 res_data ["annotation_status" ] = constances .AnnotationStatus .get_name (
@@ -1092,7 +1092,7 @@ def set_images_annotation_statuses(
10921092 project_name , folder_name , image_names , annotation_status
10931093 )
10941094 if response .errors :
1095- raise AppValidationException (response .errors )
1095+ raise AppException (response .errors )
10961096 logger .info ("Annotations status of images changed" )
10971097
10981098
@@ -1109,13 +1109,13 @@ def delete_images(project: Union[str, dict], image_names: Optional[List[str]] =
11091109 project_name , folder_name = extract_project_folder (project )
11101110
11111111 if not isinstance (image_names , list ) and image_names is not None :
1112- raise AppValidationException ("Image_names should be a list of strs or None." )
1112+ raise AppException ("Image_names should be a list of strs or None." )
11131113
11141114 response = controller .delete_images (
11151115 project_name = project_name , folder_name = folder_name , image_names = image_names
11161116 )
11171117 if response .errors :
1118- raise AppValidationException (response .errors )
1118+ raise AppException (response .errors )
11191119
11201120 logger .info (
11211121 f"Images deleted in project { project_name } { '' if folder_name else '/' + folder_name } "
@@ -1366,6 +1366,12 @@ def upload_images_from_folder_to_project(
13661366 "extensions should be a list or a tuple in upload_images_from_folder_to_project"
13671367 )
13681368
1369+ if exclude_file_patterns :
1370+ exclude_file_patterns = list (exclude_file_patterns ) + list (
1371+ constances .DEFAULT_FILE_EXCLUDE_PATTERNS
1372+ )
1373+ exclude_file_patterns = list (set (exclude_file_patterns ))
1374+
13691375 project_folder_name = project_name + (f"/{ folder_name } " if folder_name else "" )
13701376
13711377 logger .info (
@@ -1400,7 +1406,7 @@ def upload_images_from_folder_to_project(
14001406 for _ in use_case .execute ():
14011407 progress_bar .update (1 )
14021408 return use_case .data
1403- raise AppValidationException (use_case .response .errors )
1409+ raise AppException (use_case .response .errors )
14041410
14051411
14061412@Trackable
@@ -1427,7 +1433,7 @@ def get_project_image_count(
14271433 with_all_subfolders = with_all_subfolders ,
14281434 )
14291435 if response .errors :
1430- raise AppValidationException (response .errors )
1436+ raise AppException (response .errors )
14311437 return response .data
14321438
14331439
@@ -1481,7 +1487,7 @@ def download_image_annotations(
14811487 destination = local_dir_path ,
14821488 )
14831489 if res .errors :
1484- raise AppValidationException (res .errors )
1490+ raise AppException (res .errors )
14851491 return res .data
14861492
14871493
@@ -1511,7 +1517,7 @@ def download_image_preannotations(
15111517 destination = local_dir_path ,
15121518 )
15131519 if res .errors :
1514- raise AppValidationException (res .errors )
1520+ raise AppException (res .errors )
15151521 return res .data
15161522
15171523
@@ -1623,7 +1629,7 @@ def prepare_export(
16231629 annotation_statuses = annotation_statuses ,
16241630 )
16251631 if response .errors :
1626- raise AppValidationException (response .errors )
1632+ raise AppException (response .errors )
16271633 return response .data
16281634
16291635
@@ -1747,7 +1753,7 @@ def upload_videos_from_folder_to_project(
17471753 for _ in use_case .execute ():
17481754 progress_bar .update (1 )
17491755 else :
1750- raise AppValidationException (use_case .response .errors )
1756+ raise AppException (use_case .response .errors )
17511757
17521758 return
17531759
@@ -1818,7 +1824,7 @@ def upload_video_to_project(
18181824 for _ in use_case .execute ():
18191825 progress_bar .update (1 )
18201826 return use_case .data [0 ]
1821- raise AppValidationException (use_case .response .errors )
1827+ raise AppException (use_case .response .errors )
18221828
18231829
18241830@Trackable
@@ -1981,7 +1987,7 @@ def move_image(
19811987 source_project_name , source_folder_name = extract_project_folder (source_project )
19821988 project = controller .get_project_metadata (source_project_name ).data
19831989 if project ["project" ].project_type == constances .ProjectType .VIDEO .value :
1984- raise AppValidationException (
1990+ raise AppException (
19851991 "The function does not support projects containing videos attached with URLs"
19861992 )
19871993
@@ -2116,7 +2122,7 @@ def set_image_annotation_status(
21162122 project_name , folder_name , [image_name ], annotation_status
21172123 )
21182124 if response .errors :
2119- raise AppValidationException (response .errors )
2125+ raise AppException (response .errors )
21202126
21212127
21222128@Trackable
@@ -2139,7 +2145,7 @@ def set_project_workflow(project: Union[str, dict], new_workflow: List[dict]):
21392145 project_name = project_name , steps = new_workflow
21402146 )
21412147 if response .errors :
2142- raise AppValidationException (response .errors )
2148+ raise AppException (response .errors )
21432149
21442150
21452151@Trackable
@@ -2221,7 +2227,7 @@ def download_image(
22212227 include_overlay = include_overlay ,
22222228 )
22232229 if response .errors :
2224- raise AppValidationException (response .errors )
2230+ raise AppException (response .errors )
22252231 return response .data
22262232
22272233
@@ -2247,7 +2253,7 @@ def attach_image_urls_to_project(
22472253 project_name , folder_name = extract_project_folder (project )
22482254 project = controller .get_project_metadata (project_name ).data
22492255 if project ["project" ].project_type == constances .ProjectType .VIDEO .value :
2250- raise AppValidationException (
2256+ raise AppException (
22512257 "The function does not support projects containing videos attached with URLs"
22522258 )
22532259
@@ -2309,7 +2315,7 @@ def attach_video_urls_to_project(
23092315 project_name , folder_name = extract_project_folder (project )
23102316 project = controller .get_project_metadata (project_name ).data
23112317 if project ["project" ].project_type != constances .ProjectType .VIDEO .value :
2312- raise AppValidationException ("The function does not support" )
2318+ raise AppException ("The function does not support" )
23132319
23142320 image_data = pd .read_csv (attachments , dtype = str )
23152321 image_data = image_data [~ image_data ["url" ].isnull ()]
@@ -2385,7 +2391,7 @@ def upload_annotations_from_folder_to_project(
23852391 project_name , folder_name = extract_project_folder (project )
23862392 project = controller .get_project_metadata (project_name ).data
23872393 if project ["project" ].project_type == constances .ProjectType .VIDEO .value :
2388- raise AppValidationException (
2394+ raise AppException (
23892395 "The function does not support projects containing videos attached with URLs"
23902396 )
23912397
@@ -2466,7 +2472,7 @@ def upload_preannotations_from_folder_to_project(
24662472 project_name , folder_name = extract_project_folder (project )
24672473 project = controller .get_project_metadata (project_name ).data
24682474 if project ["project" ].project_type == constances .ProjectType .VIDEO .value :
2469- raise AppValidationException (
2475+ raise AppException (
24702476 "The function does not support projects containing videos attached with URLs"
24712477 )
24722478
@@ -2558,7 +2564,7 @@ def upload_image_annotations(
25582564 verbose = verbose ,
25592565 )
25602566 if response .errors :
2561- raise AppValidationException (response .errors )
2567+ raise AppException (response .errors )
25622568
25632569
25642570@Trackable
@@ -2789,7 +2795,7 @@ def benchmark(
27892795 show_plots = show_plots ,
27902796 )
27912797 if response .errors :
2792- raise AppValidationException (response .errors )
2798+ raise AppException (response .errors )
27932799 return response .data
27942800
27952801
@@ -2843,7 +2849,7 @@ def consensus(
28432849 show_plots = show_plots ,
28442850 )
28452851 if response .errors :
2846- raise AppValidationException (response .errors )
2852+ raise AppException (response .errors )
28472853 return response .data
28482854
28492855
@@ -2913,7 +2919,7 @@ def run_prediction(project, images_list, model):
29132919 folder_name = folder_name ,
29142920 )
29152921 if response .errors :
2916- raise Exception (response .errors )
2922+ raise AppException (response .errors )
29172923 return response .data
29182924
29192925
@@ -3314,7 +3320,7 @@ def upload_image_to_project(
33143320
33153321 project = controller .get_project_metadata (project_name ).data
33163322 if project ["project" ].project_type == constances .ProjectType .VIDEO .value :
3317- raise AppValidationException (
3323+ raise AppException (
33183324 "The function does not support projects containing videos attached with URLs"
33193325 )
33203326
@@ -3404,7 +3410,7 @@ def upload_images_to_project(
34043410 project_name , folder_name = extract_project_folder (project )
34053411 project = controller .get_project_metadata (project_name ).data
34063412 if project ["project" ].project_type == constances .ProjectType .VIDEO .value :
3407- raise AppValidationException (
3413+ raise AppException (
34083414 "The function does not support projects containing videos attached with URLs"
34093415 )
34103416
0 commit comments