why isn't this functionality in enum?
358531
private static LogPriorType intToType(int intPrior) {
    LogPriorType[] values = LogPriorType.values();
    for (LogPriorType val : values) {
      if (val.ordinal() == intPrior) {
        return val;
      }
    }
    throw new IllegalArgumentException(intPrior + " is not a legal LogPrior.");
  }
340126
def _load_enums(root):
    """"""
    out = collections.OrderedDict()
    for elem in root.findall('enums/enum'):
        name = elem.attrib['name']
        value = elem.attrib['value']
        comment = elem.get('comment')
        out[name] = Enum(name, value, comment)
    return out
641792
public static <E extends Enum<E>> Function<String, E> toEnum(Class<E> enumType) {
    return new Function<String, E>() {
      @Override public E apply(String name) {
        return Enum.valueOf(enumType, name);
      }
      @Override public String toString() {
        return "-> " + enumType.getName();
      }
    };
  }
1181638
def concat_enum(enum_enum)
      Enumerator.new do |yielder|
        enum_enum.each do |enum|
          enum.each { |i| yielder << i }
        end
      end
    end
422013
function enumeration(name, type, ...constants) {
  if (name[TYPICAL_TYPE]) {
    constants.unshift(type);
    type = name;
    name = `Some${type.name}Enum`;
  }

  /* istanbul ignore else */
  if (__DEV__) {
    assert(typeof name === 'string', `enum()'s name must be a string`);
    assert(type[TYPICAL_TYPE], `enum()'s type must be a type`);
    for (const constant of constants) {
      assert(type.is(constant), `enum()'s constant must have given type`);
    }
  }

  const api = this;

  function Enumeration(value, context) {
    if (Context.isRequired(context)) {
      return Context.with(value, Enumeration, context, api);
    }

    // All constants are guaranteed to have base type. See above.
    for (const constant of constants) {
      if (is(constant, value)) {
        return context.toValue(value, Enumeration);
      }
    }
    return context.valueIsNotOfType(value, Enumeration);
  }

  return decorate(Enumeration, name, enumeration, type, ...constants);
}
299012
private static String getValue(Enum<?> value){
		try{
			Method m = value.getClass().getDeclaredMethod("value");
			return (String) m.invoke(value);
		} catch (NoSuchMethodException ex){
		} catch (IllegalAccessException ex){
		} catch (InvocationTargetException ex){
		}
		return value.toString();
	}
901273
def enumerate(args={}, &block)
      passed, failed = [], []
      hook = self
      super do |callback|
        if hook.condition.call(*callback.options[:condition_args])
          hook.passed << callback
          callback.evaluate(args[:context], *args[:args], &args[:block])
        else
          hook.failed << callback
        end
      end
    end
600973
def [](name)
      enum_by_name(name).each { |f| return f.value if f.value != ""}
      enum_by_name(name).each { |f| return f.value }
      nil
    end
1348319
public String print(Enum<?> value) {

        int index = value.ordinal();

        if (this.textForms.size() <= index) {
            return value.name();
        } else {
            return this.textForms.get(index);
        }

    }
815047
static <T extends Enum<T>> T getEnumFromString(Class<T> c, String string) throws
            XmlPullParserException {
        if (c != null && string != null) {
            try {
                T t = Enum.valueOf(c, string.trim().toUpperCase());
                return t;
            } catch (IllegalArgumentException e) {
                throw new XmlPullParserException("Invalid value for " + c.getSimpleName());
            }
        } else {
            throw new XmlPullParserException("Null class or string");
        }
    }
947746
private synchronized void enumerateStringProperties(Hashtable<String, String> h) {
        if (defaults != null) {
            defaults.enumerateStringProperties(h);
        }
        for (Enumeration e = keys() ; e.hasMoreElements() ;) {
            Object k = e.nextElement();
            Object v = get(k);
            if (k instanceof String && v instanceof String) {
                h.put((String) k, (String) v);
            }
        }
    }
56700
function ENUM(values) {
    if (!values || !(values instanceof Array) || !values.length) {
        throw new Error();
    }
    if (!(this instanceof ENUM)) {
        return new ENUM(values);
    }
    this.sql = 'ENUM(' + values.join(',') + ')';
}
31345
def _enum_member_error(err, eid, name, value, bitmask):
    """"""
    exception, msg = ENUM_ERROR_MAP[err]
    enum_name = idaapi.get_enum_name(eid)
    return exception(('add_enum_member(enum="{}", member="{}", value={}, bitmask=0x{:08X}) '
                      'failed: {}').format(
        enum_name,
        name,
        value,
        bitmask,
        msg
    ))
