def set_collection_elements( self, dataset_collection, dataset_instances ): if dataset_collection.populated: raise Exception("Cannot reset elements of an already populated dataset collection.") collection_type = dataset_collection.collection_type collection_type_description = self.collection_type_descriptions.for_collection_type( collection_type ) type_plugin = collection_type_description.rank_type_plugin() builder.set_collection_elements( dataset_collection, type_plugin, dataset_instances ) dataset_collection.mark_as_populated() return dataset_collection