Parses a flat key string and returns a key
514389
def parse(key_string: str) -> 'Key':
        
        parts = key_string.split(Key.PARTITION)
        key_type = KeyType.DIMENSION
        if parts[3]:
            key_type = KeyType.TIMESTAMP
        return Key(key_type, parts[0], parts[1], parts[2].split(Key.DIMENSION_PARTITION)
                   if parts[2] else [],
                   parser.parse(parts[3]) if parts[3] else None)
1341142
def _parse_key(self, indent):
        """"""
        data = {}

        new_indent = indent
        while not self._finished and new_indent == indent:
            self._skip_whitespace()
            cur_token = self._cur_token
            if cur_token['type'] is TT.id:
                key = cur_token['value']
                next_token = self._nth_token()
                if next_token['type'] is TT.colon:
                    self._increment(2)  # move past the ':'
                    # whitespace before a newline is not important
                    # whitespace after a newline is important
                    self._skip_whitespace()
                    self._skip_newlines()
                    data[key] = self._parse_value()
                else:
                    raise ParseError("':'", next_token)
            else:
                if cur_token['type'] is TT.hyphen:
                    return data
                else:
                    raise ParseError("identifier or '-'", cur_token)

            if self.tokens[self._cur_position - 1]['type'] is not TT.lbreak:
                # skip whitespace at the end of the line
                self._skip_whitespace()
                self._skip_newlines()

            # find next indentation level without incrementing
            new_indent = 0
            temp_position = self._cur_position
            while (
                temp_position < self.num_tokens-1 and
                self.tokens[temp_position]['type'] is TT.ws
            ):
                temp_position += 1
                new_indent += 1

        if indent == 0 or new_indent < indent:
            return data
        else:
            raise Exception(
                "Parser screwed up, increase of indent on line {} should "
                "have been caught by _parse_value().".format(
                    cur_token['line']
                )
            )
1047836
def parse_sort_key(identity: str, sort_key_string: str) -> 'Key':
        
        parts = sort_key_string.split(Key.PARTITION)
        key_type = KeyType.DIMENSION
        if parts[2]:
            key_type = KeyType.TIMESTAMP
        return Key(key_type, identity, parts[0], parts[1].split(Key.DIMENSION_PARTITION)
                   if parts[1] else [],
                   parser.parse(parts[2]) if parts[2] else None)
687344
def get_kkf(ekey):
    
    key, fmt = ekey
    if '/' in key:
        key, kind = key.split('/', 1)
    else:
        kind = ''
    return key, kind, fmt
876769
def parse(cls, key):
        

        try:
            if isinstance(key, int):
                return key
            elif re.match('[<]KEY_.*[>]', key):
                # Curses control character
                return getattr(curses, key[1:-1])
            elif re.match('[<].*[>]', key):
                # Ascii control character
                return getattr(curses.ascii, key[1:-1])
            elif key.startswith('0x'):
                # Ascii hex code
                return int(key, 16)
            elif len(key) == 2:
                # Double presses
                return tuple(cls.parse(k) for k in key)
            else:
                # Ascii character
                code = ord(key)
                if 0 <= code <= 255:
                    return code
                # Python 3.3 has a curses.get_wch() function that we can use
                # for unicode keys, but Python 2.7 is limited to ascii.
                raise exceptions.ConfigError('Invalid configuration! `%s` is '
                                             'not in the ascii range' % key)

        except (AttributeError, ValueError, TypeError):
            raise exceptions.ConfigError('Invalid configuration! "%s" is not a '
                                         'valid key' % key)
923769
def _parse_bare_key(self):  # type: () -> Key
        
        key_type = None
        dotted = False

        self.mark()
        while self._current.is_bare_key_char() and self.inc():
            pass

        key = self.extract()

        if self._current == ".":
            self.inc()
            dotted = True
            key += "." + self._parse_key().as_string()
            key_type = KeyType.Bare

        return Key(key, key_type, "", dotted)
651642
function parseKey (inp) {
    var res = parseString(inp);
    if (res) return res;
  
    var match = inp.takeAPeek(JS_IDENT);
    if (match) return match[0]
  }
121526
def _parse_key_from_substring(substring) -> str:
    '''
    
    '''
    try:
        return substring.split(':')[0]
    except (ValueError, IndexError, TypeError, AttributeError):
        log.exception('Unexpected argument to _parse_key_from_substring:')
        raise ParseError(
            'Unexpected argument to _parse_key_from_substring: {}'.format(
                substring))
302066
def parse_key(key):
    
    hkey, lkey = struct.unpack('<II',key[0:UBIFS_SK_LEN])
    ino_num = hkey & UBIFS_S_KEY_HASH_MASK
    key_type = lkey >> UBIFS_S_KEY_BLOCK_BITS
    khash = lkey

    #if key_type < UBIFS_KEY_TYPES_CNT:
    return {'type':key_type, 'ino_num':ino_num, 'khash': khash}
1315418
protected String getKey(String str) {
        int index = str.indexOf('=');
        String key = null;
        if (index > 0) {
            key = str.substring(0, index).trim();
            if (key.charAt(key.length() - 1) == ':') {
                key = key.substring(0, key.length() - 1).trim();
            }
        }
        return key;
    }
820771
def parse_segdict_key(self, key):
        
        splt = key.split(':')
        if len(splt) == 2:
            return splt[0], splt[1]
        else:
            err_msg = "Key should be of the format 'ifo:name', got %s." %(key,)
            raise ValueError(err_msg)
989348
function _parseKey(key) {
  const result = key.match(/^(.+)\[([0-9]+)\]$/);

  if (result) {
    return {element: result[1], index: parseInt(result[2], 10)};
  } else {
    return {element: key, index: null};
  }
}
261718
def _to_key(d):
        """"""
        as_str = json.dumps(d, sort_keys=True)
        return as_str.replace('"{{', '{{').replace('}}"', '}}')
168311
def normalise_key(self, key):
        """"""
        key = key.replace('-', '_')
        if key.startswith("noy_"):
            key = key[4:]
        return key
1205516
def _parse_line(line=''):
    '''
    
    '''
    parts = line.split()
    key = parts.pop(0)
    value = ' '.join(parts)
    return key, value
1234989
function getkey(key) {
        var parsedKey = Number(key);

        return (isNaN(parsedKey) || key.indexOf('.') !== -1)? key : parsedKey;
    }
419372
function parseStartKey(key, restOfLine) {
        // When a new key is encountered, the rest of the line is immediately added as
        // its value, by calling `flushBuffer`.
        flushBuffer();

        incrementArrayElement(key);

        if (stackScope && stackScope.flags.indexOf('+') > -1) key = 'value';

        bufferKey = key;
        bufferString = restOfLine;

        flushBufferInto(key, { replace: true });
      }