@@ -833,14 +833,17 @@ def execute(self):
833833
834834 outline_color = 4 * (255 ,)
835835 for instance in self .annotations ["instances" ]:
836- if (not instance .get ("className" )) or (not class_color_map .get (instance ["className" ])):
836+ if (not instance .get ("className" )) or (
837+ not class_color_map .get (instance ["className" ])
838+ ):
837839 continue
838840 color = class_color_map .get (instance ["className" ])
839841 if not color :
840842 class_color_map [instance ["className" ]] = self .generate_color ()
841843 for image in images :
842844 fill_color = (
843- * class_color_map [instance ["className" ]], 255 if image .type == "fuse" else self .TRANSPARENCY
845+ * class_color_map [instance ["className" ]],
846+ 255 if image .type == "fuse" else self .TRANSPARENCY ,
844847 )
845848 if instance ["type" ] == "bbox" :
846849 image .content .draw_bbox (
@@ -909,7 +912,9 @@ def execute(self):
909912 weight , height = image .get_size ()
910913 empty_image_arr = np .full ((height , weight , 4 ), [0 , 0 , 0 , 255 ], np .uint8 )
911914 for annotation in self .annotations ["instances" ]:
912- if (not annotation .get ("className" )) or (not class_color_map .get (annotation ["className" ])):
915+ if (not annotation .get ("className" )) or (
916+ not class_color_map .get (annotation ["className" ])
917+ ):
913918 continue
914919 fill_color = * class_color_map [annotation ["className" ]], 255
915920 for part in annotation ["parts" ]:
@@ -1989,17 +1994,28 @@ def validate_limitations(self):
19891994 if self ._move :
19901995 if self ._from_project .uuid == self ._to_project .uuid :
19911996 if self ._from_folder .uuid == self ._to_folder .uuid :
1992- raise AppValidationException ("Cannot move image if source_project == destination_project." )
1997+ raise AppValidationException (
1998+ "Cannot move image if source_project == destination_project."
1999+ )
19932000 elif response .data .folder_limit .remaining_image_count < 1 :
1994- raise AppValidationException (constances .MOVE_FOLDER_LIMIT_ERROR_MESSAGE )
2001+ raise AppValidationException (
2002+ constances .MOVE_FOLDER_LIMIT_ERROR_MESSAGE
2003+ )
19952004 elif response .data .project_limit .remaining_image_count < 1 :
1996- raise AppValidationException (constances .MOVE_PROJECT_LIMIT_ERROR_MESSAGE )
2005+ raise AppValidationException (
2006+ constances .MOVE_PROJECT_LIMIT_ERROR_MESSAGE
2007+ )
19972008 else :
19982009 if response .data .folder_limit .remaining_image_count < 1 :
19992010 raise AppValidationException (constances .COPY_FOLDER_LIMIT_ERROR_MESSAGE )
20002011 if response .data .project_limit .remaining_image_count < 1 :
2001- raise AppValidationException (constances .COPY_PROJECT_LIMIT_ERROR_MESSAGE )
2002- if response .data .super_user_limit and response .data .super_user_limit .remaining_image_count < 1 :
2012+ raise AppValidationException (
2013+ constances .COPY_PROJECT_LIMIT_ERROR_MESSAGE
2014+ )
2015+ if (
2016+ response .data .super_user_limit
2017+ and response .data .super_user_limit .remaining_image_count < 1
2018+ ):
20032019 raise AppValidationException (constances .COPY_SUPER_LIMIT_ERROR_MESSAGE )
20042020
20052021 def execute (self ) -> Response :
@@ -2722,16 +2738,16 @@ def upload_to_s3(
27222738 logger .warning (f"Invalid json { image_id_name_map [image_id ].path } " )
27232739 return image_id_name_map [image_id ], False
27242740 bucket .put_object (
2725- Key = image_info ["annotation_json_path" ], Body = json .dumps (annotation_json ),
2741+ Key = image_info ["annotation_json_path" ],
2742+ Body = json .dumps (annotation_json ),
27262743 )
27272744 if self ._project .project_type == constances .ProjectType .PIXEL .value :
2728- mask_path = image_id_name_map [image_id ].path .replace ("___pixel.json" , constances .ANNOTATION_MASK_POSTFIX )
2745+ mask_path = image_id_name_map [image_id ].path .replace (
2746+ "___pixel.json" , constances .ANNOTATION_MASK_POSTFIX
2747+ )
27292748 if from_s3 :
27302749 file = io .BytesIO ()
2731- s3_object = from_s3 .Object (
2732- self ._client_s3_bucket ,
2733- mask_path
2734- )
2750+ s3_object = from_s3 .Object (self ._client_s3_bucket , mask_path )
27352751 s3_object .download_fileobj (file )
27362752 file .seek (0 )
27372753 else :
0 commit comments