@@ -129,10 +129,7 @@ def execute(self):
129129 if not projects :
130130 self ._response .errors = AppException ("Project not found." )
131131 else :
132- for project in projects :
133- if project .name == self ._name :
134- self ._response .data = project
135- break
132+ self ._response .data = next (project for project in projects if project .name == self ._name )
136133 return self ._response
137134
138135
@@ -1359,7 +1356,9 @@ def __init__(
13591356
13601357 def validate_image_quality (self ):
13611358 for setting in self ._to_update :
1362- if setting ["attribute" ].lower () == "imagequality" and isinstance (setting ["value" ], str ):
1359+ if setting ["attribute" ].lower () == "imagequality" and isinstance (
1360+ setting ["value" ], str
1361+ ):
13631362 setting ["value" ] = constances .ImageQuality .get_value (setting ["value" ])
13641363 return
13651364
@@ -1593,7 +1592,7 @@ def execute(self):
15931592 self ._backend_service .delete_images (
15941593 project_id = self ._project .uuid ,
15951594 team_id = self ._project .team_id ,
1596- image_ids = image_ids [i : i + self .CHUNK_SIZE ],
1595+ image_ids = image_ids [i : i + self .CHUNK_SIZE ], # noqa: E203
15971596 )
15981597 return self ._response
15991598
@@ -1970,6 +1969,8 @@ def execute(self):
19701969
19711970 if self ._include_contributors :
19721971 data ["contributors" ] = project .users
1972+ else :
1973+ project .users = []
19731974
19741975 self ._response .data = data
19751976 return self ._response
@@ -2678,7 +2679,11 @@ def execute(self):
26782679 for step in [step for step in self ._steps if "className" in step ]:
26792680 if step .get ("id" ):
26802681 del step ["id" ]
2681- step ["class_id" ] = annotation_classes_map [step ["className" ]]
2682+ step ["class_id" ] = annotation_classes_map .get (step ["className" ], None )
2683+ if not step ["class_id" ]:
2684+ raise AppException (
2685+ "Annotation class not found in set_project_workflow."
2686+ )
26822687
26832688 self ._service .set_project_workflow_bulk (
26842689 team_id = self ._project .team_id ,
@@ -2698,6 +2703,17 @@ def execute(self):
26982703 attribute_group_name = attribute ["attribute" ]["attribute_group" ][
26992704 "name"
27002705 ]
2706+ if not annotations_classes_attributes_map .get (
2707+ f"{ annotation_class_name } __{ attribute_group_name } __{ attribute_name } " ,
2708+ None ,
2709+ ):
2710+ raise AppException (
2711+ "Attribute group name or attribute name not found in set_project_workflow."
2712+ )
2713+
2714+ if not existing_workflows_map .get (step ["step" ], None ):
2715+ raise AppException ("Couldn't find step in workflow" )
2716+
27012717 req_data .append (
27022718 {
27032719 "workflow_id" : existing_workflows_map [step ["step" ]],
0 commit comments