MCPcopy Index your code
hub / github.com/python/cpython / get_terminal_keycodes

Function get_terminal_keycodes

Lib/_pyrepl/unix_eventqueue.py:57–68  ·  view source on GitHub ↗

Generates a dictionary mapping terminal keycodes to human-readable names.

(ti: TermInfo)

Source from the content-addressed store, hash-verified

55}
56
57def get_terminal_keycodes(ti: TermInfo) -> dict[bytes, str]:
58 """
59 Generates a dictionary mapping terminal keycodes to human-readable names.
60 """
61 keycodes = {}
62 for key, terminal_code in TERMINAL_KEYNAMES.items():
63 keycode = ti.get(terminal_code)
64 trace('key {key} tiname {terminal_code} keycode {keycode!r}', **locals())
65 if keycode:
66 keycodes[keycode] = key
67 keycodes.update(CTRL_ARROW_KEYCODES)
68 return keycodes
69
70
71class EventQueue(BaseEventQueue):

Callers 1

__init__Method · 0.85

Calls 4

traceFunction · 0.90
itemsMethod · 0.45
getMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…