@@ -2231,9 +2231,10 @@ def execute(self):
22312231 url = annotation_blue_map_creds ["url" ],
22322232 headers = annotation_blue_map_creds ["headers" ],
22332233 )
2234+ data ["annotation_mask_filename" ] = f"{ self ._image_name } ___save.png"
2235+
22342236 if response .ok :
22352237 data ["annotation_mask" ] = io .BytesIO (response .content )
2236- data ["annotation_mask_filename" ] = f"{ self ._image_name } ___save.png"
22372238 mask_path = (
22382239 Path (self ._destination ) / data ["annotation_mask_filename" ]
22392240 )
@@ -4480,58 +4481,63 @@ def paths(self):
44804481 ):
44814482 paths .append (key )
44824483 break
4483-
4484- data = []
4485- for path in paths :
4486- if all (
4487- [
4488- True if exclude_pattern not in str (path ) else False
4489- for exclude_pattern in self .exclude_file_patterns
4490- ]
4491- ):
4492- data .append (str (path ))
4493- return data
4484+ return [str (path ) for path in paths ]
44944485
44954486 @property
44964487 def images_to_upload (self ):
44974488 if not self ._images_to_upload :
44984489 paths = self .paths
44994490 filtered_paths = []
45004491 duplicated_paths = []
4492+ for path in paths :
4493+ if path .split ("/" )[- 1 ] not in [
4494+ path_name .split ("/" )[- 1 ] for path_name in filtered_paths
4495+ ]:
4496+ filtered_paths .append (path )
4497+ else :
4498+ duplicated_paths .append (path )
4499+ filtered_paths = [
4500+ path
4501+ for path in filtered_paths
4502+ if not any (
4503+ [
4504+ path .endswith (extension )
4505+ for extension in self .exclude_file_patterns
4506+ ]
4507+ )
4508+ ]
4509+ duplicated_paths = [
4510+ path
4511+ for path in duplicated_paths
4512+ if not any (
4513+ [
4514+ path .endswith (extension )
4515+ for extension in self .exclude_file_patterns
4516+ ]
4517+ )
4518+ ]
4519+
45014520 image_entities = (
45024521 GetBulkImages (
45034522 service = self ._backend_client ,
45044523 project_id = self ._project .uuid ,
45054524 team_id = self ._project .team_id ,
45064525 folder_id = self ._folder .uuid ,
4507- images = [Path ( image ). name for image in paths ],
4526+ images = [image . split ( "/" )[ - 1 ] for image in filtered_paths ],
45084527 )
45094528 .execute ()
45104529 .data
45114530 )
4531+ images_to_upload = []
4532+ image_list = [image .name for image in image_entities ]
45124533
4513- for path in paths :
4514- not_in_exclude_list = [
4515- x not in Path (path ).name for x in self .exclude_file_patterns
4516- ]
4517- non_in_service_list = [
4518- x .name not in Path (path ).name for x in image_entities
4519- ]
4520- if (
4521- all (not_in_exclude_list )
4522- and all (non_in_service_list )
4523- and not any (
4524- Path (path ).name in filtered_path
4525- for filtered_path in filtered_paths
4526- )
4527- ):
4528- filtered_paths .append (path )
4529- elif not all (non_in_service_list ) or any (
4530- Path (path ).name in filtered_path for filtered_path in filtered_paths
4531- ):
4534+ for path in filtered_paths :
4535+ if path not in image_list :
4536+ images_to_upload .append (path )
4537+ else :
45324538 duplicated_paths .append (path )
45334539
4534- self ._images_to_upload = list (set (filtered_paths )), duplicated_paths
4540+ self ._images_to_upload = list (set (images_to_upload )), duplicated_paths
45354541 return self ._images_to_upload
45364542
45374543 def execute (self ):
0 commit comments