Determines and stores whether model itself is sluggable
If so, it will have both the trait and implement the interface
326708
protected function determineIfModelIsSluggable()
    {
        $this->context->modelIsSluggable                    = false;
        $this->context->modelIsParentOfSluggableTranslation = false;

        // if the model is sluggable and not translated, or this is the actual translation
        if ($this->data['sluggable']) {

            if (    ! isset($this->data->sluggable_setup['translated'])
                ||  ! $this->data->sluggable_setup['translated']
                ||  $this->data->is_translation
            ) {

                $this->context->modelIsSluggable = true;

            } else {
                // this is the parent of a translated sluggable model

                $this->context->modelIsParentOfSluggableTranslation = true;
            }
        }
    }
961824
def allow_relation(self, obj1, obj2, **hints):
        
        if obj1._meta.app_label != 'oldimporter' and obj2._meta.app_label != 'oldimporter':
            return True
        return None
127888
private static void checkSensibility(AnnotatedType<?> type) {
        // check if it has a constructor
        if (type.getConstructors().isEmpty() && !type.getJavaClass().isInterface()) {
            MetadataLogger.LOG.noConstructor(type);
        }

        Set<Class<?>> hierarchy = new HashSet<Class<?>>();
        for (Class<?> clazz = type.getJavaClass(); clazz != null; clazz = clazz.getSuperclass()) {
            hierarchy.add(clazz);
            hierarchy.addAll(Reflections.getInterfaceClosure(clazz));
        }
        checkMembersBelongToHierarchy(type.getConstructors(), hierarchy, type);
        checkMembersBelongToHierarchy(type.getMethods(), hierarchy, type);
        checkMembersBelongToHierarchy(type.getFields(), hierarchy, type);
    }
42352
def validate_unique_slug(self):
        
        clashes_qs = type(self).objects.filter(slug=self.slug)
        if self.pk:
            clashes_qs = clashes_qs.exclude(pk=self.pk)
        if isinstance(self, PublishingModel):
            clashes_qs = clashes_qs.filter(
                publishing_is_draft=self.publishing_is_draft)
        if clashes_qs:
            raise ValidationError(
                "Slug '%s' clashes with other items: %s"
                % (self.slug, clashes_qs))
1051697
function isAbstractType(type: GraphQLType): boolean {
  const rawType = getRawType(type);
  return (
    rawType instanceof GraphQLInterfaceType ||
    rawType instanceof GraphQLUnionType
  );
}
580895
def can?(action, subject, *extra_args)
      while subject.is_a?(Draper::Decorator)
        subject = subject.model
      end

      super(action, subject, *extra_args)
    end
1367514
public boolean inherits(ASTType astType, ASTType inheritable) {
        if (astType == null) {
            return false;
        }
        if(inheritable == null || inheritable.equals(OBJECT_TYPE)){
            return true;
        }
        if (astType.equals(inheritable)) {
            return true;
        }
        for (ASTType typeInterfaces : astType.getInterfaces()) {
            if (inherits(typeInterfaces, inheritable)) {
                return true;
            }
        }
        return inherits(astType.getSuperClass(), inheritable);
    }
1174474
private static boolean isAssignableFrom(Type from, ParameterizedType to,
			Map<String, Type> typeVarMap) {

		if (from == null) {
			return false;
		}

		if (to.equals(from)) {
			return true;
		}

		// First figure out the class and any type information.
		Class<?> clazz = getRawType(from);
		ParameterizedType ptype = null;
		if (from instanceof ParameterizedType) {
			ptype = (ParameterizedType) from;
		}

		// Load up parameterized variable info if it was parameterized.
		if (ptype != null) {
			Type[] tArgs = ptype.getActualTypeArguments();
			TypeVariable<?>[] tParams = clazz.getTypeParameters();
			for (int i = 0; i < tArgs.length; i++) {
				Type arg = tArgs[i];
				TypeVariable<?> var = tParams[i];
				while (arg instanceof TypeVariable) {
					TypeVariable<?> v = (TypeVariable<?>) arg;
					arg = typeVarMap.get(v.getName());
				}
				typeVarMap.put(var.getName(), arg);
			}

			// check if they are equivalent under our current mapping.
			if (typeEquals(ptype, to, typeVarMap)) {
				return true;
			}
		}

		for (Type itype : clazz.getGenericInterfaces()) {
			if (isAssignableFrom(itype, to, new HashMap<String, Type>(
					typeVarMap))) {
				return true;
			}
		}

		// Interfaces didn't work, try the superclass.
		Type sType = clazz.getGenericSuperclass();
		if (isAssignableFrom(sType, to, new HashMap<String, Type>(typeVarMap))) {
			return true;
		}

		return false;
	}
31387
def handle
      return unless engine?
      return if decorators.empty?

      validate_decorators!
      validate_pattern_matching!

      engine.add_method_decorator(method_type, method_name, decorator)
      mark_pattern_matching_decorators
      method_reference.make_alias(target)
      redefine_method
    end
1200521
function ensureModelMixin( model, collection, options ) {
        var applyModelMixin;

        if ( !model._pickyType ) {
            applyModelMixin = Backbone.Select.Me.custom.applyModelMixin;

            if ( applyModelMixin && _.isFunction( applyModelMixin ) ) {
                applyModelMixin( model, collection, options );
            } else {
                Backbone.Select.Me.applyTo( model, options );
            }

        }
    }
515030
def get_instance_by_slug(model, slug, **kwargs):
    
    try:
        model = get_model(model)
    except ImportError:
        return None

    query_params = dict(kwargs)
    query_params['slug'] = slug

    return model.query.filter_by(**query_params).first()
367002
private boolean isReactive(Type type) {
    if (!ParameterizedType.class.isAssignableFrom(type.getClass())) {
      return false;
    }
    ParameterizedType parameterizedType = (ParameterizedType) type;
    Type raw = parameterizedType.getRawType();
    return Arrays.asList(((Class) raw).getInterfaces())
        .contains(Publisher.class);
  }
1219574
function _hasIndex(_this, model, key) {

    // Primary key always hasIndex
    if(key === 'id') {
        return true;
    }

    var modelDef = _this._models[model];
    var retval = (_.isObject(modelDef.properties[key]) && modelDef.properties[key].index) || (_.isObject(modelDef.settings[key]) && modelDef.settings[key].index);
    return retval;
}
592720
public function hasUniqueSlug()
    {
        $hash = $this->slugWorkingRecord->{$this->slugDbField} ?: $this->encrypt();
        $list = $this->slugWorkingRecord->get()->filter($this->slugDbField, $hash);

        if($this->slugWorkingRecord->ID) {
            $list = $list->exclude('ID', $this->slugWorkingRecord->ID);
        }
        else {
            $list = $list->exclude('ID', 0);
        }

        return !($list->exists());
    }
1063491
private boolean checkEDBObjectModelType(EDBObject object, Class<?> model) {
        String modelClass = object.getString(EDBConstants.MODEL_TYPE);
        if (modelClass == null) {
            LOGGER.warn(String.format("The EDBObject with the oid %s has no model type information."
                    + "The resulting model may be a different model type than expected.", object.getOID()));
        }
        if (modelClass != null && !modelClass.equals(model.getName())) {
            return false;
        }
        return true;
    }
1088941
private boolean isCopyModel(I_CmsDraggable draggable) {

        if (!(draggable instanceof CmsResultListItem)) {
            return false;
        }
        return ((CmsResultListItem)draggable).getResult().isCopyModel();
    }
982891
def is_nonlinear(self):
        """"""
        return any(
            isinstance(p, NonlinearProperty)
            for p in [self.mod_reduc, self.damping])