handy for expanding enum operations
493772
def call_enum(name, other, enum)
      if other.is_a?(Vips::Image)
        Vips::Operation.call name.to_s, [self, other, enum]
      else
        Vips::Operation.call name.to_s + "_const", [self, enum, other]
      end
    end
359556
def StartingAgeEnum(ctx):
    """"""
    return Enum(
        ctx,
        what=-2,
        unset=-1,
        dark=0,
        feudal=1,
        castle=2,
        imperial=3,
        postimperial=4,
        dmpostimperial=6
    )
1129820
def get(key, default=-1):
        """"""
        if isinstance(key, int):
            return Operation(key)
        if key not in Operation._member_map_:
            extend_enum(Operation, key, default)
        return Operation[key]
580440
def chk_enum_arg(s):
    """"""

    if len(s) == 0 or s[0].isspace() or s[-1].isspace():
        return False
    else:
        return True
1189509
def merge_enums(xml):
    ''''''
    emap = {}
    for x in xml:
        newenums = []
        for enum in x.enum:
            if enum.name in emap:
                emapitem = emap[enum.name]
                # check for possible conflicting auto-assigned values after merge
                if (emapitem.start_value <= enum.highest_value and emapitem.highest_value >= enum.start_value):
                    for entry in emapitem.entry:
                        # correct the value if necessary, but only if it was auto-assigned to begin with
                        if entry.value <= enum.highest_value and entry.autovalue == True:
                            entry.value = enum.highest_value + 1
                            enum.highest_value = entry.value
                # merge the entries
                emapitem.entry.extend(enum.entry)
                if not emapitem.description:
                    emapitem.description = enum.description
                print("Merged enum %s" % enum.name)
            else:
                newenums.append(enum)
                emap[enum.name] = enum
        x.enum = newenums
    for e in emap:
        # sort by value
        emap[e].entry = sorted(emap[e].entry,
                               key=operator.attrgetter('value'),
                               reverse=False)
        # add a ENUM_END
        emap[e].entry.append(MAVEnumEntry("%s_ENUM_END" % emap[e].name,
                                            emap[e].entry[-1].value+1, end_marker=True))
608186
def _set_enum(self, target, value, bitarray):
        '''  '''
        # derive raw value
        if isinstance(value, int):
            # check whether this value exists
            if target.find('item', {'value': value}) or self._get_rangeitem(target, value):
                # set integer values directly
                raw_value = value
            else:
                raise ValueError('Enum value "%s" not found in EEP.' % (value))
        else:
            value_item = target.find('item', {'description': value})
            if value_item is None:
                raise ValueError('Enum description for value "%s" not found in EEP.' % (value))
            raw_value = int(value_item['value'])
        return self._set_raw(target, raw_value, bitarray)
733104
def enum_menu(strs, menu=None, *args, **kwargs):
    
    if not menu:
        menu = Menu(*args, **kwargs)
    for s in strs:
        menu.enum(s)
    return menu
1088780
private String joinEnumNames(String separator) {
    E[] enumTypes = enumClass.getEnumConstants();
    StringBuilder sb = new StringBuilder();
    for(int i = 0; i < enumTypes.length; ++i) {
      if(i > 0) {
        sb.append(separator);
      }
      sb.append(enumTypes[i].name());
    }
    return sb.toString();
  }
1277790
def modify(*units):
    """"""
    ret = []
    for unit in units: # add one command for each attribute
        for attr, idx in [("energy", 1), ("life", 2), ("shields", 3)]: # see debug_pb2.UnitValue for enum declaration
            newValue = getattr(unit, attr)
            if not newValue: continue # don't bother setting something that isn't necessary
            new = DebugCommand(unit_value=DebugSetUnitValue(
                value       = newValue,
                unit_value  = idx,
                unit_tag    = unit.tag))
            ret.append(new)
    return ret
1204254
def each
      return enum_for(__method__) unless block_given?

      each_event { |v, _, _, i|
        break if i > 0
        yield v
      }
    end
1272785
function processEnumType (type) {
  var fields = _.map(type.enumValues, enumValue => {
    var field = _.cloneDeep(enumValue)
    field.isEnumValue = true
    return field
  })
  return {
    name: type.name,
    isEnumType: true,
    fields: fields
  }
}
403845
def _iter_enum_member_values(eid, bitmask):
    
    value = idaapi.get_first_enum_member(eid, bitmask)

    yield value
    while value != DEFMASK:
        value = idaapi.get_next_enum_member(eid, value, bitmask)
        yield value
651253
def convert_enum(func):
    

    @wraps(func)
    def inner(self, value):
        try:
            if self.check_value(value.value):
                return value.value
            return func(self, value.value)
        except AttributeError:
            pass

        return func(self, value)

    return inner
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);
}
230144
function buildEnumInfo(field, angularAppName, packageName, clientRootFolder) {
    const fieldType = field.fieldType;
    field.enumInstance = _.lowerFirst(fieldType);
    const enumInfo = {
        enumName: fieldType,
        enumValues: field.fieldValues.split(',').join(', '),
        enumInstance: field.enumInstance,
        enums: field.fieldValues.replace(/\s/g, '').split(','),
        angularAppName,
        packageName,
        clientRootFolder: clientRootFolder ? `${clientRootFolder}-` : ''
    };
    return enumInfo;
}
1363875
private void simplifyEnumValues(AbstractCompiler compiler) {
    if (getRhs().isObjectLit() && getRhs().hasChildren()) {
      for (Node key : getRhs().children()) {
        removeStringKeyValue(key);
      }
      compiler.reportChangeToEnclosingScope(getRhs());
    }
  }
165969
private void addArcInitialization(EnumDeclaration node) {
    String enumClassName = nameTable.getFullName(node.getTypeElement());
    List<Statement> stmts = node.getClassInitStatements().subList(0, 0);
    int i = 0;
    for (EnumConstantDeclaration constant : node.getEnumConstants()) {
      VariableElement varElement = constant.getVariableElement();
      ClassInstanceCreation creation = new ClassInstanceCreation(constant.getExecutablePair());
      TreeUtil.copyList(constant.getArguments(), creation.getArguments());
      Expression constName = options.stripEnumConstants()
          ? new StringLiteral("JAVA_LANG_ENUM_NAME_STRIPPED", typeUtil)
          : new NativeExpression(
            UnicodeUtils.format("JreEnumConstantName(%s_class_(), %d)", enumClassName, i),
            typeUtil.getJavaString().asType());
      creation.addArgument(constName);
      creation.addArgument(new NumberLiteral(i++, typeUtil));
      creation.setHasRetainedResult(true);
      stmts.add(new ExpressionStatement(new Assignment(new SimpleName(varElement), creation)));
    }
  }