Creates a enum value descriptor object from a enum value proto.

    Args:
      value_proto: The proto describing the enum value.
      index: The index of the enum value.

    Returns:
      An initialized EnumValueDescriptor object.
498086
def _MakeEnumValueDescriptor(self, value_proto, index):
    

    return descriptor.EnumValueDescriptor(
        name=value_proto.name,
        index=index,
        number=value_proto.number,
        options=_OptionsOrNone(value_proto),
        type=None)
549685
function(proto, key, def) {
		var desc;
		["getter", "setter"].forEach(function(name, set) {
			while (proto && proto[key] && !gui.Type.isDefined(def[name])) {
				proto = Object.getPrototypeOf(proto);
				desc = Object.getOwnPropertyDescriptor(proto, key);
				if (desc) {
					def[name] = desc[set ? "set" : "get"];
				}
			}
		});
		return {
			enumerable: true,
			configurable: true,
			get: def.getter || this._NOGETTER,
			set: def.setter || this._NOSETTER
		};
	}
696214
def retype(value, index_column=None):
        
        if index_column is None:
            index_column = 'date'

        if isinstance(value, pd.DataFrame):
            # use all lower case for column name
            value.columns = map(lambda c: c.lower(), value.columns)

            if index_column in value.columns:
                value.set_index(index_column, inplace=True)
            value = StockDataFrame(value)
        return value
960774
def _add_value_enum(self, var, tag):
        
        if var['ValueEnum'][0] == 's0':
                numvalues_tag = etree.SubElement(tag, 'NumValues')
                numvalues_tag.text = str(int(var['ValueEnum'][-1][-1]) + 1)
        else:
            valueenum_tag = etree.SubElement(tag, 'ValueEnum')
            valueenum_tag.text = ''
            for value in var['ValueEnum']:
                valueenum_tag.text += value + ' '
            valueenum_tag.text = valueenum_tag.text[:-1]
149326
def _value_to_pb(value, proto_type):
    
    data_type_pb = getattr(google_dot_protobuf_dot_wrappers__pb2, proto_type)()
    ParseDict(value, data_type_pb)
    return data_type_pb
22685
def get_proto(self):
        
        if self.proto_idx_value is None:
            self.proto_idx_value = self.CM.get_proto(self.proto_idx)

        return self.proto_idx_value
1231356
def enumValue(self):
        
        try:
            return self.properties.units_state[int(self.lastValue) - 1]
        except IndexError:
            value = "unknown"
        except ValueError:
            value = "NaN"
        return value
714491
def index(self, values=None, only_index=None):
        
        assert self.indexable, "Field not indexable"
        assert not only_index or self.has_index(only_index), "Invalid index"
        if only_index:
            only_index = only_index if isclass(only_index) else only_index.__class__

        if values is None:
            values = self.proxy_get()

        for value in values:
            if value is not None:
                needs_to_check_uniqueness = bool(self.unique)

                for index in self._indexes:
                    if only_index and not isinstance(index, only_index):
                        continue

                    index.add(value, check_uniqueness=needs_to_check_uniqueness and index.handle_uniqueness)

                    if needs_to_check_uniqueness and index.handle_uniqueness:
                        # uniqueness check is done for this value
                        needs_to_check_uniqueness = False
1098088
def from_proto(cls, proto_mesh, scale):
        

        mesh = cls(**proto_mesh.items())
        mesh._copy_roche_values()
        mesh._scale_mesh(scale=scale)

        return mesh
1315838
public org.tensorflow.framework.Summary.ValueOrBuilder getValueOrBuilder(
      int index) {
    return value_.get(index);
  }
698403
public int getPropertyValueEnum(int property, CharSequence alias) {
        int valueMapIndex=findProperty(property);
        if(valueMapIndex==0) {
            throw new IllegalArgumentException(
                    "Invalid property enum "+property+" (0x"+Integer.toHexString(property)+")");
        }
        valueMapIndex=valueMaps[valueMapIndex+1];
        if(valueMapIndex==0) {
            throw new IllegalArgumentException(
                    "Property "+property+" (0x"+Integer.toHexString(property)+
                    ") does not have named values");
        }
        // valueMapIndex is the start of the property's valueMap,
        // where the first word is the BytesTrie offset.
        return getPropertyOrValueEnum(valueMaps[valueMapIndex], alias);
    }
