Defines a class attribute and creates a class and instance writer methods to
 allow assignment to the attribute.
776671
def mattr_writer(*syms)
      syms.each do |sym|
        raise NameError.new("invalid attribute name: #{sym}") unless sym =~ /^[_A-Za-z]\w*$/
        class_eval(<<-EOS, __FILE__, __LINE__ + 1)
          @@#{sym} = nil unless defined? @@#{sym}
          def self.#{sym}=(obj)
            @@#{sym} = obj
          end
        EOS

        send("#{sym}=", yield) if block_given?
      end
    end
345512
def _create(self, **attributes):
        

        attributes['enabled'] = True
        if 'name' in self._data:
            attributes['description'] = self._data['name']
        obj_ref = self.api.add(self.obj_parent(), self.obj_type(), **attributes)
        self.api.commit()
        return self.api.remapIds(obj_ref)
1006444
def create(self, _attributes=None, **attributes):
        
        if _attributes is not None:
            attributes.update(_attributes)

        instance = self._related.new_instance(attributes)

        self._set_foreign_attributes_for_create(instance)

        instance.save()

        return instance
1279865
def call(attribute_definition, klass)
      define_reader.(attribute_definition, klass)
      define_writer.(attribute_definition, klass)
      attribute_definition
    end
362686
function() {
      if (!this.el) {
        var attrs = _.extend({}, _.result(this, 'attributes'));
        if (this.id) attrs.id = _.result(this, 'id');
        if (this.className) attrs['class'] = _.result(this, 'className');
        this.setElement(this._createElement(_.result(this, 'tagName')));
        this._setAttributes(attrs);
      } else {
        this.setElement(_.result(this, 'el'));
      }
    }
982722
def _add_standard_attributes(cls):
        
        setattr(
            cls.context.new_class,
            cls.context.new_meta['state_attribute_name'],
            cls.context.state_value)
        setattr(
            cls.context.new_class,
            cls.context.state_name,
            utils.state_property)

        setattr(cls.context.new_class, 'is_', utils.is_)
        setattr(cls.context.new_class, 'can_be_', utils.can_be_)
        setattr(cls.context.new_class, 'set_', utils.set_)
188284
def create(self, name: str, descriptor: str,
               code: CodeAttribute=None) -> Method:
        
        method = Method(self._cf)
        name = self._cf.constants.create_utf8(name)
        descriptor = self._cf.constants.create_utf8(descriptor)
        method._name_index = name.index
        method._descriptor_index = descriptor.index
        method.access_flags.acc_public = True

        if code is not None:
            method.attributes.create(CodeAttribute)

        self.append(method)
        return method
1289982
def instance_set(attribute, value)
      setter = :"#{self.name}_#{attribute}="
      self.instance.send(setter, value) if instance.respond_to?(setter)
    end
