Add a field to the document (and to the underlying schema)
        
        :param name: name of the new field
        :type name: str
        :param ftype: type of the new field
        :type ftype: subclass of :class:`.GenericType`
359702
def add_field(self, name, ftype, docfield=None):
        
        self.schema.add_field(name, ftype)
        self[name] = docfield or DocField.FromType(ftype)
240582
def extend_schema_spec(self) -> None:
        
        super().extend_schema_spec()

        if self.ATTRIBUTE_FIELDS in self._spec:
            # Add new fields to the schema spec. Since `_identity` is added by the super, new elements are added after
            predefined_field = self._build_time_fields_spec(self._spec[self.ATTRIBUTE_NAME])
            self._spec[self.ATTRIBUTE_FIELDS][1:1] = predefined_field

            # Add new field schema to the schema loader
            for field_schema in predefined_field:
                self.schema_loader.add_schema_spec(field_schema, self.fully_qualified_name)
968659
def addImportSchema(self, schema):
        
        if not isinstance(schema, XMLSchema):
            raise TypeError, 'expecting a Schema instance'
        if schema.targetNamespace != self.targetNamespace:
            self._imported_schemas[schema.targetNamespace] = schema
        else:
            raise SchemaError, 'import schema bad targetNamespace'
1167715
def AddDescriptorFromSchema(self, schema_name, schema):
        """"""
        # TODO(craigcitro): Is schema_name redundant?
        if self.__GetDescriptor(schema_name):
            return
        if schema.get('enum'):
            self.__DeclareEnum(schema_name, schema)
            return
        if schema.get('type') == 'any':
            self.__DeclareMessageAlias(schema, 'extra_types.JsonValue')
            return
        if schema.get('type') != 'object':
            raise ValueError('Cannot create message descriptors for type %s' %
                             schema.get('type'))
        message = extended_descriptor.ExtendedMessageDescriptor()
        message.name = self.__names.ClassName(schema['id'])
        message.description = util.CleanDescription(schema.get(
            'description', 'A %s object.' % message.name))
        self.__DeclareDescriptor(message.name)
        with self.__DescriptorEnv(message):
            properties = schema.get('properties', {})
            for index, (name, attrs) in enumerate(sorted(properties.items())):
                field = self.__FieldDescriptorFromProperties(
                    name, index + 1, attrs)
                message.fields.append(field)
                if field.name != name:
                    message.field_mappings.append(
                        type(message).JsonFieldMapping(
                            python_name=field.name, json_name=name))
                    self.__AddImport(
                        'from %s import encoding' % self.__base_files_package)
            if 'additionalProperties' in schema:
                self.__AddAdditionalProperties(message, schema, properties)
        self.__RegisterDescriptor(message)
795019
def add(self, timestamp, information):
        
        try:
            item = Schema(CollectorStage.schema_event_items()).validate({
                'timestamp': timestamp, 'information': information
            })
            self.events.append(item)
        except SchemaError as exception:
            Logger.get_logger(__name__).error(exception)
            raise RuntimeError(str(exception))
623683
def add_input(self, in_name, type_or_parse=None):
        
        if type_or_parse is None:
            type_or_parse = GenericType()
        elif not isinstance(type_or_parse, GenericType) and callable(type_or_parse):
            type_or_parse = GenericType(parse=type_or_parse)
        elif not isinstance(type_or_parse, GenericType):
            raise ValueError("the given 'type_or_parse' is invalid")
        self._inputs[in_name] = type_or_parse
1245487
public void addSchema(String version, TTypes types, MessageInfo recMessageInfo)
    {
        String name = this.fixName(recMessageInfo.getField(MessageInfo.DESCRIPTION).toString());
        
        Import importel = schemaFactory.createImport();
        org.w3._2001.xmlschema.Schema schema = (org.w3._2001.xmlschema.Schema)types.getAny().get(0);    // LAME
        schema.getIncludeOrImportOrRedefine().add(importel);
        String code = recMessageInfo.getField(MessageInfo.CODE).toString();
        if (code == null)
            code = name;
        String namespace = ((PropertiesField)recMessageInfo.getField(MessageInfo.MESSAGE_PROPERTIES)).getProperty(MessageInfo.NAMESPACE);
        String element = ((PropertiesField)recMessageInfo.getField(MessageInfo.MESSAGE_PROPERTIES)).getProperty(MessageInfo.ELEMENT);
        String schemaLocation = ((PropertiesField)recMessageInfo.getField(MessageInfo.MESSAGE_PROPERTIES)).getProperty(MessageInfo.SCHEMA_LOCATION);
        
        if (namespace == null)
            namespace = this.getMessageControl().getNamespaceFromVersion(version);
        if (element == null)
            if (code != null)
                element = code;
        if (schemaLocation == null)
            if (code != null)
                schemaLocation = code + ".xsd";
        schemaLocation = this.getMessageControl().getSchemaLocation(version, schemaLocation);
        if (namespace != null)
            importel.setNamespace(namespace);
        importel.setSchemaLocation(schemaLocation);
    }
