Gets a parameter whose value is a (possibly empty) list of enums.
189754
public <T extends Enum<T>> List<T> getEnumList(final String param, final Class<T> clazz) {
    return this.getList(param, new StringToEnum<>(clazz), new AlwaysValid<T>(), "enumeration");
  }
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();
	}
941088
def enum(**enums):
    
    # Enum values must be hashable to support reverse lookup.
    if not all(isinstance(val, collections.Hashable) for val in _values(enums)):
        raise EnumConstructionException('All enum values must be hashable.')

    # Cheating by maintaining a copy of original dict for iteration b/c iterators are hard.
    # It must be a deepcopy because new.classobj() modifies the original.
    en = copy.deepcopy(enums)
    e = type('Enum', (_EnumMethods,), dict((k, v) for k, v in _items(en)))

    try:
        e.choices = [(v, k) for k, v in sorted(_items(enums), key=itemgetter(1))]  # DEPRECATED
    except TypeError:
        pass
    e.get_id_by_label = e.__dict__.get
    e.get_label_by_id = dict((v, k) for (k, v) in _items(enums)).get

    return e
58476
private static Object[] getInitParameters(Class<?>[] parameterTypes) {
        int length = parameterTypes.length;
        Object[] result = new Object[length];
        for (int i = 0; i < length; i++) {
            if (parameterTypes[i].isPrimitive()) {
                Object init = ClassUtil.getPrimitiveDefaultValue(parameterTypes[i]);
                result[i] = init;
                continue;
            }
            result[i] = null;
        }
        return result;
    }
946193
public String getStringOf(final String param, final List<String> possibleValues) {
    checkNotNull(possibleValues);
    checkArgument(!possibleValues.isEmpty());

    final String value = getString(param);

    if (possibleValues.contains(value)) {
      return value;
    } else {
      throw new InvalidEnumeratedPropertyException(fullString(param), value, possibleValues);
    }
  }
571403
private List<Enum> getSelectableEnumsList(FormModel formModel,
			String formPropertyPath, Map context) {
		List<Enum> out = new ArrayList<Enum>();
		Boolean nullable;
		if (context.containsKey(NULLABLE_KEY)) {
			nullable = (Boolean) context.get(NULLABLE_KEY);
		} else {
			nullable = this.nullable;
		}
		if (nullable) {
			out.add(null);
		}
		for (Enum e : ((Class<Enum>) getPropertyType(formModel,
				formPropertyPath)).getEnumConstants()) {
			out.add(e);
		}
		return out;
	}
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]
552819
def p_enum_list(self, p):
        ''''''
        if p[1] is None:
            p[0] = []
        elif len(p) == 4:
            p[1].append(p[3])
            p[0] = p[1]
        elif len(p) == 2:
            p[0] = [p[1]]
458191
def get_required_args(fn) -> list:
    
    sig = inspect.signature(fn)
    return [
        name for name, param in sig.parameters.items()
        if param.default == inspect._empty and param.kind not in VAR_ARGS
    ]
323459
private Object getEnumValue(Class<?> type, Object value) {
        Object[] enumValues = type.getEnumConstants();
        for (Object enumValue : enumValues) {
            if (enumValue.toString().equals(value.toString())) {
                value = enumValue;
                break;
            }
        }
        return value;
    }
548017
def enumarg(enum, arg):
    
    try:
        return enum(arg)
    except Exception:
        try:
            return enum[arg.upper()]
        except Exception:
            raise ValueError('invalid argument %s' % arg)
164676
def __parameter_descriptor(self, param):
    
    descriptor = {}

    param_type, param_format = self.__field_to_parameter_type_and_format(param)

    # Required
    if param.required:
      descriptor['required'] = True

    # Type
    descriptor['type'] = param_type

    # Format (optional)
    if param_format:
      descriptor['format'] = param_format

    # Default
    default = self.__parameter_default(param)
    if default is not None:
      descriptor['default'] = default

    # Repeated
    if param.repeated:
      descriptor['repeated'] = True

    # Enum
    # Note that enumDescriptions are not currently supported using the
    # framework's annotations, so just insert blank strings.
    enum_descriptor = self.__parameter_enum(param)
    if enum_descriptor is not None:
      descriptor['enum'] = enum_descriptor
      descriptor['enumDescriptions'] = [''] * len(enum_descriptor)

    return descriptor
1055495
function(){
    for( let i = 0; i < type.enums.length; i++ ){
      let en = type.enums[ i ];

      if( en === value ){
        return {
          name: name,
          value: value,
          strValue: '' + value,
          bypass: propIsBypass
        };
      }
    }

    return null;
  }
244085
def enums(*names):
    
    if len(names) != len(list(set(names))):
        raise TypeError("Names in an enumeration must be unique")

    item_types = set(True if isinstance(x, tuple) else False for x in names)
    if len(item_types) == 2:
        raise TypeError("Mixing of ordered and unordered enumeration items is not allowed")
    else:
        is_ordered = item_types.pop() is True
        if not is_ordered:
            names = [(None, x) for x in names]
        return [EnumValue(name, order) for order, name in names]
96368
private @Nonnull List<SortableValue> enumsThatExist(BugAspects a) {
        List<Sortables> orderBeforeDivider = st.getOrderBeforeDivider();
        if (orderBeforeDivider.size() == 0) {
            List<SortableValue> result = Collections.emptyList();
            assert false;
            return result;
        }

        Sortables key;
        if (a.size() == 0) {
            key = orderBeforeDivider.get(0);
        } else {
            Sortables lastKey = a.last().key;
            int index = orderBeforeDivider.indexOf(lastKey);
            if (index + 1 < orderBeforeDivider.size()) {
                key = orderBeforeDivider.get(index + 1);
            } else {
                key = lastKey;
            }
        }

        String[] all = key.getAll(bugSet.query(a));
        ArrayList<SortableValue> result = new ArrayList<>(all.length);
        for (String i : all) {
            result.add(new SortableValue(key, i));
        }
        return result;

    }
1043977
public EnumModel findEnumModelByValue(String enumValue) {

        if (enums != null) {
            for (EnumModel enumModel : enums) {
                if (enumValue.equals(enumModel.getValue())) {
                    return enumModel;
                }
            }
        }
        return null;
    }
359010
public static Object[] getEnumValues(Class<? extends Enum<?>> clazz) {
		Object[] enums=clazz.getEnumConstants();
		if (enums == null) {
			Method[] mthds = clazz.getDeclaredMethods();
			Method mthd = null;
			for (Method mth : mthds) {
				if (mth.getName().equals("values")) {
					mthd = mth;
					break;
				}
			}
			if (mthd != null)
				try {
					enums = (Object[]) mthd.invoke(null);
				} catch (Throwable e) {
					throw new RuntimeException(e);
				}
		}
		return enums;
	}