def get_segments_of_type()

in distill/segmentation/segments.py [0:0]


    def get_segments_of_type(self, segment_type):
        """
        Returns a new Segments object that includes Segment objects of a specified type.

        :param segment_type: The type of Segment objects that should be included.
        :return: A new Segments object that contains Segment objects of the specified type.
        """
        if not isinstance(segment_type, distill.Segment_Type):
            raise TypeError("Given segment_type: " + str(segment_type) + " is not a valid segment type.")

        segments = [segment for segment in self.segments if segment.segment_type == segment_type]
        return Segments(segments)