Create an instance object
426782
def get_group_instance(self, parent):
        """"""
        o = copy.copy(self)
        o.init_instance(parent)
        return o
752969
def instantiate(self, cls=None):
        
        if cls is None:
            cls = self.cls
        if cls is None:
            raise TypeError("cls must a class")
        return cls.create(*self.args, **self.kwargs)
108297
def create(cls, object_version, key, value):
        """"""
        assert len(key) < 256
        assert len(value) < 256
        with db.session.begin_nested():
            obj = cls(version_id=as_object_version_id(object_version),
                      key=key,
                      value=value)
            db.session.add(obj)
        return obj
230304
function make_singleton( Constructor, singleton_config ) {
		process_after( Constructor );

		var instance = Constructor.create.apply( null, singleton_config === true ? [] : [].concat( singleton_config ) );

		util.def( Constructor, __singleton__, util.describe( { value : instance }, 'r' ) );

		return instance;
	}
631333
def instance(cls, hostname=None, auth=None, protocol=None, port=None, database=None):
        

        if cls.class_instance is None:
            if hostname is None and auth is None and protocol is None and port is None and database is None:
                cls.class_instance = Client(hostname='localhost')
            else:
                cls.class_instance = Client(hostname=hostname, auth=auth, protocol=protocol, port=port, database=database)
        else:
            if hostname is not None:
                cls.class_instance.hostname = hostname

            if protocol is not None:
                cls.class_instance.hostname = protocol

            if port is not None:
                cls.class_instance.hostname = port

            if database is not None:
                cls.class_instance.database = database

            if auth is not None:
                cls.class_instance.auth = auth

            cls.class_instance._create_api()

        return cls.class_instance
286810
public Object newInstance( String name, Object... params ) throws ClassLoaderException {
        return newInstance( name, params, null );
    }
361223
def create_instance(self, name, template, args=None, labels=None):
        
        req = rest_pb2.CreateInstanceRequest()
        req.name = name
        req.template = template
        if args:
            for k in args:
                req.templateArgs[k] = args[k]
        if labels:
            for k in labels:
                req.labels[k] = labels[k]
        url = '/instances'
        self.post_proto(url, data=req.SerializeToString())
536925
def make_instance(self, data):
        """"""
        if not self.opts.model:
            return data

        if self.instance is not None:
            for key, value in data.items():
                setattr(self.instance, key, value)
            return self.instance

        return self.opts.model(**data)
1108720
def create(self):
        
        self.add_handlers({'^E': self.quit, '^Q': self.quit})
        to_delete = self.old_instances - self.new_instances
        self.add(npyscreen.Textfield, value='Select which instances to delete'
                 ' (you must select ' + str(to_delete) +
                 ' instance(s) to delete):', editable=False, color='GOOD')
        self.del_instances = self.add(InstanceSelect,
                                      values=self.cur_instances,
                                      scroll_exit=True, rely=3,
                                      instance_num=to_delete)
1125141
def _make_instance(self, **attributes):
        
        definition = self._definitions[self._klass][self._name](self._faker)
        definition.update(attributes)

        instance = self._klass()
        instance.force_fill(**definition)

        return instance
173141
def set_instance(self, thing: type, value, overwrite=False):
        
        if thing in self.instances and not overwrite:
            raise DiayException('instance for %r already exists' % thing)
        self.instances[thing] = value
329558
def singleton(cls):
    
    INSTANCES = {}

    def _singleton(*args, **kwargs):
        if cls not in INSTANCES:
            INSTANCES[cls] = cls(*args, **kwargs)
        return INSTANCES[cls]

    return _singleton
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
364547
def instantiate_by_name_with_default(self, object_name, default_value=None):
        
        if object_name not in self.instances:
            if object_name not in self.environment:
                return default_value
            else:
                instance = self.instantiate_from_data(self.environment[object_name])

                self.instances[object_name] = instance
                return instance
        else:
            return self.instances[object_name]
1221319
def instance(cls):
        

        if not hasattr(cls, "_instance") or cls._instance is None:
            cls._instance = cls()
        return cls._instance
221866
public static Object newInstance(Class target, Class[] types, Object[] args) throws InstantiationException,
                                                                                        IllegalAccessException,
                                                                                        IllegalArgumentException,
                                                                                        InvocationTargetException,
                                                                                        NoSuchMethodException,
                                                                                        SecurityException
    {
        return newInstance(target, types, args, false);
    }
136839
def create_object(object_type, data, **api_opts):
    '''
    
    '''
    if '__opts__' in globals() and __opts__['test']:
        return {'Test': 'Would attempt to create object: {0}'.format(object_type)}
    infoblox = _get_infoblox(**api_opts)
    return infoblox.create_object(object_type, data)