Returns a docco section for the given enum.

    :Parameters:
      enum
        Parsed IDL enum dict. Keys: 'comment', 'name', 'values'
6124
def parse_enum(enum):
    
    docs = enum['comment']
    code = '<span class="k">enum</span> <span class="gs">%s</span> {\n' % enum['name']
    for v in enum["values"]:
        if v['comment']:
            for line in v['comment'].split("\n"):
                code += '    <span class="c1">// %s</span>\n' % line
        code += '    <span class="nv">%s</span>\n' % v['value']
    code += "}"

    return to_section(docs, code)
371656
def _read_dict(cp, dictionary):
    '''
    
    '''
    for section, keys in dictionary.items():
        section = six.text_type(section)

        if _is_defaultsect(section):
            if six.PY2:
                section = configparser.DEFAULTSECT
        else:
            cp.add_section(section)

        for key, value in keys.items():
            key = cp.optionxform(six.text_type(key))
            if value is not None:
                value = six.text_type(value)
            cp.set(section, key, value)
233329
def parse_section(self, section_options):
        
        for (name, (_, value)) in section_options.items():
            try:
                self[name] = value

            except KeyError:
                pass
1349660
def create(key_name: str, sections: List[str]): # -> NoParserFoundForObject:
        
        return MultipleKeyOccurenceInConfigurationError('Cannot read the provided config file as a flat dictionary : '
                                                        'key \'' + key_name + '\' appears several times, in sections'
                                                                              '\'' + str(sections) + '\'.')
510963
def create_keyval_section(pairs, name):
    '''

    '''
    section = ['%' + name ]
    for pair in pairs:
        section.append(' '.join(pair).strip().strip('\\'))
    return section
1267991
def get_values(self, keys):
        
        if is_string(keys):
            return [s.__dict__[keys] for s in self.sections]
        else:
            values = []
            for k in keys:
                values.append([s.__dict__[k] for s in self.sections])
            return values
1233987
def get_enum_key(key, choices):
    
    if key in choices:
        return key
    keys = [k for k in choices if k.startswith(key)]
    if len(keys) == 1:
        return keys[0]
291805
def parse_ents(doc, options={}):
    
    ents = [
        {"start": ent.start_char, "end": ent.end_char, "label": ent.label_}
        for ent in doc.ents
    ]
    if not ents:
        user_warning(Warnings.W006)
    title = doc.user_data.get("title", None) if hasattr(doc, "user_data") else None
    settings = get_doc_settings(doc)
    return {"text": doc.text, "ents": ents, "title": title, "settings": settings}
338291
def parse_interface(iface):
    
    sections = [ ]
    docs = iface['comment']
    code = '<span class="k">interface</span> <span class="gs">%s</span> {\n' % iface['name']
    for v in iface["functions"]:
        func_code = '    <span class="nf">%s</span>(' % v['name']
        i = 0
        for p in v["params"]:
            if i == 0: i = 1
            else: func_code += ", "
            func_code += '<span class="na">%s</span> <span class="kt">%s</span>' % (p['name'], format_type(p))
        func_code += ') <span class="kt">%s</span>\n' % format_type(v['returns'])
        if v.has_key('comment') and v['comment']:
            if code:
                sections.append(to_section(docs, code))
            docs = v['comment']
            code = func_code
        else:
            code += func_code
    code += "}"

    sections.append(to_section(docs, code))
    return sections
178422
def get_array_items_description(item: Array) -> str:
    
    desc = ''
    if isinstance(item.items, list):
        # This means the type has a list of types where each position is
        # mapped to a different type.  Document what each type should be.
        desc = ''
        item_pos_template = (
            ' *Item {pos} must be*: {description}{enum}{ref}')
        for pos, item in enumerate(item.items):
            _enum = ''
            ref = ''
            if issubclass(item, Enum):
                _enum = ' Must be one of: `{}`'.format(item.enum)
                if item.case_insensitive:
                    _enum += ' (case-insensitive)'
                _enum += '.'
            elif issubclass(item, Object):
                ref = get_object_reference(item)

            desc += item_pos_template.format(
                pos=pos, description=item.description, enum=_enum,
                ref=ref)

    else:
        # Otherwise just document the type assigned to `items`.
        desc = item.items.description
        _enum = ''
        ref = ''
        if issubclass(item.items, Enum):
            _enum = ' Must be one of: `{}`'.format(
                item.items.enum)
            if item.items.case_insensitive:
                _enum += ' (case-insensitive)'
            _enum += '.'
        elif issubclass(item.items, Object):
            ref = get_object_reference(item.items)
        desc = '  *Items must be*: {description}{enum}{ref}'.format(
            description=desc, enum=_enum, ref=ref)
    return desc
856119
def do_enum(self, parent=None, ident=0):
        
        # TC_ENUM classDesc newHandle enumConstantName
        enum = JavaEnum()
        _, classdesc = self._read_and_exec_opcode(
            ident=ident + 1,
            expect=(
                self.TC_CLASSDESC,
                self.TC_PROXYCLASSDESC,
                self.TC_NULL,
                self.TC_REFERENCE,
            ),
        )
        enum.classdesc = classdesc
        self._add_reference(enum, ident)
        _, enumConstantName = self._read_and_exec_opcode(
            ident=ident + 1, expect=(self.TC_STRING, self.TC_REFERENCE)
        )
        enum.constant = enumConstantName
        return enum
476833
def enum( definitions )
      super( definitions )
      definitions.each do |name, _|
        Helper.define_attr_i18n_method(self, name)
        Helper.define_collection_i18n_method(self, name)
      end
    end
222118
def read_enum(fo, writer_schema, reader_schema=None):
    
    index = read_long(fo)
    symbol = writer_schema['symbols'][index]
    if reader_schema and symbol not in reader_schema['symbols']:
        default = reader_schema.get("default")
        if default:
            return default
        else:
            symlist = reader_schema['symbols']
            msg = '%s not found in reader symbol list %s' % (symbol, symlist)
            raise SchemaResolutionError(msg)
    return symbol
732132
def dict_to_enum_fn(d: Dict[str, Any], enum_class: Type[Enum]) -> Enum:
    
    return enum_class[d['name']]
80146
def _Enum(docstring, *names):
  
  enums = dict(zip(names, range(len(names))))
  reverse = dict((value, key) for key, value in enums.iteritems())
  enums['reverse_mapping'] = reverse
  enums['__doc__'] = docstring
  return type('Enum', (object,), enums)
174908
def get_key_section_header(self, key, spaces):
        
        if key in self.section_headers:
            header = self.section_headers[key]
        else:
            return ''

        return header
1117136
def parse_enum_type_extension(lexer: Lexer) -> Node:
    """"""
    start = lexer.token
    expect_keyword(lexer, "extend")
    expect_keyword(lexer, "enum")
    name = parse_name(lexer)
    directives = parse_directives(lexer, True)
    values = parse_enum_values_definition(lexer)
    if not (directives or values):
        raise unexpected(lexer)
    return Node(
        name=name, directives=directives, values=values, loc=loc(lexer, start)
    )