Attributes for content type creation.
976814
def create_attributes(klass, attributes, previous_object=None):
        

        result = super(ContentType, klass).create_attributes(attributes, previous_object)

        if 'fields' not in result:
            result['fields'] = []
        return result
931565
function() {
      // if we have no publish lookup table, we have no attributes to take
      // TODO(sjmiles): ad hoc
      if (this._publishLC) {
        for (var i=0, a$=this.attributes, l=a$.length, a; (a=a$[i]) && i<l; i++) {
          this.attributeToProperty(a.name, a.value);
        }
      }
    }
802181
def wrap_with type, content, options = {} #:nodoc:
      type_tag, type_html_options = apply_html type, options
      if type_tag
        @template.content_tag type_tag, content, type_html_options
      else
        content
      end
    end
610586
def content_tag(tag, content, **options)
      attrs = options.map { |kind, value| %{ #{kind}="#{value}"} }.join
      "<#{tag}#{attrs}>#{content}</#{tag}>"
    end
1032769
def p_content(self, content):
        ''''''
        content[0] = self.doctype(content[1], content[3], content[4], content[5])
        if self.toc:
            self.toc.set_articles([a for a in content[0].sections if isinstance(a, Article)])
1173778
def build_attrs(self, *args, **kwargs):
        """"""
        self.attrs.setdefault('data-minimum-input-length', 1)
        self.attrs.setdefault('data-tags', 'true')
        self.attrs.setdefault('data-token-separators', '[",", " "]')
        return super(Select2TagMixin, self).build_attrs(*args, **kwargs)
292413
private void createDecoder()
    {
        decoder = new DOMAnalyzer(doc, base);
        if (encoding == null)
            encoding = decoder.getCharacterEncoding();
        decoder.setDefaultEncoding(encoding);
        decoder.attributesToStyles();
        decoder.addStyleSheet(null, CSSNorm.stdStyleSheet(), DOMAnalyzer.Origin.AGENT);
        decoder.addStyleSheet(null, CSSNorm.userStyleSheet(), DOMAnalyzer.Origin.AGENT);
        decoder.getStyleSheets();
    }
613194
def _setAttributeNS(self, namespaceURI, qualifiedName, value):
        '''
        
        '''
        self.node.setAttributeNS(namespaceURI, qualifiedName, value)
1179466
def set_content_type (self):
        """"""
        if self.url:
            self.content_type = mimeutil.guess_mimetype(self.url, read=self.get_content)
        else:
            self.content_type = u""
1287869
def _get_kind_and_names(attributes):
        """"""
        kind = 'document'
        possible_names = []
        for attr in attributes:
            if isinstance(attr, types.DocumentAttributeFilename):
                possible_names.insert(0, attr.file_name)

            elif isinstance(attr, types.DocumentAttributeAudio):
                kind = 'audio'
                if attr.performer and attr.title:
                    possible_names.append('{} - {}'.format(
                        attr.performer, attr.title
                    ))
                elif attr.performer:
                    possible_names.append(attr.performer)
                elif attr.title:
                    possible_names.append(attr.title)
                elif attr.voice:
                    kind = 'voice'

        return kind, possible_names
38711
def stage_tc_create_attribute(self, attribute_type, attribute_value, resource):
        
        attribute_data = {'type': str(attribute_type), 'value': str(attribute_value)}
        # handle default description and source
        if attribute_type in ['Description', 'Source']:
            attribute_data['displayed'] = True

        attrib_resource = resource.attributes()
        attrib_resource.body = json.dumps(attribute_data)
        attrib_resource.http_method = 'POST'

        # add the attribute
        a_response = attrib_resource.request()
        if a_response.get('status') != 'Success':
            self.log.warning(
                '[stage] Failed adding attribute type "{}":"{}" ({}).'.format(
                    attribute_type, attribute_value, a_response.get('response').text
                )
            )
834731
private void attributes(Options opt, FieldDoc fd[]) {
	for (FieldDoc f : fd) {
	    if (hidden(f))
		continue;
	    stereotype(opt, f, Align.LEFT);
	    String att = visibility(opt, f) + f.name();
	    if (opt.showType)
		att += typeAnnotation(opt, f.type());
	    tableLine(Align.LEFT, att);
	    tagvalue(opt, f);
	}
    }
299809
function userAttrType(attr, attrData) {
    return (
      [
        ['array', ({ options }) => !!options],
        [typeof attrData.value, () => true], // string, number,
      ].find(typeCondition => typeCondition[1](attrData))[0] || 'string'
    )
  }
306581
public function _createElements() {

        $this->_generateId();

        $this->setElements([
            $this->createFormElement('text', 'filetypes', $this->getLabel(), [
                'id' => $this->getAttribute('id'),
            ]),

            $this->createFormElement('static', 'browser', null,
                '<span data-filetypesbrowser="'.$this->getAttribute('id').'"></span>'),

            $this->createFormElement('static', 'descriptions', null,
                '<div data-filetypesdescriptions="'.$this->getAttribute('id').'"></div>')
        ]);
    }
50225
function generateElement(type, attributes, html) {
        var el = document.createElement(type);
        Object.keys(attributes || {}).forEach(function (type) {
          el.setAttribute(type, attributes[type]);
        });
        if (html) {
          el.innerHTML = html;
        }
        return el;
      }
846842
def smart_content_type(self):
        """"""
        content_type = self.content_type
        if content_type in (None, '', 'application/octet-stream'):
            content_type, _ = mimetypes.guess_type(self.name)

        return content_type
1238686
def generate_content_media_type(self):
        
        if self._definition['contentMediaType'] == 'application/json':
            with self.l('if isinstance({variable}, bytes):'):
                with self.l('try:'):
                    self.l('{variable} = {variable}.decode("utf-8")')
                with self.l('except Exception:'):
                    self.l('raise JsonSchemaException("{name} must encoded by utf8")')
            with self.l('if isinstance({variable}, str):'):
                with self.l('try:'):
                    self.l('import json')
                    self.l('{variable} = json.loads({variable})')
                with self.l('except Exception:'):
                    self.l('raise JsonSchemaException("{name} must be valid JSON")')