Create a new class based on the input_class.

    :param class input_class:  The class to patch.
    :rtype class:
439630
def patch_class(input_class):
    
    class Instantiator(object):
        @classmethod
        def _doubles__new__(self, *args, **kwargs):
            pass

    new_class = type(input_class.__name__, (input_class, Instantiator), {})

    return new_class
675167
def _onClass(self, name, line, pos, absPosition,
                 keywordLine, keywordPos,
                 colonLine, colonPos, level):
        """"""
        self.__flushLevel(level)
        c = Class(name, line, pos, absPosition, keywordLine, keywordPos,
                  colonLine, colonPos)
        if self.__lastDecorators is not None:
            c.decorators = self.__lastDecorators
            self.__lastDecorators = None
        self.objectsStack.append(c)
238712
def _create_from_java_class(cls, java_class, *args):
        
        java_obj = JavaWrapper._new_java_obj(java_class, *args)
        return cls(java_obj)
1233105
def input_classes(self):
        
        classes = [self.base_input_css_class]
        if self.css_class:
            classes.append(self.css_class)

        if self.style == styles.BOOTSTRAP_4 and self.error:
            classes.append('is-invalid')

        return ' '.join(classes)
976404
def create(cls, class_name, **attributes):
        
        object_class = cls.extend(class_name)
        return object_class(**attributes)
1251871
def apply(cls, fs):
        
        logger.debug(
            'Patching %s with %s.', fs.__class__.__name__, cls.__name__)
        fs._patch = cls
        for method_name in cls.patch_methods:
            # if fs hasn't method, raise AttributeError.
            origin = getattr(fs, method_name)
            method = getattr(cls, method_name)
            bound_method = method.__get__(fs, fs.__class__)
            setattr(fs, method_name, bound_method)
            setattr(fs, '_origin_' + method_name, origin)
1101346
def add_class(self, c: 'Class') -> None:
        
        self.classes[c.name] = c
        c.parent = self
646213
def _wrap_class(request_handler, validator):
    
    METHODS = ['get', 'post', 'put', 'head', 'options', 'delete', 'patch']
    for name in METHODS:
        method = getattr(request_handler, name)
        setattr(request_handler, name, _auth_required(method, validator))

    return request_handler
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))
676849
def create(cls, class_name: str, monoid_type=Union[Monoid, str]):
        

        def unit(cls, value):
            if hasattr(monoid_type, "empty"):
                log = monoid_type.empty()
            else:
                log = monoid_type()

            return cls(value, log)

        return type(class_name, (Writer, ), dict(unit=classmethod(unit)))
287509
def rule_for(self, target_class):
        
        def decorator(rule_class):
            self.add_rule(rule_class, target_class)
            return rule_class
        return decorator
936919
def add_input(self, input_):
        
        if not isinstance(input_, Input):
            raise TypeError('`input_` must be a Input instance')
        self.inputs.append(input_)
39498
def create(cls, this: str, super_: str=u'java/lang/Object') -> 'ClassFile':
        
        cf = ClassFile()
        cf.access_flags.acc_public = True
        cf.access_flags.acc_super = True

        cf.this = cf.constants.create_class(this)
        cf.super_ = cf.constants.create_class(super_)

        return cf
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
240224
def _load_class_entry_point(cls, entry_point):
        
        class_ = entry_point.load()
        setattr(class_, 'plugin_name', entry_point.name)
        return class_
1365850
@SuppressForbidden
  @SuppressWarnings("unused")
  public static ClassReader readAndPatchClass(InputStream in) throws IOException {
    final byte[] bytecode = readStream(in);
    if (false) patchClassMajorVersion(bytecode, Opcodes.V10 + 1, Opcodes.V10);
    return new ClassReader(bytecode);
  }
851731
def _add_base_class(mcs, cls):
        
        # Do all magic only if subclass had defined required attributes
        if getattr(mcs, '_base_classes_hash', None) is not None:
            meta = getattr(cls, 'Meta', None)
            _hash = getattr(meta, mcs._hashattr, None)
            if _hash is None and cls not in mcs._get_base_classes():
                mcs._base_classes.insert(0, cls)
                mcs._generated_class = {}  # Cleanup all caches
            elif _hash is not None and cls not in mcs._get_base_classes(_hash):
                mcs._base_classes_hash[_hash].insert(0, cls)
                mcs._generated_class[_hash] = None