Add a `Model` instance to this entry.
439161
def add_model(self, allow_alias=False, **kwargs):
        """"""
        if not allow_alias and MODEL.ALIAS in kwargs:
            err_str = "`{}` passed in kwargs, this shouldn't happen!".format(
                SOURCE.ALIAS)
            self._log.error(err_str)
            raise RuntimeError(err_str)

        # Set alias number to be +1 of current number of models
        if MODEL.ALIAS not in kwargs:
            kwargs[MODEL.ALIAS] = str(self.num_models() + 1)
        model_obj = self._init_cat_dict(Model, self._KEYS.MODELS, **kwargs)
        if model_obj is None:
            return None

        for item in self.get(self._KEYS.MODELS, ''):
            if model_obj.is_duplicate_of(item):
                return item[item._KEYS.ALIAS]

        self.setdefault(self._KEYS.MODELS, []).append(model_obj)
        return model_obj[model_obj._KEYS.ALIAS]
551143
def SetModel( self, model, adapter=None ):
        """"""
        self.model = model
        if adapter is not None:
            self.adapter = adapter
        self.UpdateDrawing()
177824
def add_eager_constraints(self, models):
        
        self._models = Collection.make(models)
        self._build_dictionary(models)
964697
def import_model(self, source):
        """"""
        if not hasattr(source, 'read'):  # Not a File-like object
            with open(self._resolve_source(source), 'r') as f:
                return self._import(f)
        else:
            return self._import(source)
528630
function( model ) {
			var modelColl = model.collection;
			var coll = this.getCollection( model );
			coll && coll._add( model );
			model.collection = modelColl;
		}
1253047
def register_model(cls: Type[Model]):
    
    if not issubclass(cls, Model):
        raise TypeError("model bust be a subclass of Model")
    if issubclass(cls, GenericModel):
        raise TypeError("model must not be a subclass of GenericModel")
    __models__.add(cls)
    return cls
209415
def add_to_class(self, cls, name):
        '''
        
        '''
        self.model_class = cls
        setattr(cls, name, PhoneNumberDescriptor(self))
        self._bound = True
57370
def register_model(cls, model):
        

        rest_name = model.rest_name
        resource_name = model.resource_name

        if rest_name not in cls._model_rest_name_registry:
            cls._model_rest_name_registry[rest_name] = [model]
            cls._model_resource_name_registry[resource_name] = [model]

        elif model not in cls._model_rest_name_registry[rest_name]:
            cls._model_rest_name_registry[rest_name].append(model)
            cls._model_resource_name_registry[resource_name].append(model)
988859
def model(self, name=None, model=None, mask=None, **kwargs):
        
        if isinstance(model, (flask_marshmallow.Schema, flask_marshmallow.base_fields.FieldABC)):
            if not name:
                name = model.__class__.__name__
            api_model = Model(name, model, mask=mask)
            api_model.__apidoc__ = kwargs
            return self.add_model(name, api_model)
        return super(Namespace, self).model(name=name, model=model, **kwargs)
586352
def set_model(self, m):
        
        self._model = m
        self.new_root.emit(QtCore.QModelIndex())
        self.model_changed(m)
1365725
def add_method_model(self,
                         func,  # type: Callable
                         name=None,  # type: Optional[str]
                         description=None,  # type: Optional[str]
                         ):
        # type: (...) -> MethodModel
        """"""
        return self._field_registry.add_method_model(
            func, name, description, self._part)
16725
def update_model(self, idx=None):
        """"""
        if idx is None:
            for w in self._widgets:
                idx = self._get_idx_from_widget(w)
                try: val = self._read_widget(idx)
                except ValueError: pass
                else: self._write_property(val, idx)
                pass
            pass
        else:
            try: val = self._read_widget(idx)
            except ValueError: pass
            else: self._write_property(val, idx)
        return
620101
def register(self, model, index):
        """"""
        self.model_to_indexes[model].add(index)
        if not self.connected:
            connections.index_name = {}
            from django.conf import settings
            kwargs = {}
            for name, params in settings.ELASTICSEARCH_CONNECTIONS.items():
                params = copy.deepcopy(params)
                kwargs[name] = params
                connections.index_name[name] = params.pop("index_name")
            connections.configure(**kwargs)
            self.connected = True
734166
def register_modele(self, modele: Modele):
        
        self.lemmatiseur._modeles[modele.gr()] = modele
169271
function(model, options) {
            model = this._prepareModel(model, options);
            this.add(model, options);
            return model;
        }
911292
public void addCache(ModelKey modelKey, Object model) {
		if ((modelKey == null) || (modelKey.getDataKey() == null))
			return;
		String modelClassName = null;
		try {
			if (modelKey.getModelClass() == null) {
				ModelMapping modelMapping = this.modelFactory.getModelMapping(modelKey.getFormName());
				modelClassName = modelMapping.getClassName();
			} else
				modelClassName = modelKey.getModelClass().getName();
			if (ModelUtil.isModel(model.getClass()))
				modelCacheManager.saveCache(modelKey.getDataKey(), modelClassName, model);
			else
				Debug.logError("addCache error:" + model.getClass() + " not ModelIF or @Model", module);
		} catch (Exception e) {
			Debug.logError("addCache error:" + e, module);
		}

	}
515640
def pre_save(self, model_instance, add):
        
        file = getattr(model_instance, self.attname)
        if file and not file._committed:
            file.name = self._clean_file_name(model_instance, file.name)
            file.file = self._resize_image(model_instance, file)
            file.save(file.name, file, save=False)
        return file