MCPcopy Index your code
hub / github.com/RustPython/RustPython / get_terminal_keycodes

Function get_terminal_keycodes

Lib/_pyrepl/unix_eventqueue.py:60–71  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

58}
59
60def get_terminal_keycodes() -> dict[bytes, str]:
61 """
62 Generates a dictionary mapping terminal keycodes to human-readable names.
63 """
64 keycodes = {}
65 for key, terminal_code in TERMINAL_KEYNAMES.items():
66 keycode = curses.tigetstr(terminal_code)
67 trace('key {key} tiname {terminal_code} keycode {keycode!r}', **locals())
68 if keycode:
69 keycodes[keycode] = key
70 keycodes.update(CTRL_ARROW_KEYCODES)
71 return keycodes
72
73class EventQueue:
74 def __init__(self, fd: int, encoding: str) -> None:

Callers 1

__init__Method · 0.85

Calls 4

traceFunction · 0.90
localsFunction · 0.85
itemsMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected