Return the XML value of the enumeration value *enum_val*.
437793
def to_xml(cls, enum_val):
        
        if enum_val not in cls._member_to_xml:
            raise ValueError(
                "value '%s' not in enumeration %s" % (enum_val, cls.__name__)
            )
        return cls._member_to_xml[enum_val]
64087
def enumeration_values
      enumeration = @xml.xpath('./xs:restriction/xs:enumeration', {'xs' => 'http://www.w3.org/2001/XMLSchema'})
      if enumeration.length > 0
        return enumeration.map {|elem| [elem.attributes['value'].value, elem.xpath('./xs:annotation/xs:documentation', {'xs' => 'http://www.w3.org/2001/XMLSchema'}).text]}
      else
        raise "Not an enumeration"
      end    
    end
1231356
def enumValue(self):
        
        try:
            return self.properties.units_state[int(self.lastValue) - 1]
        except IndexError:
            value = "unknown"
        except ValueError:
            value = "NaN"
        return value
1127865
def currentValue(self):
        
        enum  = self.enum()
        if ( self.isCheckable() ):
            value = 0
            for i in self.checkedIndexes():
                value |= enum[nativestring(self.itemText(i))]
            return value
        else:
            try:
                return enum[nativestring(self.itemText(self.currentIndex()))]
            except KeyError:
                return 0
553186
def get_child_values(parent, names):
        
        vals = []
        for name in names:
            if parent.hasElement(name):
                vals.append(XmlHelper.as_value(parent.getElement(name)))
            else:
                vals.append(np.nan)
        return vals
329530
def value(self):
        
        if self._enum and issubclass(self._enum, Enumeration):
            name = self._enum.get_name(self._value)
            if name:
                return name
        return self._value
709445
private Object onEnum(Attribute attribute, Object fieldValue)
    {
        if (((Field) attribute.getJavaMember()).getType().isEnum())
        {
            EnumAccessor accessor = new EnumAccessor();
            fieldValue = accessor.fromString(((AbstractAttribute) attribute).getBindableJavaType(),
                    fieldValue.toString());
        }
        return fieldValue;
    }
1353738
private Object toEnum(ParameterType parameterType, String enumTextValue, String paramName, boolean hardFailEnumDeserialisation) {
        try {
            return EnumUtils.readEnum(parameterType.getImplementationClass(), enumTextValue, hardFailEnumDeserialisation);
        } catch (Exception e) {
            throw XMLTranscriptionInput.exceptionDuringDeserialisation(parameterType, paramName, e, false);
        }
    }
343258
private String extractStringValue(XMLObject xmlo) {
        if (xmlo instanceof XSString) {
            return ((XSString)xmlo).getValue();
        } else if (xmlo instanceof XSAnyImpl) {
            return ((XSAnyImpl)xmlo).getTextContent();
        }
        logger.warn("Unable to map attribute class {} to String. Unknown type. Enable TRACE logging to see attribute name",
                xmlo.getClass());
        return null;
    }
444437
def visit_EnumeratorList(self, node):
        """"""
        for type, enum in node.children():
            if enum.value is None:
                pass
            elif isinstance(enum.value, (c_ast.BinaryOp, c_ast.UnaryOp)):
                enum.value = c_ast.Constant("int", "...")
            elif hasattr(enum.value, "type"):
                enum.value = c_ast.Constant(enum.value.type, "...")
654581
private void parseAttDef(String elementName) throws Exception {
        String name;
        String type;
        String enumer = null;

        // Read the attribute name.
        name = readNmtoken(true);

        // Read the attribute type.
        requireWhitespace();
        type = readAttType();

        // Get the string of enumerated values if necessary.
        if (handler.stringInterning) {
            if (("ENUMERATION" == type) || ("NOTATION" == type)) {
                enumer = dataBufferToString();
            }
        } else {
            if ("ENUMERATION".equals(type) || "NOTATION".equals(type)) {
                enumer = dataBufferToString();
            }
        }

        // Read the default value.
        requireWhitespace();
        parseDefault(elementName, name, type, enumer);
    }
345153
public static String valueToNotationString(Object val, org.openprovenance.prov.model.QualifiedName xsdType) {
        if (val instanceof LangString) {
            LangString istring = (LangString) val;
            return "\"" + istring.getValue() + 
                    ((istring.getLang()==null) ? "\"" : "\"@" + istring.getLang())
                    + (((xsdType==null)||(xsdType.getUri().equals(internationalizedStringUri)))? "" : " %% " + Namespace.qualifiedNameToStringWithNamespace(xsdType));
        } else if (val instanceof QualifiedName) {
            QualifiedName qn = (QualifiedName) val;	    
            return "'" + Namespace.qualifiedNameToStringWithNamespace(qn) + "'";
        } else if (val instanceof String) {
            String s=(String)val;
            if (s.contains("\n")) {
                return "\"\"\"" + escape(s) + "\"\"\"" ;
            } else {
                //FIXME: It's here that we should detect an int and generate the compact form: e.g. 1 instand of 1 %% xsd:int
                // However dictionaries failed to be parsed then
                //if (xsdType.getLocalPart().equals("int")) { //FIXME:need to properly compare with xsd:int
                //    return s;
                //} else {
                return "\"" + escape(s) + ((xsdType==null)? "\"" : "\" %% " + Namespace.qualifiedNameToStringWithNamespace(xsdType));
                //}
            }
        } else {
            // We should never be here!
            return "\"" + val + "\" %% " + Namespace.qualifiedNameToStringWithNamespace(xsdType);
        }
    }
1064812
private static String getValueString(XsdString value)
   {
      if (value == null || value == XsdString.NULL_XSDSTRING)
         return "";
      else
         return value.getValue();
   }
96623
def describe_enum_value(enum_value):
    
    enum_value_descriptor = EnumValueDescriptor()
    enum_value_descriptor.name = six.text_type(enum_value.name)
    enum_value_descriptor.number = enum_value.number
    return enum_value_descriptor
475084
def describe_enum(enum_definition):
    
    enum_descriptor = EnumDescriptor()
    enum_descriptor.name = enum_definition.definition_name().split('.')[-1]

    values = []
    for number in enum_definition.numbers():
        value = enum_definition.lookup_by_number(number)
        values.append(describe_enum_value(value))

    if values:
        enum_descriptor.values = values

    return enum_descriptor
1368298
@SuppressWarnings("unchecked")
    private static Enum parseEnum(final String value) {
        final int idx = value.lastIndexOf('.');
        try {
            final Class type = Class.forName(value.substring(0, idx));
            if (!type.isEnum()) {
                throw new IllegalStateException("Type " + type.getName() + " is not enum");
            }
            return Enum.valueOf(type, value.substring(idx + 1));
        } catch (Exception ex) {
            throw new IllegalStateException("Failed to recognize enum value: " + value, ex);
        }
    }
94900
def p_enum_item(self, p):
        ''''''
        if len(p) == 5:
            p[0] = ast.EnumItem(
                name=p[1], value=p[3], annotations=p[4], lineno=p.lineno(1)
            )
        else:
            p[0] = ast.EnumItem(
                name=p[1], value=None, annotations=p[2], lineno=p.lineno(1)
            )