Ejemplo n.º 1
0
    def new_inst(cls, label):
        """
        Construct a new instance of the type and with parameters associated with
        the given label.

        :param label: the configuration label
        :type label: str

        :raises KeyError: The given label does not exist in the system
            configuration

        :return: New instance of type and parameters associated with the given
            label.
        :rtype: smqtk.content_description.ContentDescriptor

        """
        label_sect = cls.get_config_sect()[label]
        cd_cls = get_descriptors()[label_sect['type']]
        return cd_cls(**label_sect['init'])
Ejemplo n.º 2
0
def test_get_descriptors():
    m = get_descriptors()
    ntools.assert_is_instance(m, dict, "Should return a dictionary of class "
                                       "label-to-types")