Return a new instance encapsulating this cdata.
970214
def _new_from_cdata(cls, cdata: Any) -> "Random":
        """"""
        self = object.__new__(cls)  # type: "Random"
        self.random_c = cdata
        return self
161316
def singleton(cls):
    '''
    
    '''

    cls.__new_original__ = cls.__new__

    @wraps(cls.__new__)
    def singleton_new(cls, *args, **kw):
        it = cls.__dict__.get('__it__')
        if it is not None:
            return it

        cls.__it__ = it = cls.__new_original__(cls, *args, **kw)
        it.__init_original__(*args, **kw)
        return it

    cls.__new__ = singleton_new
    cls.__init_original__ = cls.__init__
    cls.__init__ = object.__init__

    return cls
39171
def clone(self):
        

        p = type(self)(self.id)
        p.hooks = list(self.hooks)
        p.instance = self.instance
        return p
807508
public CookieCacheData duplicate() {
        // Create second instance and copy members
        CookieCacheData cData = new CookieCacheData();
        cData.parsedList = copyList(this.parsedList);
        cData.isDirty = this.isDirty;
        cData.hdrIndex = this.hdrIndex;
        cData.headerType = this.headerType;
        return cData;
    }
380729
public SupportProvider newDefaultInstance() {
        try {
            return clazz.newInstance();
        } catch (InstantiationException e) {
            throw new RuntimeException("Failed to instantiate " + clazz, e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException("Failed to instantiate " + clazz, e);
        }
    }
214582
@Override
    public Mp newInstance() throws DempsyException {
        try {
            return newMp.get();
        } catch(final RuntimeException rte) {
            throw new DempsyException(rte, true);
        }
    }
676548
def create_new(cls, oldvalue, *args):
    ""
    if oldvalue is not None:
        raise AlreadyExistsException('%r already exists' % (oldvalue,))
    return cls.create_instance(*args)
697390
def new(cls, **kwargs):
        
        kwargs = cls.preprocess_kwargs_before_new(kwargs)
        if cls.__mapper__.polymorphic_on is not None:
            discriminator_key = cls.__mapper__.polymorphic_on.name
            discriminator_val = kwargs.get(discriminator_key)
            if discriminator_val is not None and discriminator_val in cls.__mapper__.polymorphic_map:
                actual_cls = cls.__mapper__.polymorphic_map[discriminator_val].class_
                return actual_cls(
                    **subdict(
                        actual_cls._preprocess_params(kwargs),
                        actual_cls.all_settable_keys())
                )
        return cls(**subdict(cls._preprocess_params(kwargs), cls.all_settable_keys()))
346472
def instance(self_or_cls,**params):
        

        if isinstance (self_or_cls,ParameterizedMetaclass):
            cls = self_or_cls
        else:
            p = params
            params = dict(self_or_cls.get_param_values())
            params.update(p)
            params.pop('name')
            cls = self_or_cls.__class__

        inst=Parameterized.__new__(cls)
        Parameterized.__init__(inst,**params)
        if 'name' in params:  inst.__name__ = params['name']
        else:                 inst.__name__ = self_or_cls.name
        return inst
1054037
public static <T> T newInstance(final Class<T> clas) {
		try {
			return clas.newInstance();
		} catch (final Exception e) {
			throw new RuntimeException(e);
		}

	}
20557
public static Object newInstanceFromName(Object enclosingObject, String className, ClassLoader classLoader) {
		try {
			Class<?> clazz = Class.forName(className, false, classLoader);
			for (Constructor<?> c : clazz.getConstructors()) {
				Class<?>[] parameterTypes = c.getParameterTypes();
				if (parameterTypes.length == 0) {
					return c.newInstance();
				} else if (parameterTypes.length == 1 && enclosingObject != null && parameterTypes[0].equals(enclosingObject.getClass())) {
					return c.newInstance(enclosingObject);
				}
			}
			return clazz.newInstance();
		} catch (Exception e) {
			String m = "Couldn't create instance from name " + className + " (" + e.getMessage() + ")";
			LOG.error(m, e);
			throw new RuntimeException(m);
		}
	}
387101
def create(cls, data, **kwargs):
        """"""
        with db.session.begin_nested():
            model = cls.dbmodel(**kwargs)
            model.data = data
            obj = cls(model)
            db.session.add(obj.model)
        return obj
495352
public static Red5 from(CompositeData cd) {
        Red5 instance = null;
        if (cd.containsKey("connection")) {
            Object cn = cd.get("connection");
            if (cn != null && cn instanceof IConnection) {
                instance = new Red5((IConnection) cn);
            } else {
                instance = new Red5();
            }
        } else {
            instance = new Red5();
        }
        return instance;
    }
421261
def create(cls):
        
        if cls not in cls._instances:
            cls._instances[cls] = cls()

        return cls._instances[cls]
560860
def _Cobject(cls, ctype):
    
    o = object.__new__(cls)
    o._as_parameter_ = ctype
    return o
482785
protected static Object newInstance(String className) {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        log.debug("Conversion utils classloader: {}", cl);
        Object instance = null;
        try {
            Class<?> clazz = cl.loadClass(className);
            instance = clazz.newInstance();
        } catch (Exception ex) {
            log.error("Error loading class: {}", className, ex);
        }
        return instance;
    }
1188761
static Object newInstance (ClassLoader classLoader, String className)
        throws ClassNotFoundException, IllegalAccessException,
            InstantiationException
    {
        Class driverClass;
        if (classLoader == null) {
            driverClass = Class.forName(className);
        } else {
            driverClass = classLoader.loadClass(className);
        }
        return driverClass.newInstance();
    }