creates the class for each class in the data set

            args:
                class_types: list of class_types in the dataset
                non_defined: list of subjects that have no defined class
437563
def _generate_classes(self, class_types, non_defined, **kwargs):
        
        # kwargs['dataset'] = self
        for class_type in class_types:
            self[class_type[self.smap]] = self._get_rdfclass(class_type,
                                                             **kwargs)\
                                                            (class_type,
                                                             self,
                                                             **kwargs)

            self.add_rmap_item(self[class_type[self.smap]],
                               class_type[self.pmap],
                               class_type[self.omap])

        for class_type in non_defined:
            self[class_type] = RdfClassBase(class_type, self, **kwargs)
            self.add_rmap_item(self[class_type], __a__, None)
        self.__set_classes__
        try:
            self.base_class = self[self.base_uri]
        except KeyError:
            self.base_class = None
1109437
def find_classes_in_module(module, clstypes):
    
    classes = []
    for item in dir(module):
        item = getattr(module, item)
        try:
            for cls in clstypes:
                if issubclass(item, cls) and item != cls:
                    classes.append(item)
        except Exception as e:
            pass
    return classes
1134263
def create_class(self, data, options=None, **kwargs):
        
        obj_map = dict(
            (cls.type, cls)
            for cls in [
                PythonClass,
                PythonFunction,
                PythonModule,
                PythonMethod,
                PythonPackage,
                PythonAttribute,
                PythonData,
                PythonException,
            ]
        )
        try:
            cls = obj_map[data["type"]]
        except KeyError:
            LOGGER.warning("Unknown type: %s" % data["type"])
        else:
            obj = cls(
                data,
                class_content=self.app.config.autoapi_python_class_content,
                options=self.app.config.autoapi_options,
                jinja_env=self.jinja_env,
                url_root=self.url_root,
                **kwargs
            )

            lines = sphinx.util.docstrings.prepare_docstring(obj.docstring)
            if lines and "autodoc-process-docstring" in self.app.events.events:
                self.app.emit(
                    "autodoc-process-docstring",
                    cls.type,
                    obj.name,
                    None,  # object
                    None,  # options
                    lines,
                )
            obj.docstring = "\n".join(lines)

            for child_data in data.get("children", []):
                for child_obj in self.create_class(
                    child_data, options=options, **kwargs
                ):
                    obj.children.append(child_obj)
            yield obj
421261
def create(cls):
        
        if cls not in cls._instances:
            cls._instances[cls] = cls()

        return cls._instances[cls]
677863
def create_class(self):
        
        if self.target_language in ['java', 'go']:
            n_indents = 1 if self.target_language == 'java' else 0
            class_head_temp = self.temp('separated.{}.class'.format(
                self.prefix), n_indents=n_indents, skipping=True)
            self.class_head = class_head_temp.format(**self.__dict__)

        return self.temp('separated.class').format(**self.__dict__)
513705
def make(class_name, base, schema):
    
    return type(class_name, (base,), dict(SCHEMA=schema))
922675
def classes(self, set_uri_or_id=None, nestedhierarchy=False):
        """"""
        if set_uri_or_id and set_uri_or_id.startswith(('http://','https://')):
            set_uri = set_uri_or_id
        else:
            set_uri = self.get_set_uri(set_uri_or_id)

        assert set_uri is not None

        classes= {}
        uri2idmap = {}
        for row in self.graph.query("SELECT ?classuri ?classid ?classlabel ?parentclass ?seqnr  WHERE { ?classuri rdf:type skos:Concept ; skos:notation ?classid. <" + str(set_uri) + "> skos:member ?classuri . OPTIONAL { ?classuri skos:prefLabel ?classlabel } OPTIONAL { ?classuri skos:narrower ?parentclass } OPTIONAL { ?classuri fsd:sequenceNumber ?seqnr } }"):
            classinfo = {'uri': str(row.classuri), 'id': str(row.classid),'label': str(row.classlabel) if row.classlabel else "" }
            if nestedhierarchy:
                uri2idmap[str(row.classuri)] = str(row.classid)
            if row.parentclass:
                classinfo['parentclass'] =  str(row.parentclass) #uri
            if row.seqnr:
                classinfo['seqnr'] =  int(row.seqnr)
            classes[str(row.classid)] = classinfo

        if nestedhierarchy:
            #build hierarchy
            removekeys = []
            for classid, classinfo in classes.items():
                if 'parentclass' in classinfo:
                    removekeys.append(classid)
                    parentclassid = uri2idmap[classinfo['parentclass']]
                    if 'subclasses' not in classes[parentclassid]:
                        classes[parentclassid]['subclasses'] = {}
                    classes[parentclassid]['subclasses'][classid] = classinfo
            for key in removekeys:
                del classes[key]
        return classes
