From e657f44aa38f9f25a151938d0f39e57798e816c3 Mon Sep 17 00:00:00 2001 From: iftwigs <42752431+iftwigs@users.noreply.github.com> Date: Thu, 8 Aug 2024 19:15:58 +0400 Subject: [PATCH] Added: handling of no_label_annotation_set (#529) --- konfuzio_sdk/data.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/konfuzio_sdk/data.py b/konfuzio_sdk/data.py index c8b1b15da..78a71db6c 100644 --- a/konfuzio_sdk/data.py +++ b/konfuzio_sdk/data.py @@ -3137,14 +3137,17 @@ def no_label_annotation_set(self) -> AnnotationSet: self.annotation_sets() # Find no label annotation set - self._no_label_annotation_set = next( - ( - annotation_set - for annotation_set in self._annotation_sets - if annotation_set.label_set == self.project.no_label_set - ), - None, - ) + if self._annotation_sets is not None: + self._no_label_annotation_set = next( + ( + annotation_set + for annotation_set in self._annotation_sets + if annotation_set.label_set == self.project.no_label_set + ), + None, + ) + else: + self._no_label_annotation_set = None # Create no label annotation set if not found if self._no_label_annotation_set is None: