(self, start_index, length, metadata=None)
Insert annotation
Insert annotation
Insert annotation
def add_annotation(self, start_index, length, metadata=None):
        """
        Insert annotation
        """
        assert start_index >= self._get_start_offset()
        assert length >= 1
        metadata = metadata or {}
        metadata[self.START_INDEX_KEY] = start_index
        metadata[self.LENGTH_INDEX_KEY] = length
        self._validate_dict_in_section(metadata, self.ANNOTATION_KEY)
        self._metadata[self.ANNOTATION_KEY] = insert_sorted_dict_list(
            self._metadata.get(self.ANNOTATION_KEY, []),
            metadata,
            self.START_INDEX_KEY,
            force_insertion=True
        )
def add_annotation ( self , start_index , length , metadata = None ) : assert start_index >= self . _get_start_offset ( ) assert length >= 1 metadata = metadata or { } metadata [ self . START_INDEX_KEY ] = start_index metadata [ self . LENGTH_INDEX_KEY ] = length self . _validate_dict_in_section ( metadata , self . ANNOTATION_KEY ) self . _metadata [ self . ANNOTATION_KEY ] = insert_sorted_dict_list ( self . _metadata . get ( self . ANNOTATION_KEY , [ ] ) , metadata , self . START_INDEX_KEY , force_insertion = True )