398744
@Override
    public Uid create(
            final ObjectClass objClass,
            final Set<Attribute> attrs,
            final OperationOptions options) {

        LOG.ok("Account creation");

        // check objectclass
        if (objClass == null || (!objClass.equals(ObjectClass.ACCOUNT))) {
            throw new IllegalArgumentException("Invalid objectclass");
        }

        // check attributes
        if (attrs == null || attrs.isEmpty()) {
            throw new IllegalArgumentException("No attribute specified");
        }

        // get web service client
        final Provisioning provisioning = connection.getProvisioning();
        if (provisioning == null) {
            throw new IllegalStateException("Web Service client not found");
        }

        // get account name
        final Name name = AttributeUtil.getNameFromAttributes(attrs);
        if (name == null) {
            throw new IllegalArgumentException("No name specified");
        }

        LOG.ok("Account to be created: " + name.getNameValue());

        // to be user in order to pass information to the web service
        final List<WSAttributeValue> attributes = new ArrayList<WSAttributeValue>();

        // retrieve attributes
        for (Attribute attr : attrs) {
            final WSAttribute wsAttribute = new WSAttribute(attr.getName());

            if (attr.is(Name.NAME)) {
                wsAttribute.setKey(true);
                wsAttribute.setNullable(false);
            }

            if (attr.is(OperationalAttributeInfos.PASSWORD.getName())) {
                wsAttribute.setName(OperationalAttributeInfos.PASSWORD.getName());
                wsAttribute.setPassword(true);
            }

            if (LOG.isOk()) {
                LOG.ok(
                        "\nAttribute: "
                        + "\n\tName: " + wsAttribute.getName()
                        + "\n\tType: " + wsAttribute.getType()
                        + "\n\tIsKey: " + wsAttribute.isKey()
                        + "\n\tIsPassword: " + wsAttribute.isPassword());
            }

            final WSAttributeValue wsAttributeValue = new WSAttributeValue(wsAttribute);
            attributes.add(wsAttributeValue);

            final List<Object> value = attr.getValue();
            if (value != null && value.size() == 1
                    && (value.get(0) instanceof GuardedString || value.get(0) instanceof GuardedByteArray)) {

                wsAttributeValue.addValue(value.toString());
            } else {
                wsAttributeValue.setValues(value);
            }
        }

        LOG.ok("\nUser " + name.getNameValue() + "\n\tattributes: " + attributes.size());

        try {
            // user creation
            provisioning.create(attributes);
        } catch (ProvisioningException e) {
            throw new ConnectorException("Creation failed", e);
        } catch (Throwable t) {
            throw new ConnectorException("Communication exception", t);
        }

        // return Uid
        return new Uid(name.getNameValue());
    }
723218
protected int writeEnclosingMethodAttribute(Name attributeName, ClassSymbol c) {
        if (c.owner.kind != MTH && // neither a local class
            c.name != names.empty) // nor anonymous
            return 0;

        int alenIdx = writeAttr(attributeName);
        ClassSymbol enclClass = c.owner.enclClass();
        MethodSymbol enclMethod =
            (c.owner.type == null // local to init block
             || c.owner.kind != MTH) // or member init
            ? null
            : (MethodSymbol)c.owner;
        databuf.appendChar(pool.put(enclClass));
        databuf.appendChar(enclMethod == null ? 0 : pool.put(nameType(c.owner)));
        endAttr(alenIdx);
        return 1;
    }
727281
def add_attribute_value_initializer
      class << self
        def new(opts=nil)
          obj = super()
          obj.post_initialize
          obj.merge_attributes(opts) if opts
          obj
        end
      end
      logger.debug { "#{self} is extended with an optional {attribute=>value} constructor parameter." }
    end
669970
def assign(self, attrs):
        
        for k, v in attrs.items():
            setattr(self, k, v)
1211405
def create!(attributes)
      new_attributes = map_to_keys(attributes)

      new_attributes = new_attributes.merge(
        RecordTypeManager::FIELD_NAME => klass.record_type_id
      ) if klass.record_type_id

      client.create!(klass.object_name, new_attributes)
    end
217038
def _initialize_referenced(model_class, attribute):
    
    # this should be a descriptor
    def _related_objects(self):
        return (model_class.objects
                .filter(**{attribute.attname: self.id}))

    klass = attribute._target_type
    if isinstance(klass, basestring):
        return (klass, model_class, attribute)
    else:
        related_name = (attribute.related_name or
                model_class.__name__.lower() + '_set')
        setattr(klass, related_name,
                property(_related_objects))
470778
def add_to_class(self, cls, name):
        '''
        
        '''
        self._name = name
        self._container_model_class = cls
        setattr(cls, name, FieldDescriptor(self))
        self._bound = True
1234434
def create_attributes(klass, attributes, previous_object=None):
        

        return {
            'name': attributes.get(
                'name',
                previous_object.name if previous_object is not None else ''
            ),
            'description': attributes.get(
                'description',
                previous_object.description if previous_object is not None else ''
            ),
            'environments': attributes.get(
                'environments',
                [e.to_json() for e in previous_object.environments] if previous_object is not None else []  # Will default to master if empty
            )
        }
1087138
def create_attributes(klass, attributes, previous_object=None):
        

        result = {}

        if previous_object is not None:
            result = {k: v for k, v in previous_object.to_json().items() if k != 'sys'}

        result.update(attributes)

        return result