Helper to read descriptor key.
779370
def read_length_and_key(fp):
    
    length = read_fmt('I', fp)[0]
    key = fp.read(length or 4)
    if length == 0 and key not in _TERMS:
        logger.debug('Unknown term: %r' % (key))
        _TERMS.add(key)
    return key
53398
def descriptor_for_symbol(self, symbol):
        
        if isinstance(symbol, basestring):
            symbol = sympy.Symbol(symbol)

        try:
            return self._descriptions_dict[symbol]
        except KeyError:
            raise KeyError("Symbol {0!r} not found in left-hand-side of the equations".format(symbol))
6816
def get_name(self, key):
        '''
        '''
        try:
            return self.nameDict[key]
        except IndexError as e:
            print 'IndexError {0}: {1}'.format(e.errno, e.strerror)
124502
def decode(self, descriptor):
        
        i = iter(descriptor)
        n = len(self._schema)

        # Add the name key to our schema
        schema = self._schema + ('name',)
        # For each dimensions, generator takes n items off iterator
        # wrapping the descriptor, making a tuple with the dimension
        # name appended
        tuple_gen = (tuple(itertools.islice(i, n)) + (d, )
            for d in self._dimensions)

        # Generate dictionary by mapping schema keys to generated tuples
        return [{ k: v for k, v in zip(schema, t) } for t in tuple_gen]
1203625
def read_key(suppress=False):
    
    event = read_event(suppress)
    return event.name or event.scan_code
393135
def parse_descriptor(descriptor: str) -> list:
    
    # States:
    #   10 == NORMAL,
    #   20 == OBJECT REFERENCE
    state = 10
    tokens = []
    token = []
    dimensions = 0
    for char in descriptor:
        if state == 10 and char == 'L':
            state = 20
        elif state == 10 and char == '[':
            dimensions += 1
        elif state == 10:
            tokens.append(JVMType(char, dimensions, _HUMAN_NAMES[char]))
            dimensions = 0
        elif state == 20 and char == ';':
            tokens.append(JVMType('L', dimensions, ''.join(token)))
            dimensions = 0
            state = 10
            del token[:]
        elif state == 20:
            token.append(char)
    return tokens
1124168
private int getDataIndexOfKey(Object key) {
    int dataSize = this.size << 1;
    Object[] data = this.data;
    for (int i = 0; i < dataSize; i += 2) {
      Object k = data[i];
      if (key == null ? k == null : key.equals(k)) {
        return i;
      }
    }
    return -2;
  }
228945
private static int getIdentifier(Context context, String type, String key) {
    return context.getResources().getIdentifier(key, type, context.getPackageName());
  }
1193685
private static MethodRef getSetOrAddMethod(FieldDescriptor descriptor) {
    TypeInfo builder = builderRuntimeType(descriptor.getContainingType());
    String prefix = descriptor.isRepeated() ? "add" : "set";
    boolean isProto3EnumField = isProto3EnumField(descriptor);
    String suffix = isProto3EnumField ? "Value" : "";
    return MethodRef.createInstanceMethod(
            builder,
            new Method(
                prefix + getFieldName(descriptor, true) + suffix,
                builder.type(),
                new Type[] {isProto3EnumField ? Type.INT_TYPE : getRuntimeType(descriptor)}))
        .asNonNullable();
  }
584234
private static int getMapperId(long key, int numReducers, int maxKeySpace) {
    key = key - getFirstSumKey(numReducers, maxKeySpace);
    return (int) (key / numReducers);
  }
1319905
public static TypeDesc forDescriptor(String desc)
        throws IllegalArgumentException
    {
        // TODO: Figure out how to cache these. Using a plain IdentityMap poses
        // a problem. The back reference to the key causes a memory leak.

        TypeDesc td;
        int cursor = 0;
        int dim = 0;
        try {
            char c;
            while ((c = desc.charAt(cursor++)) == '[') {
                dim++;
            }

            switch (c) {
            case 'V':
                td = VOID;
                break;
            case 'Z':
                td = BOOLEAN;
                break;
            case 'C':
                td = CHAR;
                break;
            case 'B':
                td = BYTE;
                break;
            case 'S':
                td = SHORT;
                break;
            case 'I':
                td = INT;
                break;
            case 'J':
                td = LONG;
                break;
            case 'F':
                td = FLOAT;
                break;
            case 'D':
                td = DOUBLE;
                break;
            case 'L':
                if (dim > 0) {
                    desc = desc.substring(dim);
                    cursor = 1;
                }
                StringBuffer name = new StringBuffer(desc.length() - 2);
                while ((c = desc.charAt(cursor++)) != ';') {
                    if (c == '/') {
                        c = '.';
                    }
                    name.append(c);
                }
                td = intern(new ObjectType(desc, name.toString()));
                break;
            default:
                throw invalidDescriptor(desc);
            }
        }
        catch (NullPointerException e) {
            throw invalidDescriptor(desc);
        }
        catch (IndexOutOfBoundsException e) {
            throw invalidDescriptor(desc);
        }

        if (cursor != desc.length()) {
            throw invalidDescriptor(desc);
        }

        while (--dim >= 0) {
            td = td.toArrayType();
        }

        return td;
    }
685602
private int getFileDescriptor() throws IOException {
		final int fd = SharedSecrets.getJavaIOFileDescriptorAccess().get(getFD());

        if(fd < 1)
            throw new IOException("failed to get POSIX file descriptor!");

        return fd;
    }
407423
def _deserialize_key(cls, key):
        

        if key in cls._KEYS_OVERLAPPING:
            return key + cls._SUFFIX_KEY_OVERLAPPING

        return key
534080
def key(self):
        """"""
        if self.curie is None:
            return self.name
        return ":".join((self.curie.name, self.name))
446609
def getKey(self, key):
		
		data = self.getDictionary()
		if key in data:
			return data[key]
		else:
			return None
283908
function checkDescriptor(descriptor, err){
	if(typeof descriptor != 'object') return false;
	
	for(var key in CONST.descriptorType){
		if(!checkType(descriptor[key], CONST.descriptorType[key])){
			err.key = key;
			err.expect = CONST.descriptorType[key];
			err.type = typeof descriptor[key];
			return false;
		}
	}

	for(var key in CONST.descriptorOptType){
		if(typeof descriptor[key] != 'undefined' && checkType(descriptor[key], CONST.descriptorOptType[key].type)) continue;
		if(typeof descriptor[key] == 'undefined'){
			if(typeof CONST.descriptorOptType[key].value != 'undefined') descriptor[key] = CONST.descriptorOptType[key].value;
			continue;
		}

		err.key = key;
		err.expect = CONST.descriptorOptType[key].type;
		err.type = typeof descriptor[key];
		return false;
	}

	return true;
}
1284971
def _parse_field_descriptor(self, encoding):
        
        self.catalog = self.read_length_coded_string()
        self.db = self.read_length_coded_string()
        self.table_name = self.read_length_coded_string().decode(encoding)
        self.org_table = self.read_length_coded_string().decode(encoding)
        self.name = self.read_length_coded_string().decode(encoding)
        self.org_name = self.read_length_coded_string().decode(encoding)
        self.charsetnr, self.length, self.type_code, self.flags, self.scale = (
            self.read_struct('<xHIBHBxx'))