Decide whether to use a model, based on the model name and the lists of
        models to exclude and include.
173080
def use_model(self, model_name):
        
        # Check against exclude list.
        if self.exclude_models:
            for model_pattern in self.exclude_models:
                model_pattern = '^%s$' % model_pattern.replace('*', '.*')
                if re.search(model_pattern, model_name):
                    return False
        # Check against exclude list.
        elif self.include_models:
            for model_pattern in self.include_models:
                model_pattern = '^%s$' % model_pattern.replace('*', '.*')
                if re.search(model_pattern, model_name):
                    return True
        # Return `True` if `include_models` is falsey, otherwise return `False`.
        return not self.include_models
548695
def _get_recommended_models(models, fld_name):
        
        target_value = min([model.output[fld_name] for model in models])
        return [model for model in models if model.output[fld_name] == target_value]
941087
function(models, options) {
      models  || (models = []);
      options || (options = {});
      this.each(this._removeReference);
      this._reset();
      this.add(models, {silent: true});
      if (!options.silent) this.trigger('reset', this, options);
      return this;
    }
1350963
def then_a_model_exists(context, model_name, key, value):
    
    model = apps.get_model(model_name)
    args = {
        key: value
    }
    obj = model.objects.get(**args)
    assert obj is not None
805395
def validate_include_exclude(include, exclude):
    
    if include is not None and exclude is not None:
        raise ValueError("Only one of 'include' or 'exclude' argument should be provided.")
    validate('include', include, instance_of=(str, Sequence), enforce_not_none=False)
    validate('exclude', exclude, instance_of=(str, Sequence), enforce_not_none=False)
469622
function (model) {
        var newModels = slice.call(this.models);
        var modelIndex = newModels.indexOf(model);
        if (modelIndex > -1) {
            newModels.splice(modelIndex, 1);
            this.models = newModels;
            this._removeIndex(this._indexes, model);
            return true;
        }
        return false;
    }
473148
function(model, options) {
            var index;

            if (_.isArray(model)) {
                _.each(model, function(m) {
                    this.remove(m, options);
                }, this);
                return this;
            }

            options = _.defaults(options || {}, {
                silent: false
            });

            model = this._prepareModel(model);

            _.each(this.models, function(m, i) {
                if (!m || model.id == m.id) {
                    this.models.splice(i, 1);
                    index = i;
                    return;
                }
            }, this);
            delete this._byId[model.id];

            if (options.silent) return this;
            options.index = index;
            if (this._totalCount != null) this._totalCount = _.max([0, this._totalCount - 1]);
            this.trigger('remove', model, this, options);
            this._removeReference(model);

            return this;
        }
199938
def _list_model(self, model_cls: Type[X]) -> List[X]:
        """"""
        return self.session.query(model_cls).all()
187860
def has_requisite_content_models(self):
        ''''''
        for cmodel in getattr(self, 'CONTENT_MODELS', ()):
            if not self.has_model(cmodel):
                return False
        return True
1292719
protected function checkModels()
    {
        $models = func_get_args();
        //
        foreach ($models as $model) {
            if (!class_exists($model)) {
                $this->ModelNotFinded($model);
            }
        }
    }
766328
def check_dependencies(model, model_queue, avaliable_models):
    
    # A list of allowed links: existing fields, itself and the special case ContentType
    allowed_links = [m.model.__name__ for m in model_queue] + [model.__name__, 'ContentType']

    # For each ForeignKey or ManyToMany field, check that a link is possible

    for field in model._meta.fields:
        if not field.remote_field:
            continue
        if field.remote_field.model.__name__ not in allowed_links:
            if field.remote_field.model not in avaliable_models:
                continue
            return False

    for field in model._meta.many_to_many:
        if not field.remote_field:
            continue
        if field.remote_field.model.__name__ not in allowed_links:
            return False

    return True
931980
def filtered_elements(self, model):
        """"""
        if isinstance(model, self.element_type):
            yield model
        yield from (e for e in model.eAllContents() if isinstance(e, self.element_type))
610769
function (model, options) {
        if (this === model.collection) delete model.collection;
        this._deIndex(model);
        if (model.off) model.off('all', this._onModelEvent, this);
    }
180951
function(models, options) {
      options = _.extend({}, options);
      var singular = !_.isArray(models);
      models = singular ? [models] : models.slice();
      var removed = this._removeModels(models, options);
      if (!options.silent && removed.length) {
        options.changes = {added: [], merged: [], removed: removed};
        this.trigger('update', this, options);
      }
      return singular ? removed[0] : removed;
    }
598028
protected function shouldMaintainIndex(Model $model = null)
    {
        if ((bool) $this->config('maintain_index', true) === false) {
            return false;
        }

        if ($model !== null) {
            return $this->option($model, 'maintain_index', true);
        }
    }
304380
def validate_instance(instance):
    """"""
    excludes = settings.AUTOMATED_LOGGING['exclude']['model']

    for excluded in excludes:
        if (excluded in [instance._meta.app_label.lower(),
                         instance.__class__.__name__.lower()] or
                instance.__module__.lower().startswith(excluded)):
            return False

    return True
618321
def filter(self, model=None, context=None):
        
        if model is None:
            return

        # properties
        self.filter_properties(model, context=context)

        # entities
        self.filter_entities(model, context=context)

        # collections
        self.filter_collections(model, context=context)