(self, include_labels=None, exclude_labels=None)
return aggregations
List all saved aggregations for this sketch.

        Args:
            include_labels (list): list of strings with labels. If defined
                then only return aggregations that have the label in the list.
            exclude_labels (list): list of strings with labels. If defined
                then only return aggregations that don't have a label in the
                list. include_labels will be processed first in case both are
                defined.

        Returns:
            List of aggregations (instances of Aggregation objects)
List all saved aggregations for this sketch.
List all saved aggregations for this sketch .
def list_aggregations(self, include_labels=None, exclude_labels=None):
        """List all saved aggregations for this sketch.

        Args:
            include_labels (list): list of strings with labels. If defined
                then only return aggregations that have the label in the list.
            exclude_labels (list): list of strings with labels. If defined
                then only return aggregations that don't have a label in the
                list. include_labels will be processed first in case both are
                defined.

        Returns:
            List of aggregations (instances of Aggregation objects)
        """
        if self.is_archived():
            raise RuntimeError(
                'Unable to list aggregations on an archived sketch.')
        aggregations = []

        data = self.api.fetch_resource_data(f'sketches/{self.id}/aggregation/')
        objects = data.get('objects')
        if not objects:
            return aggregations

        if not isinstance(objects, (list, tuple)):
            return aggregations

        object_list = objects[0]
        if not isinstance(object_list, (list, tuple)):
            return aggregations

        for aggregation_dict in object_list:
            agg_id = aggregation_dict.get('id')
            group_id = aggregation_dict.get('aggregationgroup_id')
            if group_id:
                continue
            label_string = aggregation_dict.get('label_string', '')
            if label_string:
                labels = json.loads(label_string)
            else:
                labels = []

            if include_labels:
                if not any(x in include_labels for x in labels):
                    continue

            if exclude_labels:
                if any(x in exclude_labels for x in labels):
                    continue

            aggregation_obj = aggregation.Aggregation(sketch=self)
            aggregation_obj.from_saved(aggregation_id=agg_id)
            aggregations.append(aggregation_obj)
        return aggregations
def list_aggregations ( self , include_labels = None , exclude_labels = None ) : if self . is_archived ( ) : raise RuntimeError ( 'Unable to list aggregations on an archived sketch.' ) aggregations = [ ] data = self . api . fetch_resource_data ( f'sketches/{self.id}/aggregation/' ) objects = data . get ( 'objects' ) if not objects : return aggregations if not isinstance ( objects , ( list , tuple ) ) : return aggregations object_list = objects [ 0 ] if not isinstance ( object_list , ( list , tuple ) ) : return aggregations for aggregation_dict in object_list : agg_id = aggregation_dict . get ( 'id' ) group_id = aggregation_dict . get ( 'aggregationgroup_id' ) if group_id : continue label_string = aggregation_dict . get ( 'label_string' , '' ) if label_string : labels = json . loads ( label_string ) else : labels = [ ] if include_labels : if not any ( x in include_labels for x in labels ) : continue if exclude_labels : if any ( x in exclude_labels for x in labels ) : continue aggregation_obj = aggregation . Aggregation ( sketch = self ) aggregation_obj . from_saved ( aggregation_id = agg_id ) aggregations . append ( aggregation_obj ) return aggregations