Returns the key string with no naughty characters.
167226
def _clean_up_key(self, key):
        
        for n in self.naughty: key = key.replace(n, '_')
        return key
601766
def _clean_key_type(key_name, escape_char=ESCAPE_SEQ):
    

    for i in (2, 1):

        if len(key_name) < i:
            return None, key_name

        type_v = key_name[-i:]

        if type_v in _KEY_SPLIT:
            if len(key_name) <= i:
                return _KEY_SPLIT[type_v], ''

            esc_cnt = 0
            for pos in range(-i - 1, -len(key_name) - 1, -1):
                if key_name[pos] == escape_char:
                    esc_cnt += 1
                else:
                    break

            if esc_cnt % 2 == 0:
                return _KEY_SPLIT[type_v], key_name[:-i]
            else:
                return None, key_name

    return None, key_name
752704
function getKeyName(key) {
    if (key.indexOf("ui") > -1) {
        if (key === "ui") {
            return "UI";
        }
        if (key === "ui-external") {
            return "UI External";
        }
    }
    return key.substr(0, 1).toUpperCase() + key.substring(1);
}
1120281
private static String key2Str(Key k, byte type) {
    String s = key2Str_impl(k, type);
    Key x;
    assert (x = str2Key_impl(s)).equals(k) : "bijection fail " + k + "." + (char) type + " <-> " + s + " <-> " + x;
    return s;
  }
1012493
def make_keys_safe(dct):
    """"""
    result = {}
    for key, val in dct.items():
        key = key.replace('-', '_')
        if key in keyword.kwlist:
            key = key + '_'
        result[key] = val
    return result
741927
public function getKey(): string
    {
        if ($this->key === null) {
            $this->key = md5($this->getContent());
        }
        return $this->key;
    }
740239
def prettykey(self, key):
        
        f = list(self.decodekey(key))
        f[0] = f[0].decode('utf-8')
        if len(f) > 2 and type(f[2]) == bytes:
            f[2] = f[2].decode('utf-8')

        if f[0] == '.':
            if len(f) == 2:
                return "%s%16x" % tuple(f)
            elif len(f) == 3:
                return "%s%16x %s" % tuple(f)
            elif len(f) == 4:
                if f[2] == 'H' and type(f[3]) in (str, bytes):
                    f[3] = f[3].decode('utf-8')
                    return "%s%16x %s '%s'" % tuple(f)
                elif type(f[3]) in (int, long):
                    return "%s%16x %s %x" % tuple(f)
                else:
                    f[3] = hexdump(f[3])
                    return "%s%16x %s %s" % tuple(f)
        elif f[0] in ('N', 'n', '$'):
            if type(f[1]) in (int, long):
                return "%s %x %16x" % tuple(f)
            else:
                return "%s'%s'" % tuple(f)
        elif f[0] == '-':
            return "%s %x" % tuple(f)

        return hexdump(key)
901982
public String getFullKey(String strSubKey)
    {
        String strReturnKey = strSubKey;
        if (strReturnKey == null)
            strReturnKey = Constant.BLANK;
        if (this.getMessageDataParent() instanceof MessageDataDesc)
        {    // Don't add for top level or above
            if (strReturnKey.length() > 0)
                strReturnKey = '/' + strReturnKey;
            strReturnKey = this.getKey() + strReturnKey;
            strReturnKey = ((MessageDataDesc)this.getMessageDataParent()).getFullKey(strReturnKey);
        }
        return strReturnKey;
    }
134767
public static String getPathForKey(Key k) {
    final int off = k._kb[0]==Key.CHK   || k._kb[0]==Key.VEC ? Vec.KEY_PREFIX_LEN : 0;
    String p = new String(k._kb,off,k._kb.length-off);

    if(p.startsWith("nfs:/"))
      p = p.substring("nfs:/".length());
    else if (p.startsWith("nfs:\\"))
      p = p.substring("nfs:\\".length());

    return p;
  }
208137
def check_key(self, key):
        """"""
        return _check_key(key, allow_unicode_keys=self.allow_unicode_keys,
                          key_prefix=self.key_prefix)
357614
public static String ascii(String code, String key) {
        return ascii(code, CryptUtils.stringToKey(key));
    }
814474
def make_key(self, key, version=None):
        """"""
        return '{}:{}:{}'.format(
            self.prefix,
            version or self.version,
            key,
        )
1120329
private static String formatKey(String prjKey) {
        String formatKey = prjKey;
        if (prjKey.startsWith("+")) {
            formatKey = prjKey.substring(1);
        }
        return formatKey;
    }
544187
def get_key():
    
    character_name = chr
    codes = _get_keycodes()
    if len(codes) == 1:
        code = codes[0]
        if code >= 32:
            return character_name(code)
        return control_key_name(code)
    return get_extended_key_name(codes)
1118564
def get_key(raw=False):
    
    while True:
        try:
            if kbhit():
                char = getch()
                ordinal = ord(char)
                if ordinal in (0, 224):
                    extention = ord(getch())
                    scan_code = ordinal + extention * 256
                    result = scan_codes.get(scan_code)
                    break
                else:
                    result = char.decode()
                    break
        except KeyboardInterrupt:
            return "ctrl-c"
    return result if raw else keys_flipped.get(result, result)
639378
def _process_key(evt):
    """"""
    key = evt.GetKeyCode()
    if key in KEYMAP:
        return KEYMAP[key], ''
    if 97 <= key <= 122:
        key -= 32
    if key >= 32 and key <= 127:
        return keys.Key(chr(key)), chr(key)
    else:
        return None, None
1231215
public function getKey(): string
    {
        if (starts_with($this->key, 'base64:')) {
            return base64_decode(mb_substr($this->key, 7));
        }

        return $this->key;
    }