@@ -168,6 +168,7 @@ def _upload_annotation(
168168 bucket ,
169169 ):
170170 try :
171+ self .reporter .disable_warnings ()
171172 response = UploadAnnotationUseCase (
172173 project = self ._project ,
173174 folder = self ._folder ,
@@ -196,6 +197,8 @@ def _upload_annotation(
196197 except Exception as e :
197198 logger .debug (str (e ), exc_info = True )
198199 return path , False
200+ finally :
201+ self .reporter .enable_warnings ()
199202
200203 def get_bucket_to_upload (self , ids : List [int ]):
201204 upload_data = self .get_annotation_upload_data (ids )
@@ -231,8 +234,7 @@ def _log_report(self):
231234 logger .warning (
232235 f"Couldn't validate { len (self .reporter .custom_messages ['invalid_jsons' ])} /"
233236 f"{ len (self .annotations_to_upload + self .missing_annotations )} annotations from { self ._folder_path } . "
234- f"Use the validate_annotations function to discover the possible reason(s) for "
235- f"which an annotation is invalid."
237+ f"{ constances .USE_VALIDATE_MESSAGE } "
236238 )
237239
238240 def execute (self ):
@@ -486,12 +488,13 @@ def execute(self):
486488 )
487489 self ._images .update (self ._image )
488490 if self ._verbose :
489- logger .info (
490- "Uploading annotations for image %s in project %s." ,
491- str (self ._image .name ),
492- self ._project .name ,
491+ self .reporter .log_info (
492+ f"Uploading annotations for image { str (self ._image .name )} in project { self ._project .name } ."
493493 )
494494 else :
495- self ._response .errors = "Invalid json"
495+ self ._response .errors = constances . INVALID_JSON_MESSAGE
496496 self .reporter .store_message ("invalid_jsons" , self ._annotation_path )
497+ self .reporter .log_warning (
498+ f"Couldn't validate annotations. { constances .USE_VALIDATE_MESSAGE } "
499+ )
497500 return self ._response
0 commit comments