859599
def get_enum_from_name(self, enum_name):
        
        return next((e for e in self.enums if e.name == enum_name), None)
768447
def enum_check(*args, func=None):
    """"""
    func = func or inspect.stack()[2][3]
    for var in args:
        if not isinstance(var, (enum.EnumMeta, aenum.EnumMeta)):
            name = type(var).__name__
            raise EnumError(
                f'Function {func} expected enumeration, {name} got instead.')
89219
function enumFill(path, t, id) {
  const x = translateEnumValues(path, t);
  const assignments = x.map(([memberName, memberValue]) =>
    buildEnumMember(t.isStringLiteral(memberValue), {
      ENUM: t.cloneNode(id),
      NAME: memberName,
      VALUE: memberValue,
    }),
  );

  return buildEnumWrapper({
    ID: t.cloneNode(id),
    ASSIGNMENTS: assignments,
  });
}
237528
function makeMaybe(inValues, makeChildType) {


	var maybeUniverse = new is.In(inValues);

	function Maybe(values) {

		// Maybe has two sub-sets:
		// - `.range` - Selects the non-enum values. Ex: `GreaterThan(3)`
		// - `.enum` - Selects the enum values. This is ALWAYS an `In`. Ex: `In([null])`.
		// Maybe is effectively an OR with these two properties.
		var result = splitByRangeAndEnum(maybeUniverse, values.range);
		this.range = result.range || set.EMPTY;
		if (values.enum) {
			if (result.enum !== set.EMPTY) {
				this.enum = set.union(result.enum, values.enum);
			} else {
				this.enum = values.enum;
			}
		} else {
			this.enum = result.enum;
		}
		if(this.enum === set.EMPTY && this.range === set.EMPTY) {
			return set.EMPTY;
		}
	}
	Maybe.prototype.orValues = function() {
		var values = [];
		if( this.range !== set.EMPTY ) {
			values.push(this.range);
		}
		if( this.enum !== set.EMPTY ) {
			values.push(this.enum);
		}
		return values;
	};
	Maybe.prototype[isMemberSymbol] = function isMember() {
		var rangeIsMember = this.range[isMemberSymbol] || this.range.isMember,
			enumIsMember = this.enum[isMemberSymbol] || this.enum.isMember;
		return rangeIsMember.apply(this.range, arguments) || enumIsMember.apply(this.enum, arguments);
	}



	set.defineComparison(Maybe, Maybe, {
		union: function(maybeA, maybeB) {
			var enumSet = set.union(maybeA.enum, maybeB.enum);
			var range = set.union(maybeA.range, maybeB.range);

			return new Maybe({
				enum: enumSet,
				range: range
			});
		},
		difference: function(maybeA, maybeB) {
			var enumSet = set.difference(maybeA.enum, maybeB.enum);
			var range = set.difference(maybeA.range, maybeB.range);

			return new Maybe({
				enum: enumSet,
				range: range
			});
		},
		intersection: function(maybeA, maybeB) {
			var enumSet = set.intersection(maybeA.enum, maybeB.enum);
			var range = set.intersection(maybeA.range, maybeB.range);

			return new Maybe({
				enum: enumSet,
				range: range
			});
		}
	});
	Maybe.inValues = inValues;

	set.defineComparison(set.UNIVERSAL, Maybe, {
		difference: function(universe, maybe) {
			var primary,
				secondary;

			if (maybe.range === set.UNIVERSAL) {
				// there is only the enum
				return new Maybe({
					range: maybe.range,
					enum: set.difference(maybeUniverse, maybe.enum)
				});
			}
			// there is only a primary
			if (maybe.enum === set.EMPTY) {
				var rangeSet = set.difference(set.UNIVERSAL, maybe.range);
				var notPresent = set.difference(maybeUniverse, maybe.range);
				// make sure they are included
				var enumSet = set.difference(notPresent, rangeSet);


				return new Maybe({
					range: rangeSet,
					enum: enumSet
				});
				// check enum things that aren't included in primary

			} else {
				primary = set.difference(universe, maybe.range);
				secondary = set.difference(maybeUniverse, maybe.enum);
			}
			return new Maybe({
				enum: secondary,
				range: primary
			});
		}
	});
	makeChildType = makeChildType || function(v) {
		return v;
	}

	Maybe.hydrate = function(value, childHydrate) {
		return new Maybe({
			range: childHydrate(value, makeChildType)
		});
	};

	return Maybe;
}