Use "links" key, remove support for polymorphic type
174300
function(record, json, relationship) {
        var attr = relationship.key;
        var belongsTo = record.belongsTo(attr);
        var type, key;

        if (isNone(belongsTo)) {
          return;
        }

        type = this.keyForSnapshot(belongsTo);
        key = this.keyForRelationship(attr);

        if (!json.links) {
          json.links = json.relationships || {};
        }
        json.links[key] = belongsToLink(key, type, get(belongsTo, 'id'));
      }
1190030
def delete_typeattr(typeattr,**kwargs):
    

    tmpltype = get_templatetype(typeattr.type_id, user_id=kwargs.get('user_id'))

    ta = db.DBSession.query(TypeAttr).filter(TypeAttr.type_id == typeattr.type_id,
                                          TypeAttr.attr_id == typeattr.attr_id).one()

    tmpltype.typeattrs.remove(ta)

    db.DBSession.flush()

    return 'OK'
410955
def supported_cache_type(types):
    
    if isinstance(types, str):
        types = [typ.strip() for typ in types.split(",")]
    for typ in types:
        if typ not in ["reflink", "hardlink", "symlink", "copy"]:
            return False
    return True
807024
function polymorphism(iterator, data, params, cb) {
    var h = artoo.helpers,
        i, d, p, c;

    if (h.isPlainObject(iterator) &&
        !h.isSelector(iterator) &&
        !h.isDocument(iterator) &&
        (iterator.iterator || iterator.data || iterator.params)) {
      d = iterator.data;
      p = h.isPlainObject(iterator.params) ? iterator.params : {};
      i = iterator.iterator;
    }
    else {
      d = data;
      p = h.isPlainObject(params) ? params : {};
      i = iterator;
    }

    // Default values
    d = d || 'text';

    c = typeof cb === 'function' ? cb :
          typeof params === 'function' ? params :
            p.done;

    return [i, d, p, c];
  }
401986
def remove_alias(type_):
    
    if isinstance(type_, cpptypes.type_t):
        type_ref = type_
    elif isinstance(type_, typedef.typedef_t):
        type_ref = type_.decl_type
    else:
        # Not a valid input, just return it
        return type_
    if type_ref.cache.remove_alias:
        return type_ref.cache.remove_alias
    no_alias = __remove_alias(type_ref.clone())
    type_ref.cache.remove_alias = no_alias
    return no_alias
1001066
private static void getTypeInfo(UResourceBundle typeInfoRes) {
        Map<String,Set<String>> _deprecatedKeyTypes = new LinkedHashMap<String,Set<String>>();
        for (UResourceBundleIterator keyInfoIt = typeInfoRes.getIterator(); keyInfoIt.hasNext();) {
            UResourceBundle keyInfoEntry = keyInfoIt.next();
            String key = keyInfoEntry.getKey();
            TypeInfoType typeInfo = TypeInfoType.valueOf(key);
            for (UResourceBundleIterator keyInfoIt2 = keyInfoEntry.getIterator(); keyInfoIt2.hasNext();) {
                UResourceBundle keyInfoEntry2 = keyInfoIt2.next();
                String key2 = keyInfoEntry2.getKey();
                Set<String> _deprecatedTypes = new LinkedHashSet<String>();
                for (UResourceBundleIterator keyInfoIt3 = keyInfoEntry2.getIterator(); keyInfoIt3.hasNext();) {
                    UResourceBundle keyInfoEntry3 = keyInfoIt3.next();
                    String key3 = keyInfoEntry3.getKey();
                    switch (typeInfo) { // allow for expansion
                    case deprecated:
                        _deprecatedTypes.add(key3);
                        break;
                    }
                }
                _deprecatedKeyTypes.put(key2, Collections.unmodifiableSet(_deprecatedTypes));
            }
        }
        DEPRECATED_KEY_TYPES = Collections.unmodifiableMap(_deprecatedKeyTypes);
    }
597375
function normalizeLinks(base, input) {
  if (!input) return;
  if (!Array.isArray(input)) input = [ input ];

  return flatten(input).filter(Boolean).map(function (link) {
    return normalizeLink(base, link);
  });
}
344405
def extends(path_or_lambda, options = nil)
      if path_or_lambda.is_a?(Proc)
        @template.add_node Nodes::Polymorphic.new(path_or_lambda)
        return
      end

      other = Library.instance.compile_template_from_path(path_or_lambda, @view)

      if options && options.is_a?(Hash)
        @template.add_node Nodes::Extend.new(other.nodes, options[:locals])
      else
        @template.extends(other)
      end
    end