3286
def make(self):
        
        log.setLevel(self.log_level)
        created = []
        self.set_class_dict()
        start = datetime.datetime.now()
        log.info(" # of classes to create: %s" % len(self.class_dict))
        log.debug(" creating classes that are not subclassed")

        for name, cls_defs in self.class_dict.items():
            # if name in ['bf_Organization', 'bf_Agent']:
            #     pdb.set_trace()
            if not self.class_dict[name].get('rdfs_subClassOf'):
                created.append(name)
                setattr(MODULE.rdfclass,
                        name,
                        types.new_class(name,
                                        (RdfClassBase,),
                                        {#'metaclass': RdfClassMeta,
                                         'cls_defs': cls_defs}))
        log.debug(" created %s classes in: %s",
                  len(created),
                  (datetime.datetime.now() - start))
        for name in created:
            del self.class_dict[name]
        left = len(self.class_dict)
        classes = []
        while left > 0:
            new = []
            for name, cls_defs in self.class_dict.items():
                # if name in ['bf_Organization', 'bf_Agent']:
                    # pdb.set_trace()
                parents = self.class_dict[name].get('rdfs_subClassOf')
                if not parents:
                    bases += (RdfClassBase, )
                else:
                    for parent in make_list(parents):
                        bases = tuple()
                        if parent in created or parent in classes:
                            if parent in classes:
                                bases += (RdfClassBase, )
                            else:
                                base = getattr(MODULE.rdfclass, parent)
                                bases += (base,) + base.__bases__
                if len(bases) > 0:
                    created.append(name)
                    setattr(MODULE.rdfclass,
                            name,
                            types.new_class(name,
                                            bases,
                                            {#'metaclass': RdfClassMeta,
                                             'cls_defs': cls_defs}))
            for name in created:
                try:
                    del self.class_dict[name]
                except KeyError:
                    pass
            if left == len(self.class_dict):
                # c_list = [self.class_dict[name].get('rdfs_subClassOf') \
                #           for name in self.class_dict]
                missing_parents = []
                for name in self.class_dict:
                    missing_parents += \
                            self.class_dict[name].get('rdfs_subClassOf', [])
                missing_parents = set(missing_parents)
                still_valid = set([name for name in self.class_dict
                                   if name not in missing_parents])
                classes = list(missing_parents.difference(\
                            set(self.class_dict.keys())))
                # classess = []
                # for cl in c_list:
                #     for item in cl:
                #         classes.append(item)

                for name in self.class_dict:
                    if name in classes:
                        classes.remove(name)
                    for p_name in self.class_dict[name].get('rdfs_subClassOf',
                                                            []).copy():
                        if p_name in classes:
                            self.class_dict[name]['rdfs_subClassOf'].remove(\
                                    p_name)
                # pdb.set_trace()
            left = len(self.class_dict)
        # self.tie_properties(created)
        log.info(" created all classes in %s",
                 (datetime.datetime.now() - start))
411935
def class_factory(name, base_class, class_dict):
    """"""

    def __init__(self, tcex):
        base_class.__init__(self, tcex)
        for k, v in class_dict.items():
            setattr(self, k, v)

    newclass = type(str(name), (base_class,), {'__init__': __init__})
    return newclass
975599
def start_class(self, class_):
        
        matches = filter(lambda svc: isinstance(svc, class_), self)
        if not matches:
            svc = class_()
            self.register(svc)
            matches = [svc]
        map(self.start, matches)
        return matches
933806
def get_class(class_path):
        
        module_path, class_name = class_path.rsplit(".", 1)

        try:
            module = __import__(class_path, fromlist=[class_name])
        except ImportError:
            raise ValueError('Class {0} could not be imported'.format(class_path))

        try:
            cls = getattr(module, class_name)
        except AttributeError:
            raise ValueError("Module '%s' has no class '%s'" % (module_path, class_name,))

        try:
            instance = cls()
        except TypeError as type_error:
            raise ValueError('Failed to instantiate class {0}. Error: {1}'.format(class_name, type_error.message))

        return instance
1212111
def _all_classes(self, classes):
        
        all_classes = {}

        def recurse(cls):
            all_classes[cls] = None
            for c in cls.__bases__:
                if c not in all_classes:
                    recurse(c)

        for cls in classes:
            recurse(cls)

        return all_classes.keys()
711599
def _build_superclass_lists(self):
        
        cls_dict = self.all_classes
        for cls in list(cls_dict.values()):
            cls.all_superclasses = []
            superclass = cls.superclass
            try:
                while superclass:
                    superclass_obj = cls_dict[superclass]
                    cls.all_superclasses.append(superclass_obj)
                    superclass = superclass_obj.superclass
            except KeyError:
                print("Missing superclass: " + superclass)
1337739
def register_classes(self, classes):
        
        classes = util.return_list(classes)
        for klass in classes:
            IPlugin.register(klass)
593363
def classes_for_day(day)
      days_classes = ClassArray.new
      self.each { |c| days_classes << c if c.day == day }
      days_classes.count > 0 ? days_classes : nil
    end
316679
def _import_classes(self, class_names, currmodule):
        # type: (unicode, str) -> List[Any]
        """"""
        classes = []  # type: List[Any]
        for name in class_names:
            classes.extend(import_classes(name, currmodule))
        return classes
1266327
def klass_for_type(type, singular=false)
      type = type.singularize unless singular
      type.classify.constantize
    end