511594
def _index_to_ansi_values(self, index):
        ''' 
        '''
        if self.__class__.__name__[0] == 'F':   # Foreground
            if index < 8:
                index += ANSI_FG_LO_BASE
            else:
                index += (ANSI_FG_HI_BASE - 8)  # 82
        else:                                   # Background
            if index < 8:
                index += ANSI_BG_LO_BASE
            else:
                index += (ANSI_BG_HI_BASE - 8)  # 92
        return [str(index)]
165395
def AddEnumDescriptor(self, name, description,
                          enum_values, enum_descriptions):
        """"""
        message = extended_descriptor.ExtendedEnumDescriptor()
        message.name = self.__names.ClassName(name)
        message.description = util.CleanDescription(description)
        self.__DeclareDescriptor(message.name)
        for index, (enum_name, enum_description) in enumerate(
                zip(enum_values, enum_descriptions)):
            enum_value = extended_descriptor.ExtendedEnumValueDescriptor()
            enum_value.name = self.__names.NormalizeEnumName(enum_name)
            if enum_value.name != enum_name:
                message.enum_mappings.append(
                    extended_descriptor.ExtendedEnumDescriptor.JsonEnumMapping(
                        python_name=enum_value.name, json_name=enum_name))
                self.__AddImport('from %s import encoding' %
                                 self.__base_files_package)
            enum_value.number = index
            enum_value.description = util.CleanDescription(
                enum_description or '<no description>')
            message.values.append(enum_value)
        self.__RegisterDescriptor(message)
305102
public void createEncodedValues(List<EncodedValue> registerNewEncodedValue, String prefix, int index) {
        // define the first 2 speedBits in flags for routing
        registerNewEncodedValue.add(accessEnc = new SimpleBooleanEncodedValue(prefix + "access", true));
        roundaboutEnc = getBooleanEncodedValue(EncodingManager.ROUNDABOUT);
        encoderBit = 1L << index;
    }
120964
public static TypeRepresentation ofEnum(final TypeIdentifier identifier, final String... enumValues) {
        return new EnumTypeRepresentation(identifier, new HashSet<>(Arrays.asList(enumValues)));
    }
1008478
def pretty_const(self, index):
        

        t, v = self.consts[index]
        if not t:
            return None, None
        else:
            return _pretty_const_type_val(t, v)
1321537
function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
  if (field.resolvedType) {
    if (field.resolvedType instanceof Enum) {
      gen('switch(d%s){', prop);
      for (let values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) {
        if (field.repeated && values[keys[i]] === field.typeDefault) gen('default:');
        gen('case%j:', keys[i])('case %i:', values[keys[i]])('m%s=%j', prop, values[keys[i]])('break');
      }
      gen('}');
    } else {
      gen('if(typeof d%s!=="object")', prop)('throw TypeError(%j)', field.fullName + ': object expected')('m%s=types[%i].fromObject(d%s)', prop, fieldIndex, prop);
    }
  } else {
    let isUnsigned = false;
    switch (field.type) {
      case 'double':
      case 'float':
        gen('m%s=Number(d%s)', prop, prop); // also catches "NaN", "Infinity"
        break;
      case 'uint32':
      case 'fixed32':
        gen('m%s=d%s>>>0', prop, prop);
        break;
      case 'int32':
      case 'sint32':
      case 'sfixed32':
        gen('m%s=d%s|0', prop, prop);
        break;
      case 'uint64':
        isUnsigned = true;
        // eslint-disable-line no-fallthrough
      case 'int64':
      case 'sint64':
      case 'fixed64':
      case 'sfixed64':
        gen('if(util.Long)')('(m%s=util.Long.fromValue(d%s)).unsigned=%j', prop, prop, isUnsigned)('else if(typeof d%s==="string")', prop)('m%s=parseInt(d%s,10)', prop, prop)('else if(typeof d%s==="number")', prop)('m%s=d%s', prop, prop)('else if(typeof d%s==="object")', prop)('m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)', prop, prop, prop, isUnsigned ? 'true' : '');
        break;
      case 'bytes':
        gen('if(typeof d%s==="string")', prop)('util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)', prop, prop, prop)('else if(d%s.length)', prop)('m%s=d%s', prop, prop);
        break;
      case 'string':
        gen('m%s=String(d%s)', prop, prop);
        break;
      case 'bool':
        gen('m%s=Boolean(d%s)', prop, prop);
        break;
      default:
        break;
        /* default: gen
            ("m%s=d%s", prop, prop);
            break; */
    }
  }
  return gen;
}