Create a new :class:`CustomAttribute`.

        :param project: :class:`Project` id
        :param name: name of the custom attribute
        :param attrs: optional attributes of the custom attributes
424867
def create(self, project, name, **attrs):
        
        attrs.update(
            {
                'project': project, 'name': name
            }
        )
        return self._new_resource(payload=attrs)
593988
def attributes(atts = {}, for_definition = false)
      wrapped_attributes atts, for_definition
      attributes_assignments atts, false, for_definition
      atts
    end
1344617
function getAttribute(path, attrNode) {
    path.forEach(attrName => {
        if (!(attrNode.attributes && attrNode.attributes[attrName])) {
            throw new ImplementationError(`Result-Builder: Unknown attribute "${path.join('.')}"`);
        }
        attrNode = attrNode.attributes[attrName];
    });
    return attrNode;
}
607521
def create_atype(self, ):
        
        name = self.name_le.text()
        desc = self.desc_pte.toPlainText()
        try:
            atype = djadapter.models.Atype(name=name, description=desc)
            atype.save()
            for prj in self.projects:
                atype.projects.add(prj)
            self.atype = atype
            self.accept()
        except:
            log.exception("Could not create new assettype")
1112066
function(attributes, options) {
    var attrs = attributes || {};
    options || (options = {});
    this.cid = _.uniqueId('c');
    this.attributes = {};
    if (options.collection) this.collection = options.collection;
    if (options.parse) attrs = this.parse(attrs, options) || {};
    this._schema = this.schema();
    this._defaults = this.defaults(undefined, true);
    attrs = _.defaultsDeep({}, attrs, this.defaults(undefined, false));
    this.set(attrs, options);
    this.changed = {};
    this.initialize.apply(this, arguments);
  }
882456
def attr(cls, iterable, attr_name):
    

    return cls(getattr(x, attr_name) for x in iterable)
113067
def add(self, name, path=None, **kwargs):
        
        path = path or kwargs.pop('default_path', None)

        if not self._path_is_valid(path):
            return

        if not self._is_unique(name, path):
            p = Project.select().where(
                (Project.name == name) |
                (Project.path == path)
            )[0]
            self._print(self._ERROR_PROJECT_EXISTS.format(name, p.path), 'red')
            return

        Project.create(name=name, path=path)
        self._print(self._SUCCESS_PROJECT_ADDED.format(name), 'green')
862343
def attribute_by_name(self, name):
        
        att = self.__attribute_by_name(javabridge.get_env().new_string(name))
        if att is None:
            return None
        else:
            return Attribute(att)
260804
def _set_attr(self, name, doc=None, preload=False):
        ""

        if doc is None:
            doc = 'The {name} attribute.'.format(name=name)

        if not hasattr(self._attr_func_, name):
            attr_prop = property(
                functools.partial(self._setable_get_, name),
                functools.partial(self._setable_set_, name),
                doc=doc
            )

        elif preload:
            func = getattr(self._attr_func_, name)
            setattr(self._attr_data_, name, func())
            delattr(self._attr_func_, name)
            attr_prop = property(
                functools.partial(self._simple_get_, name),
                doc=doc
            )

        else:
            attr_prop = property(
                functools.partial(self._loadable_get_, name),
                doc=doc
            )

        setattr(type(self), name, attr_prop)
294353
def attribute(name, options = {})
        return unless
          @_object &&
          attribute_present?(name) &&
          resolve_condition(options)

        attribute = data_object_attribute(name)
        name = create_key(options[:as] || name)
        @_result[name] = attribute
      end
624365
def add_task_attribute(self, name, **attrs):
        
        return TaskAttributes(self.requester).create(
            self.id, name, **attrs
        )
605037
def prj_create_atype(self, *args, **kwargs):
        
        if not self.cur_prj:
            return
        atype = self.create_atype(projects=[self.cur_prj])
        if atype:
            atypedata = djitemdata.AtypeItemData(atype)
            treemodel.TreeItem(atypedata, self.prj_atype_model.root)
1310916
def add_attribute(self, name, value):
        

        self.attributes.append(Attribute(name, value))
1185389
public AbstractPrintQuery addAttribute(final String... _attrNames)
        throws EFapsException
    {
        final Type type = getMainType();
        if (type != null) {
            for (final String attrName : _attrNames) {
                final Attribute attr = type.getAttribute(attrName);
                if (attr == null) {
                    final AttributeSet set = AttributeSet.find(type.getName(), attrName);
                    if (set != null) {
                        addAttributeSet(set);
                    }
                } else {
                    addAttribute(attr);
                }
            }
        }
        return this;
    }
879868
def attribute(*args)
      if args.first.is_a?(Hash)
        args.first.each_pair do |key, name|
          @attributes.add(name: name, attr: key)
        end
      else
        options = args.extract_options!
        args.each do |name|
          key = options[:as] || name
          @attributes.add(name: name, attr: key)
        end
      end
    end
1013822
def __new_attr(self, name, attr):
        
        if isinstance(attr, Pref):
            # Child attribute already has a Pref wrapping
            if VERBOSE_PREF:
                print('[pref.__new_attr]: %s.%s = %r' % (self._intern.name, name, attr.value()))
            new_childx = len(self._tree.child_names)
            # Children know about parents
            attr._tree.parent = self     # Give child parent
            attr._intern.name = name     # Give child name
            if attr._intern.depeq is None:
                attr._intern.depeq = self._intern.depeq  # Give child parent dependencies
            if attr._intern.hidden:
                self._tree.hidden_children.append(new_childx)
                self._tree.hidden_children.sort()
            # Used for QTIndexing
            attr._intern.aschildx = new_childx
            # Parents know about children
            self._tree.child_names.append(name)  # Add child to tree
            self._tree.child_list.append(attr)
            self.__dict__[name] = attr.value()   # Add child value to dict
        else:
            # The child attribute is not wrapped. Wrap with Pref and readd.
            pref_attr = Pref(default=attr)
            self.__new_attr(name, pref_attr)
837122
private void createAttributesCache() {
        final String METHODNAME = "createAttributesCache";

        if (iAttrsCacheEnabled) {
            if (FactoryManager.getCacheUtil().isCacheAvailable()) {
                iAttrsCache = FactoryManager.getCacheUtil().initialize("AttributesCache", iAttrsCacheSize, iAttrsCacheSize, iAttrsCacheTimeOut);
                if (iAttrsCache != null) {
                    if (tc.isDebugEnabled()) {
                        StringBuilder strBuf = new StringBuilder(METHODNAME);
                        strBuf.append(" \nAttributes Cache: ").append(iAttrsCacheName).append(" is enabled:\n");
                        strBuf.append("\tCacheSize: ").append(iAttrsCacheSize).append("\n");
                        strBuf.append("\tCacheTimeOut: ").append(iAttrsCacheTimeOut).append("\n");
                        strBuf.append("\tCacheSizeLimit: ").append(iAttrsSizeLmit).append("\n");
                        Tr.debug(tc, strBuf.toString());
                    }
                }
            }
        }
    }