573542
def add_attr2fields(self, attr_name, attr_val, fields=[], exclude=[], include_all_if_empty=True):
        
        for f in self.filter_fields(fields, exclude, include_all_if_empty):
            f = self.fields[f.name]
            org_val = f.widget.attrs.get(attr_name, '')
            f.widget.attrs[attr_name] = '%s %s' % (org_val, attr_val) if org_val else attr_val
747155
private void add(Field f) {

        m_fields.put(f.name(), f);
        m_doc.add(f);
    }
367511
def []= (name, value)
      field = schema.fields[name.to_s] || FieldDefinition.new(name, :type => value.class)
      write_attribute(field, value, self)
    end
373046
def add_datatype(self, name: str, datatype: DT):
        
        self._datatypes[name] = datatype
496245
def _add_field(self, node, field_name, field):
        
        value = field.to_string(field.read_from(self))
        text_value = "" if value is None else value

        # Is the field type supposed to serialize the fact that the value is None to XML?
        save_none_as_xml_attr = field.none_to_xml and value is None
        field_attrs = {"none": "true"} if save_none_as_xml_attr else {}

        if save_none_as_xml_attr or field.xml_node:
            # Field will be output to XML as an separate element.
            tag = etree.QName(XML_NAMESPACES["option"], field_name)
            elem = etree.SubElement(node, tag, field_attrs)
            if field.xml_node:
                # Only set the value if forced via xml_node;
                # in all other cases, the value is None.
                # Avoids an unnecessary XML end tag.
                elem.text = text_value
        else:
            # Field will be output to XML as an attribute on the node.
            node.set(field_name, text_value)
375481
def _add_dynamic_field_to_model(cls, field, field_name):
        
        # create the new field
        new_field = field._create_dynamic_version()
        new_field.name = field_name
        new_field._attach_to_model(cls)

        # set it as an attribute on the class, to be reachable
        setattr(cls, "_redis_attr_%s" % field_name, new_field)

        # NOTE: don't add the field to the "_fields" list, to avoid use extra
        #       memory to each future instance that will create a field for each
        #       dynamic one created

        # # add the field to the list to avoid to done all of this again
        # # (_fields is already on this class only, not subclasses)
        # cls._fields.append(field_name)

        # each subclass needs its own copy
        for subclass in cls.__subclasses__():
            subclass._add_dynamic_field_to_model(field, field_name)

        return new_field
344379
public void addField(String fieldName, String type, short flags) {
        short fieldNameIndex = itsConstantPool.addUtf8(fieldName);
        short typeIndex = itsConstantPool.addUtf8(type);
        itsFields.add(new ClassFileField(fieldNameIndex, typeIndex, flags));
    }
396680
def create_column(self, name, type):
        
        self._check_dropped()
        if normalize_column_name(name) not in self._normalized_columns:
            self.op.add_column(self.table.name, Column(name, type), self.table.schema)
            self.table = self._update_table(self.table.name)
33790
def _write_method(schema):
    
    def method(
        self,
        filename=None,
        schema=schema,
        id_col='uid',
        sequence_col='sequence',
        extra_data=None,
        alphabet=None,
        **kwargs):
        # Use generic write class to write data.
        return _write(
            self._data,
            filename=filename,
            schema=schema,
            id_col=id_col,
            sequence_col=sequence_col,
            extra_data=extra_data,
            alphabet=alphabet,
            **kwargs
        )
    # Update docs
    method.__doc__ = _write_doc_template(schema)
    return method
392894
public void addField(String name, Object value, Object type) {
        if (value == null) {
            this.fields.add(new Field(name, null, null));
        } else {
            this.fields.add(new Field(name, value.toString(), type.toString()));
        }
    }