returns a dictionary mapping of human readable key names to their keycodes
    this parses constants with the names of K_* and makes code=name pairs
    this is for KeyEvent.key variable and that enables things like:
    if (event.key == 'PAGEUP'):
432554
def _parseKeyNames(lib):
    
    _keyNames = {}
    for attr in dir(lib): # from the modules variables
        if attr[:6] == 'TCODK_': # get the K_* constants
            _keyNames[getattr(lib, attr)] = attr[6:] # and make CODE=NAME pairs
    return _keyNames
487674
def get_arg_names(target) -> typing.List[str]:
    

    code = getattr(target, '__code__')

    if code is None:
        return []

    arg_count = code.co_argcount
    kwarg_count = code.co_kwonlyargcount
    args_index = get_args_index(target)
    kwargs_index = get_kwargs_index(target)

    arg_names = list(code.co_varnames[:arg_count])
    if args_index != -1:
        arg_names.append(code.co_varnames[args_index])
    arg_names += list(code.co_varnames[arg_count:(arg_count + kwarg_count)])
    if kwargs_index != -1:
        arg_names.append(code.co_varnames[kwargs_index])
    if len(arg_names) > 0 and arg_names[0] in ['self', 'cls']:
        arg_count -= 1
        arg_names.pop(0)

    return arg_names
466635
def key_list(items=None):
    '''
    
    '''
    if items is None:
        items = []

    ret = {}
    if items and isinstance(items, list):
        for item in items:
            if 'name' in item:
                # added for consistency with old code
                if 'id' not in item:
                    item['id'] = item['name']
                ret[item['name']] = item
    return ret
490094
def _key(self, ch):
        """"""

        if ch in self.D:
            return ch

        if isinstance(ch, int):
            raise KeyError(ch)  # dont accept integers as custom names

        if self.chnames:
            for item in self.chnames.items():
                if item[1] == ch:
                    return item[0]
        for item in self.chnames_0.items():
            if item[1] == ch:
                return item[0]

        # If we got here, ch can be an int represented by a string if it comes
        # from a condition string:
        try:
            chint = int(ch)
            if chint in self.D:
                return chint
        except ValueError:
            pass

        raise KeyError(ch)
1203625
def read_key(suppress=False):
    
    event = read_event(suppress)
    return event.name or event.scan_code
1159932
function keygen (k) {
        var P = [];
        var s = [];
        k = k || [];
        clamp(k);
        core(P, s, k, null);

        return { p: P, s: s, k: k };
    }
971937
def get_key(self):
        
        event = self.get_event()
        if event and isinstance(event, KeyboardEvent):
            return event.key_code
        return None
482948
def keysyms_from_strings():
    
    for number, codepoint, status, name in keysym_definitions():
        # Ignore keysyms that do not map to unicode characters
        if all(c == '0' for c in codepoint):
            continue

        # Ignore keysyms that are not well established
        if status != '.':
            continue

        yield (codepoint, name)
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)
829197
def parse_keybinding(parser, event, node): #pylint: disable=unused-argument
    """"""

    name = _get_required_attribute(node, 'NAME')

    (next_event, next_node) = six.next(parser)

    if _is_start(next_event, next_node, 'KEYVALUE'):
        keyvalue = parse_keyvalue(parser, next_event, next_node)
        result = (name, keyvalue)

    elif _is_start(next_event, next_node, 'VALUE.REFERENCE'):
        value_reference = parse_value_reference(parser,
                                                next_event, next_node)
        result = (name, value_reference)

    else:
        raise ParseError('Expecting KEYVALUE or VALUE.REFERENCE element')

    _get_end_event(parser, 'KEYBINDING')

    return result
833635
def get_human_key(self, key):
        """"""
        for human_key, k in self._identifier_map.items():
            if k == key:
                return human_key
        raise KeyError(key)
990207
def parse_keypair_lines(content, delim='|', kv_sep='='):
    
    r = []
    if content:
        for row in [line for line in content if line]:
            item_dict = {}
            for item in row.split(delim):
                key, value = [i.strip("'\"").strip() for i in item.strip().split(kv_sep)]
                item_dict[key] = value
            r.append(item_dict)
    return r
479570
function checkKeyNamespace(key) {
            try {
        	    var regDot = /\./;
        	    if (regDot.test(key)) {
            		var fullname = '';
            		var names = key.split(/\./);
            		for (var i = 0; i < names.length; i++) {
            		    if (i > 0) {
            			    fullname += '.';
            		    }
            		    fullname += names[i];

                        if (typeof fullname === "undefined") {
                            fullname = {};
                        }

            		    /*if (eval('typeof ' + fullname + ' == "undefined"')) {
            			    eval(fullname + '={};');
            		    }*/
        		    }
    	        }
            } catch(e) {
                logger.error("AUGMENTED: MessageBundle " + e);
            }
    	}
1042679
def read_hotkey(suppress=True):
    
    queue = _queue.Queue()
    fn = lambda e: queue.put(e) or e.event_type == KEY_DOWN
    hooked = hook(fn, suppress=suppress)
    while True:
        event = queue.get()
        if event.event_type == KEY_UP:
            unhook(hooked)
            with _pressed_events_lock:
                names = [e.name for e in _pressed_events.values()] + [event.name]
            return get_hotkey_name(names)
860125
def _stringifyKeys(d):
    
    return dict((k.encode('ascii'), v)  for (k, v) in d.iteritems())
1049047
def key_for_class
      word = self.class.name.split("::").last.to_s.dup
      word.gsub!(/::/, '/')
      word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
      word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
      word.tr!("-", "_")
      word.downcase!
      word.to_sym
    end
1118581
def getKeyboardText(self, pchText, cchText):
        """"""

        fn = self.function_table.getKeyboardText
        result = fn(pchText, cchText)
        return result