120149
def coerce(cls, key, value):
        """"""
        if not isinstance(value, MutationList):
            if isinstance(value, list):
                return MutationList(value)

            # this call will raise ValueError
            return Mutable.coerce(key, value)
        else:
            return value
127257
function (parsed_key, options)
{
    "use strict";

    this.key = parsed_key;

    options = options || {};

    this.options = {};
    this.options.json = options.json !== false;
    this.options.check = options.check !== false;
    this.options.pad = options.pad !== false;
    this.options.custom = options.custom;

    this.encoding = options.base64 !== false ? 'base64' : undefined;
}
408789
def edit_link(obj, options = {})
      if policy(obj).edit?
        url = polymorphic_url([:edit] + Array(obj))
        action_link('Edit', url, 'pencil', options)
      end
    end
507783
function(types, callback, scope){
            types = types || [];
            var args = [].slice.call(arguments);

            if($.isString(types)){
                types = types.split(',');
            }
            var len = types.length;
            if(len===0){
                return this;
            }
            args = args.length > 3 ? args.splice(3, args.length-1) : [];
            for(var i = 0;i<len;i++){
                var type = types[i];
                _cache[type] = _cache[type] || [];
                _cache[type].push({callback:callback,scope:scope,args:args});
            }
            return this;
        }
727862
public void unlink(ParaObject obj, String type2, String id2) {
		if (obj == null || obj.getId() == null || type2 == null || id2 == null) {
			return;
		}
		String url = Utils.formatMessage("{0}/links/{1}/{2}", obj.getObjectURI(), type2, id2);
		invokeDelete(url, null);
	}
623801
function normalizeLink(base, input) {
  assert(input.rel, 'links must have a rel');
  assert(input.href, 'links must have an href');

  var ret = clone(input);

  ret.rel = normalizeRel(base, input.rel);
  ret.href = normalizeHref(base, input.href);

  var cls = normalizeClass(input.class);
  if (cls) ret.class = cls;

  return ret;
}
690658
private void unmarshalKeyAndParentKey() throws Throwable {
    KeyMetadata keyMetadata = entityMetadata.getKeyMetadata();
    if (keyMetadata != null) {
      MethodHandle writeMethod = keyMetadata.getWriteMethod();
      Key entityKey = (Key) nativeEntity.getKey();
      writeMethod.invoke(entity, new DefaultDatastoreKey(entityKey));
    }

    ParentKeyMetadata parentKeyMetadata = entityMetadata.getParentKeyMetadata();
    if (parentKeyMetadata != null) {
      MethodHandle writeMethod = parentKeyMetadata.getWriteMethod();
      Key parentKey = nativeEntity.getKey().getParent();
      if (parentKey != null) {
        writeMethod.invoke(entity, new DefaultDatastoreKey(parentKey));
      }
    }
  }
4
def key_to_kind(cls, key):
    
    if key.kind() == Kind.KIND_NAME:
      return key.id()
    else:
      return key.parent().id()
49337
def add_resource_attrs_from_type(type_id, resource_type, resource_id,**kwargs):
    
    type_i = _get_templatetype(type_id)

    resource_i = _get_resource(resource_type, resource_id)

    resourceattr_qry = db.DBSession.query(ResourceAttr).filter(ResourceAttr.ref_key==resource_type)

    if resource_type == 'NETWORK':
        resourceattr_qry.filter(ResourceAttr.network_id==resource_id)
    elif resource_type == 'NODE':
        resourceattr_qry.filter(ResourceAttr.node_id==resource_id)
    elif resource_type == 'LINK':
        resourceattr_qry.filter(ResourceAttr.link_id==resource_id)
    elif resource_type == 'GROUP':
        resourceattr_qry.filter(ResourceAttr.group_id==resource_id)
    elif resource_type == 'PROJECT':
        resourceattr_qry.filter(ResourceAttr.project_id==resource_id)

    resource_attrs = resourceattr_qry.all()

    attrs = {}
    for res_attr in resource_attrs:
        attrs[res_attr.attr_id] = res_attr

    new_resource_attrs = []
    for item in type_i.typeattrs:
        if attrs.get(item.attr_id) is None:
            ra = resource_i.add_attribute(item.attr_id)
            new_resource_attrs.append(ra)

    db.DBSession.flush()

    return new_resource_attrs